toml parser update + 'toml' module is built-in now

This commit is contained in:
MihailRis
2024-05-20 01:28:42 +03:00
parent ffdeac5c1f
commit c94d40ab02
15 changed files with 252 additions and 178 deletions
+11
View File
@@ -443,3 +443,14 @@ std::string util::format_data_size(size_t size) {
std::to_string(static_cast<int>(round(remainder/1024.0f)))+
postfixes[group];
}
std::pair<std::string, std::string> util::split_at(std::string_view view, char c) {
size_t idx = view.find(c);
if (idx == std::string::npos) {
throw std::runtime_error(util::quote(std::string({c}))+" not found");
}
return std::make_pair(
std::string(view.substr(0, idx)),
std::string(view.substr(idx+1))
);
}