Uninlined, added validity check, and documented functions.

This commit is contained in:
Guillaume Melquiond 2010-06-12 18:58:35 +00:00
parent 10b7dfd773
commit 997643d2eb
2 changed files with 16 additions and 2 deletions

View File

@ -491,6 +491,12 @@ const config::attribute_value &config::operator[](const std::string &key) const
return empty_attribute;
}
config::attribute_value &config::operator[](const std::string &key)
{
check_valid();
return values[key];
}
const config::attribute_value &config::get_old_attribute(const std::string &key, const std::string &old_key, const std::string &msg) const
{
check_valid();

View File

@ -254,8 +254,16 @@ public:
config& add_child(const std::string& key, const config& val);
config& add_child_at(const std::string& key, const config& val, size_t index);
attribute_value &operator[](const std::string &key)
{ return values[key]; }
/**
* Returns a reference to the attribute with the given @a key.
* Creates it if it does not exist.
*/
attribute_value &operator[](const std::string &key);
/**
* Returns a reference to the attribute with the given @a key
* or to a dummy empty attribute if it does not exist.
*/
const attribute_value &operator[](const std::string &key) const;
/**