ValueTree::StrList& ValueTree::insertArray(const string& spec) { size_t dotPos = spec.find_last_of('.'); ValueTree* tree = this; string key = spec; if(dotPos != string::npos) { tree = insertSubTree(spec.substr(0, dotPos)); key = spec.substr(dotPos+1); } return tree->attr(key); }
string& ValueTree::insertValue(const string& spec) { size_t dotPos = spec.find_last_of('.'); ValueTree* tree = this; string key = spec; if(dotPos != string::npos) { tree = insertSubTree(spec.substr(0, dotPos)); key = spec.substr(dotPos+1); } StrList& list = tree->attr(key); if(!list.size()) list.push_back(""); return list[0]; }