forked from bblanchon/ArduinoJson
Rename addElement()
to add()
This commit is contained in:
@ -11,12 +11,12 @@ namespace ARDUINOJSON_NAMESPACE {
|
||||
|
||||
template <typename TArray>
|
||||
inline ArrayRef ArrayShortcuts<TArray>::createNestedArray() const {
|
||||
return impl()->addElement().template to<ArrayRef>();
|
||||
return impl()->add().template to<ArrayRef>();
|
||||
}
|
||||
|
||||
template <typename TArray>
|
||||
inline ObjectRef ArrayShortcuts<TArray>::createNestedObject() const {
|
||||
return impl()->addElement().template to<ObjectRef>();
|
||||
return impl()->add().template to<ObjectRef>();
|
||||
}
|
||||
|
||||
template <typename TArray>
|
||||
|
@ -130,10 +130,12 @@ class ArrayRef : public ArrayRefBase<CollectionData>,
|
||||
return ArrayConstRef(_data);
|
||||
}
|
||||
|
||||
VariantRef addElement() const {
|
||||
VariantRef add() const {
|
||||
return VariantRef(_pool, arrayAdd(_data, _pool));
|
||||
}
|
||||
|
||||
using ArrayShortcuts<ArrayRef>::add;
|
||||
|
||||
FORCE_INLINE iterator begin() const {
|
||||
if (!_data)
|
||||
return iterator();
|
||||
|
@ -31,14 +31,14 @@ class ArrayShortcuts {
|
||||
// std::string, String, ObjectRef
|
||||
template <typename T>
|
||||
FORCE_INLINE bool add(const T &value) const {
|
||||
return impl()->addElement().set(value);
|
||||
return impl()->add().set(value);
|
||||
}
|
||||
//
|
||||
// bool add(TValue);
|
||||
// TValue = char*, const char*, const __FlashStringHelper*
|
||||
template <typename T>
|
||||
FORCE_INLINE bool add(T *value) const {
|
||||
return impl()->addElement().set(value);
|
||||
return impl()->add().set(value);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -165,10 +165,12 @@ class ElementProxy : public VariantOperators<ElementProxy<TArray> >,
|
||||
return getOrAddUpstreamElement().getOrAddMember(key);
|
||||
}
|
||||
|
||||
VariantRef addElement() const {
|
||||
return getOrAddUpstreamElement().addElement();
|
||||
VariantRef add() const {
|
||||
return getOrAddUpstreamElement().add();
|
||||
}
|
||||
|
||||
using ArrayShortcuts<ElementProxy<TArray> >::add;
|
||||
|
||||
VariantRef getElement(size_t index) const {
|
||||
return getOrAddUpstreamElement().getElement(index);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ inline typename enable_if<!is_base_of<JsonDocument, TDestination>::value,
|
||||
copyArray(const T* src, size_t len, const TDestination& dst) {
|
||||
bool ok = true;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
ok &= copyArray(src[i], dst.addElement());
|
||||
ok &= copyArray(src[i], dst.add());
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class JsonDocument : public VariantOperators<const JsonDocument&> {
|
||||
}
|
||||
|
||||
ArrayRef createNestedArray() {
|
||||
return addElement().to<ArrayRef>();
|
||||
return add().to<ArrayRef>();
|
||||
}
|
||||
|
||||
// createNestedArray(char*)
|
||||
@ -111,7 +111,7 @@ class JsonDocument : public VariantOperators<const JsonDocument&> {
|
||||
}
|
||||
|
||||
ObjectRef createNestedObject() {
|
||||
return addElement().to<ObjectRef>();
|
||||
return add().to<ObjectRef>();
|
||||
}
|
||||
|
||||
// createNestedObject(char*)
|
||||
@ -254,13 +254,13 @@ class JsonDocument : public VariantOperators<const JsonDocument&> {
|
||||
getStringStoragePolicy(key)));
|
||||
}
|
||||
|
||||
FORCE_INLINE VariantRef addElement() {
|
||||
FORCE_INLINE VariantRef add() {
|
||||
return VariantRef(&_pool, _data.addElement(&_pool));
|
||||
}
|
||||
|
||||
template <typename TValue>
|
||||
FORCE_INLINE bool add(const TValue& value) {
|
||||
return addElement().set(value);
|
||||
return add().set(value);
|
||||
}
|
||||
|
||||
// add(char*) const
|
||||
@ -268,7 +268,7 @@ class JsonDocument : public VariantOperators<const JsonDocument&> {
|
||||
// add(const __FlashStringHelper*) const
|
||||
template <typename TChar>
|
||||
FORCE_INLINE bool add(TChar* value) {
|
||||
return addElement().set(value);
|
||||
return add().set(value);
|
||||
}
|
||||
|
||||
FORCE_INLINE void remove(size_t index) {
|
||||
|
@ -154,10 +154,12 @@ class MemberProxy : public VariantOperators<MemberProxy<TObject, TStringRef> >,
|
||||
return getOrAddUpstreamMember().set(value);
|
||||
}
|
||||
|
||||
FORCE_INLINE VariantRef addElement() const {
|
||||
return getOrAddUpstreamMember().addElement();
|
||||
FORCE_INLINE VariantRef add() const {
|
||||
return getOrAddUpstreamMember().add();
|
||||
}
|
||||
|
||||
using ArrayShortcuts<MemberProxy<TObject, TStringRef> >::add;
|
||||
|
||||
FORCE_INLINE VariantRef getElement(size_t index) const {
|
||||
return getUpstreamMember().getElement(index);
|
||||
}
|
||||
|
@ -269,13 +269,11 @@ class VariantRef : public VariantRefBase<VariantData>,
|
||||
typename enable_if<is_same<T, VariantRef>::value, VariantRef>::type to()
|
||||
const;
|
||||
|
||||
VariantRef addElement() const {
|
||||
VariantRef add() const {
|
||||
return VariantRef(_pool, variantAddElement(_data, _pool));
|
||||
}
|
||||
|
||||
FORCE_INLINE VariantRef getElement(size_t index) const {
|
||||
return VariantRef(_pool, _data != 0 ? _data->getElement(index) : 0);
|
||||
}
|
||||
using ArrayShortcuts<VariantRef>::add;
|
||||
|
||||
FORCE_INLINE VariantConstRef getElementConst(size_t index) const {
|
||||
return VariantConstRef(_data != 0 ? _data->getElement(index) : 0);
|
||||
|
Reference in New Issue
Block a user