return true;
}
+void ConfigMap::parse_key(
+ const std::string& key,
+ std::string *name,
+ std::string *who)
+{
+ auto last_slash = key.rfind('/');
+ if (last_slash == std::string::npos) {
+ *name = key;
+ } else if (auto mgrpos = key.find("/mgr/"); mgrpos != std::string::npos) {
+ *name = key.substr(mgrpos + 1);
+ *who = key.substr(0, mgrpos);
+ } else {
+ *name = key.substr(last_slash + 1);
+ *who = key.substr(0, last_slash);
+ }
+}
+
// --------------
const std::string& device_class,
std::map<std::string,std::pair<std::string,const MaskedOption*>> *src=0);
+ void parse_key(
+ const std::string& key,
+ std::string *name,
+ std::string *who);
static bool parse_mask(
const std::string& in,
std::string *section,
current[key] = it->value();
- auto last_slash = key.rfind('/');
string name;
string who;
- if (last_slash == std::string::npos) {
- name = key;
- } else if (auto mgrpos = key.find("/mgr/"); mgrpos != std::string::npos) {
- name = key.substr(mgrpos + 1);
- who = key.substr(0, mgrpos);
- } else {
- name = key.substr(last_slash + 1);
- who = key.substr(0, last_slash);
- }
+ config_map.parse_key(key, &name, &who);
// has this option been renamed?
{