142 lines
5.3 KiB
HTML
142 lines
5.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
|
<html lang='en'>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" >
|
|
<title>dyaml.hacks - D:YAML 0.5 API documentation</title>
|
|
<link rel="stylesheet" type="text/css" href="css/style.css">
|
|
</head>
|
|
|
|
<body><div id="top">
|
|
<div id="header">
|
|
<img id="logo" alt="D:YAML logo" src="images/logo.png"><a id="main-heading" href="index.html">D:YAML 0.5 API documentation</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="navigation">
|
|
<div class="navblock">
|
|
<div id="toctop">
|
|
<ul><li><a href="../index.html">Documentation home</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="navblock">
|
|
<ul><li><a href="index.html">Main page</a></li>
|
|
<li><a href="dyaml.constructor.html">dyaml.constructor</a></li>
|
|
<li><a href="dyaml.dumper.html">dyaml.dumper</a></li>
|
|
<li><a href="dyaml.exception.html">dyaml.exception</a></li>
|
|
<li><a href="dyaml.hacks.html">dyaml.hacks</a></li>
|
|
<li><a href="dyaml.linebreak.html">dyaml.linebreak</a></li>
|
|
<li><a href="dyaml.loader.html">dyaml.loader</a></li>
|
|
<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.style.html">dyaml.style</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="content">
|
|
<h1>dyaml.hacks</h1>
|
|
<!-- Generated by Ddoc from dyaml/hacks.d -->
|
|
<p>Functionality that may sometimes be needed but allows unsafe or unstandard behavior, and should only be used in specific cases.</p>
|
|
|
|
<dl><dt class="d_decl"><a name="scalarStyleHack"></a>nothrow @safe ScalarStyle <a name="scalarStyleHack"></a><span class="ddoc_psymbol">scalarStyleHack</span>(ref const(Node) <b>node</b>);
|
|
</dt>
|
|
<dd><p>Get the scalar style a <b>node</b> had in the file it was loaded from.
|
|
</p>
|
|
<p>This is only useful for nodes loaded from files.
|
|
<br>
|
|
|
|
This is a "hack" because a YAML application is supposed to be unaware of styles
|
|
used in YAML styles, i.e. treating different styles differently is unstandard.
|
|
However, determining style may be useful in some cases, e.g. YAML utilities.
|
|
<br>
|
|
|
|
May only be called on scalar nodes (nodes where <b>node</b>.isScalar() == <b>true</b>).
|
|
|
|
</p>
|
|
<p><b>Example:</b><br>
|
|
<pre class="d_code"><span class="d_comment">// Node node // loaded from a file
|
|
</span><span class="d_keyword">if</span>(<span class="d_param">node</span>.isScalar)
|
|
{
|
|
<span class="d_keyword">import</span> std.stdio;
|
|
writeln(<span class="d_param">node</span>.<span class="d_psymbol">scalarStyleHack</span>());
|
|
}
|
|
</pre>
|
|
</p>
|
|
|
|
</dd>
|
|
<dt class="d_decl"><a name="collectionStyleHack"></a>nothrow @safe CollectionStyle <a name="collectionStyleHack"></a><span class="ddoc_psymbol">collectionStyleHack</span>(ref const(Node) <b>node</b>);
|
|
</dt>
|
|
<dd><p>Get the collection style a YAML <b>node</b> had in the file it was loaded from.
|
|
</p>
|
|
<p>May only be called on collection nodes (nodes where <b>node</b>.isScalar() != <b>true</b>).
|
|
<br>
|
|
|
|
<br>
|
|
|
|
|
|
</p>
|
|
<b>See Also:</b><div class="pbr">scalarStyleHack</div>
|
|
|
|
</dd>
|
|
<dt class="d_decl"><a name="scalarStyleHack"></a>nothrow @safe void <a name="scalarStyleHack"></a><span class="ddoc_psymbol">scalarStyleHack</span>(ref Node <b>node</b>, const ScalarStyle <b>rhs</b>);
|
|
</dt>
|
|
<dd><p>Set the scalar style <b>node</b> should have when written to a file.
|
|
</p>
|
|
<p>Setting the style might be useful when generating YAML or reformatting existing
|
|
<br>
|
|
|
|
files.
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
May only be called on scalar nodes (nodes where <b>node</b>.isScalar() == <b>true</b>).</p>
|
|
<b>Examples:</b><div class="pbr"><pre class="d_code">
|
|
writeln(<span class="d_string">"D:YAML scalarStyleHack setter unittest"</span>);
|
|
<span class="d_keyword">auto</span> <span class="d_param">node</span> = Node(5);
|
|
<span class="d_param">node</span>.<span class="d_psymbol">scalarStyleHack</span> = ScalarStyle.DoubleQuoted;
|
|
<span class="d_keyword">assert</span>(<span class="d_param">node</span>.<span class="d_psymbol">scalarStyleHack</span>() == ScalarStyle.DoubleQuoted);
|
|
</pre>
|
|
</div>
|
|
</dd>
|
|
<dt class="d_decl"><a name="collectionStyleHack"></a>nothrow @safe void <a name="collectionStyleHack"></a><span class="ddoc_psymbol">collectionStyleHack</span>(ref Node <b>node</b>, const CollectionStyle <b>rhs</b>);
|
|
</dt>
|
|
<dd><p>Set the collection style <b>node</b> should have when written to a file.
|
|
</p>
|
|
<p>Setting the style might be useful when generating YAML or reformatting existing
|
|
<br>
|
|
|
|
files.
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
May only be called on collection nodes (nodes where <b>node</b>.isScalar() != <b>true</b>).</p>
|
|
<b>Examples:</b><div class="pbr"><pre class="d_code">
|
|
writeln(<span class="d_string">"D:YAML collectionStyleHack setter unittest"</span>);
|
|
<span class="d_keyword">auto</span> <span class="d_param">node</span> = Node([1, 2, 3, 4, 5]);
|
|
<span class="d_param">node</span>.<span class="d_psymbol">collectionStyleHack</span> = CollectionStyle.Block;
|
|
<span class="d_keyword">assert</span>(<span class="d_param">node</span>.<span class="d_psymbol">collectionStyleHack</span>() == CollectionStyle.Block);
|
|
</pre>
|
|
</div>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
<div id="copyright">
|
|
Copyright © Ferdinand Majerech 2011-2014. Based on <a href="http://www.pyyaml.org">PyYAML</a> by Kirill Simonov. |
|
|
Page generated by AutoDDoc and <a href="http://www.digitalmars.com/d/2.0/ddoc.html">Ddoc</a>.
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|