Representer

Represents YAML nodes as scalar, sequence and mapping nodes ready for output.

This class is used to add support for dumping of custom data types.

It can also override default node formatting styles for output.

Constructors

this
this(const Flag!"useDefaultRepresenters" useDefaultRepresenters = Yes.useDefaultRepresenters)

Construct a Representer.

Destructor

~this
~this()

Destroy the Representer.

Members

Functions

addRepresenter
void addRepresenter(Node function(ref Node, Representer) representer)

Add a function to represent nodes with a specific data type.

representMapping
Node representMapping(string tag, Node.Pair[] pairs, CollectionStyle style = CollectionStyle.Invalid)

Represent a mapping with specified _tag, representing children first.

representScalar
Node representScalar(string tag, string scalar, ScalarStyle style = ScalarStyle.Invalid)

Represent a _scalar with specified _tag.

representSequence
Node representSequence(string tag, Node[] sequence, CollectionStyle style = CollectionStyle.Invalid)

Represent a _sequence with specified _tag, representing children first.

Properties

defaultCollectionStyle
CollectionStyle defaultCollectionStyle [@property setter]

Set default _style for collections. If style is CollectionStyle.Invalid, the _style is chosen automatically.

defaultScalarStyle
ScalarStyle defaultScalarStyle [@property setter]

Set default _style for scalars. If style is ScalarStyle.Invalid, the _style is chosen automatically.

Meta