File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1740,6 +1740,26 @@ namespace crow // NOTE: Already documented in "crow/app.h"
17401740 return const_cast <wvalue*>(this )->operator [](index);
17411741 }
17421742
1743+ // / Check if the object contains the given key.
1744+ bool has (const char * key) const
1745+ {
1746+ return has (std::string (key));
1747+ }
1748+
1749+ // / Check if the object contains the given key.
1750+ bool has (const std::string& key) const
1751+ {
1752+ if (t_ != type::Object)
1753+ return false ;
1754+ if (!o)
1755+ return false ;
1756+ #if (__cplusplus>=202002L)
1757+ return o->contains (key);
1758+ #else
1759+ return o->count (key)>0 ;
1760+ #endif
1761+ }
1762+
17431763 int count (const std::string& str) const
17441764 {
17451765 if (t_ != type::Object)
@@ -2042,6 +2062,12 @@ namespace crow // NOTE: Already documented in "crow/app.h"
20422062
20432063 return dump (DontIndent);
20442064 }
2065+
2066+ // / Return json string.
2067+ explicit operator std::string () const
2068+ {
2069+ return dump ();
2070+ }
20452071 };
20462072
20472073 // Used for accessing the internals of a wvalue
You can’t perform that action at this time.
0 commit comments