Added nesting() to JsonArray, JsonDocument, JsonObject, and JsonVariant

This commit is contained in:
Benoit Blanchon
2019-01-17 09:55:51 +01:00
parent c51cc91f92
commit 30b94493bb
16 changed files with 172 additions and 0 deletions

View File

@@ -280,6 +280,16 @@ class VariantData {
}
}
size_t nesting() const {
switch (type()) {
case VALUE_IS_OBJECT:
case VALUE_IS_ARRAY:
return _content.asCollection.nesting();
default:
return 0;
}
}
size_t size() const {
if (type() == VALUE_IS_OBJECT || type() == VALUE_IS_ARRAY)
return _content.asCollection.size();

View File

@@ -99,6 +99,10 @@ class VariantRefBase {
return _data ? _data->memoryUsage() : 0;
}
FORCE_INLINE size_t nesting() const {
return _data ? _data->nesting() : 0;
}
size_t size() const {
return variantSize(_data);
}