Node

YAML node.

This is a pseudo-dynamic type that can store any YAML value, including a sequence or mapping of nodes. You can get data from a Node directly or iterate over it if it's a collection.

Constructors

this
this(T value, const string tag = null)

Construct a Node from a value.

this
this(K[] keys, V[] values, const string tag = null)

Construct a node from arrays of _keys and _values.

Members

Aliases

as
alias as = get

Shortcut for get().

Functions

add
void add(T value)

Add an element to a sequence.

add
void add(K key, V value)

Add a key-value pair to a mapping.

contains
bool contains(T rhs)

Determine if a collection contains specified value.

containsKey
bool containsKey(T rhs)

Determine if a mapping contains specified key.

get
inout(T) get()

Get the value of the node as specified type.

mappingKeys
auto mappingKeys()

Return a range object iterating over mapping's keys.

mappingValues
auto mappingValues()

Return a range object iterating over mapping's values.

opApply
int opApply(D dg)
int opApply(D dg)

Foreach over a sequence, getting each element as T.

opApply
int opApply(DG dg)
int opApply(DG dg)

Foreach over a mapping, getting each key/value as K/V.

opAssign
void opAssign(auto ref Node rhs)

Assignment (shallow copy) by value.

opBinaryRight
inout(Node*) opBinaryRight(K key)

Determine whether a key is in a mapping, and access its value.

opCmp
int opCmp(ref const Node node)

Compare with another _node.

opEquals
bool opEquals(const auto ref T rhs)

Equality test.

opIndex
inout(Node) opIndex(T index)

Get the element at specified index.

opIndexAssign
void opIndexAssign(V value, K index)

Set element at specified index in a collection.

remove
void remove(T rhs)

Remove first (if any) occurence of a value in a collection.

removeAt
void removeAt(T index)

Remove element at the specified index of a collection.

setStyle
void setStyle(CollectionStyle style)
void setStyle(ScalarStyle style)

Sets the style of this node when dumped.

Properties

isMapping
bool isMapping [@property getter]

Is this node a mapping?

isNull
bool isNull [@property getter]

Is this node null?

isScalar
bool isScalar [@property getter]

Is this node a scalar value?

isSequence
bool isSequence [@property getter]

Is this node a sequence?

isUserType
bool isUserType [@property getter]

Is this node a user defined type?

isValid
bool isValid [@property getter]

Is this node valid (initialized)?

length
size_t length [@property getter]

If this is a collection, return its length.

tag
string tag [@property getter]

Return tag of the node.

Templates

mapping
template mapping()

Return a range object iterating over mapping's pairs.

sequence
template sequence(T = Node)

Return a range object iterating over a sequence, getting each element as T.

Meta