fix: tidy statics, instance, stretch43, fill/find_if ranges, NOLINT externs

This commit is contained in:
2026-05-16 15:17:38 +02:00
parent ae359f4a1e
commit b984e6041e
15 changed files with 77 additions and 74 deletions
+6 -6
View File
@@ -9,7 +9,7 @@
namespace Locale {
static std::unordered_map<std::string, std::string> strings_;
static std::unordered_map<std::string, std::string> strings_table;
// Aplana un node YAML en claus amb notació punt
static void traverse(const fkyaml::node& node, const std::string& prefix) {
@@ -25,7 +25,7 @@ namespace Locale {
}
} else if (node.is_scalar()) {
try {
strings_[prefix] = node.get_value<std::string>();
strings_table[prefix] = node.get_value<std::string>();
} catch (...) {
// @INTENTIONAL: si el valor no és string vàlid, l'ignorem i continuem.
}
@@ -42,9 +42,9 @@ namespace Locale {
try {
auto yaml = fkyaml::node::deserialize(content);
strings_.clear();
strings_table.clear();
traverse(yaml, "");
std::cout << "Locale loaded: " << strings_.size() << " string(s) from " << filename << '\n';
std::cout << "Locale loaded: " << strings_table.size() << " string(s) from " << filename << '\n';
return true;
} catch (const fkyaml::exception& e) {
std::cerr << "Locale: error parsing " << filename << ": " << e.what() << '\n';
@@ -53,8 +53,8 @@ namespace Locale {
}
auto get(const char* key) -> const char* {
auto it = strings_.find(key);
if (it != strings_.end()) {
auto it = strings_table.find(key);
if (it != strings_table.end()) {
return it->second.c_str();
}
return key; // fallback: retorna la clau mateixa