Add json::object::has query for keys

This commit is contained in:
Danny Robson 2012-04-20 18:09:23 +10:00
parent f0928b80c1
commit fd113f6c4d
2 changed files with 8 additions and 1 deletions

View File

@ -403,6 +403,12 @@ json::object::operator[](const std::string &key) const {
}
bool
json::object::has (const std::string &key) const {
return m_values.find (key) != m_values.end ();
}
void
json::object::clear (void)
{ m_values.clear (); }

View File

@ -104,8 +104,9 @@ namespace json {
virtual bool operator==(const node &rhs) const
{ return rhs == *this; }
virtual void insert (const std::string &key, std::unique_ptr<node>&& value);
virtual void insert (const std::string &key, std::unique_ptr<node>&& value);
virtual const node& operator[](const std::string &key) const;
virtual bool has (const std::string&) const;
virtual void clear (void);
virtual void erase (const std::string &key);