ddn.data.cdm.member

CDM member for object key-value pairs.

This module provides the CdmMember struct for representing key-value pairs in CDM objects with full roundtrip metadata.

CdmMember captures not just the key and value, but also how the key was quoted, what separator was used between key and value, what separator follows the member, and any comments that appear between the key and the assignment operator.

struct CdmMember

Types 1

structCdmMember

A key-value pair in an object with roundtrip metadata.

CdmMember stores everything needed to faithfully reproduce the original source formatting when writing back a modified configuration file.

The struct is designed to be 48 bytes for efficient storage:

  • 16 bytes: key string
  • 3 bytes: style enums + padding
  • 16 bytes: postKeyComments array
  • 8 bytes: value pointer

Examples

CdmMember member;
member.key = "server";
member.separator = CdmFormat.KeyValueSep.EQUALS;
member.value = new CdmNode("localhost");
assert(!member.isImplicit);
Fields
string keyDecoded key text (semantic value)
CdmFormat.QuoteStyle keyQuoteStyleHow the key was quoted (NONE for unquoted identifiers)
CdmFormat.KeyValueSep separatorKey-value separator: =, :, or NONE (implicit/HCL-style)
CdmFormat.SeparatorStyle elementSeparatorSeparator after this member: comma, semicolon, newline, or none
CdmComment[] postKeyCommentsComments appearing between key and assignment operator. Per CF v1.0: "Block comments MAY appear anywhere whitespace is allowed"
CdmNode * valueThe value node (heap-allocated for stable references)
Methods
bool isImplicit() const pure nothrow @nogc @safeReturns true if this member uses implicit assignment (no `=`).
bool hasPostKeyComments() const pure nothrow @nogc @safeReturns true if there are comments between key and `=`.