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) nothrow
GType _getGType() static nothrow
GType _gType() @property nothrow
Array self() nothrowReturns `this`, for use in `with` statements.
json.array.Array sizedNew(uint nElements) static nothrowCreates a new array with `n_elements` slots already allocated.
void addArrayElement(json.array.Array value = null) nothrowConveniently adds an array element into an array.
void addBooleanElement(bool value) nothrowConveniently adds the given boolean value into an array.
void addDoubleElement(double value) nothrowConveniently adds the given floating point value into an array.
void addElement(json.node.Node node) nothrowAppends the given `node` inside an array.
void addIntElement(long value) nothrowConveniently adds the given integer value into an array.
void addNullElement() nothrowConveniently adds a `null` element into an array
void addObjectElement(json.object.ObjectWrap value = null) nothrowConveniently adds an object into an array.
void addStringElement(string value) nothrowConveniently adds the given string value into an array.
json.node.Node dupElement(uint index) nothrowRetrieves a copy of the element at the given position in the array.
bool equal(json.array.Array b) nothrowCheck whether two arrays are equal.
void foreachElement(json.types.ArrayForeach func) nothrowIterates over all elements of an array, and calls a function on each one of them.
json.array.Array getArrayElement(uint index) nothrowConveniently retrieves the array at the given position inside an array.
bool getBooleanElement(uint index) nothrowConveniently retrieves the boolean value of the element at the given position inside an array.
double getDoubleElement(uint index) nothrowConveniently retrieves the floating point value of the element at the given position inside an array.
json.node.Node getElement(uint index) nothrowRetrieves the element at the given position in the array.
json.node.Node[] getElements() nothrowRetrieves all the elements of an array as a list of nodes. Returns: the elements of the array
long getIntElement(uint index) nothrowConveniently retrieves the integer value of the element at the given position inside an array.
uint getLength() nothrowRetrieves the length of the given array Returns: the length of the array
bool getNullElement(uint index) nothrowConveniently checks whether the element at the given position inside the array contains a `null` value.
json.object.ObjectWrap getObjectElement(uint index) nothrowConveniently retrieves the object at the given position inside an array.
string getStringElement(uint index) nothrowConveniently retrieves the string value of the element at the given position inside an array.
uint hash() nothrowCalculates a hash value for the given `key`.
bool isImmutable() nothrowCheck 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) nothrowRemoves the element at the given position inside an array.
void seal() nothrowSeals 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