|
| Json_array () |
|
enum_json_type | json_type () const override |
|
bool | append_clone (const Json_dom *value) |
| Append a clone of the value to the end of the array. More...
|
|
bool | append_alias (Json_dom *value) |
| Append the value to the end of the array. More...
|
|
bool | append_alias (Json_dom_ptr value) |
| Append the value to the end of the array and take over the ownership of the value. More...
|
|
bool | consume (Json_array_ptr other) |
| Moves all of the elements in the other array to the end of this array. More...
|
|
bool | insert_clone (size_t index, const Json_dom *value) |
| Insert a clone of the value at position index of the array. More...
|
|
bool | insert_alias (size_t index, Json_dom_ptr value) |
| Insert the value at position index of the array. More...
|
|
bool | remove (size_t index) |
| Remove the value at this index. More...
|
|
size_t | size () const |
| The cardinality of the array (number of values). More...
|
|
uint32 | depth () const override |
| Compute the depth of a document. More...
|
|
Json_dom_ptr | clone () const override |
| Make a deep clone. More...
|
|
Json_dom * | operator[] (size_t index) const |
| Get the value at position index. More...
|
|
void | clear () |
| Remove the values in the array. More...
|
|
const_iterator | begin () const |
| Returns a const_iterator that refers to the first element. More...
|
|
const_iterator | end () const |
| Returns a const_iterator that refers past the last element. More...
|
|
void | replace_dom_in_container (const Json_dom *oldv, Json_dom_ptr newv) override |
| Replace oldv contained inside this container array or object) with newv. More...
|
|
void | sort (const CHARSET_INFO *cs=nullptr) |
| Sort the array. More...
|
|
template<class T > |
void | sort (const T &comparator) |
| Sort the array using a user-defined comparator. More...
|
|
bool | binary_search (Json_dom *val) |
| Check if the given value appears in the array. More...
|
|
void | remove_duplicates (const CHARSET_INFO *cs) |
| Sort array and remove duplicate elements. More...
|
|
virtual | ~Json_dom ()=default |
|
void * | operator new (size_t size, const std::nothrow_t &) noexcept |
| Allocate space on the heap for a Json_dom object. More...
|
|
void | operator delete (void *ptr) noexcept |
| Deallocate the space used by a Json_dom object. More...
|
|
void | operator delete (void *ptr, const std::nothrow_t &) noexcept |
| Nothrow delete. More...
|
|
Json_container * | parent () const |
| Get the parent dom to which this dom is attached. More...
|
|
virtual bool | is_scalar () const |
|
virtual bool | is_number () const |
|
Json_path | get_location () const |
| Get the path location of this dom, measured from the outermost document it nests inside. More...
|
|
bool | seek (const Json_seekable_path &path, size_t legs, Json_dom_vector *hits, bool auto_wrap, bool only_need_one) |
| Finds all of the json sub-documents which match the path expression. More...
|
|
Represents a JSON array container, i.e.
type J_ARRAY here.
bool Json_array::append_alias |
( |
Json_dom * |
value | ) |
|
|
inline |
Append the value to the end of the array.
Ownership of the value is effectively transferred to the array and the value will be deallocated by the array so only append values that can be deallocated safely (no stack variables please!)
New code should prefer append_alias(Json_dom_ptr) to this function, because that makes the transfer of ownership more explicit. This function might be removed in the future.
- Parameters
-
[in] | value | a JSON value to be appended |
- Return values
-
false | on success |
true | on failure |
uint32 Json_array::depth |
( |
| ) |
const |
|
overridevirtual |
Compute the depth of a document.
This is the value which would be returned by the JSON_DEPTH() system function.
- for scalar values, empty array and empty object: 1
- for non-empty array: 1+ max(depth of array elements)
- for non-empty objects: 1+ max(depth of object values)
For example: "abc", [] and {} have depth 1. ["abc", [3]] and {"a": "abc", "b": [3]} have depth 3.
- Returns
- the depth of the document
Implements Json_dom.