dex.cf.writer

CF Writer - Serializer for CF Configuration Files

This module provides a writer/serializer that converts CF documents to CF text format with roundtrip-preserving output using the document's metadata to reproduce original formatting as closely as possible.

Types 2

Configuration options for the CF writer.

Controls formatting behavior for fresh output and as fallback for modified nodes in roundtrip mode.

Fields
string indentIndentation string (default: 3 spaces per CODE_STYLE)
bool sortKeysSort object keys for deterministic output
bool useHCLStyleOmit `=` before objects (HCL-style)
SeparatorStyle separatorStyleDefault separator for fresh output
QuoteStyle quoteStyleDefault quote style for fresh output
bool minifiedMinified output (no whitespace/newlines)
private structCfWriter

Internal CF writer implementation.

Fields
Appender!string output
bool needsNewline
Methods
void writeDocument(CfDocument doc)Writes a complete CfDocument.
void writeMembers(CfMember[] members, int depth, bool explicit)Writes a sequence of object members.
void writeKey(CfMember member)Writes a member key.
void writeSeparator(SeparatorStyle style, bool isLast)Writes a separator between members/elements.
void writeNode(CfNode * node, int depth)Writes a CfNode.
void writeString(CfNode * node)Writes a string node.
void writeInteger(CfNode * node)Writes an integer node.
void writeFloat(CfNode * node)Writes a float node.
void writeFloatValue(double value)Writes a float value with proper handling of special values.
void writeObject(CfNode * node, int depth)Writes an object node.
void writeArray(CfNode * node, int depth)Writes an array node.
void writeComments(CfComment[] comments, int depth)Writes comments.
void writeComment(CfComment comment)Writes a single comment.
void writeIndent(int depth)Writes indentation.
Constructors
this(CfWriterConfig cfg)Constructs a CfWriter with the given configuration.

Functions 5

fnstring toCF(CfDocument doc, CfWriterConfig config = CfWriterConfig.init)Converts a `CfDocument` to CF format string.
private fnbool needsQuoting(string key) @safe pure nothrowChecks if a key needs quoting.
private fnbool isKeyword(string s) @safe pure nothrowChecks if a string is a reserved keyword.
private fnstring quoteString(string s, QuoteStyle style) @safe pureQuotes a string with the specified style.
private fnstring escapeChar(char c, char quote) @safe pure nothrowEscapes a character for inclusion in a quoted string.