fromVar

fnCdmNode fromVar(var v) @safe

Convert a var to a CdmNode (default formatting).

Creates a new CdmNode tree from a var value. Object vars that contain a #name key are converted to TAG nodes; other objects become CdmNode objects.

Acyclicity precondition: the resulting node graph is expected to remain acyclic. If callers later introduce pointer cycles via member/attribute value pointers, recursive consumers may not terminate.

Parameters

vThe var value to convert.

Returns

A CdmNode representing the var value.

Throws

ConvException if an unsigned integer exceeds the CdmNode integer

range (long.max) and cannot be represented as INTEGER.

fnCdmDocument fromVar(var v, CdmDocument.Format fmt) @safe

Convert a var to a CdmDocument with the given format.

Parameters

vThe var value to convert as the document root.
fmtThe document format to set.

Returns

A CdmDocument with the specified format and converted root node.