Small cleanup

This commit is contained in:
momo5502 2023-04-02 19:46:02 +02:00
parent 8fd5a82153
commit ec31664c52

View File

@ -42,25 +42,25 @@ namespace utils
buffer = buffer.substr(1); buffer = buffer.substr(1);
} }
auto key_values = string::split(buffer, '\\'); const auto key_values = string::split(buffer, '\\');
for (size_t i = 0; !key_values.empty() && i < (key_values.size() - 1); i += 2) for (size_t i = 0; !key_values.empty() && i < (key_values.size() - 1); i += 2)
{ {
const auto& key = key_values[i]; const auto& key = key_values[i];
const auto& value = key_values[i + 1]; const auto& value = key_values[i + 1];
this->key_value_pairs_[key] = value;
if (!this->key_value_pairs_.contains(key))
{
this->key_value_pairs_[key] = value;
}
} }
} }
std::string info_string::build() const std::string info_string::build() const
{ {
//auto first = true;
std::string info_string; std::string info_string;
for (auto i = this->key_value_pairs_.begin(); i != this->key_value_pairs_.end(); ++i) for (auto i = this->key_value_pairs_.begin(); i != this->key_value_pairs_.end(); ++i)
{ {
//if (first) first = false;
/*else*/
info_string.append("\\"); info_string.append("\\");
info_string.append(i->first); // Key info_string.append(i->first); // Key
info_string.append("\\"); info_string.append("\\");
info_string.append(i->second); // Value info_string.append(i->second); // Value