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.

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.

isValid
bool isValid()

Is this node valid (initialized)?

length
size_t length()

If this is a collection, return its length.

mappingKeys
auto mappingKeys()

Return a range object iterating over mapping's keys.

mappingValues
auto mappingValues()

Return a range object iterating over mapping's values.

nodeID
NodeID nodeID()

Get the kind of node this is.

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(const ref Node rhs)

Compare with another _node.

opEquals
bool opEquals(const Node 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.

tag
string tag()

Return tag of the node.

type
NodeType type()

Get type of the node value.

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