rename add_attribute to init_attribute and add comment

This commit is contained in:
Tomasz Śniatowski 2008-06-14 15:10:24 +01:00
parent 37c4557706
commit 7808ddb06f

View file

@ -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;
}