Add json::object::has query for keys
This commit is contained in:
parent
f0928b80c1
commit
fd113f6c4d
@ -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
|
void
|
||||||
json::object::clear (void)
|
json::object::clear (void)
|
||||||
{ m_values.clear (); }
|
{ m_values.clear (); }
|
||||||
|
3
json.hpp
3
json.hpp
@ -104,8 +104,9 @@ namespace json {
|
|||||||
virtual bool operator==(const node &rhs) const
|
virtual bool operator==(const node &rhs) const
|
||||||
{ return rhs == *this; }
|
{ 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 const node& operator[](const std::string &key) const;
|
||||||
|
virtual bool has (const std::string&) const;
|
||||||
|
|
||||||
virtual void clear (void);
|
virtual void clear (void);
|
||||||
virtual void erase (const std::string &key);
|
virtual void erase (const std::string &key);
|
||||||
|
Loading…
Reference in New Issue
Block a user