Updated Representer API doc, minor documentation changes.

This commit is contained in:
Ferdinand Majerech 2011-10-29 20:43:30 +02:00
parent 0e0113ef0e
commit e835f1a191
23 changed files with 144 additions and 115 deletions

View file

@ -32,6 +32,8 @@
<li><a href="dyaml.node.html">dyaml.node</a></li>
<li><a href="dyaml.representer.html">dyaml.representer</a></li>
<li><a href="dyaml.resolver.html">dyaml.resolver</a></li>
<li><a href="dyaml.std.variant.html">dyaml.std.variant</a></li>
<li><a href="dyaml.style.html">dyaml.style</a></li>
</ul>
</div>
</div>
@ -72,12 +74,12 @@
</dd>
<dt class="d_decl">@property void <a name="defaultScalarStyle"></a><span class="ddoc_psymbol">defaultScalarStyle</span>(ScalarStyle <b>style</b>);
</dt>
<dd><p>Set default <b>style</b> for scalars. Invalid means the <b>style</b> is chosen automatically.</p>
<dd><p>Set default style for scalars. Invalid means the style is chosen automatically.</p>
</dd>
<dt class="d_decl">@property void <a name="defaultCollectionStyle"></a><span class="ddoc_psymbol">defaultCollectionStyle</span>(CollectionStyle <b>style</b>);
</dt>
<dd><p>Set default <b>style</b> for collections. Invalid means the <b>style</b> is chosen automatically. </p>
<dd><p>Set default style for collections. Invalid means the style is chosen automatically. </p>
</dd>
<dt class="d_decl">void <a name="addRepresenter"></a><span class="ddoc_psymbol">addRepresenter</span>(T)(Node function(ref Node, Representer) <b>representer</b>);
@ -193,7 +195,8 @@
<tr><td valign=top>string <b>scalar</b></td>
<td valign=top>Scalar value.</td></tr>
<tr><td valign=top>ScalarStyle <b>style</b></td>
<td valign=top>Style of the <b>scalar</b> (will be default if invalid).</td></tr>
<td valign=top>Style of the scalar. If invalid, default style will be used.
If the node was loaded before, previous style will always be used.</td></tr>
</table></div>
<b>Returns:</b><div class="pbr">The represented node.
@ -209,6 +212,7 @@
<span class="d_keyword">auto</span> value = node.as!MyStruct;
<span class="d_keyword">auto</span> <span class="d_param">scalar</span> = format(value.x, <span class="d_string">":"</span>, value.y, <span class="d_string">":"</span>, value.z);
<span class="d_keyword">return</span> representer.<span class="d_psymbol">representScalar</span>(<span class="d_string">"!mystruct.tag"</span>, <span class="d_param">scalar</span>);
}
</pre>
</p>
@ -226,7 +230,8 @@
<tr><td valign=top>Node[] <b>sequence</b></td>
<td valign=top>Sequence of nodes.</td></tr>
<tr><td valign=top>CollectionStyle <b>style</b></td>
<td valign=top>Style of the <b>sequence</b> (will be default if invalid).</td></tr>
<td valign=top>Style of the sequence. If invalid, default style will be used.
If the node was loaded before, previous style will always be used.</td></tr>
</table></div>
<b>Returns:</b><div class="pbr">The represented node.
@ -244,7 +249,9 @@
{
<span class="d_keyword">auto</span> value = node.as!MyStruct;
<span class="d_keyword">auto</span> nodes = [Node(value.x), Node(value.y), Node(value.z)];
<span class="d_keyword">return</span> representer.<span class="d_psymbol">representSequence</span>(<span class="d_string">"!mystruct.tag"</span>, nodes);
<span class="d_comment">//use flow style
</span> <span class="d_keyword">return</span> representer.<span class="d_psymbol">representSequence</span>(<span class="d_string">"!mystruct.tag"</span>, nodes,
CollectionStyle.Flow);
}
</pre>
</p>
@ -262,7 +269,8 @@
<tr><td valign=top>Pair[] <b>pairs</b></td>
<td valign=top>Key-value pairs of the mapping.</td></tr>
<tr><td valign=top>CollectionStyle <b>style</b></td>
<td valign=top>Style of the mapping (will be default if invalid).</td></tr>
<td valign=top>Style of the mapping. If invalid, default style will be used.
If the node was loaded before, previous style will always be used.</td></tr>
</table></div>
<b>Returns:</b><div class="pbr">The represented node.