Changed the Constructor API (for loading of custom types) to
make it easier to load custom classes/structs. Updated API docs, tutorials and examples accordingly.
This commit is contained in:
parent
5547f62176
commit
548480b06b
19 changed files with 371 additions and 396 deletions
|
@ -94,14 +94,15 @@
|
|||
</table></div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">void <a name="addConstructor"></a><span class="ddoc_psymbol">addConstructor</span>(T, U)(in string <b>tag</b>, T function(Mark, Mark, U) <b>ctor</b>);
|
||||
<dt class="d_decl">void <a name="addConstructorScalar"></a><span class="ddoc_psymbol">addConstructorScalar</span>(T)(in string <b>tag</b>, T function(Mark, Mark, ref Node) <b>ctor</b>);
|
||||
</dt>
|
||||
<dd><p>Add a constructor function.
|
||||
<dd><p>Add a constructor function from scalar.
|
||||
</p>
|
||||
<p>The function passed must two Marks (determining start and end positions of
|
||||
the node in file) and either a string (if constructing from scalar),
|
||||
an array of Nodes (from sequence) or an array of Node.Pair (from mapping).
|
||||
The value returned by this function will be stored in the resulring node.
|
||||
<p>The function must take two Marks (start and end positions of
|
||||
the node in file) and a reference to Node to construct from.
|
||||
The node contains a string for scalars, Node[] for sequences and
|
||||
Node.Pair[] for mappings.
|
||||
The value returned by this function will be stored in the resulting node.
|
||||
<br>
|
||||
|
||||
Only one constructor function can be set for one tag.
|
||||
|
@ -113,47 +114,61 @@
|
|||
<td valign=top>Constructor function.</td></tr>
|
||||
</table></div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">void <a name="addConstructorSequence"></a><span class="ddoc_psymbol">addConstructorSequence</span>(T)(in string <b>tag</b>, T function(Mark, Mark, ref Node) <b>ctor</b>);
|
||||
</dt>
|
||||
<dd><p>Add a constructor function from sequence.
|
||||
</p>
|
||||
<b>See Also:</b><div class="pbr">addConstructorScalar</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">void <a name="addConstructorMapping"></a><span class="ddoc_psymbol">addConstructorMapping</span>(T)(in string <b>tag</b>, T function(Mark, Mark, ref Node) <b>ctor</b>);
|
||||
</dt>
|
||||
<dd><p>Add a constructor function from a mapping.
|
||||
</p>
|
||||
<b>See Also:</b><div class="pbr">addConstructorScalar</div>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt class="d_decl">YAMLNull <a name="constructNull"></a><span class="ddoc_psymbol">constructNull</span>(Mark <b>start</b>, Mark <b>end</b>, string <b>value</b>);
|
||||
<dt class="d_decl">YAMLNull <a name="constructNull"></a><span class="ddoc_psymbol">constructNull</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a <b>null</b> node.</p>
|
||||
<dd><p>Construct a <b>null</b> <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">YAMLMerge <a name="constructMerge"></a><span class="ddoc_psymbol">constructMerge</span>(Mark <b>start</b>, Mark <b>end</b>, string <b>value</b>);
|
||||
<dt class="d_decl">YAMLMerge <a name="constructMerge"></a><span class="ddoc_psymbol">constructMerge</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a merge node - a node that merges another node into a mapping.</p>
|
||||
<dd><p>Construct a merge <b>node</b> - a <b>node</b> that merges another <b>node</b> into a mapping.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">bool <a name="constructBool"></a><span class="ddoc_psymbol">constructBool</span>(Mark <b>start</b>, Mark <b>end</b>, string <b>value</b>);
|
||||
<dt class="d_decl">bool <a name="constructBool"></a><span class="ddoc_psymbol">constructBool</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a boolean node.</p>
|
||||
<dd><p>Construct a boolean <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">long <a name="constructLong"></a><span class="ddoc_psymbol">constructLong</span>(Mark <b>start</b>, Mark <b>end</b>, string <b>value</b>);
|
||||
<dt class="d_decl">long <a name="constructLong"></a><span class="ddoc_psymbol">constructLong</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct an integer (long) node.</p>
|
||||
<dd><p>Construct an integer (long) <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">real <a name="constructReal"></a><span class="ddoc_psymbol">constructReal</span>(Mark <b>start</b>, Mark <b>end</b>, string <b>value</b>);
|
||||
<dt class="d_decl">real <a name="constructReal"></a><span class="ddoc_psymbol">constructReal</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a floating point (real) node.</p>
|
||||
<dd><p>Construct a floating point (real) <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">ubyte[] <a name="constructBinary"></a><span class="ddoc_psymbol">constructBinary</span>(Mark <b>start</b>, Mark <b>end</b>, string <b>value</b>);
|
||||
<dt class="d_decl">ubyte[] <a name="constructBinary"></a><span class="ddoc_psymbol">constructBinary</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a binary (base64) node.</p>
|
||||
<dd><p>Construct a binary (base64) <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">SysTime <a name="constructTimestamp"></a><span class="ddoc_psymbol">constructTimestamp</span>(Mark <b>start</b>, Mark <b>end</b>, string <b>value</b>);
|
||||
<dt class="d_decl">SysTime <a name="constructTimestamp"></a><span class="ddoc_psymbol">constructTimestamp</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a timestamp (SysTime) node.</p>
|
||||
<dd><p>Construct a timestamp (SysTime) <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">string <a name="constructString"></a><span class="ddoc_psymbol">constructString</span>(Mark <b>start</b>, Mark <b>end</b>, string <b>value</b>);
|
||||
<dt class="d_decl">string <a name="constructString"></a><span class="ddoc_psymbol">constructString</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a string node.</p>
|
||||
<dd><p>Construct a string <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">Pair[] <a name="getPairs"></a><span class="ddoc_psymbol">getPairs</span>(string <b>type</b>, Mark <b>start</b>, Mark <b>end</b>, Node[] <b>nodes</b>);
|
||||
|
@ -161,29 +176,29 @@
|
|||
<dd><p>Convert a sequence of single-element mappings into a sequence of pairs.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">Pair[] <a name="constructOrderedMap"></a><span class="ddoc_psymbol">constructOrderedMap</span>(Mark <b>start</b>, Mark <b>end</b>, Node[] <b>nodes</b>);
|
||||
<dt class="d_decl">Pair[] <a name="constructOrderedMap"></a><span class="ddoc_psymbol">constructOrderedMap</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct an ordered map (ordered sequence of key:value pairs without duplicates) node.</p>
|
||||
<dd><p>Construct an ordered map (ordered sequence of key:value pairs without duplicates) <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">Pair[] <a name="constructPairs"></a><span class="ddoc_psymbol">constructPairs</span>(Mark <b>start</b>, Mark <b>end</b>, Node[] <b>nodes</b>);
|
||||
<dt class="d_decl">Pair[] <a name="constructPairs"></a><span class="ddoc_psymbol">constructPairs</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a pairs (ordered sequence of key: value pairs allowing duplicates) node.</p>
|
||||
<dd><p>Construct a pairs (ordered sequence of key: value pairs allowing duplicates) <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">Node[] <a name="constructSet"></a><span class="ddoc_psymbol">constructSet</span>(Mark <b>start</b>, Mark <b>end</b>, Pair[] <b>pairs</b>);
|
||||
<dt class="d_decl">Node[] <a name="constructSet"></a><span class="ddoc_psymbol">constructSet</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a set node.</p>
|
||||
<dd><p>Construct a set <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">Node[] <a name="constructSequence"></a><span class="ddoc_psymbol">constructSequence</span>(Mark <b>start</b>, Mark <b>end</b>, Node[] <b>nodes</b>);
|
||||
<dt class="d_decl">Node[] <a name="constructSequence"></a><span class="ddoc_psymbol">constructSequence</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a sequence (array) node.</p>
|
||||
<dd><p>Construct a sequence (array) <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl">Pair[] <a name="constructMap"></a><span class="ddoc_psymbol">constructMap</span>(Mark <b>start</b>, Mark <b>end</b>, Pair[] <b>pairs</b>);
|
||||
<dt class="d_decl">Pair[] <a name="constructMap"></a><span class="ddoc_psymbol">constructMap</span>(Mark <b>start</b>, Mark <b>end</b>, ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct an unordered map (unordered set of key: value pairs without duplicates) node.</p>
|
||||
<dd><p>Construct an unordered map (unordered set of key: value pairs without duplicates) <b>node</b>.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue