summaryrefslogtreecommitdiff
path: root/include/lib/ArduinoJson/Object/ObjectImpl.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/lib/ArduinoJson/Object/ObjectImpl.hpp')
-rw-r--r--include/lib/ArduinoJson/Object/ObjectImpl.hpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/include/lib/ArduinoJson/Object/ObjectImpl.hpp b/include/lib/ArduinoJson/Object/ObjectImpl.hpp
new file mode 100644
index 0000000..d66b61c
--- /dev/null
+++ b/include/lib/ArduinoJson/Object/ObjectImpl.hpp
@@ -0,0 +1,69 @@
+// ArduinoJson - https://arduinojson.org
+// Copyright Benoit Blanchon 2014-2021
+// MIT License
+
+#pragma once
+
+#include <ArduinoJson/Array/ArrayRef.hpp>
+#include <ArduinoJson/Object/ObjectRef.hpp>
+
+namespace ARDUINOJSON_NAMESPACE {
+
+template <typename TObject>
+template <typename TString>
+inline ArrayRef ObjectShortcuts<TObject>::createNestedArray(
+ const TString& key) const {
+ return impl()->getOrAddMember(key).template to<ArrayRef>();
+}
+
+template <typename TObject>
+template <typename TChar>
+inline ArrayRef ObjectShortcuts<TObject>::createNestedArray(TChar* key) const {
+ return impl()->getOrAddMember(key).template to<ArrayRef>();
+}
+
+template <typename TObject>
+template <typename TString>
+inline ObjectRef ObjectShortcuts<TObject>::createNestedObject(
+ const TString& key) const {
+ return impl()->getOrAddMember(key).template to<ObjectRef>();
+}
+
+template <typename TObject>
+template <typename TChar>
+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();
+}
+
+template <typename TObject>
+template <typename TString>
+inline typename enable_if<IsString<TString*>::value,
+ MemberProxy<TObject, TString*> >::type
+ObjectShortcuts<TObject>::operator[](TString* key) const {
+ return MemberProxy<TObject, TString*>(*impl(), key);
+}
+
+template <typename TObject>
+template <typename TString>
+inline typename enable_if<IsString<TString>::value,
+ MemberProxy<TObject, TString> >::type
+ObjectShortcuts<TObject>::operator[](const TString& key) const {
+ return MemberProxy<TObject, TString>(*impl(), key);
+}
+
+} // namespace ARDUINOJSON_NAMESPACE