public ScalarStyle scalarStyleHack(ref const(Node) node) @safe nothrow

Get the scalar style a node had in the file it was loaded from.

This is only useful for nodes loaded from files.

This is a "hack" because a YAML application is supposed to be unaware of styles used in YAML styles, i.e. treating different styles differently is unstandard. However, determining style may be useful in some cases, e.g. YAML utilities.

May only be called on scalar nodes (nodes where node.isScalar() == true).

Example

 // Node node // loaded from a file
 if(node.isScalar)
 {
     import std.stdio;
     writeln(node.scalarStyleHack());
 }
public CollectionStyle collectionStyleHack(ref const(Node) node) @safe nothrow

Get the collection style a YAML node had in the file it was loaded from.

May only be called on collection nodes (nodes where node.isScalar() != true).

See Also:

scalarStyleHack

public void scalarStyleHack(
    ref Node node, 
    const ScalarStyle rhs) @safe nothrow

Set the scalar style node should have when written to a file.

Setting the style might be useful when generating YAML or reformatting existing files.

May only be called on scalar nodes (nodes where node.isScalar() == true).

Example

writeln("D:YAML scalarStyleHack setter unittest");
auto node = Node(5);
node.scalarStyleHack = ScalarStyle.DoubleQuoted;
assert(node.scalarStyleHack() == ScalarStyle.DoubleQuoted);

public void collectionStyleHack(
    ref Node node, 
    const CollectionStyle rhs) @safe nothrow

Set the collection style node should have when written to a file.

Setting the style might be useful when generating YAML or reformatting existing files.

May only be called on collection nodes (nodes where node.isScalar() != true).

Example

writeln("D:YAML collectionStyleHack setter unittest");
auto node = Node([1, 2, 3, 4, 5]);
node.collectionStyleHack = CollectionStyle.Block;
assert(node.collectionStyleHack() == CollectionStyle.Block);

Functionality that may sometimes be needed but allows unsafe or unstandard behavior, and should only be used in specific cases.

Functions

scalarStyleHack@safe, nothrow

Get the scalar style a node had in the file it was loaded from.

collectionStyleHack@safe, nothrow

Get the collection style a YAML node had in the file it was loaded from.

scalarStyleHack@safe, nothrow

Set the scalar style node should have when written to a file.

collectionStyleHack@safe, nothrow

Set the collection style node should have when written to a file.