dyaml.emitter
YAML emitter. Code based on PyYAML: http://www.pyyaml.org
Types 7
structScalarAnalysis
Nested Templates
AnalysisFlagsprivate aliasisNewLine = among!('\n', '\u0085', '\u2028', '\u2029')
private aliasisSpecialChar = among!('#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\\', '\'', '"', '%', '@', '`')
private aliasisFlowIndicator = among!(',', '?', '[', ']', '{', '}')
private aliasisSpace = among!('\0', '\n', '\r', '\u0085', '\u2028', '\u2029', ' ', '\t')
Fields
TagDirective[] defaultTagDirectives_Default tag handle shortcuts and replacements.Range stream_Stream to write to.Appender!(EmitterFunction[]) states_Stack of states.EmitterFunction state_Current state.Event event_Event we're currently emitting.Appender!(int[]) indents_Stack of previous indentation levels.int indent_Current indentation level.uint flowLevel_Level of nesting in flow context. If 0, we're in block context.Context context_Current context.uint line_Characteristics of the last emitted character: Line.uint column_Column.bool whitespace_Whitespace character?bool indentation_indentation space, '-', '?', or ':'?bool openEnded_Does the document require an explicit document indicator?bool canonical_Formatting details. Canonical scalar format?uint bestIndent_Best indentation width.uint bestWidth_Best text width.LineBreak bestLineBreak_Best line break character/s.TagDirective[] tagDirectives_Tag directive handle - prefix pairs.string preparedAnchor_Anchor/alias to process.string preparedTag_Tag to process.ScalarAnalysis analysis_Analysis result of the current scalar.ScalarStyle style_Style of the current scalar.Methods
void pushState(string D)() @safevoid increaseIndent(const Flag!"flow" flow = No.flow, const bool indentless = false) @safeIncrease indentation level.bool eventTypeIs(in EventID id) const pure @safeDetermines if the type of current event is as specified. Throws if no event.void expectNode(const Context context) @safeHandle a new node. Context specifies where in the document we are.void encodeChar(Writer)(ref Writer writer, in dchar c) @safeEncode an Unicode character for tag directive and write it to writer.ScalarAnalysis analyzeScalar(string scalar) @safeAnalyze specifed scalar and return the analysis result.void writeIndicator(const scope char[] indicator,
const Flag!"needWhitespace" needWhitespace,
const Flag!"whitespace" whitespace = No.whitespace,
const Flag!"indentation" indentation = No.indentation) @safeWrite an indicator (e.g. ":", "[", ">", etc.).void nextExpected(string D)() @safevoid nextExpected(EmitterFunction f) @safevoid callNext() @safeConstructors
Nested Templates
ContextDescribes context (where we are in the document).structScalarWriter(Range, CharType)
RAII struct used to write out scalar values.
Fields
dchar.max dcharNoneUsed as "null" UTF-32 character.string text_UTF-8 encoded text of the scalar to write.bool split_Can we split the scalar into multiple lines?bool spaces_Are we currently going over spaces in the text?bool breaks_Are we currently going over line breaks in the text?size_t startByte_Start and end byte of the text range we're currently working with.size_t nextEndByte_End byte of the text range including the currently processed character.long startChar_Start and end character of the text range we're currently working with.Methods
size_t determineBlockHints(char[] hints, uint bestIndent) const pure @safeDetermine hints (indicators) for block scalar.void initBlock(const char indicator) @safeInitialize for block scalar writing with specified indicator.void writeCurrentRange(const Flag!"UpdateColumn" updateColumn) @safeWrite out the current text range.void writeIndent(const Flag!"ResetSpace" resetSpace) @safeWrite indentation, optionally resetting whitespace/indentation flags.void updateBreaks(in dchar c, const Flag!"UpdateSpaces" updateSpaces) pure @safeUpdate the line breaks flag, optionally updating the spaces flag.