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.

struct Node {}

Constructors

this
this(T value, string tag)

Construct a Node from a value.

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

Construct a node from arrays of _keys and _values.

Members

Aliases

Pair
alias Pair = .Pair
Undocumented in source.
Value
alias Value = TaggedVariant!(["null_", "merge", "boolean", "integer", "decimal", "binary", "timestamp", "string", "mapping", "sequence"], typeof(null), YAMLMerge, bool, long, double, ubyte[], Timestamp, string, Node.Pair[], Node[])
Undocumented in source.
as
alias as = get

Shortcut for get().

Enums

allowed
eponymoustemplate allowed(T)
Undocumented in source.

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.

deserializeFromIon
auto deserializeFromIon(const(char[])[] symbolTable, IonDescribedValue value)
auto deserializeFromIon(const(string)[] symbolTable, IonDescribedValue value)

Deserialization support for mir-ion

get
inout(T) get()
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)

Foreach over a sequence, getting each element as T.

opApply
int opApply(DG dg)

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

opAssign
void opAssign(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(Node rhs)

Compare with another _node.

opEquals
bool opEquals(Node rhs)

Equality test.

opEquals
bool opEquals(T rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
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.

serialize
void serialize(S serializer)

Serialization support for mir-ion and asdf

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

Sets the style of this node when dumped.

toHash
hash_t toHash()
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

_is
bool _is [@property getter]

Determine if the value stored by the node is of specified type. This only works for default YAML types, not for user defined types.

convertsTo
bool convertsTo [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
debugString
uint debugString [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
length
size_t length [@property getter]

If this is a collection, return its length.

nodeID
NodeID nodeID [@property getter]

Get the kind of node this is.

startMark
Mark startMark [@property getter]

Return the start position of the node.

tag
string tag [@property getter]

Return tag of the node.

type
NodeType type [@property getter]

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.

Variables

collectionStyle
CollectionStyle collectionStyle;
Undocumented in source.
scalarStyle
ScalarStyle scalarStyle;
Undocumented in source.
startMark_
Mark startMark_;
Undocumented in source.
tag_
string tag_;
Undocumented in source.
value_
Value value_;
Undocumented in source.

Meta