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; AimKV kv1;
if (db.number_of_values) 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()); kvm.insert(kv1.begin(), kv1.end());
} }
}; };
@ -315,7 +315,7 @@ int main(int argc, char *argv[])
#undef ADD_LANGUAGE #undef ADD_LANGUAGE
else else
{ {
std::cerr << "No such lang: " << p.filename().u8string() << "\n"; std::cerr << "No such lang: " << to_printable_string(p.filename()) << "\n";
continue; continue;
} }
} }

View file

@ -63,7 +63,7 @@ mmm read_mmm(const path &fn)
void process_mmm(const path &fn) void process_mmm(const path &fn)
{ {
auto m = read_mmm(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[]) 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) 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()) if (!prefix.empty())
map_name = prefix + "." + map_name; map_name = prefix + "." + map_name;
std::transform(map_name.begin(), map_name.end(), map_name.begin(), ::tolower); 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.name;
std::cout << " " << mg.org; std::cout << " " << mg.org;
std::cout << " " << mg.mechanoids.size(); std::cout << " " << mg.mechanoids.size();
std::cout << " " << file.filename().stem().u8string(); std::cout << " " << to_printable_string(file.filename().stem());
std::cout << "\n"; std::cout << "\n";
} }
}); });

View file

@ -393,7 +393,7 @@ void mmp::writeHeightMap()
fclose(f); 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(".heightmap16.r16", heightmap, sizeof(decltype(heightmap)::type));
write_hm(".heightmap32.r32", heightmap32, sizeof(decltype(heightmap32)::type)); write_hm(".heightmap32.r32", heightmap32, sizeof(decltype(heightmap32)::type));
@ -471,7 +471,7 @@ void mmp::writeSplitColormap() const
for (auto &pixel : m) for (auto &pixel : m)
pixel = pixel == color ? 0x0000FF00 : 0; pixel = pixel == color ? 0x0000FF00 : 0;
std::cout << "\r[" << i << "/" << colors.size() << "] Processing color " << ss.str(); 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 if (fn.extension() == ".mod") // single block file from m2 sdk viewer
{ {
block bl; block bl;
bl.h.name = fn.stem().u8string(); bl.h.name = to_printable_string(fn.stem());
bl.loadPayload(b); bl.loadPayload(b);
m.blocks.push_back(bl); m.blocks.push_back(bl);
} }
@ -112,8 +112,8 @@ void convert_model(const model &m, const path &fn)
{ {
// write all // write all
if (all_formats) if (all_formats)
m.print(fn.u8string(), AS); m.print(to_printable_string(fn), AS);
m.printFbx(fn.u8string(), AS); m.printFbx(to_printable_string(fn), AS);
} }
void convert_model(const path &fn) void convert_model(const path &fn)
@ -122,7 +122,7 @@ void convert_model(const path &fn)
if (stats) if (stats)
{ {
m.save(root[fn.filename().u8string()]); m.save(root[to_printable_string(fn.filename())]);
return; return;
} }
@ -159,7 +159,7 @@ int main(int argc, char *argv[])
} }
} }
else 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) if (stats)
{ {

8
sw.cpp
View file

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