File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,11 @@ JSONVar JSONVar::operator[](const char* key)
246
246
return JSONVar (json, _json);
247
247
}
248
248
249
+ JSONVar JSONVar::operator [](const String& key)
250
+ {
251
+ return (*this )[key.c_str ()];
252
+ }
253
+
249
254
JSONVar JSONVar::operator [](int index)
250
255
{
251
256
if (!cJSON_IsArray (_json)) {
@@ -322,6 +327,11 @@ bool JSONVar::hasOwnProperty(const char* key) const
322
327
return (json != NULL );
323
328
}
324
329
330
+ bool JSONVar::hasOwnProperty (const String& key) const
331
+ {
332
+ return hasOwnProperty (key.c_str ());
333
+ }
334
+
325
335
JSONVar JSONVar::parse (const char * s)
326
336
{
327
337
cJSON* json = cJSON_Parse (s);
Original file line number Diff line number Diff line change @@ -67,12 +67,14 @@ class JSONVar : public Printable {
67
67
bool operator ==(nullptr_t ) const ;
68
68
69
69
JSONVar operator [](const char * key);
70
+ JSONVar operator [](const String& key);
70
71
JSONVar operator [](int index);
71
72
JSONVar operator [](const JSONVar& key);
72
73
73
74
int length () const ;
74
75
JSONVar keys () const ;
75
76
bool hasOwnProperty (const char * key) const ;
77
+ bool hasOwnProperty (const String& key) const ;
76
78
77
79
static JSONVar parse (const char * s);
78
80
static JSONVar parse (const String& s);
You can’t perform that action at this time.
0 commit comments