Update to C++20.

This commit is contained in:
lzwdgc 2020-09-10 13:34:07 +03:00
parent 170fad79d7
commit d39c091312
6 changed files with 16 additions and 16 deletions

View file

@ -219,7 +219,7 @@ static void process_lang(polygon4::Storage &s, const path &p, polygon4::String p
AimKV kv1;
if (db.number_of_values)
{
kv1 = ::get_kv(db, get_cp(p.filename().u8string()));
kv1 = ::get_kv(db, get_cp(to_printable_string(p.filename())));
kvm.insert(kv1.begin(), kv1.end());
}
};
@ -315,7 +315,7 @@ int main(int argc, char *argv[])
#undef ADD_LANGUAGE
else
{
std::cerr << "No such lang: " << p.filename().u8string() << "\n";
std::cerr << "No such lang: " << to_printable_string(p.filename()) << "\n";
continue;
}
}

View file

@ -63,7 +63,7 @@ mmm read_mmm(const path &fn)
void process_mmm(const path &fn)
{
auto m = read_mmm(fn);
write_mat_bmp(fn.u8string() + ".bmp", m.data.unpack_mmm());
write_mat_bmp(path(fn) += ".bmp", m.data.unpack_mmm());
}
int main(int argc, char *argv[])

View file

@ -105,7 +105,7 @@ mmo_storage read_mmo(const path &fn)
void write_mmo(Storage *storage, const mmo_storage &s)
{
std::string map_name = s.name.filename().stem().u8string();
std::string map_name = to_printable_string(s.name.filename().stem());
if (!prefix.empty())
map_name = prefix + "." + map_name;
std::transform(map_name.begin(), map_name.end(), map_name.begin(), ::tolower);
@ -303,7 +303,7 @@ int main(int argc, char *argv[])
std::cout << mg.name;
std::cout << " " << mg.org;
std::cout << " " << mg.mechanoids.size();
std::cout << " " << file.filename().stem().u8string();
std::cout << " " << to_printable_string(file.filename().stem());
std::cout << "\n";
}
});

View file

@ -393,7 +393,7 @@ void mmp::writeHeightMap()
fclose(f);
};
cv::imwrite((path(filename) += ".heightmap16.png").u8string(), toCvMat(heightmap));
cv::imwrite((const char *)to_path_string(path(filename) += ".heightmap16.png").c_str(), toCvMat(heightmap));
//write_hm(".heightmap16.r16", heightmap, sizeof(decltype(heightmap)::type));
write_hm(".heightmap32.r32", heightmap32, sizeof(decltype(heightmap32)::type));
@ -471,7 +471,7 @@ void mmp::writeSplitColormap() const
for (auto &pixel : m)
pixel = pixel == color ? 0x0000FF00 : 0;
std::cout << "\r[" << i << "/" << colors.size() << "] Processing color " << ss.str();
cv::imwrite(fn.u8string(), toCvMat(m));
cv::imwrite((const char *)to_path_string(fn).c_str(), toCvMat(m));
}
}

View file

@ -87,7 +87,7 @@ auto read_model(const path &fn)
if (fn.extension() == ".mod") // single block file from m2 sdk viewer
{
block bl;
bl.h.name = fn.stem().u8string();
bl.h.name = to_printable_string(fn.stem());
bl.loadPayload(b);
m.blocks.push_back(bl);
}
@ -112,8 +112,8 @@ void convert_model(const model &m, const path &fn)
{
// write all
if (all_formats)
m.print(fn.u8string(), AS);
m.printFbx(fn.u8string(), AS);
m.print(to_printable_string(fn), AS);
m.printFbx(to_printable_string(fn), AS);
}
void convert_model(const path &fn)
@ -122,7 +122,7 @@ void convert_model(const path &fn)
if (stats)
{
m.save(root[fn.filename().u8string()]);
m.save(root[to_printable_string(fn.filename())]);
return;
}
@ -159,7 +159,7 @@ int main(int argc, char *argv[])
}
}
else
throw std::runtime_error("No such file or directory: " + normalize_path(p));
throw std::runtime_error("No such file or directory: " + to_printable_string(normalize_path(p)));
if (stats)
{

8
sw.cpp
View file

@ -6,7 +6,7 @@ void build(Solution &s)
tools += Git("https://github.com/aimrebirth/tools", "", "{v}");
auto &common = tools.addStaticLibrary("common");
common.CPPVersion = CPPLanguageStandard::CPP17;
common += cpp20;
common.setRootDirectory("src/common");
common.Public += "pub.egorpugin.primitives.filesystem-master"_dep;
common.Public += "pub.egorpugin.primitives.sw.main-master"_dep;
@ -14,7 +14,7 @@ void build(Solution &s)
auto add_exe = [&tools](const String &name) -> decltype(auto)
{
auto &t = tools.addExecutable(name);
t.CPPVersion = CPPLanguageStandard::CPP17;
t += cpp20;
t.setRootDirectory("src/" + name);
return t;
};
@ -47,14 +47,14 @@ void build(Solution &s)
// not so simple targets
auto &script2txt = tools.addStaticLibrary("script2txt");
script2txt.CPPVersion = CPPLanguageStandard::CPP17;
script2txt += cpp20;
script2txt.setRootDirectory("src/script2txt");
script2txt += "pub.lzwdgc.Polygon4.DataManager.schema-master"_dep;
gen_flex_bison_pair("org.sw.demo.lexxmark.winflexbison"_dep, script2txt, "LALR1_CPP_VARIANT_PARSER", "script2txt");
script2txt.CompileOptions.push_back("/Zc:__cplusplus");
auto &model = tools.addStaticLibrary("model");
model.CPPVersion = CPPLanguageStandard::CPP17;
model += cpp20;
model.setRootDirectory("src/model");
model.Public += common,
"org.sw.demo.unicode.icu.i18n"_dep,