Added JsonVariant::containsKey()

This commit is contained in:
Benoit Blanchon
2019-03-22 09:00:00 +01:00
parent c8e49a7e4e
commit 6ec5ba521b
13 changed files with 142 additions and 33 deletions

View File

@@ -35,4 +35,18 @@ inline ObjectRef ObjectShortcuts<TObject>::createNestedObject(
TChar* key) const {
return impl()->getOrAddMember(key).template to<ObjectRef>();
}
template <typename TObject>
template <typename TString>
inline typename enable_if<IsString<TString>::value, bool>::type
ObjectShortcuts<TObject>::containsKey(const TString& key) const {
return !impl()->getMember(key).isUndefined();
}
template <typename TObject>
template <typename TChar>
inline typename enable_if<IsString<TChar*>::value, bool>::type
ObjectShortcuts<TObject>::containsKey(TChar* key) const {
return !impl()->getMember(key).isUndefined();
}
} // namespace ARDUINOJSON_NAMESPACE