rename add_attribute to init_attribute and add comment
This commit is contained in:
parent
37c4557706
commit
7808ddb06f
1 changed files with 8 additions and 1 deletions
|
@ -79,7 +79,14 @@ public:
|
|||
|
||||
const t_string& get_attribute(const std::string& key) const;
|
||||
bool has_attribute(const std::string& key) const {return values.find(key) != values.end();}
|
||||
bool add_attribute(const std::string& key, const t_string& value) {
|
||||
|
||||
/**
|
||||
* This should only be used if there is no mapping of the key already,
|
||||
* e.g. when creating a new config object. It does not replace an existing value.
|
||||
* @returns true when it added the key-value pair, false if it already existed
|
||||
* (and you probably wanted to use config[key] = value)
|
||||
*/
|
||||
bool init_attribute(const std::string& key, const t_string& value) {
|
||||
return values.insert(string_map::value_type(key, value)).second;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue