mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-18 04:52:22 +02:00
Added typedef JsonKey
This commit is contained in:
@ -39,7 +39,7 @@ size_t JsonObjectBase::printTo(Print& p) const
|
||||
return n;
|
||||
}
|
||||
|
||||
JsonObjectBase::KeyValuePair* JsonObjectBase::getMatchingPair(char const* key) const
|
||||
JsonObjectBase::KeyValuePair* JsonObjectBase::getMatchingPair(JsonKey key) const
|
||||
{
|
||||
KeyValuePair* p = items;
|
||||
|
||||
@ -54,14 +54,15 @@ JsonObjectBase::KeyValuePair* JsonObjectBase::getMatchingPair(char const* key) c
|
||||
return 0;
|
||||
}
|
||||
|
||||
JsonValue& JsonObjectBase::operator[](char const* key)
|
||||
JsonValue& JsonObjectBase::operator[](JsonKey key)
|
||||
{
|
||||
KeyValuePair* match = getMatchingPair(key);
|
||||
JsonValue* value;
|
||||
|
||||
if (match)
|
||||
return match->value;
|
||||
|
||||
JsonValue* value;
|
||||
|
||||
if (count < capacity)
|
||||
{
|
||||
items[count].key = key;
|
||||
@ -77,7 +78,7 @@ JsonValue& JsonObjectBase::operator[](char const* key)
|
||||
return *value;
|
||||
}
|
||||
|
||||
bool JsonObjectBase::containsKey(char const* key) const
|
||||
bool JsonObjectBase::containsKey(JsonKey key) const
|
||||
{
|
||||
return getMatchingPair(key) != 0;
|
||||
}
|
Reference in New Issue
Block a user