json.array

Module for [Array] class

class Array

Types 1

[json.array.Array] is the representation of the array type inside JSON.

A [json.array.Array] contains [json.node.Node] elements, which may contain fundamental types, other arrays or objects.

Since arrays can be arbitrarily big, copying them can be expensive; for this reason, they are reference counted. You can control the lifetime of a [json.array.Array] using [json.array.Array.ref_] and [json.array.Array.unref].

To append an element, use [json.array.Array.addElement].

To extract an element at a given index, use [json.array.Array.getElement].

To retrieve the entire array in list form, use [json.array.Array.getElements].

To retrieve the length of the array, use [json.array.Array.getLength].

Methods
void * _cPtr(Flag!"Dup" dup = No.Dup)
GType _gType() @property
Array self()Returns `this`, for use in `with` statements.
json.array.Array sizedNew(uint nElements)Creates a new array with `n_elements` slots already allocated.
void addArrayElement(json.array.Array value = null)Conveniently adds an array element into an array.
void addBooleanElement(bool value)Conveniently adds the given boolean value into an array.
void addDoubleElement(double value)Conveniently adds the given floating point value into an array.
void addElement(json.node.Node node)Appends the given `node` inside an array.
void addIntElement(long value)Conveniently adds the given integer value into an array.
void addNullElement()Conveniently adds a `null` element into an array
void addObjectElement(json.object.ObjectWrap value = null)Conveniently adds an object into an array.
void addStringElement(string value)Conveniently adds the given string value into an array.
json.node.Node dupElement(uint index)Retrieves a copy of the element at the given position in the array.
bool equal(json.array.Array b)Check whether two arrays are equal.
void foreachElement(json.types.ArrayForeach func)Iterates over all elements of an array, and calls a function on each one of them.
json.array.Array getArrayElement(uint index)Conveniently retrieves the array at the given position inside an array.
bool getBooleanElement(uint index)Conveniently retrieves the boolean value of the element at the given position inside an array.
double getDoubleElement(uint index)Conveniently retrieves the floating point value of the element at the given position inside an array.
json.node.Node getElement(uint index)Retrieves the element at the given position in the array.
json.node.Node[] getElements()Retrieves all the elements of an array as a list of nodes. Returns: the elements of the array
long getIntElement(uint index)Conveniently retrieves the integer value of the element at the given position inside an array.
uint getLength()Retrieves the length of the given array Returns: the length of the array
bool getNullElement(uint index)Conveniently checks whether the element at the given position inside the array contains a `null` value.
json.object.ObjectWrap getObjectElement(uint index)Conveniently retrieves the object at the given position inside an array.
string getStringElement(uint index)Conveniently retrieves the string value of the element at the given position inside an array.
uint hash()Calculates a hash value for the given `key`.
bool isImmutable()Check whether the given `array` has been marked as immutable by calling [json.array.Array.seal] on it. Returns: true if the array is immutable
void removeElement(uint index)Removes the element at the given position inside an array.
void seal()Seals the given array, making it immutable to further changes.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new array. Returns: the newly created array