Disambiguated the name get() with getElement() and getMember()

This commit is contained in:
Benoit Blanchon
2019-02-15 15:53:53 +01:00
parent 7ed92bebd3
commit e9b4c6289b
19 changed files with 172 additions and 200 deletions

View File

@@ -285,17 +285,23 @@ class VariantData {
return isCollection() ? _content.asCollection.size() : 0;
}
VariantData *get(size_t index) const {
VariantData *addElement(MemoryPool *pool) {
if (isNull()) toArray();
if (!isArray()) return 0;
return _content.asCollection.add(pool);
}
VariantData *getElement(size_t index) const {
return isArray() ? _content.asCollection.get(index) : 0;
}
template <typename TAdaptedString>
VariantData *get(TAdaptedString key) const {
VariantData *getMember(TAdaptedString key) const {
return isObject() ? _content.asCollection.get(key) : 0;
}
template <typename TAdaptedString>
VariantData *getOrCreate(TAdaptedString key, MemoryPool *pool) {
VariantData *getOrAddMember(TAdaptedString key, MemoryPool *pool) {
if (isNull()) toObject();
if (!isObject()) return 0;
VariantData *var = _content.asCollection.get(key);
@@ -303,12 +309,6 @@ class VariantData {
return _content.asCollection.add(key, pool);
}
VariantData *add(MemoryPool *pool) {
if (isNull()) toArray();
if (!isArray()) return 0;
return _content.asCollection.add(pool);
}
private:
uint8_t type() const {
return _flags & VALUE_MASK;