Array

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.

Constructors

this
this()

Creates a new array.

Members

Functions

addArrayElement
void addArrayElement(json.array.Array value)

Conveniently adds an array element into an array.

addBooleanElement
void addBooleanElement(bool value)

Conveniently adds the given boolean value into an array.

addDoubleElement
void addDoubleElement(double value)

Conveniently adds the given floating point value into an array.

addElement
void addElement(json.node.Node node)

Appends the given node inside an array.

addIntElement
void addIntElement(long value)

Conveniently adds the given integer value into an array.

addNullElement
void addNullElement()

Conveniently adds a null element into an array

addObjectElement
void addObjectElement(json.object.ObjectJson value)

Conveniently adds an object into an array.

addStringElement
void addStringElement(string value)

Conveniently adds the given string value into an array.

dupElement
json.node.Node dupElement(uint index)

Retrieves a copy of the element at the given position in the array.

equal
bool equal(json.array.Array b)

Check whether two arrays are equal.

foreachElement
void foreachElement(json.types.ArrayForeach func)

Iterates over all elements of an array, and calls a function on each one of them.

getArrayElement
json.array.Array getArrayElement(uint index)

Conveniently retrieves the array at the given position inside an array.

getBooleanElement
bool getBooleanElement(uint index)

Conveniently retrieves the boolean value of the element at the given position inside an array.

getDoubleElement
double getDoubleElement(uint index)

Conveniently retrieves the floating point value of the element at the given position inside an array.

getElement
json.node.Node getElement(uint index)

Retrieves the element at the given position in the array.

getElements
json.node.Node[] getElements()

Retrieves all the elements of an array as a list of nodes.

getIntElement
long getIntElement(uint index)

Conveniently retrieves the integer value of the element at the given position inside an array.

getLength
uint getLength()

Retrieves the length of the given array

getNullElement
bool getNullElement(uint index)

Conveniently checks whether the element at the given position inside the array contains a null value.

getObjectElement
json.object.ObjectJson getObjectElement(uint index)

Conveniently retrieves the object at the given position inside an array.

getStringElement
string getStringElement(uint index)

Conveniently retrieves the string value of the element at the given position inside an array.

hash
uint hash()

Calculates a hash value for the given key.

isImmutable
bool isImmutable()

Check whether the given array has been marked as immutable by calling json.array.Array.seal on it.

removeElement
void removeElement(uint index)

Removes the element at the given position inside an array.

seal
void seal()

Seals the given array, making it immutable to further changes.

Static functions

sizedNew
json.array.Array sizedNew(uint nElements)

Creates a new array with n_elements slots already allocated.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.