refactor(tokens): Move token suffix to configuration

This commit is contained in:
Michael Carlberg 2017-01-13 20:03:08 +01:00
parent b395285a68
commit 3292cea786
14 changed files with 79 additions and 46 deletions
include/components

View file

@ -38,6 +38,24 @@ class config {
return it != m_sections.end() && it->second.find(key) != it->second.end();
}
/**
* Set parameter value
*/
void set(const string& section, const string& key, string&& value) {
auto it = m_sections.find(section);
if (it == m_sections.end()) {
valuemap_t values;
values[key] = value;
m_sections[section] = move(values);
}
auto it2 = it->second.find(key);
if ((it2 = it->second.find(key)) == it->second.end()) {
it2 = it->second.emplace_hint(it2, key, value);
} else {
it2->second = value;
}
}
/**
* Get parameter for the current bar by name
*/