Regenerated docs
This commit is contained in:
parent
9775f35120
commit
0a0e966a26
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,7 +2,7 @@
|
|||
Welcome to D:YAML documentation!
|
||||
================================
|
||||
|
||||
`API Documentation <api/index.html>`_
|
||||
API Documentation `(online) <http://ddocs.org/dyaml/~master/index.html>`_ `(local copy) <api/index.html>`_
|
||||
|
||||
Tutorials:
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ Create a file called ``dub.json`` with the following contents:
|
|||
"mainSourceFile": "main.d",
|
||||
"dependencies":
|
||||
{
|
||||
"dyaml": { "version" : "~>0.5.0", "path" : "../../"},
|
||||
"dyaml": { "version" : "~>0.5.0" },
|
||||
},
|
||||
}
|
||||
|
||||
|
|
9406
doc/html/_static/jquery.js
vendored
9406
doc/html/_static/jquery.js
vendored
File diff suppressed because one or more lines are too long
|
@ -40,6 +40,7 @@
|
|||
.highlight .nv { color: #bb60d5 } /* Name.Variable */
|
||||
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
|
||||
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
||||
.highlight .mb { color: #208050 } /* Literal.Number.Bin */
|
||||
.highlight .mf { color: #208050 } /* Literal.Number.Float */
|
||||
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
|
||||
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,220 +0,0 @@
|
|||
body
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
color: black;
|
||||
background-color: #1f252b;
|
||||
font-size: 100%;
|
||||
font-family: Verdana, "Deja Vu", "Bitstream Vera Sans", sans-serif;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6
|
||||
{
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
font-weight: normal;
|
||||
color: #633;
|
||||
line-height: normal;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
margin-top: 0;
|
||||
font-size: 2.5em;
|
||||
}
|
||||
|
||||
h2{font-size: 1.7em;}
|
||||
|
||||
h3{font-size: 1.35em;}
|
||||
|
||||
h4
|
||||
{
|
||||
font-size: 1.15em;
|
||||
font-style: italic;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
pre
|
||||
{
|
||||
background: #eef;
|
||||
padding: 1ex;
|
||||
margin: 1em 0 1em 3em;
|
||||
font-family: monospace;
|
||||
font-size: 1.2em;
|
||||
line-height: normal;
|
||||
border: 1px solid #ccc;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
dd
|
||||
{
|
||||
padding: 1ex;
|
||||
margin-left: 3em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
td{text-align: justify;}
|
||||
|
||||
hr{margin: 2em 0;}
|
||||
|
||||
a{color: #006;}
|
||||
|
||||
a:visited{color: #606;}
|
||||
|
||||
/* These are different kinds of <pre> sections */
|
||||
.console /* command line console */
|
||||
{
|
||||
background-color: #f7f7f7;
|
||||
color: #181818;
|
||||
}
|
||||
|
||||
.moddeffile /* module definition file */
|
||||
{
|
||||
background-color: #efeffe;
|
||||
color: #010199;
|
||||
}
|
||||
|
||||
.d_code /* D code */
|
||||
{
|
||||
background-color: #fcfcfc;
|
||||
color: #000066;
|
||||
}
|
||||
|
||||
.d_code2 /* D code */
|
||||
{
|
||||
background-color: #fcfcfc;
|
||||
color: #000066;
|
||||
}
|
||||
|
||||
td .d_code2
|
||||
{
|
||||
min-width: 20em;
|
||||
margin: 1em 0em;
|
||||
}
|
||||
|
||||
.d_inlinecode
|
||||
{
|
||||
font-family: monospace;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Elements of D source code text */
|
||||
.d_comment{color: green;}
|
||||
.d_string {color: red;}
|
||||
.d_keyword{color: blue;}
|
||||
.d_psymbol{text-decoration: underline;}
|
||||
.d_param {font-style: italic;}
|
||||
|
||||
/* Focal symbol that is being documented */
|
||||
.ddoc_psymbol{color: #336600;}
|
||||
|
||||
div#top{max-width: 85em;}
|
||||
|
||||
div#header{padding: 0.2em 1em 0.2em 1em;}
|
||||
div.pbr
|
||||
{
|
||||
margin: 4px 0px 8px 10px}
|
||||
|
||||
img#logo{vertical-align: bottom;}
|
||||
|
||||
#main-heading
|
||||
{
|
||||
margin-left: 1em;
|
||||
color: white;
|
||||
font-size: 1.4em;
|
||||
font-family: Arial, Verdana, sans-serif;
|
||||
font-variant: small-caps;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div#navigation
|
||||
{
|
||||
font-size: 0.875em;
|
||||
float: left;
|
||||
width: 12.0em;
|
||||
padding: 0 1.5em;
|
||||
}
|
||||
|
||||
div.navblock
|
||||
{
|
||||
margin-top: 0;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
div#navigation .navblock h2
|
||||
{
|
||||
font-family: Verdana, "Deja Vu", "Bitstream Vera Sans", sans-serif;
|
||||
font-size: 1.35em;
|
||||
color: #ccc;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div#navigation .navblock ul
|
||||
{
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div#navigation .navblock li
|
||||
{
|
||||
margin: 0 0 0 0.8em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#navigation .navblock a
|
||||
{
|
||||
display: block;
|
||||
color: #ddd;
|
||||
text-decoration: none;
|
||||
padding: 0.1em 0;
|
||||
border-bottom: 1px dashed #444;
|
||||
}
|
||||
|
||||
#navigation .navblock a:hover{color: white;}
|
||||
|
||||
#navigation .navblock a.active
|
||||
{
|
||||
color: white;
|
||||
border-color: white;
|
||||
}
|
||||
|
||||
div#content
|
||||
{
|
||||
min-height: 440px;
|
||||
margin-left: 15em;
|
||||
margin-right: 1.6em;
|
||||
padding: 1.6em;
|
||||
padding-top: 1.3em;
|
||||
border: 0.6em solid #cccccc;
|
||||
background-color: #f6f6f6;
|
||||
font-size: 0.875em;
|
||||
line-height: 1.3em;
|
||||
}
|
||||
|
||||
div#content li{padding-bottom: .7ex;}
|
||||
|
||||
div#copyright
|
||||
{
|
||||
padding: 1em 2em;
|
||||
background-color: #303333;
|
||||
color: #ccc;
|
||||
font-size: 0.75em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div#copyright a{color: #ccc;}
|
||||
|
||||
.d_inlinecode
|
||||
{
|
||||
font-family: Consolas, "Bitstream Vera Sans Mono", "Andale Mono", "DejaVu Sans Mono", "Lucida Console", monospace;
|
||||
}
|
||||
|
||||
.d_decl
|
||||
{
|
||||
font-weight: bold;
|
||||
background-color: #E4E9EF;
|
||||
border-bottom: solid 2px #336600;
|
||||
padding: 2px 0px 2px 2px;
|
||||
}
|
|
@ -1,337 +0,0 @@
|
|||
<!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.constructor - 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.constructor</h1>
|
||||
<!-- Generated by Ddoc from dyaml/constructor.d -->
|
||||
<p>Class that processes YAML mappings, sequences and scalars into nodes. This can be
|
||||
used to add custom data types. A tutorial can be found
|
||||
<a href="../tutorials/custom_types.html">here</a>.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="Constructor"></a>class <a name="Constructor"></a><span class="ddoc_psymbol">Constructor</span>;
|
||||
</dt>
|
||||
<dd><p>Constructs YAML values.
|
||||
</p>
|
||||
<p>Each YAML scalar, sequence or mapping has a tag specifying its data type.
|
||||
<a name="Constructor"></a><span class="ddoc_psymbol">Constructor</span> uses user-specifyable functions to create a node of desired
|
||||
data type from a scalar, sequence or mapping.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
Each of these functions is associated with a tag, and can process either
|
||||
a scalar, a sequence, or a mapping. The constructor passes each value to
|
||||
the function with corresponding tag, which then returns the resulting value
|
||||
that can be stored in a node.
|
||||
<br>
|
||||
|
||||
If a tag is detected with no known constructor function, it is considered an error.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="Constructor.this"></a>nothrow @safe this(const Flag!"useDefaultConstructors" <b>defaultConstructors</b> = Yes.useDefaultConstructors);
|
||||
</dt>
|
||||
<dd><p>Construct a Constructor.
|
||||
</p>
|
||||
<p>If you don't want to support default YAML tags/data types, you can use
|
||||
<br>
|
||||
|
||||
<b>defaultConstructors</b> to disable constructor functions for these.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>Flag!"useDefaultConstructors" <b>defaultConstructors</b></td>
|
||||
<td valign=top>Use constructors for default YAML tags?</td></tr>
|
||||
</table></div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Constructor.addConstructorScalar"></a>nothrow @safe void <a name="addConstructorScalar"></a><span class="ddoc_psymbol">addConstructorScalar</span>(T)(const string <b>tag</b>, T function(ref Node) <b>ctor</b>);
|
||||
</dt>
|
||||
<dd><p>Add a constructor function from scalar.
|
||||
</p>
|
||||
<p>The function must take a reference to <span class="d_inlinecode">Node</span> to construct from.
|
||||
The node contains a string for scalars, <span class="d_inlinecode">Node[]</span> for sequences and
|
||||
<span class="d_inlinecode">Node.Pair[]</span> for mappings.
|
||||
<br>
|
||||
|
||||
Any exception thrown by this function will be caught by D:YAML and
|
||||
its message will be added to a <span class="d_inlinecode">YAMLException</span> that will also tell
|
||||
the user which type failed to construct, and position in the file.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
The value returned by this function will be stored in the resulting node.
|
||||
<br>
|
||||
|
||||
Only one constructor function can be set for one tag.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
Structs and classes must implement the <span class="d_inlinecode">opCmp()</span> operator for D:YAML
|
||||
support. The signature of the operator that must be implemented
|
||||
is <span class="d_inlinecode">const int opCmp(ref const MyStruct s)</span> for structs where
|
||||
<i>MyStruct</i> is the struct type, and <span class="d_inlinecode">int opCmp(Object o)</span> for
|
||||
classes. Note that the class <span class="d_inlinecode">opCmp()</span> should not alter the compared
|
||||
values - it is not const for compatibility reasons.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>string tag</td>
|
||||
<td valign=top>Tag for the function to handle.</td></tr>
|
||||
<tr><td valign=top>T function(ref Node) ctor</td>
|
||||
<td valign=top>Constructor function.</td></tr>
|
||||
</table></div>
|
||||
<p><b>Example:</b><br>
|
||||
<pre class="d_code"><span class="d_keyword">import</span> std.string;
|
||||
|
||||
<span class="d_keyword">import</span> dyaml.all;
|
||||
|
||||
<span class="d_keyword">struct</span> MyStruct
|
||||
{
|
||||
<span class="d_keyword">int</span> x, y, z;
|
||||
|
||||
<span class="d_comment">//Any D:YAML type must have a custom opCmp operator.
|
||||
</span> <span class="d_comment">//This is used for ordering in mappings.
|
||||
</span> <span class="d_keyword">const</span> <span class="d_keyword">int</span> opCmp(<span class="d_keyword">ref</span> <span class="d_keyword">const</span> MyStruct s)
|
||||
{
|
||||
<span class="d_keyword">if</span>(x != s.x){<span class="d_keyword">return</span> x - s.x;}
|
||||
<span class="d_keyword">if</span>(y != s.y){<span class="d_keyword">return</span> y - s.y;}
|
||||
<span class="d_keyword">if</span>(z != s.z){<span class="d_keyword">return</span> z - s.z;}
|
||||
<span class="d_keyword">return</span> 0;
|
||||
}
|
||||
}
|
||||
|
||||
MyStruct constructMyStructScalar(<span class="d_keyword">ref</span> Node node)
|
||||
{
|
||||
<span class="d_comment">//Guaranteed to be string as we construct from scalar.
|
||||
</span> <span class="d_comment">//!mystruct x:y:z
|
||||
</span> <span class="d_keyword">auto</span> parts = node.as!string().split(<span class="d_string">":"</span>);
|
||||
<span class="d_comment">// If this throws, the D:YAML will handle it and throw a YAMLException.
|
||||
</span> <span class="d_keyword">return</span> MyStruct(to!<span class="d_keyword">int</span>(parts[0]), to!<span class="d_keyword">int</span>(parts[1]), to!<span class="d_keyword">int</span>(parts[2]));
|
||||
}
|
||||
|
||||
<span class="d_keyword">void</span> main()
|
||||
{
|
||||
<span class="d_keyword">auto</span> loader = Loader(<span class="d_string">"file.yaml"</span>);
|
||||
<span class="d_keyword">auto</span> constructor = <span class="d_keyword">new</span> Constructor;
|
||||
constructor.<span class="d_psymbol">addConstructorScalar</span>(<span class="d_string">"!mystruct"</span>, &constructMyStructScalar);
|
||||
loader.constructor = constructor;
|
||||
Node node = loader.load();
|
||||
}
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Constructor.addConstructorSequence"></a>nothrow @safe void <a name="addConstructorSequence"></a><span class="ddoc_psymbol">addConstructorSequence</span>(T)(const string <b>tag</b>, T function(ref Node) <b>ctor</b>);
|
||||
</dt>
|
||||
<dd><p>Add a constructor function from sequence.
|
||||
</p>
|
||||
<b>See Also:</b><div class="pbr">addConstructorScalar
|
||||
|
||||
</div>
|
||||
<p><b>Example:</b><br>
|
||||
<pre class="d_code"><span class="d_keyword">import</span> std.string;
|
||||
|
||||
<span class="d_keyword">import</span> dyaml.all;
|
||||
|
||||
<span class="d_keyword">struct</span> MyStruct
|
||||
{
|
||||
<span class="d_keyword">int</span> x, y, z;
|
||||
|
||||
<span class="d_comment">//Any D:YAML type must have a custom opCmp operator.
|
||||
</span> <span class="d_comment">//This is used for ordering in mappings.
|
||||
</span> <span class="d_keyword">const</span> <span class="d_keyword">int</span> opCmp(<span class="d_keyword">ref</span> <span class="d_keyword">const</span> MyStruct s)
|
||||
{
|
||||
<span class="d_keyword">if</span>(x != s.x){<span class="d_keyword">return</span> x - s.x;}
|
||||
<span class="d_keyword">if</span>(y != s.y){<span class="d_keyword">return</span> y - s.y;}
|
||||
<span class="d_keyword">if</span>(z != s.z){<span class="d_keyword">return</span> z - s.z;}
|
||||
<span class="d_keyword">return</span> 0;
|
||||
}
|
||||
}
|
||||
|
||||
MyStruct constructMyStructSequence(<span class="d_keyword">ref</span> Node node)
|
||||
{
|
||||
<span class="d_comment">//node is guaranteed to be sequence.
|
||||
</span> <span class="d_comment">//!mystruct [x, y, z]
|
||||
</span> <span class="d_keyword">return</span> MyStruct(node[0].as!<span class="d_keyword">int</span>, node[1].as!<span class="d_keyword">int</span>, node[2].as!<span class="d_keyword">int</span>);
|
||||
}
|
||||
|
||||
<span class="d_keyword">void</span> main()
|
||||
{
|
||||
<span class="d_keyword">auto</span> loader = Loader(<span class="d_string">"file.yaml"</span>);
|
||||
<span class="d_keyword">auto</span> constructor = <span class="d_keyword">new</span> Constructor;
|
||||
constructor.<span class="d_psymbol">addConstructorSequence</span>(<span class="d_string">"!mystruct"</span>, &constructMyStructSequence);
|
||||
loader.constructor = constructor;
|
||||
Node node = loader.load();
|
||||
}
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Constructor.addConstructorMapping"></a>nothrow @safe void <a name="addConstructorMapping"></a><span class="ddoc_psymbol">addConstructorMapping</span>(T)(const string <b>tag</b>, T function(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>
|
||||
<p><b>Example:</b><br>
|
||||
<pre class="d_code"><span class="d_keyword">import</span> std.string;
|
||||
|
||||
<span class="d_keyword">import</span> dyaml.all;
|
||||
|
||||
<span class="d_keyword">struct</span> MyStruct
|
||||
{
|
||||
<span class="d_keyword">int</span> x, y, z;
|
||||
|
||||
<span class="d_comment">//Any D:YAML type must have a custom opCmp operator.
|
||||
</span> <span class="d_comment">//This is used for ordering in mappings.
|
||||
</span> <span class="d_keyword">const</span> <span class="d_keyword">int</span> opCmp(<span class="d_keyword">ref</span> <span class="d_keyword">const</span> MyStruct s)
|
||||
{
|
||||
<span class="d_keyword">if</span>(x != s.x){<span class="d_keyword">return</span> x - s.x;}
|
||||
<span class="d_keyword">if</span>(y != s.y){<span class="d_keyword">return</span> y - s.y;}
|
||||
<span class="d_keyword">if</span>(z != s.z){<span class="d_keyword">return</span> z - s.z;}
|
||||
<span class="d_keyword">return</span> 0;
|
||||
}
|
||||
}
|
||||
|
||||
MyStruct constructMyStructMapping(<span class="d_keyword">ref</span> Node node)
|
||||
{
|
||||
<span class="d_comment">//node is guaranteed to be mapping.
|
||||
</span> <span class="d_comment">//!mystruct {"x": x, "y": y, "z": z}
|
||||
</span> <span class="d_keyword">return</span> MyStruct(node[<span class="d_string">"x"</span>].as!<span class="d_keyword">int</span>, node[<span class="d_string">"y"</span>].as!<span class="d_keyword">int</span>, node[<span class="d_string">"z"</span>].as!<span class="d_keyword">int</span>);
|
||||
}
|
||||
|
||||
<span class="d_keyword">void</span> main()
|
||||
{
|
||||
<span class="d_keyword">auto</span> loader = Loader(<span class="d_string">"file.yaml"</span>);
|
||||
<span class="d_keyword">auto</span> constructor = <span class="d_keyword">new</span> Constructor;
|
||||
constructor.<span class="d_psymbol">addConstructorMapping</span>(<span class="d_string">"!mystruct"</span>, &constructMyStructMapping);
|
||||
loader.constructor = constructor;
|
||||
Node node = loader.load();
|
||||
}
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructNull"></a>pure nothrow @nogc @safe YAMLNull <a name="constructNull"></a><span class="ddoc_psymbol">constructNull</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a null node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructMerge"></a>pure nothrow @nogc @safe YAMLMerge <a name="constructMerge"></a><span class="ddoc_psymbol">constructMerge</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a merge node - a node that merges another node into a mapping.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructBool"></a>@safe bool <a name="constructBool"></a><span class="ddoc_psymbol">constructBool</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a boolean node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructLong"></a>long <a name="constructLong"></a><span class="ddoc_psymbol">constructLong</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct an integer (long) node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructReal"></a>real <a name="constructReal"></a><span class="ddoc_psymbol">constructReal</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a floating point (real) node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructBinary"></a>ubyte[] <a name="constructBinary"></a><span class="ddoc_psymbol">constructBinary</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a binary (base64) node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructTimestamp"></a>SysTime <a name="constructTimestamp"></a><span class="ddoc_psymbol">constructTimestamp</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a timestamp (SysTime) node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructString"></a>string <a name="constructString"></a><span class="ddoc_psymbol">constructString</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a string node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="getPairs"></a>Node.Pair[] <a name="getPairs"></a><span class="ddoc_psymbol">getPairs</span>(string <b>type</b>, Node[] <b>nodes</b>);
|
||||
</dt>
|
||||
<dd><p>Convert a sequence of single-element mappings into a sequence of pairs.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructOrderedMap"></a>Node.Pair[] <a name="constructOrderedMap"></a><span class="ddoc_psymbol">constructOrderedMap</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct an ordered map (ordered sequence of key:value pairs without duplicates) node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructPairs"></a>Node.Pair[] <a name="constructPairs"></a><span class="ddoc_psymbol">constructPairs</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a pairs (ordered sequence of key: value pairs allowing duplicates) node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructSet"></a>Node[] <a name="constructSet"></a><span class="ddoc_psymbol">constructSet</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a set node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructSequence"></a>Node[] <a name="constructSequence"></a><span class="ddoc_psymbol">constructSequence</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a sequence (array) node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="constructMap"></a>Node.Pair[] <a name="constructMap"></a><span class="ddoc_psymbol">constructMap</span>(ref Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Construct an unordered map (unordered set of key:value pairs without duplicates) node.</p>
|
||||
|
||||
</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>
|
|
@ -1,234 +0,0 @@
|
|||
<!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.dumper - 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.dumper</h1>
|
||||
<!-- Generated by Ddoc from dyaml/dumper.d -->
|
||||
<p>YAML dumper.
|
||||
</p>
|
||||
<p>Code based on <a href="http://www.pyyaml.org">PyYAML</a>.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="Dumper"></a>struct <a name="Dumper"></a><span class="ddoc_psymbol">Dumper</span>;
|
||||
</dt>
|
||||
<dd><p>Dumps YAML documents to files or streams.
|
||||
</p>
|
||||
<p>User specified Representer and/or Resolver can be used to support new
|
||||
tags / data types.
|
||||
<br>
|
||||
|
||||
Setters are provided to affect output details (style, encoding, etc.).
|
||||
|
||||
</p>
|
||||
<b>Examples:</b><div class="pbr"> Write to a file:
|
||||
<pre class="d_code"><span class="d_keyword">auto</span> node = Node([1, 2, 3, 4, 5]);
|
||||
<span class="d_psymbol">Dumper</span>(<span class="d_string">"file.yaml"</span>).dump(node);
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
Write multiple YAML documents to a file:
|
||||
<pre class="d_code"><span class="d_keyword">auto</span> node1 = Node([1, 2, 3, 4, 5]);
|
||||
<span class="d_keyword">auto</span> node2 = Node(<span class="d_string">"This document contains only one string"</span>);
|
||||
<span class="d_psymbol">Dumper</span>(<span class="d_string">"file.yaml"</span>).dump(node1, node2);
|
||||
|
||||
<span class="d_comment">//Or with an array:
|
||||
</span><span class="d_comment">//Dumper("file.yaml").dump([node1, node2]);
|
||||
</span>
|
||||
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
Write to memory:
|
||||
<pre class="d_code"><span class="d_keyword">import</span> std.stream;
|
||||
<span class="d_keyword">auto</span> stream = <span class="d_keyword">new</span> MemoryStream();
|
||||
<span class="d_keyword">auto</span> node = Node([1, 2, 3, 4, 5]);
|
||||
<span class="d_psymbol">Dumper</span>(stream).dump(node);
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
Use a custom representer/resolver to support custom data types and/or implicit tags:
|
||||
<pre class="d_code"><span class="d_keyword">auto</span> node = Node([1, 2, 3, 4, 5]);
|
||||
<span class="d_keyword">auto</span> representer = <span class="d_keyword">new</span> Representer();
|
||||
<span class="d_keyword">auto</span> resolver = <span class="d_keyword">new</span> Resolver();
|
||||
|
||||
<span class="d_comment">//Add representer functions / resolver expressions here...
|
||||
</span>
|
||||
<span class="d_keyword">auto</span> dumper = <span class="d_psymbol">Dumper</span>(<span class="d_string">"file.yaml"</span>);
|
||||
dumper.representer = representer;
|
||||
dumper.resolver = resolver;
|
||||
dumper.dump(node);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<dl><dt class="d_decl"><a name="Dumper.this"></a>@trusted this(string <b>filename</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a Dumper writing to a file.
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>string <b>filename</b></td>
|
||||
<td valign=top>File name to write to.</td></tr>
|
||||
</table></div>
|
||||
<b>Throws:</b><div class="pbr">YAMLException if the file can not be dumped to (e.g. cannot be opened).</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.this"></a>@safe this(Stream <b>stream</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a Dumper writing to a stream. This is useful to e.g. write to memory.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.name"></a>pure nothrow @property @safe void <a name="name"></a><span class="ddoc_psymbol">name</span>(string <a name="name"></a><span class="ddoc_psymbol">name</span>);
|
||||
</dt>
|
||||
<dd><p>Set stream name. Used in debugging messages.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.resolver"></a>@property @trusted void <a name="resolver"></a><span class="ddoc_psymbol">resolver</span>(Resolver <a name="resolver"></a><span class="ddoc_psymbol">resolver</span>);
|
||||
</dt>
|
||||
<dd><p>Specify custom Resolver to use.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.representer"></a>@property @trusted void <a name="representer"></a><span class="ddoc_psymbol">representer</span>(Representer <a name="representer"></a><span class="ddoc_psymbol">representer</span>);
|
||||
</dt>
|
||||
<dd><p>Specify custom Representer to use.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.canonical"></a>pure nothrow @property @safe void <a name="canonical"></a><span class="ddoc_psymbol">canonical</span>(bool <a name="canonical"></a><span class="ddoc_psymbol">canonical</span>);
|
||||
</dt>
|
||||
<dd><p>Write scalars in canonical form?</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.indent"></a>pure nothrow @property @safe void <a name="indent"></a><span class="ddoc_psymbol">indent</span>(uint <a name="indent"></a><span class="ddoc_psymbol">indent</span>);
|
||||
</dt>
|
||||
<dd><p>Set indentation width. 2 by default. Must not be zero.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.textWidth"></a>pure nothrow @property @safe void <a name="textWidth"></a><span class="ddoc_psymbol">textWidth</span>(uint <b>width</b>);
|
||||
</dt>
|
||||
<dd><p>Set preferred text width.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.lineBreak"></a>pure nothrow @property @safe void <a name="lineBreak"></a><span class="ddoc_psymbol">lineBreak</span>(LineBreak <a name="lineBreak"></a><span class="ddoc_psymbol">lineBreak</span>);
|
||||
</dt>
|
||||
<dd><p>Set line break to use. Unix by default.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.encoding"></a>pure nothrow @property @safe void <a name="encoding"></a><span class="ddoc_psymbol">encoding</span>(Encoding <a name="encoding"></a><span class="ddoc_psymbol">encoding</span>);
|
||||
</dt>
|
||||
<dd><p>Set character encoding to use. UTF-8 by default.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.explicitStart"></a>pure nothrow @property @safe void <a name="explicitStart"></a><span class="ddoc_psymbol">explicitStart</span>(bool <b>explicit</b>);
|
||||
</dt>
|
||||
<dd><p>Always explicitly write document start?</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.explicitEnd"></a>pure nothrow @property @safe void <a name="explicitEnd"></a><span class="ddoc_psymbol">explicitEnd</span>(bool <b>explicit</b>);
|
||||
</dt>
|
||||
<dd><p>Always explicitly write document end?</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.YAMLVersion"></a>pure nothrow @property @safe void <a name="YAMLVersion"></a><span class="ddoc_psymbol">YAMLVersion</span>(string <a name="YAMLVersion"></a><span class="ddoc_psymbol">YAMLVersion</span>);
|
||||
</dt>
|
||||
<dd><p>Specify YAML version string. "1.1" by default.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.tagDirectives"></a>pure @property @trusted void <a name="tagDirectives"></a><span class="ddoc_psymbol">tagDirectives</span>(string[string] <b>tags</b>);
|
||||
</dt>
|
||||
<dd><p>Specify tag directives.
|
||||
</p>
|
||||
<p>A tag directive specifies a shorthand notation for specifying tags.
|
||||
Each tag directive associates a handle with a prefix. This allows for
|
||||
compact tag notation.
|
||||
<br>
|
||||
|
||||
Each handle specified MUST start and end with a '!' character
|
||||
(a single character "!" handle is allowed as well).
|
||||
<br>
|
||||
|
||||
Only alphanumeric characters, '-', and '_' may be used in handles.
|
||||
<br>
|
||||
|
||||
Each prefix MUST not be empty.
|
||||
<br>
|
||||
|
||||
The "!!" handle is used for default YAML tags with prefix
|
||||
"tag:yaml.org,2002:". This can be overridden.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>string[string] <b>tags</b></td>
|
||||
<td valign=top>Tag directives (keys are handles, values are prefixes).</td></tr>
|
||||
</table></div>
|
||||
<p><b>Example:</b><br>
|
||||
<pre class="d_code">Dumper dumper = Dumper(<span class="d_string">"file.yaml"</span>);
|
||||
string[string] directives;
|
||||
directives[<span class="d_string">"!short!"</span>] = <span class="d_string">"tag:long.org,2011:"</span>;
|
||||
<span class="d_comment">//This will emit tags starting with "tag:long.org,2011"
|
||||
</span><span class="d_comment">//with a "!short!" prefix instead.
|
||||
</span>dumper.<span class="d_psymbol">tagDirectives</span>(directives);
|
||||
dumper.dump(Node(<span class="d_string">"foo"</span>));
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Dumper.dump"></a>@trusted void <a name="dump"></a><span class="ddoc_psymbol">dump</span>(Node[] <b>documents</b>...);
|
||||
</dt>
|
||||
<dd><p>Dump one or more YAML documents to the file/stream.
|
||||
</p>
|
||||
<p>Note that while you can call <a name="dump"></a><span class="ddoc_psymbol">dump</span>() multiple times on the same
|
||||
dumper, you will end up writing multiple YAML "files" to the same
|
||||
file/stream.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>Node[] <b>documents</b></td>
|
||||
<td valign=top>Documents to dump (root nodes of the documents).</td></tr>
|
||||
</table></div>
|
||||
<b>Throws:</b><div class="pbr">YAMLException on error (e.g. invalid nodes,
|
||||
unable to write to file/stream).</div>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</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>
|
|
@ -1,66 +0,0 @@
|
|||
<!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.exception - 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.exception</h1>
|
||||
<!-- Generated by Ddoc from dyaml/exception.d -->
|
||||
<p>Exceptions thrown by D:YAML and exception related code.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="YAMLException"></a>class <a name="YAMLException"></a><span class="ddoc_psymbol">YAMLException</span>: <u>object.Exception</u>;
|
||||
</dt>
|
||||
<dd><p>Base class for all exceptions thrown by D:YAML.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="YAMLException.this"></a>pure nothrow @safe this(string <b>msg</b>, string <b>file</b> = __FILE__, int <b>line</b> = __LINE__);
|
||||
</dt>
|
||||
<dd><p>Construct a YAMLException with specified message and position where it was thrown.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</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>
|
|
@ -1,141 +0,0 @@
|
|||
<!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>
|
|
@ -1,72 +0,0 @@
|
|||
<!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.linebreak - 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.linebreak</h1>
|
||||
<!-- Generated by Ddoc from dyaml/linebreak.d -->
|
||||
<br>
|
||||
<dl><dt class="d_decl"><a name="LineBreak"></a>enum <a name="LineBreak"></a><span class="ddoc_psymbol">LineBreak</span>: int;
|
||||
</dt>
|
||||
<dd><p>Enumerates platform specific line breaks.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="LineBreak.Unix"></a><a name="Unix"></a><span class="ddoc_psymbol">Unix</span></dt>
|
||||
<dd><p><a name="Unix"></a><span class="ddoc_psymbol">Unix</span> line break ("\n").</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="LineBreak.Windows"></a><a name="Windows"></a><span class="ddoc_psymbol">Windows</span></dt>
|
||||
<dd><p><a name="Windows"></a><span class="ddoc_psymbol">Windows</span> line break ("\r\n").</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="LineBreak.Macintosh"></a><a name="Macintosh"></a><span class="ddoc_psymbol">Macintosh</span></dt>
|
||||
<dd><p><a name="Macintosh"></a><span class="ddoc_psymbol">Macintosh</span> line break ("\r").</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</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>
|
|
@ -1,244 +0,0 @@
|
|||
<!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.loader - 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.loader</h1>
|
||||
<!-- Generated by Ddoc from dyaml/loader.d -->
|
||||
<p>Class used to load YAML documents.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="Loader"></a>struct <a name="Loader"></a><span class="ddoc_psymbol">Loader</span>;
|
||||
</dt>
|
||||
<dd><p>Loads YAML documents from files or streams.
|
||||
</p>
|
||||
<p>User specified Constructor and/or Resolver can be used to support new
|
||||
tags / data types.
|
||||
|
||||
</p>
|
||||
<b>Examples:</b><div class="pbr"> Load single YAML document from a file:
|
||||
<pre class="d_code"><span class="d_keyword">auto</span> rootNode = <span class="d_psymbol">Loader</span>(<span class="d_string">"file.yaml"</span>).load();
|
||||
...
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
Load all YAML documents from a file:
|
||||
<pre class="d_code"><span class="d_keyword">auto</span> nodes = <span class="d_psymbol">Loader</span>(<span class="d_string">"file.yaml"</span>).loadAll();
|
||||
...
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
Iterate over YAML documents in a file, lazily loading them:
|
||||
<pre class="d_code"><span class="d_keyword">auto</span> loader = <span class="d_psymbol">Loader</span>(<span class="d_string">"file.yaml"</span>);
|
||||
|
||||
<span class="d_keyword">foreach</span>(<span class="d_keyword">ref</span> node; loader)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
Load YAML from a string:
|
||||
<pre class="d_code"><span class="d_keyword">char</span>[] yaml_input = <span class="d_string">"red: '#ff0000'\n"</span>
|
||||
<span class="d_string">"green: '#00ff00'\n"</span>
|
||||
<span class="d_string">"blue: '#0000ff'"</span>.dup;
|
||||
|
||||
<span class="d_keyword">auto</span> colors = <span class="d_psymbol">Loader</span>.fromString(yaml_input).load();
|
||||
|
||||
<span class="d_keyword">foreach</span>(string color, string value; colors)
|
||||
{
|
||||
<span class="d_keyword">import</span> std.stdio;
|
||||
writeln(color, <span class="d_string">" is "</span>, value, <span class="d_string">" in HTML/CSS"</span>);
|
||||
}
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
Load a file into a buffer in memory and then load YAML from that buffer:
|
||||
<pre class="d_code"><span class="d_keyword">try</span>
|
||||
{
|
||||
<span class="d_keyword">import</span> std.file;
|
||||
<span class="d_keyword">void</span>[] buffer = std.file.read(<span class="d_string">"file.yaml"</span>);
|
||||
<span class="d_keyword">auto</span> yamlNode = <span class="d_psymbol">Loader</span>(buffer);
|
||||
|
||||
<span class="d_comment">// Read data from yamlNode here...
|
||||
</span>}
|
||||
<span class="d_keyword">catch</span>(FileException e)
|
||||
{
|
||||
writeln(<span class="d_string">"Failed to read file 'file.yaml'"</span>);
|
||||
}
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
Use a custom constructor/resolver to support custom data types and/or implicit tags:
|
||||
<pre class="d_code"><span class="d_keyword">auto</span> constructor = <span class="d_keyword">new</span> Constructor();
|
||||
<span class="d_keyword">auto</span> resolver = <span class="d_keyword">new</span> Resolver();
|
||||
|
||||
<span class="d_comment">// Add constructor functions / resolver expressions here...
|
||||
</span>
|
||||
<span class="d_keyword">auto</span> loader = <span class="d_psymbol">Loader</span>(<span class="d_string">"file.yaml"</span>);
|
||||
loader.constructor = constructor;
|
||||
loader.resolver = resolver;
|
||||
<span class="d_keyword">auto</span> rootNode = loader.load(node);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<dl><dt class="d_decl"><a name="Loader.this"></a>@trusted this(string <b>filename</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a Loader to load YAML from a file.
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>string <b>filename</b></td>
|
||||
<td valign=top>Name of the file to load from.</td></tr>
|
||||
</table></div>
|
||||
<b>Throws:</b><div class="pbr">YAMLException if the file could not be opened or read.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Loader.fromString"></a>static @safe Loader <a name="fromString"></a><span class="ddoc_psymbol">fromString</span>(char[] <b>data</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a Loader to load YAML from a string (char []).
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>char[] <b>data</b></td>
|
||||
<td valign=top>String to load YAML from. <b>will</b> be overwritten during
|
||||
parsing as D:YAML reuses memory. Use <b>data</b>.dup if you don't
|
||||
want to modify the original string.</td></tr>
|
||||
</table></div>
|
||||
<b>Returns:</b><div class="pbr">Loader loading YAML from given string.
|
||||
|
||||
</div>
|
||||
<b>Throws:</b><div class="pbr">YAMLException if <b>data</b> could not be read (e.g. a decoding error)</div>
|
||||
<b>Examples:</b><div class="pbr"><pre class="d_code">
|
||||
<span class="d_keyword">assert</span>(Loader.<span class="d_psymbol">fromString</span>(<span class="d_keyword">cast</span>(<span class="d_keyword">char</span>[])<span class="d_string">"42"</span>).load().as!<span class="d_keyword">int</span> == 42);
|
||||
</pre>
|
||||
</div>
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Loader.this"></a>@safe this(void[] <b>yamlData</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a Loader to load YAML from a buffer.
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>void[] <b>yamlData</b></td>
|
||||
<td valign=top>Buffer with YAML data to load. This may be e.g. a file
|
||||
loaded to memory or a string with YAML data. Note that
|
||||
buffer <b>will</b> be overwritten, as D:YAML minimizes
|
||||
memory allocations by reusing the input buffer.
|
||||
<b>Must not be deleted or modified by the user as long
|
||||
as nodes loaded by this Loader are in use!</b> - Nodes may
|
||||
refer to data in this buffer.
|
||||
<br>
|
||||
|
||||
Note that D:YAML looks for byte-order-marks YAML files encoded in
|
||||
UTF-16/UTF-32 (and sometimes UTF-8) use to specify the encoding and
|
||||
endianness, so it should be enough to load an entire file to a buffer and
|
||||
pass it to D:YAML, regardless of Unicode encoding.</td></tr>
|
||||
</table></div>
|
||||
<b>Throws:</b><div class="pbr">YAMLException if <b>yamlData</b> contains data illegal in YAML.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Loader.name"></a>pure nothrow @nogc @safe void <a name="name"></a><span class="ddoc_psymbol">name</span>(string <a name="name"></a><span class="ddoc_psymbol">name</span>);
|
||||
</dt>
|
||||
<dd><p>Set stream name. Used in debugging messages.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Loader.resolver"></a>pure nothrow @nogc @safe void <a name="resolver"></a><span class="ddoc_psymbol">resolver</span>(Resolver <a name="resolver"></a><span class="ddoc_psymbol">resolver</span>);
|
||||
</dt>
|
||||
<dd><p>Specify custom Resolver to use.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Loader.constructor"></a>pure nothrow @nogc @safe void <a name="constructor"></a><span class="ddoc_psymbol">constructor</span>(Constructor <a name="constructor"></a><span class="ddoc_psymbol">constructor</span>);
|
||||
</dt>
|
||||
<dd><p>Specify custom Constructor to use.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Loader.load"></a>@safe Node <a name="load"></a><span class="ddoc_psymbol">load</span>();
|
||||
</dt>
|
||||
<dd><p>Load single YAML document.
|
||||
</p>
|
||||
<p>If none or more than one YAML document is found, this throws a YAMLException.
|
||||
<br>
|
||||
|
||||
This can only be called once; this is enforced by contract.
|
||||
|
||||
</p>
|
||||
<b>Returns:</b><div class="pbr">Root node of the document.
|
||||
|
||||
</div>
|
||||
<b>Throws:</b><div class="pbr">YAMLException if there wasn't exactly one document
|
||||
or on a YAML parsing error.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Loader.loadAll"></a>@trusted Node[] <a name="loadAll"></a><span class="ddoc_psymbol">loadAll</span>();
|
||||
</dt>
|
||||
<dd><p>Load all YAML documents.
|
||||
</p>
|
||||
<p>This is just a shortcut that iterates over all documents and returns them
|
||||
all at once. Calling <a name="loadAll"></a><span class="ddoc_psymbol">loadAll</span> after iterating over the node or vice versa
|
||||
will not return any documents, as they have all been parsed already.
|
||||
<br>
|
||||
|
||||
This can only be called once; this is enforced by contract.
|
||||
|
||||
</p>
|
||||
<b>Returns:</b><div class="pbr">Array of root nodes of all documents in the file/stream.
|
||||
|
||||
</div>
|
||||
<b>Throws:</b><div class="pbr">YAMLException on a parsing error.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Loader.opApply"></a>@trusted int <a name="opApply"></a><span class="ddoc_psymbol">opApply</span>(int delegate(ref Node) <b>dg</b>);
|
||||
</dt>
|
||||
<dd><p>Foreach over YAML documents.
|
||||
</p>
|
||||
<p>Parses documents lazily, when they are needed.
|
||||
<br>
|
||||
|
||||
Foreach over a Loader can only be used once; this is enforced by contract.
|
||||
|
||||
</p>
|
||||
<b>Throws:</b><div class="pbr">YAMLException on a parsing error.</div>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</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>
|
|
@ -1,611 +0,0 @@
|
|||
<!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.node - 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.node</h1>
|
||||
<!-- Generated by Ddoc from dyaml/node.d -->
|
||||
<p>Node of a YAML document. Used to read YAML data once it's loaded,
|
||||
</p>
|
||||
<p>and to prepare data to emit.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="NodeException"></a>class <a name="NodeException"></a><span class="ddoc_psymbol">NodeException</span>: <u>dyaml.exception.YAMLException</u>;
|
||||
</dt>
|
||||
<dd><p>Exception thrown at node related errors.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="YAMLNull"></a>struct <a name="YAMLNull"></a><span class="ddoc_psymbol">YAMLNull</span>;
|
||||
</dt>
|
||||
<dd><p>Null YAML type. Used in nodes with null values.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="YAMLNull.toString"></a>const pure nothrow @safe string <a name="toString"></a><span class="ddoc_psymbol">toString</span>();
|
||||
</dt>
|
||||
<dd><p>Used for string conversion.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node"></a>struct <a name="Node"></a><span class="ddoc_psymbol">Node</span>;
|
||||
</dt>
|
||||
<dd><p>YAML node.
|
||||
</p>
|
||||
<p>This is a pseudo-dynamic type that can store any YAML value, including a
|
||||
sequence or mapping of nodes. You can get data from a <a name="Node"></a><span class="ddoc_psymbol">Node</span> directly or
|
||||
iterate over it if it's a collection.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="Node.this"></a>@trusted this(T)(T <b>value</b>, const string <b>tag</b> = null) if (isSomeString!T || !isArray!T && !isAssociativeArray!T);
|
||||
</dt>
|
||||
<dd><p>Construct a Node from a value.
|
||||
</p>
|
||||
<p>Any type except for Node can be stored in a Node, but default YAML
|
||||
types (integers, floats, strings, timestamps, etc.) will be stored
|
||||
more efficiently. To create a node representing a <b>null</b> value,
|
||||
construct it from YAMLNull.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
Note that to emit any non-default types you store
|
||||
in a node, you need a Representer to represent them in YAML -
|
||||
otherwise emitting will fail.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>T value</td>
|
||||
<td valign=top>Value to store in the node.</td></tr>
|
||||
<tr><td valign=top>string tag</td>
|
||||
<td valign=top>Overrides tag of the node when emitted, regardless
|
||||
of tag determined by Representer. Representer uses
|
||||
this to determine YAML data type when a D data type
|
||||
maps to multiple different YAML data types. Tag must
|
||||
be in full form, e.g. "tag:yaml.org,2002:int", not
|
||||
a shortcut, like "!!int".</td></tr>
|
||||
</table></div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.this"></a>@safe this(T)(T[] <b>array</b>, const string <b>tag</b> = null) if (!isSomeString!(T[]));
|
||||
</dt>
|
||||
<dd><p>Construct a node from an array.
|
||||
</p>
|
||||
<p>If array is an array of nodes or pairs, it is stored directly.
|
||||
Otherwise, every value in the array is converted to a node, and
|
||||
those nodes are stored.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>T[] array</td>
|
||||
<td valign=top>Values to store in the node.</td></tr>
|
||||
<tr><td valign=top>string tag</td>
|
||||
<td valign=top>Overrides tag of the node when emitted, regardless
|
||||
of tag determined by Representer. Representer uses
|
||||
this to determine YAML data type when a D data type
|
||||
maps to multiple different YAML data types.
|
||||
This is used to differentiate between YAML sequences
|
||||
("!!seq") and sets ("!!set"), which both are
|
||||
internally represented as an array_ of nodes. Tag
|
||||
must be in full form, e.g. "tag:yaml.org,2002:set",
|
||||
not a shortcut, like "!!set".</td></tr>
|
||||
</table></div>
|
||||
<b>Examples:</b><div class="pbr"><pre class="d_code"><span class="d_comment">// Will be emitted as a sequence (default for arrays)
|
||||
</span><span class="d_keyword">auto</span> seq = Node([1, 2, 3, 4, 5]);
|
||||
<span class="d_comment">// Will be emitted as a set (overriden tag)
|
||||
</span><span class="d_keyword">auto</span> set = Node([1, 2, 3, 4, 5], <span class="d_string">"tag:yaml.org,2002:set"</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.this"></a>@safe this(K, V)(V[K] <b>array</b>, const string <b>tag</b> = null);
|
||||
</dt>
|
||||
<dd><p>Construct a node from an associative array.
|
||||
</p>
|
||||
<p>If keys and/or values of array are nodes, they stored directly.
|
||||
Otherwise they are converted to nodes and then stored.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>V[K] array</td>
|
||||
<td valign=top>Values to store in the node.</td></tr>
|
||||
<tr><td valign=top>string tag</td>
|
||||
<td valign=top>Overrides tag of the node when emitted, regardless
|
||||
of tag determined by Representer. Representer uses
|
||||
this to determine YAML data type when a D data type
|
||||
maps to multiple different YAML data types.
|
||||
This is used to differentiate between YAML unordered
|
||||
mappings ("!!map"), ordered mappings ("!!omap"), and
|
||||
pairs ("!!pairs") which are all internally
|
||||
represented as an array of node pairs. Tag must be
|
||||
in full form, e.g. "tag:yaml.org,2002:omap", not a
|
||||
shortcut, like "!!omap".</td></tr>
|
||||
</table></div>
|
||||
<b>Examples:</b><div class="pbr"><pre class="d_code"><span class="d_comment">// Will be emitted as an unordered mapping (default for mappings)
|
||||
</span><span class="d_keyword">auto</span> map = Node([1 : <span class="d_string">"a"</span>, 2 : <span class="d_string">"b"</span>]);
|
||||
<span class="d_comment">// Will be emitted as an ordered map (overriden tag)
|
||||
</span><span class="d_keyword">auto</span> omap = Node([1 : <span class="d_string">"a"</span>, 2 : <span class="d_string">"b"</span>], <span class="d_string">"tag:yaml.org,2002:omap"</span>);
|
||||
<span class="d_comment">// Will be emitted as pairs (overriden tag)
|
||||
</span><span class="d_keyword">auto</span> pairs = Node([1 : <span class="d_string">"a"</span>, 2 : <span class="d_string">"b"</span>], <span class="d_string">"tag:yaml.org,2002:pairs"</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.this"></a>@safe this(K, V)(K[] <b>keys</b>, V[] <b>values</b>, const string <b>tag</b> = null) if (!(isSomeString!(K[]) || isSomeString!(V[])));
|
||||
</dt>
|
||||
<dd><p>Construct a node from arrays of keys and values.
|
||||
</p>
|
||||
<p>Constructs a mapping node with key-value pairs from
|
||||
keys and values, keeping their order. Useful when order
|
||||
is important (ordered maps, pairs).
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
keys and values must have equal length.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
If keys and/or values are nodes, they are stored directly/
|
||||
Otherwise they are converted to nodes and then stored.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>K[] keys</td>
|
||||
<td valign=top>Keys of the mapping, from first to last pair.</td></tr>
|
||||
<tr><td valign=top>V[] values</td>
|
||||
<td valign=top>Values of the mapping, from first to last pair.</td></tr>
|
||||
<tr><td valign=top>string tag</td>
|
||||
<td valign=top>Overrides tag of the node when emitted, regardless
|
||||
of tag determined by Representer. Representer uses
|
||||
this to determine YAML data type when a D data type
|
||||
maps to multiple different YAML data types.
|
||||
This is used to differentiate between YAML unordered
|
||||
mappings ("!!map"), ordered mappings ("!!omap"), and
|
||||
pairs ("!!pairs") which are all internally
|
||||
represented as an array of node pairs. Tag must be
|
||||
in full form, e.g. "tag:yaml.org,2002:omap", not a
|
||||
shortcut, like "!!omap".</td></tr>
|
||||
</table></div>
|
||||
<b>Examples:</b><div class="pbr"><pre class="d_code"><span class="d_comment">// Will be emitted as an unordered mapping (default for mappings)
|
||||
</span><span class="d_keyword">auto</span> map = Node([1, 2], [<span class="d_string">"a"</span>, <span class="d_string">"b"</span>]);
|
||||
<span class="d_comment">// Will be emitted as an ordered map (overriden tag)
|
||||
</span><span class="d_keyword">auto</span> omap = Node([1, 2], [<span class="d_string">"a"</span>, <span class="d_string">"b"</span>], <span class="d_string">"tag:yaml.org,2002:omap"</span>);
|
||||
<span class="d_comment">// Will be emitted as pairs (overriden tag)
|
||||
</span><span class="d_keyword">auto</span> pairs = Node([1, 2], [<span class="d_string">"a"</span>, <span class="d_string">"b"</span>], <span class="d_string">"tag:yaml.org,2002:pairs"</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.isValid"></a>const pure nothrow @property @safe bool <a name="isValid"></a><span class="ddoc_psymbol">isValid</span>();
|
||||
</dt>
|
||||
<dd><p>Is this node valid (initialized)?</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.isScalar"></a>const nothrow @property @safe bool <a name="isScalar"></a><span class="ddoc_psymbol">isScalar</span>();
|
||||
</dt>
|
||||
<dd><p>Is this node a scalar value?</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.isSequence"></a>const nothrow @property @safe bool <a name="isSequence"></a><span class="ddoc_psymbol">isSequence</span>();
|
||||
</dt>
|
||||
<dd><p>Is this node a sequence?</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.isMapping"></a>const nothrow @property @safe bool <a name="isMapping"></a><span class="ddoc_psymbol">isMapping</span>();
|
||||
</dt>
|
||||
<dd><p>Is this node a mapping?</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.isUserType"></a>const nothrow @property @safe bool <a name="isUserType"></a><span class="ddoc_psymbol">isUserType</span>();
|
||||
</dt>
|
||||
<dd><p>Is this node a user defined type?</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.isNull"></a>const nothrow @property @safe bool <a name="isNull"></a><span class="ddoc_psymbol">isNull</span>();
|
||||
</dt>
|
||||
<dd><p>Is this node <b>null</b>?</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.tag"></a>const nothrow @property @safe string <a name="tag"></a><span class="ddoc_psymbol">tag</span>();
|
||||
</dt>
|
||||
<dd><p>Return <a name="tag"></a><span class="ddoc_psymbol">tag</span> of the node.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.opEquals"></a>const @safe bool <a name="opEquals"></a><span class="ddoc_psymbol">opEquals</span>(T)(auto ref const T <b>rhs</b>);
|
||||
</dt>
|
||||
<dd><p>Equality test.
|
||||
</p>
|
||||
<p>If T is Node, recursively compares all subnodes.
|
||||
This might be quite expensive if testing entire documents.
|
||||
<br>
|
||||
|
||||
If T is not Node, gets a value of type T from the node and tests
|
||||
equality with that.
|
||||
<br>
|
||||
|
||||
To test equality with a <b>null</b> YAML value, use YAMLNull.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>T rhs</td>
|
||||
<td valign=top>Variable to test equality with.</td></tr>
|
||||
</table></div>
|
||||
<b>Returns:</b><div class="pbr"><b>true</b> if equal, <b>false</b> otherwise.</div>
|
||||
<b>Examples:</b><div class="pbr"><pre class="d_code">
|
||||
<span class="d_keyword">auto</span> node = Node(42);
|
||||
|
||||
<span class="d_keyword">assert</span>(node == 42);
|
||||
<span class="d_keyword">assert</span>(node != <span class="d_string">"42"</span>);
|
||||
<span class="d_keyword">assert</span>(node != <span class="d_string">"43"</span>);
|
||||
|
||||
<span class="d_keyword">auto</span> node2 = Node(YAMLNull());
|
||||
<span class="d_keyword">assert</span>(node2 == YAMLNull());
|
||||
</pre>
|
||||
</div>
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.as"></a>alias <a name="as"></a><span class="ddoc_psymbol">as</span> = get(T, Flag stringConversion = Yes.stringConversion)() if (!is(T == const));
|
||||
</dt>
|
||||
<dd><p>Shortcut for get().</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.get"></a>@property @trusted T <a name="get"></a><span class="ddoc_psymbol">get</span>(T, Flag!"stringConversion" stringConversion = Yes.stringConversion)() if (!is(T == const));
|
||||
</dt>
|
||||
<dd><p>Get the value of the node as specified type.
|
||||
</p>
|
||||
<p>If the specifed type does not match type in the node,
|
||||
conversion is attempted. The stringConversion template
|
||||
parameter can be used to disable conversion from non-string
|
||||
types to strings.
|
||||
<br>
|
||||
|
||||
Numeric values are range checked, throwing if out of range of
|
||||
requested type.
|
||||
<br>
|
||||
|
||||
Timestamps are stored as std.datetime.SysTime.
|
||||
Binary values are decoded and stored as ubyte[].
|
||||
<br>
|
||||
|
||||
To <a name="get"></a><span class="ddoc_psymbol">get</span> a <b>null</b> value, use <a name="get"></a><span class="ddoc_psymbol">get</span>!YAMLNull . This is to
|
||||
prevent getting <b>null</b> values for types such as strings or classes.
|
||||
<br>
|
||||
|
||||
<br><b>Mapping default values:</b>
|
||||
<br>
|
||||
|
||||
<div class="pbr"> The '=' key can be used to denote the default value of a mapping.
|
||||
This can be used when a node is scalar in early versions of a program,
|
||||
but is replaced by a mapping later. Even if the node is a mapping, the
|
||||
<a name="get"></a><span class="ddoc_psymbol">get</span> method can be used as if it was a scalar if it has a default value.
|
||||
This way, new YAML files where the node is a mapping can still be read
|
||||
by old versions of the program, which expect the node to be a scalar.
|
||||
</div>
|
||||
|
||||
</p>
|
||||
<b>Examples:</b><div class="pbr"> Automatic type conversion:
|
||||
<pre class="d_code"><span class="d_keyword">auto</span> node = Node(42);
|
||||
|
||||
<span class="d_keyword">assert</span>(node.as!<span class="d_keyword">int</span> == 42);
|
||||
<span class="d_keyword">assert</span>(node.as!string == <span class="d_string">"42"</span>);
|
||||
<span class="d_keyword">assert</span>(node.as!<span class="d_keyword">double</span> == 42.0);
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
<b>Returns:</b><div class="pbr">Value of the node as specified type.
|
||||
|
||||
</div>
|
||||
<b>Throws:</b><div class="pbr">NodeException if unable to convert to specified type, or if
|
||||
the value is out of range of requested type.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.get"></a>const @property @trusted T <a name="get"></a><span class="ddoc_psymbol">get</span>(T, Flag!"stringConversion" stringConversion = Yes.stringConversion)() if (is(T == const));
|
||||
</dt>
|
||||
<dd><p>Ditto.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.length"></a>const @property @safe size_t <a name="length"></a><span class="ddoc_psymbol">length</span>();
|
||||
</dt>
|
||||
<dd><p>If this is a collection, return its length.
|
||||
</p>
|
||||
<p>Otherwise, throw NodeException.
|
||||
|
||||
</p>
|
||||
<b>Returns:</b><div class="pbr">Number of elements in a sequence or key-value pairs in a mapping.
|
||||
|
||||
</div>
|
||||
<b>Throws:</b><div class="pbr">NodeException if this is not a sequence nor a mapping.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.opIndex"></a>ref @trusted Node <a name="opIndex"></a><span class="ddoc_psymbol">opIndex</span>(T)(T <b>index</b>);
|
||||
</dt>
|
||||
<dd><p>Get the element at specified index.
|
||||
</p>
|
||||
<p>If the node is a sequence, index must be integral.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
If the node is a mapping, return the value corresponding to the first
|
||||
key equal to index. containsKey() can be used to determine if a mapping
|
||||
has a specific key.
|
||||
<br>
|
||||
|
||||
To get element at a <b>null</b> index, use YAMLNull for index.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>T index</td>
|
||||
<td valign=top>Index to use.</td></tr>
|
||||
</table></div>
|
||||
<b>Returns:</b><div class="pbr">Value corresponding to the index.
|
||||
|
||||
</div>
|
||||
<b>Throws:</b><div class="pbr">NodeException if the index could not be found,
|
||||
non-integral index is used with a sequence or the node is
|
||||
not a collection.</div>
|
||||
<b>Examples:</b><div class="pbr"><pre class="d_code">
|
||||
writeln(<span class="d_string">"D:YAML Node opIndex unittest"</span>);
|
||||
<span class="d_keyword">alias</span> Node.Value Value;
|
||||
<span class="d_keyword">alias</span> Node.Pair Pair;
|
||||
|
||||
Node narray = Node([11, 12, 13, 14]);
|
||||
Node nmap = Node([<span class="d_string">"11"</span>, <span class="d_string">"12"</span>, <span class="d_string">"13"</span>, <span class="d_string">"14"</span>], [11, 12, 13, 14]);
|
||||
|
||||
<span class="d_keyword">assert</span>(narray[0].as!<span class="d_keyword">int</span> == 11);
|
||||
<span class="d_keyword">assert</span>(<span class="d_keyword">null</span> !<span class="d_keyword">is</span> collectException(narray[42]));
|
||||
<span class="d_keyword">assert</span>(nmap[<span class="d_string">"11"</span>].as!<span class="d_keyword">int</span> == 11);
|
||||
<span class="d_keyword">assert</span>(nmap[<span class="d_string">"14"</span>].as!<span class="d_keyword">int</span> == 14);
|
||||
</pre>
|
||||
</div>
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.contains"></a>const @safe bool <a name="contains"></a><span class="ddoc_psymbol">contains</span>(T)(T <b>rhs</b>);
|
||||
</dt>
|
||||
<dd><p>Determine if a collection <a name="contains"></a><span class="ddoc_psymbol">contains</span> specified value.
|
||||
</p>
|
||||
<p>If the node is a sequence, check if it <a name="contains"></a><span class="ddoc_psymbol">contains</span> the specified value.
|
||||
If it's a mapping, check if it has a value that matches specified value.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>T rhs</td>
|
||||
<td valign=top>Item to look for. Use YAMLNull to check for a <b>null</b> value.</td></tr>
|
||||
</table></div>
|
||||
<b>Returns:</b><div class="pbr"><b>true</b> if rhs was found, <b>false</b> otherwise.
|
||||
|
||||
</div>
|
||||
<b>Throws:</b><div class="pbr">NodeException if the node is not a collection.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.containsKey"></a>const @safe bool <a name="containsKey"></a><span class="ddoc_psymbol">containsKey</span>(T)(T <b>rhs</b>);
|
||||
</dt>
|
||||
<dd><p>Determine if a mapping contains specified key.
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>T rhs</td>
|
||||
<td valign=top>Key to look for. Use YAMLNull to check for a <b>null</b> key.</td></tr>
|
||||
</table></div>
|
||||
<b>Returns:</b><div class="pbr"><b>true</b> if rhs was found, <b>false</b> otherwise.
|
||||
|
||||
</div>
|
||||
<b>Throws:</b><div class="pbr">NodeException if the node is not a mapping.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.opAssign"></a>nothrow @safe void <a name="opAssign"></a><span class="ddoc_psymbol">opAssign</span>(Node <b>rhs</b>);
|
||||
</dt>
|
||||
<dd><p>Assignment (shallow copy) by value.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.opAssign"></a>nothrow @trusted void <a name="opAssign"></a><span class="ddoc_psymbol">opAssign</span>(ref Node <b>rhs</b>);
|
||||
</dt>
|
||||
<dd><p>Assignment (shallow copy) by reference.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.opIndexAssign"></a>@safe void <a name="opIndexAssign"></a><span class="ddoc_psymbol">opIndexAssign</span>(K, V)(V <b>value</b>, K <b>index</b>);
|
||||
</dt>
|
||||
<dd><p>Set element at specified index in a collection.
|
||||
</p>
|
||||
<p>This method can only be called on collection nodes.
|
||||
<br>
|
||||
|
||||
If the node is a sequence, index must be integral.
|
||||
<br>
|
||||
|
||||
If the node is a mapping, sets the value corresponding to the first
|
||||
key matching index (including conversion, so e.g. "42" matches 42).
|
||||
<br>
|
||||
|
||||
If the node is a mapping and no key matches index, a new key-value
|
||||
pair is added to the mapping. In sequences the index must be in
|
||||
range. This ensures behavior siilar to D arrays and associative
|
||||
arrays.
|
||||
<br>
|
||||
|
||||
To set element at a <b>null</b> index, use YAMLNull for index.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>K index</td>
|
||||
<td valign=top>Index of the value to set.</td></tr>
|
||||
</table></div>
|
||||
<b>Throws:</b><div class="pbr">NodeException if the node is not a collection, index is out
|
||||
of range or if a non-integral index is used on a sequence node.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.opApply"></a>@trusted int <a name="opApply"></a><span class="ddoc_psymbol">opApply</span>(T)(int delegate(ref T) <b>dg</b>);
|
||||
</dt>
|
||||
<dd><p>Foreach over a sequence, getting each element as T.
|
||||
</p>
|
||||
<p>If T is Node, simply iterate over the nodes in the sequence.
|
||||
Otherwise, convert each node to T during iteration.
|
||||
|
||||
</p>
|
||||
<b>Throws:</b><div class="pbr">NodeException if the node is not a sequence or an
|
||||
element could not be converted to specified type.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.opApply"></a>@trusted int <a name="opApply"></a><span class="ddoc_psymbol">opApply</span>(K, V)(int delegate(ref K, ref V) <b>dg</b>);
|
||||
</dt>
|
||||
<dd><p>Foreach over a mapping, getting each key/value as K/V.
|
||||
</p>
|
||||
<p>If the K and/or V is Node, simply iterate over the nodes in the mapping.
|
||||
Otherwise, convert each key/value to T during iteration.
|
||||
|
||||
</p>
|
||||
<b>Throws:</b><div class="pbr">NodeException if the node is not a mapping or an
|
||||
element could not be converted to specified type.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.add"></a>@safe void <a name="add"></a><span class="ddoc_psymbol">add</span>(T)(T <b>value</b>);
|
||||
</dt>
|
||||
<dd><p>Add an element to a sequence.
|
||||
</p>
|
||||
<p>This method can only be called on sequence nodes.
|
||||
<br>
|
||||
|
||||
If value is a node, it is copied to the sequence directly. Otherwise
|
||||
value is converted to a node and then stored in the sequence.
|
||||
<br>
|
||||
|
||||
<p>When emitting, all values in the sequence will be emitted. When
|
||||
using the !!set tag, the user needs to ensure that all elements in
|
||||
the sequence are unique, otherwise <b>invalid</b> YAML code will be
|
||||
emitted.</p>
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>T value</td>
|
||||
<td valign=top>Value to add to the sequence.</td></tr>
|
||||
</table></div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.add"></a>@safe void <a name="add"></a><span class="ddoc_psymbol">add</span>(K, V)(K <b>key</b>, V <b>value</b>);
|
||||
</dt>
|
||||
<dd><p>Add a key-value pair to a mapping.
|
||||
</p>
|
||||
<p>This method can only be called on mapping nodes.
|
||||
<br>
|
||||
|
||||
If key and/or value is a node, it is copied to the mapping directly.
|
||||
Otherwise it is converted to a node and then stored in the mapping.
|
||||
<br>
|
||||
|
||||
<p>It is possible for the same key to be present more than once in a
|
||||
mapping. When emitting, all key-value pairs will be emitted.
|
||||
This is useful with the "!!pairs" tag, but will result in
|
||||
<b>invalid</b> YAML with "!!map" and "!!omap" tags.</p>
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>K key</td>
|
||||
<td valign=top>Key to add.</td></tr>
|
||||
<tr><td valign=top>V value</td>
|
||||
<td valign=top>Value to add.</td></tr>
|
||||
</table></div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.opBinaryRight"></a>@system Node* <a name="opBinaryRight"></a><span class="ddoc_psymbol">opBinaryRight</span>(string op, K)(K <b>key</b>) if (op == "in");
|
||||
</dt>
|
||||
<dd><p>Determine whether a key is in a mapping, and access its value.
|
||||
</p>
|
||||
<p>This method can only be called on mapping nodes.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>K key</td>
|
||||
<td valign=top>Key to search for.</td></tr>
|
||||
</table></div>
|
||||
<b>Returns:</b><div class="pbr">A pointer to the value (as a Node) corresponding to key,
|
||||
or <b>null</b> if not found.
|
||||
|
||||
</div>
|
||||
<p><b>Note:</b><br>
|
||||
Any modification to the node can invalidate the returned
|
||||
pointer.
|
||||
|
||||
</p>
|
||||
<b>See Also:</b><div class="pbr">contains</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.remove"></a>@trusted void <a name="remove"></a><span class="ddoc_psymbol">remove</span>(T)(T <b>rhs</b>);
|
||||
</dt>
|
||||
<dd><p>Remove first (if any) occurence of a value in a collection.
|
||||
</p>
|
||||
<p>This method can only be called on collection nodes.
|
||||
<br>
|
||||
|
||||
If the node is a sequence, the first node matching value is removed.
|
||||
If the node is a mapping, the first key-value pair where value
|
||||
matches specified value is removed.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>T rhs</td>
|
||||
<td valign=top>Value to remove.</td></tr>
|
||||
</table></div>
|
||||
<b>Throws:</b><div class="pbr">NodeException if the node is not a collection.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.removeAt"></a>@trusted void <a name="removeAt"></a><span class="ddoc_psymbol">removeAt</span>(T)(T <b>index</b>);
|
||||
</dt>
|
||||
<dd><p>Remove element at the specified index of a collection.
|
||||
</p>
|
||||
<p>This method can only be called on collection nodes.
|
||||
<br>
|
||||
|
||||
If the node is a sequence, index must be integral.
|
||||
<br>
|
||||
|
||||
If the node is a mapping, remove the first key-value pair where
|
||||
key matches index.
|
||||
<br>
|
||||
|
||||
If the node is a mapping and no key matches index, nothing is removed
|
||||
and no exception is thrown. This ensures behavior siilar to D arrays
|
||||
and associative arrays.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>T index</td>
|
||||
<td valign=top>Index to remove at.</td></tr>
|
||||
</table></div>
|
||||
<b>Throws:</b><div class="pbr">NodeException if the node is not a collection, index is out
|
||||
of range or if a non-integral index is used on a sequence node.</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Node.opCmp"></a>const @safe int <a name="opCmp"></a><span class="ddoc_psymbol">opCmp</span>(ref const Node <b>node</b>);
|
||||
</dt>
|
||||
<dd><p>Compare with another node.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</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>
|
|
@ -1,411 +0,0 @@
|
|||
<!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.representer - 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.representer</h1>
|
||||
<!-- Generated by Ddoc from dyaml/representer.d -->
|
||||
<p>YAML node representer. Prepares YAML nodes for output. A tutorial can be
|
||||
found <a href="../tutorials/custom_types.html">here</a>.
|
||||
</p>
|
||||
<p>Code based on <a href="http://www.pyyaml.org">PyYAML</a>.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="RepresenterException"></a>class <a name="RepresenterException"></a><span class="ddoc_psymbol">RepresenterException</span>: <u>dyaml.exception.YAMLException</u>;
|
||||
</dt>
|
||||
<dd><p>Exception thrown on Representer errors.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Representer"></a>class <a name="Representer"></a><span class="ddoc_psymbol">Representer</span>;
|
||||
</dt>
|
||||
<dd><p>Represents YAML nodes as scalar, sequence and mapping nodes ready for output.
|
||||
</p>
|
||||
<p>This class is used to add support for dumping of custom data types.
|
||||
<br>
|
||||
|
||||
It can also override default node formatting styles for output.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="Representer.this"></a>pure @safe this(const Flag!"<b>useDefaultRepresenters</b>" <b>useDefaultRepresenters</b> = Yes.<b>useDefaultRepresenters</b>);
|
||||
</dt>
|
||||
<dd><p>Construct a Representer.
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>Flag!"<b>useDefaultRepresenters</b>" <b>useDefaultRepresenters</b></td>
|
||||
<td valign=top>Use default representer functions
|
||||
for default YAML types? This can be
|
||||
disabled to use custom representer
|
||||
functions for default types.</td></tr>
|
||||
</table></div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Representer.defaultScalarStyle"></a>pure nothrow @property @safe void <a name="defaultScalarStyle"></a><span class="ddoc_psymbol">defaultScalarStyle</span>(ScalarStyle <b>style</b>);
|
||||
</dt>
|
||||
<dd><p>Set default style for scalars. If <b>style</b> is <span class="d_inlinecode">ScalarStyle.Invalid</span>, the style is chosen automatically.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Representer.defaultCollectionStyle"></a>pure nothrow @property @safe void <a name="defaultCollectionStyle"></a><span class="ddoc_psymbol">defaultCollectionStyle</span>(CollectionStyle <b>style</b>);
|
||||
</dt>
|
||||
<dd><p>Set default style for collections. If <b>style</b> is <span class="d_inlinecode">CollectionStyle.Invalid</span>, the style is chosen automatically.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Representer.addRepresenter"></a>pure @trusted void <a name="addRepresenter"></a><span class="ddoc_psymbol">addRepresenter</span>(T)(Node function(ref Node, Representer) <b>representer</b>);
|
||||
</dt>
|
||||
<dd><p>Add a function to represent nodes with a specific data type.
|
||||
</p>
|
||||
<p>The representer function takes references to a <span class="d_inlinecode">Node</span> storing the data
|
||||
type and to the <span class="d_inlinecode">Representer</span>. It returns the represented node and may
|
||||
throw a <span class="d_inlinecode">RepresenterException</span>. See the example for more information.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
Only one function may be specified for one data type. Default data
|
||||
types already have representer functions unless disabled in the
|
||||
<span class="d_inlinecode">Representer</span> constructor.
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
||||
Structs and classes must implement the <span class="d_inlinecode">opCmp()</span> operator for D:YAML
|
||||
support. The signature of the operator that must be implemented
|
||||
is <span class="d_inlinecode">const int opCmp(ref const MyStruct s)</span> for structs where
|
||||
<i>MyStruct</i> is the struct type, and <span class="d_inlinecode">int opCmp(Object o)</span> for
|
||||
classes. Note that the class <span class="d_inlinecode">opCmp()</span> should not alter the compared
|
||||
values - it is not const for compatibility reasons.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>Node function(ref Node, Representer) representer</td>
|
||||
<td valign=top>Representer function to add.</td></tr>
|
||||
</table></div>
|
||||
<b>Examples:</b><div class="pbr"> Representing a simple struct:
|
||||
<pre class="d_code"><span class="d_keyword">import</span> std.string;
|
||||
|
||||
<span class="d_keyword">import</span> dyaml.all;
|
||||
|
||||
<span class="d_keyword">struct</span> MyStruct
|
||||
{
|
||||
<span class="d_keyword">int</span> x, y, z;
|
||||
|
||||
<span class="d_comment">//Any D:YAML type must have a custom opCmp operator.
|
||||
</span> <span class="d_comment">//This is used for ordering in mappings.
|
||||
</span> <span class="d_keyword">const</span> <span class="d_keyword">int</span> opCmp(<span class="d_keyword">ref</span> <span class="d_keyword">const</span> MyStruct s)
|
||||
{
|
||||
<span class="d_keyword">if</span>(x != s.x){<span class="d_keyword">return</span> x - s.x;}
|
||||
<span class="d_keyword">if</span>(y != s.y){<span class="d_keyword">return</span> y - s.y;}
|
||||
<span class="d_keyword">if</span>(z != s.z){<span class="d_keyword">return</span> z - s.z;}
|
||||
<span class="d_keyword">return</span> 0;
|
||||
}
|
||||
}
|
||||
|
||||
Node representMyStruct(<span class="d_keyword">ref</span> Node node, Representer representer)
|
||||
{
|
||||
<span class="d_comment">//The node is guaranteed to be MyStruct as we add representer for MyStruct.
|
||||
</span> <span class="d_keyword">auto</span> value = node.as!MyStruct;
|
||||
<span class="d_comment">//Using custom scalar format, x:y:z.
|
||||
</span> <span class="d_keyword">auto</span> scalar = format(<span class="d_string">"%s:%s:%s"</span>, value.x, value.y, value.z);
|
||||
<span class="d_comment">//Representing as a scalar, with custom tag to specify this data type.
|
||||
</span> <span class="d_keyword">return</span> representer.representScalar(<span class="d_string">"!mystruct.tag"</span>, scalar);
|
||||
}
|
||||
|
||||
<span class="d_keyword">void</span> main()
|
||||
{
|
||||
<span class="d_keyword">auto</span> dumper = Dumper(<span class="d_string">"file.yaml"</span>);
|
||||
<span class="d_keyword">auto</span> representer = <span class="d_keyword">new</span> Representer;
|
||||
representer.<span class="d_psymbol">addRepresenter</span>!MyStruct(&representMyStruct);
|
||||
dumper.representer = representer;
|
||||
dumper.dump(Node(MyStruct(1,2,3)));
|
||||
}
|
||||
</pre>
|
||||
<br>
|
||||
|
||||
Representing a class:
|
||||
<pre class="d_code"><span class="d_keyword">import</span> std.string;
|
||||
|
||||
<span class="d_keyword">import</span> dyaml.all;
|
||||
|
||||
<span class="d_keyword">class</span> MyClass
|
||||
{
|
||||
<span class="d_keyword">int</span> x, y, z;
|
||||
|
||||
<span class="d_keyword">this</span>(<span class="d_keyword">int</span> x, <span class="d_keyword">int</span> y, <span class="d_keyword">int</span> z)
|
||||
{
|
||||
<span class="d_keyword">this</span>.x = x;
|
||||
<span class="d_keyword">this</span>.y = y;
|
||||
<span class="d_keyword">this</span>.z = z;
|
||||
}
|
||||
|
||||
<span class="d_comment">//Any D:YAML type must have a custom opCmp operator.
|
||||
</span> <span class="d_comment">//This is used for ordering in mappings.
|
||||
</span> <span class="d_keyword">override</span> <span class="d_keyword">int</span> opCmp(Object o)
|
||||
{
|
||||
MyClass s = <span class="d_keyword">cast</span>(MyClass)o;
|
||||
<span class="d_keyword">if</span>(s <span class="d_keyword">is</span> <span class="d_keyword">null</span>){<span class="d_keyword">return</span> -1;}
|
||||
<span class="d_keyword">if</span>(x != s.x){<span class="d_keyword">return</span> x - s.x;}
|
||||
<span class="d_keyword">if</span>(y != s.y){<span class="d_keyword">return</span> y - s.y;}
|
||||
<span class="d_keyword">if</span>(z != s.z){<span class="d_keyword">return</span> z - s.z;}
|
||||
<span class="d_keyword">return</span> 0;
|
||||
}
|
||||
|
||||
<span class="d_comment">///Useful for Node.as!string .
|
||||
</span> <span class="d_keyword">override</span> string toString()
|
||||
{
|
||||
<span class="d_keyword">return</span> format(<span class="d_string">"MyClass(%s, %s, %s)"</span>, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
<span class="d_comment">//Same as representMyStruct.
|
||||
</span>Node representMyClass(<span class="d_keyword">ref</span> Node node, Representer representer)
|
||||
{
|
||||
<span class="d_comment">//The node is guaranteed to be MyClass as we add representer for MyClass.
|
||||
</span> <span class="d_keyword">auto</span> value = node.as!MyClass;
|
||||
<span class="d_comment">//Using custom scalar format, x:y:z.
|
||||
</span> <span class="d_keyword">auto</span> scalar = format(<span class="d_string">"%s:%s:%s"</span>, value.x, value.y, value.z);
|
||||
<span class="d_comment">//Representing as a scalar, with custom tag to specify this data type.
|
||||
</span> <span class="d_keyword">return</span> representer.representScalar(<span class="d_string">"!myclass.tag"</span>, scalar);
|
||||
}
|
||||
|
||||
<span class="d_keyword">void</span> main()
|
||||
{
|
||||
<span class="d_keyword">auto</span> dumper = Dumper(<span class="d_string">"file.yaml"</span>);
|
||||
<span class="d_keyword">auto</span> representer = <span class="d_keyword">new</span> Representer;
|
||||
representer.<span class="d_psymbol">addRepresenter</span>!MyClass(&representMyClass);
|
||||
dumper.representer = representer;
|
||||
dumper.dump(Node(<span class="d_keyword">new</span> MyClass(1,2,3)));
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Representer.representScalar"></a>@safe Node <a name="representScalar"></a><span class="ddoc_psymbol">representScalar</span>(string <b>tag</b>, string <b>scalar</b>, ScalarStyle <b>style</b> = ScalarStyle.Invalid);
|
||||
</dt>
|
||||
<dd><p>Represent a scalar with specified tag.
|
||||
</p>
|
||||
<p>This is used by representer functions that produce scalars.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>string <b>tag</b></td>
|
||||
<td valign=top>Tag of the scalar.</td></tr>
|
||||
<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 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.
|
||||
|
||||
</div>
|
||||
<p><b>Example:</b><br>
|
||||
<pre class="d_code"><span class="d_keyword">struct</span> MyStruct
|
||||
{
|
||||
<span class="d_keyword">int</span> x, y, z;
|
||||
|
||||
<span class="d_comment">//Any D:YAML type must have a custom opCmp operator.
|
||||
</span> <span class="d_comment">//This is used for ordering in mappings.
|
||||
</span> <span class="d_keyword">const</span> <span class="d_keyword">int</span> opCmp(<span class="d_keyword">ref</span> <span class="d_keyword">const</span> MyStruct s)
|
||||
{
|
||||
<span class="d_keyword">if</span>(x != s.x){<span class="d_keyword">return</span> x - s.x;}
|
||||
<span class="d_keyword">if</span>(y != s.y){<span class="d_keyword">return</span> y - s.y;}
|
||||
<span class="d_keyword">if</span>(z != s.z){<span class="d_keyword">return</span> z - s.z;}
|
||||
<span class="d_keyword">return</span> 0;
|
||||
}
|
||||
}
|
||||
|
||||
Node representMyStruct(<span class="d_keyword">ref</span> Node node, Representer representer)
|
||||
{
|
||||
<span class="d_keyword">auto</span> value = node.as!MyStruct;
|
||||
<span class="d_keyword">auto</span> <span class="d_param">scalar</span> = format(<span class="d_string">"%s:%s:%s"</span>, value.x, value.y, 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>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Representer.representSequence"></a>@trusted Node <a name="representSequence"></a><span class="ddoc_psymbol">representSequence</span>(string <b>tag</b>, Node[] <b>sequence</b>, CollectionStyle <b>style</b> = CollectionStyle.Invalid);
|
||||
</dt>
|
||||
<dd><p>Represent a sequence with specified tag, representing children first.
|
||||
</p>
|
||||
<p>This is used by representer functions that produce sequences.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>string <b>tag</b></td>
|
||||
<td valign=top>Tag of the sequence.</td></tr>
|
||||
<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 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.
|
||||
|
||||
</div>
|
||||
<b>Throws:</b><div class="pbr"><span class="d_inlinecode">RepresenterException</span> if a child could not be represented.
|
||||
|
||||
</div>
|
||||
<p><b>Example:</b><br>
|
||||
<pre class="d_code"><span class="d_keyword">struct</span> MyStruct
|
||||
{
|
||||
<span class="d_keyword">int</span> x, y, z;
|
||||
|
||||
<span class="d_comment">//Any D:YAML type must have a custom opCmp operator.
|
||||
</span> <span class="d_comment">//This is used for ordering in mappings.
|
||||
</span> <span class="d_keyword">const</span> <span class="d_keyword">int</span> opCmp(<span class="d_keyword">ref</span> <span class="d_keyword">const</span> MyStruct s)
|
||||
{
|
||||
<span class="d_keyword">if</span>(x != s.x){<span class="d_keyword">return</span> x - s.x;}
|
||||
<span class="d_keyword">if</span>(y != s.y){<span class="d_keyword">return</span> y - s.y;}
|
||||
<span class="d_keyword">if</span>(z != s.z){<span class="d_keyword">return</span> z - s.z;}
|
||||
<span class="d_keyword">return</span> 0;
|
||||
}
|
||||
}
|
||||
|
||||
Node representMyStruct(<span class="d_keyword">ref</span> Node node, Representer representer)
|
||||
{
|
||||
<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_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>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Representer.representMapping"></a>@trusted Node <a name="representMapping"></a><span class="ddoc_psymbol">representMapping</span>(string <b>tag</b>, Node.Pair[] <b>pairs</b>, CollectionStyle <b>style</b> = CollectionStyle.Invalid);
|
||||
</dt>
|
||||
<dd><p>Represent a mapping with specified tag, representing children first.
|
||||
</p>
|
||||
<p>This is used by representer functions that produce mappings.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>string <b>tag</b></td>
|
||||
<td valign=top>Tag of the mapping.</td></tr>
|
||||
<tr><td valign=top>Node.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. 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.
|
||||
|
||||
</div>
|
||||
<b>Throws:</b><div class="pbr"><span class="d_inlinecode">RepresenterException</span> if a child could not be represented.
|
||||
|
||||
</div>
|
||||
<p><b>Example:</b><br>
|
||||
<pre class="d_code"><span class="d_keyword">struct</span> MyStruct
|
||||
{
|
||||
<span class="d_keyword">int</span> x, y, z;
|
||||
|
||||
<span class="d_comment">//Any D:YAML type must have a custom opCmp operator.
|
||||
</span> <span class="d_comment">//This is used for ordering in mappings.
|
||||
</span> <span class="d_keyword">const</span> <span class="d_keyword">int</span> opCmp(<span class="d_keyword">ref</span> <span class="d_keyword">const</span> MyStruct s)
|
||||
{
|
||||
<span class="d_keyword">if</span>(x != s.x){<span class="d_keyword">return</span> x - s.x;}
|
||||
<span class="d_keyword">if</span>(y != s.y){<span class="d_keyword">return</span> y - s.y;}
|
||||
<span class="d_keyword">if</span>(z != s.z){<span class="d_keyword">return</span> z - s.z;}
|
||||
<span class="d_keyword">return</span> 0;
|
||||
}
|
||||
}
|
||||
|
||||
Node representMyStruct(<span class="d_keyword">ref</span> Node node, Representer representer)
|
||||
{
|
||||
<span class="d_keyword">auto</span> value = node.as!MyStruct;
|
||||
<span class="d_keyword">auto</span> <span class="d_param">pairs</span> = [Node.Pair(<span class="d_string">"x"</span>, value.x),
|
||||
Node.Pair(<span class="d_string">"y"</span>, value.y),
|
||||
Node.Pair(<span class="d_string">"z"</span>, value.z)];
|
||||
<span class="d_keyword">return</span> representer.<span class="d_psymbol">representMapping</span>(<span class="d_string">"!mystruct.tag"</span>, <span class="d_param">pairs</span>);
|
||||
}
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="representNull"></a>@safe Node <a name="representNull"></a><span class="ddoc_psymbol">representNull</span>(ref Node <b>node</b>, Representer <b>representer</b>);
|
||||
</dt>
|
||||
<dd><p>Represent a null node as a null YAML value.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="representString"></a>@safe Node <a name="representString"></a><span class="ddoc_psymbol">representString</span>(ref Node <b>node</b>, Representer <b>representer</b>);
|
||||
</dt>
|
||||
<dd><p>Represent a string node as a string scalar.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="representBytes"></a>@system Node <a name="representBytes"></a><span class="ddoc_psymbol">representBytes</span>(ref Node <b>node</b>, Representer <b>representer</b>);
|
||||
</dt>
|
||||
<dd><p>Represent a bytes node as a binary scalar.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="representBool"></a>@safe Node <a name="representBool"></a><span class="ddoc_psymbol">representBool</span>(ref Node <b>node</b>, Representer <b>representer</b>);
|
||||
</dt>
|
||||
<dd><p>Represent a bool node as a bool scalar.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="representLong"></a>@system Node <a name="representLong"></a><span class="ddoc_psymbol">representLong</span>(ref Node <b>node</b>, Representer <b>representer</b>);
|
||||
</dt>
|
||||
<dd><p>Represent a long node as an integer scalar.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="representReal"></a>@system Node <a name="representReal"></a><span class="ddoc_psymbol">representReal</span>(ref Node <b>node</b>, Representer <b>representer</b>);
|
||||
</dt>
|
||||
<dd><p>Represent a real node as a floating point scalar.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="representSysTime"></a>@system Node <a name="representSysTime"></a><span class="ddoc_psymbol">representSysTime</span>(ref Node <b>node</b>, Representer <b>representer</b>);
|
||||
</dt>
|
||||
<dd><p>Represent a SysTime node as a timestamp.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="representNodes"></a>@safe Node <a name="representNodes"></a><span class="ddoc_psymbol">representNodes</span>(ref Node <b>node</b>, Representer <b>representer</b>);
|
||||
</dt>
|
||||
<dd><p>Represent a sequence node as sequence/set.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="representPairs"></a>@system Node <a name="representPairs"></a><span class="ddoc_psymbol">representPairs</span>(ref Node <b>node</b>, Representer <b>representer</b>);
|
||||
</dt>
|
||||
<dd><p>Represent a mapping node as map/ordered map/pairs.</p>
|
||||
|
||||
</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>
|
|
@ -1,140 +0,0 @@
|
|||
<!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.resolver - 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.resolver</h1>
|
||||
<!-- Generated by Ddoc from dyaml/resolver.d -->
|
||||
<p>Implements a class that resolves YAML tags. This can be used to implicitly
|
||||
resolve tags for custom data types, removing the need to explicitly
|
||||
specify tags in YAML. A tutorial can be found
|
||||
<a href="../tutorials/custom_types.html">here</a>.
|
||||
</p>
|
||||
<p>Code based on <a href="http://www.pyyaml.org">PyYAML</a>.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="Resolver"></a>class <a name="Resolver"></a><span class="ddoc_psymbol">Resolver</span>;
|
||||
</dt>
|
||||
<dd><p>Resolves YAML tags (data types).
|
||||
</p>
|
||||
<p>Can be used to implicitly resolve custom data types of scalar values.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="Resolver.this"></a>@safe this(Flag!"useDefaultImplicitResolvers" <b>defaultImplicitResolvers</b> = Yes.useDefaultImplicitResolvers);
|
||||
</dt>
|
||||
<dd><p>Construct a Resolver.
|
||||
</p>
|
||||
<p>If you don't want to implicitly resolve default YAML tags/data types,
|
||||
you can use <b>defaultImplicitResolvers</b> to disable default resolvers.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>Flag!"useDefaultImplicitResolvers" <b>defaultImplicitResolvers</b></td>
|
||||
<td valign=top>Use default YAML implicit resolvers?</td></tr>
|
||||
</table></div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Resolver.addImplicitResolver"></a>pure @safe void <a name="addImplicitResolver"></a><span class="ddoc_psymbol">addImplicitResolver</span>(string <b>tag</b>, Regex!char <b>regexp</b>, string <b>first</b>);
|
||||
</dt>
|
||||
<dd><p>Add an implicit scalar resolver.
|
||||
</p>
|
||||
<p>If a scalar matches <b>regexp</b> and starts with any character in <b>first</b>,
|
||||
its tag is set to <b>tag</b>. If it matches more than one resolver regexp
|
||||
resolvers added first override ones added later. Default resolvers
|
||||
override any user specified resolvers, but they can be disabled in
|
||||
Resolver constructor.
|
||||
<br>
|
||||
|
||||
If a scalar is not resolved to anything, it is assigned the default
|
||||
YAML tag for strings.
|
||||
|
||||
</p>
|
||||
<b>Parameters:</b><div class="pbr"><table class=parms><tr><td valign=top>string <b>tag</b></td>
|
||||
<td valign=top>Tag to resolve to.</td></tr>
|
||||
<tr><td valign=top>Regex!char <b>regexp</b></td>
|
||||
<td valign=top>Regular expression the scalar must match to have this tag.</td></tr>
|
||||
<tr><td valign=top>string <b>first</b></td>
|
||||
<td valign=top>String of possible starting characters of the scalar.</td></tr>
|
||||
</table></div>
|
||||
<b>Examples:</b><div class="pbr"> Resolve scalars starting with 'A' to !tag :
|
||||
<pre class="d_code"><span class="d_keyword">import</span> std.regex;
|
||||
|
||||
<span class="d_keyword">import</span> dyaml.all;
|
||||
|
||||
<span class="d_keyword">void</span> main()
|
||||
{
|
||||
<span class="d_keyword">auto</span> loader = Loader(<span class="d_string">"file.txt"</span>);
|
||||
<span class="d_keyword">auto</span> resolver = <span class="d_keyword">new</span> Resolver();
|
||||
resolver.<span class="d_psymbol">addImplicitResolver</span>(<span class="d_string">"!tag"</span>, std.regex.regex(<span class="d_string">"A.*"</span>), <span class="d_string">"A"</span>);
|
||||
loader.resolver = resolver;
|
||||
|
||||
<span class="d_comment">//Note that we have no constructor from tag "!tag", so we can't
|
||||
</span> <span class="d_comment">//actually load anything that resolves to this tag.
|
||||
</span> <span class="d_comment">//See Constructor API documentation and tutorial for more information.
|
||||
</span>
|
||||
<span class="d_keyword">auto</span> node = loader.load();
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Resolver.defaultScalarTag"></a>package const pure nothrow @property @safe Tag <a name="defaultScalarTag"></a><span class="ddoc_psymbol">defaultScalarTag</span>();
|
||||
</dt>
|
||||
<dd><p>Return default scalar tag.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Resolver.defaultSequenceTag"></a>package const pure nothrow @property @safe Tag <a name="defaultSequenceTag"></a><span class="ddoc_psymbol">defaultSequenceTag</span>();
|
||||
</dt>
|
||||
<dd><p>Return default sequence tag.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="Resolver.defaultMappingTag"></a>package const pure nothrow @property @safe Tag <a name="defaultMappingTag"></a><span class="ddoc_psymbol">defaultMappingTag</span>();
|
||||
</dt>
|
||||
<dd><p>Return default mapping tag.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</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>
|
|
@ -1,103 +0,0 @@
|
|||
<!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.style - 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.style</h1>
|
||||
<!-- Generated by Ddoc from dyaml/style.d -->
|
||||
<p>YAML node formatting styles.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="ScalarStyle"></a>enum <a name="ScalarStyle"></a><span class="ddoc_psymbol">ScalarStyle</span>: ubyte;
|
||||
</dt>
|
||||
<dd><p>Scalar styles.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="ScalarStyle.Invalid"></a><a name="Invalid"></a><span class="ddoc_psymbol">Invalid</span></dt>
|
||||
<dd><p><a name="Invalid"></a><span class="ddoc_psymbol">Invalid</span> (uninitialized) style</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="ScalarStyle.Literal"></a><a name="Literal"></a><span class="ddoc_psymbol">Literal</span></dt>
|
||||
<dd><p>| (<a name="Literal"></a><span class="ddoc_psymbol">Literal</span> block style)</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="ScalarStyle.Folded"></a><a name="Folded"></a><span class="ddoc_psymbol">Folded</span></dt>
|
||||
<dd><p>> (<a name="Folded"></a><span class="ddoc_psymbol">Folded</span> block style)</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="ScalarStyle.Plain"></a><a name="Plain"></a><span class="ddoc_psymbol">Plain</span></dt>
|
||||
<dd><p><a name="Plain"></a><span class="ddoc_psymbol">Plain</span> scalar</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="ScalarStyle.SingleQuoted"></a><a name="SingleQuoted"></a><span class="ddoc_psymbol">SingleQuoted</span></dt>
|
||||
<dd><p>Single quoted scalar</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="ScalarStyle.DoubleQuoted"></a><a name="DoubleQuoted"></a><span class="ddoc_psymbol">DoubleQuoted</span></dt>
|
||||
<dd><p>Double quoted scalar</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="CollectionStyle"></a>enum <a name="CollectionStyle"></a><span class="ddoc_psymbol">CollectionStyle</span>: ubyte;
|
||||
</dt>
|
||||
<dd><p>Collection styles.</p>
|
||||
|
||||
<dl><dt class="d_decl"><a name="CollectionStyle.Invalid"></a><a name="Invalid"></a><span class="ddoc_psymbol">Invalid</span></dt>
|
||||
<dd><p><a name="Invalid"></a><span class="ddoc_psymbol">Invalid</span> (uninitialized) style</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="CollectionStyle.Block"></a><a name="Block"></a><span class="ddoc_psymbol">Block</span></dt>
|
||||
<dd><p><a name="Block"></a><span class="ddoc_psymbol">Block</span> style.</p>
|
||||
|
||||
</dd>
|
||||
<dt class="d_decl"><a name="CollectionStyle.Flow"></a><a name="Flow"></a><span class="ddoc_psymbol">Flow</span></dt>
|
||||
<dd><p><a name="Flow"></a><span class="ddoc_psymbol">Flow</span> style.</p>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
</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>
|
189
doc/html/api/dyaml/constructor.html
Normal file
189
doc/html/api/dyaml/constructor.html
Normal file
|
@ -0,0 +1,189 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css"/>
|
||||
<script src="../highlight.pack.js"></script>
|
||||
<title>dyaml.constructor</title>
|
||||
<base href="../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.constructor</small>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/constructor.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/constructor.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/constructor.html">constructor</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><a class="anchor" id="constructNull"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/YAMLNull.html">YAMLNull</a> <a href="dyaml/constructor.html#constructNull">constructNull</a>(ref <a href="dyaml/node/Node.html">Node</a> node) @safe pure nothrow @nogc
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a _null _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructMerge"></a><div class="symbol"><div class="description"><pre><code>public YAMLMerge <a href="dyaml/constructor.html#constructMerge">constructMerge</a>(ref <a href="dyaml/node/Node.html">Node</a> node) @safe pure nothrow @nogc
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a merge _node - a _node that merges another _node into a mapping.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructBool"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">bool</a> <a href="dyaml/constructor.html#constructBool">constructBool</a>(ref <a href="dyaml/node/Node.html">Node</a> node) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a boolean _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructLong"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">long</a> <a href="dyaml/constructor.html#constructLong">constructLong</a>(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct an integer (long) _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructReal"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">real</a> <a href="dyaml/constructor.html#constructReal">constructReal</a>(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a floating point (real) _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructBinary"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">ubyte</a>[] <a href="dyaml/constructor.html#constructBinary">constructBinary</a>(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a binary (base64) _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructTimestamp"></a><div class="symbol"><div class="description"><pre><code>public SysTime <a href="dyaml/constructor.html#constructTimestamp">constructTimestamp</a>(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a timestamp (SysTime) _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructString"></a><div class="symbol"><div class="description"><pre><code>public string <a href="dyaml/constructor.html#constructString">constructString</a>(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a string _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="getPairs"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a>.Pair[] <a href="dyaml/constructor.html#getPairs">getPairs</a>(
|
||||
string type,
|
||||
<a href="dyaml/node/Node.html">Node</a>[] nodes)
|
||||
</code></pre>
|
||||
<div class="section "><p>Convert a sequence of single-element mappings into a sequence of pairs.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructOrderedMap"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a>.Pair[] <a href="dyaml/constructor.html#constructOrderedMap">constructOrderedMap</a>(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct an ordered map (ordered sequence of key:value pairs without duplicates) _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructPairs"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a>.Pair[] <a href="dyaml/constructor.html#constructPairs">constructPairs</a>(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a pairs (ordered sequence of key: value pairs allowing duplicates) _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructSet"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a>[] <a href="dyaml/constructor.html#constructSet">constructSet</a>(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a set _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructSequence"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a>[] <a href="dyaml/constructor.html#constructSequence">constructSequence</a>(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a sequence (array) _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructMap"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a>.Pair[] <a href="dyaml/constructor.html#constructMap">constructMap</a>(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct an unordered map (unordered set of key:value _pairs without duplicates) _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><div class="description"><div class="section "><p>Class that processes YAML mappings, sequences and scalars into nodes. This can be
|
||||
used to add custom data types. A tutorial can be found
|
||||
<a href="../tutorials/custom_types.html">here</a>.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Functions</h2><table><tr><td><a href="dyaml/constructor.html#constructNull">constructNull</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span>, <span class="attr-pure">pure</span>, <span class="attr-nothrow">nothrow</span>, <span class="attr-nogc">@nogc</span></span></span></td><td></td><td><p>Construct a _null _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructMerge">constructMerge</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span>, <span class="attr-pure">pure</span>, <span class="attr-nothrow">nothrow</span>, <span class="attr-nogc">@nogc</span></span></span></td><td></td><td><p>Construct a merge _node - a _node that merges another _node into a mapping.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructBool">constructBool</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Construct a boolean _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructLong">constructLong</a><span class="extrainfo"></span></td><td></td><td><p>Construct an integer (long) _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructReal">constructReal</a><span class="extrainfo"></span></td><td></td><td><p>Construct a floating point (real) _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructBinary">constructBinary</a><span class="extrainfo"></span></td><td></td><td><p>Construct a binary (base64) _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructTimestamp">constructTimestamp</a><span class="extrainfo"></span></td><td></td><td><p>Construct a timestamp (SysTime) _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructString">constructString</a><span class="extrainfo"></span></td><td></td><td><p>Construct a string _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#getPairs">getPairs</a><span class="extrainfo"></span></td><td></td><td><p>Convert a sequence of single-element mappings into a sequence of pairs.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructOrderedMap">constructOrderedMap</a><span class="extrainfo"></span></td><td></td><td><p>Construct an ordered map (ordered sequence of key:value pairs without duplicates) _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructPairs">constructPairs</a><span class="extrainfo"></span></td><td></td><td><p>Construct a pairs (ordered sequence of key: value pairs allowing duplicates) _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructSet">constructSet</a><span class="extrainfo"></span></td><td></td><td><p>Construct a set _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructSequence">constructSequence</a><span class="extrainfo"></span></td><td></td><td><p>Construct a sequence (array) _node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor.html#constructMap">constructMap</a><span class="extrainfo"></span></td><td></td><td><p>Construct an unordered map (unordered set of key:value _pairs without duplicates) _node.
|
||||
</p>
|
||||
</td></tr></table><h2>Classes</h2><table><tr><td><a href="dyaml/constructor/Constructor.html">Constructor</a></td><td></td><td><p>Constructs YAML values.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
291
doc/html/api/dyaml/constructor/Constructor.html
Normal file
291
doc/html/api/dyaml/constructor/Constructor.html
Normal file
|
@ -0,0 +1,291 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>Constructor</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/constructor.html>constructor</a>.</small><span class="highlight">Constructor</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/constructor.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/constructor.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/constructor.html">constructor</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public final class Constructor
|
||||
</code></pre>
|
||||
<div class="section "><p>Constructs YAML values.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Each YAML scalar, sequence or mapping has a tag specifying its data type.
|
||||
Constructor uses user-specifyable functions to create a node of desired
|
||||
data type from a scalar, sequence or mapping.
|
||||
</p>
|
||||
<p> Each of these functions is associated with a tag, and can process either
|
||||
a scalar, a sequence, or a mapping. The constructor passes each value to
|
||||
the function with corresponding tag, which then returns the resulting value
|
||||
that can be stored in a node.
|
||||
</p>
|
||||
<p> If a tag is detected with no known constructor function, it is considered an error.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(const Flag!"useDefaultConstructors" defaultConstructors = Yes.useDefaultConstructors) @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a Constructor.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>/// If you don't want to support default YAML tags/data types, you can use
|
||||
defaultConstructors to disable constructor functions for these.
|
||||
</p>
|
||||
<p>/// Params: defaultConstructors = Use constructors for default YAML tags?
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="addConstructorScalar"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/constructor/Constructor.html#addConstructorScalar">addConstructorScalar</a>(T)(
|
||||
const string tag,
|
||||
T function(ref <a href="dyaml/node/Node.html">Node</a>) ctor) @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Add a constructor function from scalar.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>The function must take a reference to <code class="d_inlinecode">Node</code> to construct from.
|
||||
The node contains a string for scalars, <code class="d_inlinecode">Node[]</code> for sequences and
|
||||
<code class="d_inlinecode">Node.Pair[]</code> for mappings.
|
||||
</p>
|
||||
<p> Any exception thrown by this function will be caught by D:YAML and
|
||||
its message will be added to a <code class="d_inlinecode">YAMLException</code> that will also tell
|
||||
the user which type failed to construct, and position in the file.
|
||||
</p>
|
||||
<p> The value returned by this function will be stored in the resulting node.
|
||||
</p>
|
||||
<p> Only one constructor function can be set for one tag.
|
||||
</p>
|
||||
<p> Structs and classes must implement the <code class="d_inlinecode">opCmp()</code> operator for D:YAML
|
||||
support. The signature of the operator that must be implemented
|
||||
is <code class="d_inlinecode">const int opCmp(ref const MyStruct s)</code> for structs where
|
||||
<i>MyStruct</i> is the struct type, and <code class="d_inlinecode">int opCmp(Object o)</code> for
|
||||
classes. Note that the class <code class="d_inlinecode">opCmp()</code> should not alter the compared
|
||||
values - it is not const for compatibility reasons.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">tag</td><td class="paramDoc"><p>Tag for the function to handle.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">ctor</td><td class="paramDoc"><p>Constructor function.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Example</h2>
|
||||
|
||||
|
||||
<pre><code> import std.string;
|
||||
|
||||
import dyaml.all;
|
||||
|
||||
struct MyStruct
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
//Any D:YAML type must have a custom opCmp operator.
|
||||
//This is used for ordering in mappings.
|
||||
const int opCmp(ref const MyStruct s)
|
||||
{
|
||||
if(x != s.x){return x - s.x;}
|
||||
if(y != s.y){return y - s.y;}
|
||||
if(z != s.z){return z - s.z;}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
MyStruct constructMyStructScalar(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
{
|
||||
//Guaranteed to be string as we construct from scalar.
|
||||
//!mystruct x:y:z
|
||||
auto parts = node.as!string().split(":");
|
||||
// If <a href="dyaml/constructor/Constructor.html#this">this</a> throws, the D:YAML will handle it and throw a <a href="dyaml/exception/YAMLException.html">YAMLException</a>.
|
||||
return MyStruct(to!int(parts[0]), to!int(parts[1]), to!int(parts[2]));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
auto loader = <a href="dyaml/loader/Loader.html">Loader</a>("file.yaml");
|
||||
auto constructor = new <a href="dyaml/constructor/Constructor.html">Constructor</a>;
|
||||
constructor.<a href="dyaml/constructor/Constructor.html#addConstructorScalar">addConstructorScalar</a>("!mystruct", &constructMyStructScalar);
|
||||
loader.constructor = constructor;
|
||||
<a href="dyaml/node/Node.html">Node</a> node = loader.load();
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="addConstructorSequence"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/constructor/Constructor.html#addConstructorSequence">addConstructorSequence</a>(T)(
|
||||
const string tag,
|
||||
T function(ref <a href="dyaml/node/Node.html">Node</a>) ctor) @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Add a constructor function from sequence.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Example</h2>
|
||||
|
||||
|
||||
<pre><code> import std.string;
|
||||
|
||||
import dyaml.all;
|
||||
|
||||
struct MyStruct
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
//Any D:YAML type must have a custom opCmp operator.
|
||||
//This is used for ordering in mappings.
|
||||
const int opCmp(ref const MyStruct s)
|
||||
{
|
||||
if(x != s.x){return x - s.x;}
|
||||
if(y != s.y){return y - s.y;}
|
||||
if(z != s.z){return z - s.z;}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
MyStruct constructMyStructSequence(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
{
|
||||
//node is guaranteed to be sequence.
|
||||
//!mystruct [x, y, z]
|
||||
return MyStruct(node[0].as!int, node[1].as!int, node[2].as!int);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
auto loader = <a href="dyaml/loader/Loader.html">Loader</a>("file.yaml");
|
||||
auto constructor = new <a href="dyaml/constructor/Constructor.html">Constructor</a>;
|
||||
constructor.<a href="dyaml/constructor/Constructor.html#addConstructorSequence">addConstructorSequence</a>("!mystruct", &constructMyStructSequence);
|
||||
loader.constructor = constructor;
|
||||
<a href="dyaml/node/Node.html">Node</a> node = loader.load();
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="section seealso">
|
||||
<h2>See Also:</h2>
|
||||
<div class="seealso-content">
|
||||
<pre class="prettyprint"><code><a href="dyaml/constructor/Constructor.html#addConstructorScalar">addConstructorScalar</a>
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div></div><a class="anchor" id="addConstructorMapping"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/constructor/Constructor.html#addConstructorMapping">addConstructorMapping</a>(T)(
|
||||
const string tag,
|
||||
T function(ref <a href="dyaml/node/Node.html">Node</a>) ctor) @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Add a constructor function from a mapping.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Example</h2>
|
||||
|
||||
|
||||
<pre><code> import std.string;
|
||||
|
||||
import dyaml.all;
|
||||
|
||||
struct MyStruct
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
//Any D:YAML type must have a custom opCmp operator.
|
||||
//This is used for ordering in mappings.
|
||||
const int opCmp(ref const MyStruct s)
|
||||
{
|
||||
if(x != s.x){return x - s.x;}
|
||||
if(y != s.y){return y - s.y;}
|
||||
if(z != s.z){return z - s.z;}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
MyStruct constructMyStructMapping(ref <a href="dyaml/node/Node.html">Node</a> node)
|
||||
{
|
||||
//node is guaranteed to be mapping.
|
||||
//!mystruct {"x": x, "y": y, "z": z}
|
||||
return MyStruct(node["x"].as!int, node["y"].as!int, node["z"].as!int);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
auto loader = <a href="dyaml/loader/Loader.html">Loader</a>("file.yaml");
|
||||
auto constructor = new <a href="dyaml/constructor/Constructor.html">Constructor</a>;
|
||||
constructor.<a href="dyaml/constructor/Constructor.html#addConstructorMapping">addConstructorMapping</a>("!mystruct", &constructMyStructMapping);
|
||||
loader.constructor = constructor;
|
||||
<a href="dyaml/node/Node.html">Node</a> node = loader.load();
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="section seealso">
|
||||
<h2>See Also:</h2>
|
||||
<div class="seealso-content">
|
||||
<pre class="prettyprint"><code><a href="dyaml/constructor/Constructor.html#addConstructorScalar">addConstructorScalar</a>
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div></div><div class="section members"><h2>Functions</h2><table><tr><td><a href="dyaml/constructor/Constructor.html#this">this</a></td><td></td><td><p>Construct a Constructor.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor/Constructor.html#addConstructorScalar">addConstructorScalar</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Add a constructor function from scalar.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor/Constructor.html#addConstructorSequence">addConstructorSequence</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Add a constructor function from sequence.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/constructor/Constructor.html#addConstructorMapping">addConstructorMapping</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Add a constructor function from a mapping.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
64
doc/html/api/dyaml/dumper.html
Normal file
64
doc/html/api/dyaml/dumper.html
Normal file
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css"/>
|
||||
<script src="../highlight.pack.js"></script>
|
||||
<title>dyaml.dumper</title>
|
||||
<base href="../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.dumper</small>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/dumper.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/dumper.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/dumper.html">dumper</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><div class="section "><p>YAML dumper.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Code based on <a href="http://www.pyyaml.org">PyYAML</a>.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Structs</h2><table><tr><td><a href="dyaml/dumper/Dumper.html">Dumper</a></td><td></td><td><p>Dumps YAML documents to files or streams.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
319
doc/html/api/dyaml/dumper/Dumper.html
Normal file
319
doc/html/api/dyaml/dumper/Dumper.html
Normal file
|
@ -0,0 +1,319 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>Dumper</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/dumper.html>dumper</a>.</small><span class="highlight">Dumper</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/dumper.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/dumper.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/dumper.html">dumper</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public struct Dumper
|
||||
</code></pre>
|
||||
<div class="section "><p>Dumps YAML documents to files or streams.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>User specified Representer and/or Resolver can be used to support new
|
||||
tags / data types.
|
||||
</p>
|
||||
<p>Setters are provided to affect output details (style, encoding, etc.).
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Examples</h2>
|
||||
|
||||
|
||||
Write to a file:
|
||||
<pre><code>auto node = <a href="dyaml/node/Node.html">Node</a>([1, 2, 3, 4, 5]);
|
||||
<a href="dyaml/dumper/Dumper.html">Dumper</a>("file.yaml").<a href="dyaml/dumper/Dumper.html#dump">dump</a>(node);</code></pre>
|
||||
|
||||
Write multiple YAML documents to a file:
|
||||
<pre><code>auto node1 = <a href="dyaml/node/Node.html">Node</a>([1, 2, 3, 4, 5]);
|
||||
auto node2 = <a href="dyaml/node/Node.html">Node</a>("This document contains only one string");
|
||||
<a href="dyaml/dumper/Dumper.html">Dumper</a>("file.yaml").<a href="dyaml/dumper/Dumper.html#dump">dump</a>(node1, node2);
|
||||
|
||||
//Or with an array:
|
||||
//<a href="dyaml/dumper/Dumper.html">Dumper</a>("file.yaml").<a href="dyaml/dumper/Dumper.html#dump">dump</a>([node1, node2]);
|
||||
|
||||
</code></pre>
|
||||
|
||||
Write to memory:
|
||||
<pre><code>import std.stream;
|
||||
auto stream = new MemoryStream();
|
||||
auto node = <a href="dyaml/node/Node.html">Node</a>([1, 2, 3, 4, 5]);
|
||||
<a href="dyaml/dumper/Dumper.html">Dumper</a>(stream).<a href="dyaml/dumper/Dumper.html#dump">dump</a>(node);</code></pre>
|
||||
|
||||
Use a custom representer/resolver to support custom data types and/or implicit tags:
|
||||
<pre><code>auto node = <a href="dyaml/node/Node.html">Node</a>([1, 2, 3, 4, 5]);
|
||||
auto <a href="dyaml/dumper/Dumper.html#representer">representer</a> = new <a href="dyaml/representer/Representer.html">Representer</a>();
|
||||
auto <a href="dyaml/dumper/Dumper.html#resolver">resolver</a> = new <a href="dyaml/resolver/Resolver.html">Resolver</a>();
|
||||
|
||||
//Add <a href="dyaml/dumper/Dumper.html#representer">representer</a> functions / <a href="dyaml/dumper/Dumper.html#resolver">resolver</a> expressions here...
|
||||
|
||||
auto dumper = <a href="dyaml/dumper/Dumper.html">Dumper</a>("file.yaml");
|
||||
dumper.<a href="dyaml/dumper/Dumper.html#representer">representer</a> = <a href="dyaml/dumper/Dumper.html#representer">representer</a>;
|
||||
dumper.<a href="dyaml/dumper/Dumper.html#resolver">resolver</a> = <a href="dyaml/dumper/Dumper.html#resolver">resolver</a>;
|
||||
dumper.<a href="dyaml/dumper/Dumper.html#dump">dump</a>(node);</code></pre>
|
||||
|
||||
</div>
|
||||
</div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(string filename) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a Dumper writing to a file.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">filename</td><td class="paramDoc"><p>File name to write to.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> YAMLException if the file can not be dumped to (e.g. cannot be opened).
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(Stream stream) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a Dumper writing to a _stream. This is useful to e.g. write to memory.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="name"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#name">name</a>(string name) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Set stream _name. Used in debugging messages.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="resolver"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#resolver">resolver</a>(<a href="dyaml/resolver/Resolver.html">Resolver</a> resolver) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Specify custom Resolver to use.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representer"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#representer">representer</a>(<a href="dyaml/representer/Representer.html">Representer</a> representer) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Specify custom Representer to use.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="canonical"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#canonical">canonical</a>(<a href="http://dlang.org/type.html#basic-data-types">bool</a> canonical) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Write scalars in _canonical form?
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="indent"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#indent">indent</a>(<a href="http://dlang.org/type.html#basic-data-types">uint</a> indent) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Set indentation width. 2 by default. Must not be zero.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section "><h2>Contracts</h2><pre><code>in
|
||||
{
|
||||
assert (<a href="dyaml/dumper/Dumper.html#indent">indent</a> != 0, "Can't use zero YAML <a href="dyaml/dumper/Dumper.html#indent">indent</a> width");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="textWidth"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#textWidth">textWidth</a>(<a href="http://dlang.org/type.html#basic-data-types">uint</a> width) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Set preferred text _width.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="lineBreak"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#lineBreak">lineBreak</a>(<a href="dyaml/linebreak/LineBreak.html">LineBreak</a> lineBreak) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Set line break to use. Unix by default.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="encoding"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#encoding">encoding</a>(Encoding encoding) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Set character _encoding to use. UTF-8 by default.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="explicitStart"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#explicitStart">explicitStart</a>(<a href="http://dlang.org/type.html#basic-data-types">bool</a> explicit) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Always explicitly write document start?
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="explicitEnd"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#explicitEnd">explicitEnd</a>(<a href="http://dlang.org/type.html#basic-data-types">bool</a> explicit) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Always explicitly write document end?
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="YAMLVersion"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#YAMLVersion">YAMLVersion</a>(string YAMLVersion) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Specify YAML version string. "1.1" by default.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="tagDirectives"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#tagDirectives">tagDirectives</a>(string[string] tags) pure @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Specify tag directives.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>A tag directive specifies a shorthand notation for specifying _tags.
|
||||
Each tag directive associates a handle with a prefix. This allows for
|
||||
compact tag notation.
|
||||
</p>
|
||||
<p>Each handle specified MUST start and end with a '!' character
|
||||
(a single character "!" handle is allowed as well).
|
||||
</p>
|
||||
<p>Only alphanumeric characters, '-', and '__' may be used in handles.
|
||||
</p>
|
||||
<p>Each prefix MUST not be empty.
|
||||
</p>
|
||||
<p>The "!!" handle is used for default YAML _tags with prefix
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>"tag</h2>
|
||||
<p>yaml.org,2002:". This can be overridden.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">tags</td><td class="paramDoc"><p>Tag directives (keys are handles, values are prefixes).
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Example</h2>
|
||||
|
||||
<pre><code><a href="dyaml/dumper/Dumper.html">Dumper</a> dumper = <a href="dyaml/dumper/Dumper.html">Dumper</a>("file.yaml");
|
||||
string[string] directives;
|
||||
directives["!short!"] = "tag:long.org,2011:";
|
||||
//This will emit tags starting with "tag:long.org,2011"
|
||||
//with a "!short!" prefix instead.
|
||||
dumper.<a href="dyaml/dumper/Dumper.html#tagDirectives">tagDirectives</a>(directives);
|
||||
dumper.<a href="dyaml/dumper/Dumper.html#dump">dump</a>(<a href="dyaml/node/Node.html">Node</a>("foo"));</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="dump"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/dumper/Dumper.html#dump">dump</a>(<a href="dyaml/node/Node.html">Node</a>[] documents...) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Dump one or more YAML _documents to the file/stream.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Note that while you can call dump() multiple times on the same
|
||||
dumper, you will end up writing multiple YAML "files" to the same
|
||||
file/stream.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">documents</td><td class="paramDoc"><p>Documents to _dump (root nodes of the _documents).
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> YAMLException on error (e.g. invalid nodes,
|
||||
unable to write to file/stream).
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><div class="section members"><h2>Functions</h2><table><tr><td><a href="dyaml/dumper/Dumper.html#this">this</a></td><td></td><td><p>Construct a Dumper writing to a file.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/dumper/Dumper.html#this">this</a></td><td></td><td><p>Construct a Dumper writing to a _stream. This is useful to e.g. write to memory.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#name">name</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Set stream _name. Used in debugging messages.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#resolver">resolver</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Specify custom Resolver to use.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#representer">representer</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Specify custom Representer to use.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#canonical">canonical</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Write scalars in _canonical form?
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#indent">indent</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Set indentation width. 2 by default. Must not be zero.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#textWidth">textWidth</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Set preferred text _width.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#lineBreak">lineBreak</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Set line break to use. Unix by default.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#encoding">encoding</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Set character _encoding to use. UTF-8 by default.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#explicitStart">explicitStart</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Always explicitly write document start?
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#explicitEnd">explicitEnd</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Always explicitly write document end?
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#YAMLVersion">YAMLVersion</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Specify YAML version string. "1.1" by default.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/dumper/Dumper.html#tagDirectives">tagDirectives</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Specify tag directives.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/dumper/Dumper.html#dump">dump</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Dump one or more YAML _documents to the file/stream.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
59
doc/html/api/dyaml/exception.html
Normal file
59
doc/html/api/dyaml/exception.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css"/>
|
||||
<script src="../highlight.pack.js"></script>
|
||||
<title>dyaml.exception</title>
|
||||
<base href="../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.exception</small>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/exception.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/exception.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/exception.html">exception</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><div class="section "><p>Exceptions thrown by D:YAML and _exception related code.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Classes</h2><table><tr><td><a href="dyaml/exception/YAMLException.html">YAMLException</a></td><td></td><td><p>Base class for all exceptions thrown by D:YAML.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
71
doc/html/api/dyaml/exception/YAMLException.html
Normal file
71
doc/html/api/dyaml/exception/YAMLException.html
Normal file
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>YAMLException</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/exception.html>exception</a>.</small><span class="highlight">YAMLException</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/exception.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/exception.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/exception.html">exception</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public class YAMLException : Exception
|
||||
</code></pre>
|
||||
<div class="section "><p>Base class for all exceptions thrown by D:YAML.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(
|
||||
string msg,
|
||||
string file = __FILE__,
|
||||
size_t line = __LINE__) @safe pure nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a YAMLException with specified message and position where it was thrown.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><div class="section members"><h2>Functions</h2><table><tr><td><a href="dyaml/exception/YAMLException.html#this">this</a></td><td></td><td><p>Construct a YAMLException with specified message and position where it was thrown.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
164
doc/html/api/dyaml/hacks.html
Normal file
164
doc/html/api/dyaml/hacks.html
Normal file
|
@ -0,0 +1,164 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css"/>
|
||||
<script src="../highlight.pack.js"></script>
|
||||
<title>dyaml.hacks</title>
|
||||
<base href="../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.hacks</small>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/hacks.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/hacks.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/hacks.html">hacks</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><a class="anchor" id="scalarStyleHack"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/style/ScalarStyle.html">ScalarStyle</a> <a href="dyaml/hacks.html#scalarStyleHack">scalarStyleHack</a>(ref const(<a href="dyaml/node/Node.html">Node</a>) node) @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Get the scalar style a node had in the file it was loaded from.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This is only useful for nodes loaded from files.
|
||||
</p>
|
||||
<p> 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.
|
||||
</p>
|
||||
<p> May only be called on scalar nodes (nodes where node.isScalar() == true).
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Example</h2>
|
||||
|
||||
<pre><code> // <a href="dyaml/node/Node.html">Node</a> node // loaded from a file
|
||||
if(node.isScalar)
|
||||
{
|
||||
import std.stdio;
|
||||
writeln(node.<a href="dyaml/hacks.html#scalarStyleHack">scalarStyleHack</a>());
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="collectionStyleHack"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/style/CollectionStyle.html">CollectionStyle</a> <a href="dyaml/hacks.html#collectionStyleHack">collectionStyleHack</a>(ref const(<a href="dyaml/node/Node.html">Node</a>) node) @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Get the collection style a YAML node had in the file it was loaded from.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>May only be called on collection nodes (nodes where node.isScalar() != true).
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section seealso">
|
||||
<h2>See Also:</h2>
|
||||
<div class="seealso-content">
|
||||
<p> scalarStyleHack
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div></div><a class="anchor" id="scalarStyleHack"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/hacks.html#scalarStyleHack">scalarStyleHack</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
const <a href="dyaml/style/ScalarStyle.html">ScalarStyle</a> rhs) @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Set the scalar style node should have when written to a file.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Setting the style might be useful when generating YAML or reformatting existing files.
|
||||
</p>
|
||||
<p> May only be called on scalar nodes (nodes where node.isScalar() == true).
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section "><h2>Example</h2>
|
||||
<pre><code>writeln("D:YAML <a href="dyaml/hacks.html#scalarStyleHack">scalarStyleHack</a> setter unittest");
|
||||
auto node = <a href="dyaml/node/Node.html">Node</a>(5);
|
||||
node.<a href="dyaml/hacks.html#scalarStyleHack">scalarStyleHack</a> = <a href="dyaml/style/ScalarStyle.html#DoubleQuoted">ScalarStyle.DoubleQuoted</a>;
|
||||
assert(node.<a href="dyaml/hacks.html#scalarStyleHack">scalarStyleHack</a>() == <a href="dyaml/style/ScalarStyle.html#DoubleQuoted">ScalarStyle.DoubleQuoted</a>);
|
||||
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="collectionStyleHack"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/hacks.html#collectionStyleHack">collectionStyleHack</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
const <a href="dyaml/style/CollectionStyle.html">CollectionStyle</a> rhs) @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Set the collection style node should have when written to a file.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Setting the style might be useful when generating YAML or reformatting existing files.
|
||||
</p>
|
||||
<p> May only be called on collection nodes (nodes where node.isScalar() != true).
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section "><h2>Example</h2>
|
||||
<pre><code>writeln("D:YAML <a href="dyaml/hacks.html#collectionStyleHack">collectionStyleHack</a> setter unittest");
|
||||
auto node = <a href="dyaml/node/Node.html">Node</a>([1, 2, 3, 4, 5]);
|
||||
node.<a href="dyaml/hacks.html#collectionStyleHack">collectionStyleHack</a> = <a href="dyaml/style/CollectionStyle.html#Block">CollectionStyle.Block</a>;
|
||||
assert(node.<a href="dyaml/hacks.html#collectionStyleHack">collectionStyleHack</a>() == <a href="dyaml/style/CollectionStyle.html#Block">CollectionStyle.Block</a>);
|
||||
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><div class="description"><div class="section "><p>Functionality that may sometimes be needed but allows unsafe or unstandard behavior, and should only be used in specific cases.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Functions</h2><table><tr><td><a href="dyaml/hacks.html#scalarStyleHack">scalarStyleHack</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Get the scalar style a node had in the file it was loaded from.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/hacks.html#collectionStyleHack">collectionStyleHack</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Get the collection style a YAML node had in the file it was loaded from.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/hacks.html#scalarStyleHack">scalarStyleHack</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Set the scalar style node should have when written to a file.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/hacks.html#collectionStyleHack">collectionStyleHack</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Set the collection style node should have when written to a file.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
54
doc/html/api/dyaml/linebreak.html
Normal file
54
doc/html/api/dyaml/linebreak.html
Normal file
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css"/>
|
||||
<script src="../highlight.pack.js"></script>
|
||||
<title>dyaml.linebreak</title>
|
||||
<base href="../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.linebreak</small>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/linebreak.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/linebreak.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/linebreak.html">linebreak</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"></div><div class="section members"><h2>Enums</h2><table><tr><td><a href="dyaml/linebreak/LineBreak.html">LineBreak</a></td><td></td><td><p>Enumerates platform specific line breaks.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
65
doc/html/api/dyaml/linebreak/LineBreak.html
Normal file
65
doc/html/api/dyaml/linebreak/LineBreak.html
Normal file
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>LineBreak</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/linebreak.html>linebreak</a>.</small><span class="highlight">LineBreak</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/linebreak.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/linebreak.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/linebreak.html">linebreak</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public enum LineBreak
|
||||
</code></pre>
|
||||
<div class="section "><p>Enumerates platform specific line breaks.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Values</h2><table><tr><td>Unix</td><td></td><td><p>Unix line break ("\n").
|
||||
</p>
|
||||
</td></tr><tr><td>Windows</td><td></td><td><p>Windows line break ("\r\n").
|
||||
</p>
|
||||
</td></tr><tr><td>Macintosh</td><td></td><td><p>Macintosh line break ("\r").
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
59
doc/html/api/dyaml/loader.html
Normal file
59
doc/html/api/dyaml/loader.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css"/>
|
||||
<script src="../highlight.pack.js"></script>
|
||||
<title>dyaml.loader</title>
|
||||
<base href="../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.loader</small>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/loader.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/loader.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/loader.html">loader</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><div class="section "><p>Class used to load YAML documents.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Structs</h2><table><tr><td><a href="dyaml/loader/Loader.html">Loader</a></td><td></td><td><p>Loads YAML documents from files or streams.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
329
doc/html/api/dyaml/loader/Loader.html
Normal file
329
doc/html/api/dyaml/loader/Loader.html
Normal file
|
@ -0,0 +1,329 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>Loader</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/loader.html>loader</a>.</small><span class="highlight">Loader</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/loader.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/loader.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/loader.html">loader</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public struct Loader
|
||||
</code></pre>
|
||||
<div class="section "><p>Loads YAML documents from files or streams.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>User specified Constructor and/or Resolver can be used to support new
|
||||
tags / data types.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Examples</h2>
|
||||
|
||||
|
||||
Load single YAML document from a file:
|
||||
<pre><code> auto rootNode = <a href="dyaml/loader/Loader.html">Loader</a>("file.yaml").<a href="dyaml/loader/Loader.html#load">load</a>();
|
||||
...
|
||||
</code></pre>
|
||||
|
||||
Load all YAML documents from a file:
|
||||
<pre><code> auto nodes = <a href="dyaml/loader/Loader.html">Loader</a>("file.yaml").<a href="dyaml/loader/Loader.html#loadAll">loadAll</a>();
|
||||
...
|
||||
</code></pre>
|
||||
|
||||
Iterate over YAML documents in a file, lazily loading them:
|
||||
<pre><code> auto loader = <a href="dyaml/loader/Loader.html">Loader</a>("file.yaml");
|
||||
|
||||
foreach(ref node; loader)
|
||||
{
|
||||
...
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
Load YAML from a string:
|
||||
<pre><code> char[] yaml_input = "red: '#ff0000'\n"
|
||||
"green: '#00ff00'\n"
|
||||
"blue: '#0000ff'".dup;
|
||||
|
||||
auto colors = <a href="dyaml/loader/Loader.html#fromString">Loader.fromString</a>(yaml_input).<a href="dyaml/loader/Loader.html#load">load</a>();
|
||||
|
||||
foreach(string color, string value; colors)
|
||||
{
|
||||
import std.stdio;
|
||||
writeln(color, " is ", value, " in HTML/CSS");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
Load a file into a buffer in memory and then load YAML from that buffer:
|
||||
<pre><code> try
|
||||
{
|
||||
import std.file;
|
||||
void[] buffer = std.file.read("file.yaml");
|
||||
auto yamlNode = <a href="dyaml/loader/Loader.html">Loader</a>(buffer);
|
||||
|
||||
// Read data from yamlNode here...
|
||||
}
|
||||
catch(FileException e)
|
||||
{
|
||||
writeln("Failed to read file 'file.yaml'");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
Use a custom constructor/resolver to support custom data types and/or implicit tags:
|
||||
<pre><code> auto <a href="dyaml/loader/Loader.html#constructor">constructor</a> = new <a href="dyaml/constructor/Constructor.html">Constructor</a>();
|
||||
auto <a href="dyaml/loader/Loader.html#resolver">resolver</a> = new <a href="dyaml/resolver/Resolver.html">Resolver</a>();
|
||||
|
||||
// Add <a href="dyaml/loader/Loader.html#constructor">constructor</a> functions / <a href="dyaml/loader/Loader.html#resolver">resolver</a> expressions here...
|
||||
|
||||
auto loader = <a href="dyaml/loader/Loader.html">Loader</a>("file.yaml");
|
||||
loader.<a href="dyaml/loader/Loader.html#constructor">constructor</a> = <a href="dyaml/loader/Loader.html#constructor">constructor</a>;
|
||||
loader.<a href="dyaml/loader/Loader.html#resolver">resolver</a> = <a href="dyaml/loader/Loader.html#resolver">resolver</a>;
|
||||
auto rootNode = loader.<a href="dyaml/loader/Loader.html#load">load</a>(node);
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(string filename) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a Loader to load YAML from a file.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">filename</td><td class="paramDoc"><p>Name of the file to load from.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> YAMLException if the file could not be opened or read.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="fromString"></a><div class="symbol"><div class="description"><pre><code>public static <a href="dyaml/loader/Loader.html">Loader</a> <a href="dyaml/loader/Loader.html#fromString">fromString</a>(<a href="http://dlang.org/type.html#basic-data-types">char</a>[] data) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a Loader to load YAML from a string (char []).
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">data</td><td class="paramDoc"><p>String to load YAML from. <b>will</b> be overwritten during parsing as D:YAML reuses memory. Use data.dup if you don't want to modify the original string.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> Loader loading YAML from given string.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> YAMLException if data could not be read (e.g. a decoding error)
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section "><h2>Example</h2>
|
||||
<pre><code>assert(<a href="dyaml/loader/Loader.html#fromString">Loader.fromString</a>(cast(char[])"42").<a href="dyaml/loader/Loader.html#load">load</a>().as!int == 42);
|
||||
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(<a href="http://dlang.org/type.html#basic-data-types">void</a>[] yamlData) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a Loader to load YAML from a buffer.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">yamlData</td><td class="paramDoc"><p>Buffer with YAML data to load. This may be e.g. a file loaded to memory or a string with YAML data. Note that buffer <b>will</b> be overwritten, as D:YAML minimizes memory allocations by reusing the input _buffer. <b>Must not be deleted or modified by the user as long as nodes loaded by this Loader are in use!</b> - Nodes may refer to data in this buffer. Note that D:YAML looks for byte-order-marks YAML files encoded in UTF-16/UTF-32 (and sometimes UTF-8) use to specify the encoding and endianness, so it should be enough to load an entire file to a buffer and pass it to D:YAML, regardless of Unicode encoding.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> YAMLException if yamlData contains data illegal in YAML.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="name"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/loader/Loader.html#name">name</a>(string name) pure @safe nothrow @nogc
|
||||
</code></pre>
|
||||
<div class="section "><p>Set stream _name. Used in debugging messages.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="resolver"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/loader/Loader.html#resolver">resolver</a>(<a href="dyaml/resolver/Resolver.html">Resolver</a> resolver) pure @safe nothrow @nogc
|
||||
</code></pre>
|
||||
<div class="section "><p>Specify custom Resolver to use.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="constructor"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/loader/Loader.html#constructor">constructor</a>(<a href="dyaml/constructor/Constructor.html">Constructor</a> constructor) pure @safe nothrow @nogc
|
||||
</code></pre>
|
||||
<div class="section "><p>Specify custom Constructor to use.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="load"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/loader/Loader.html#load">load</a>() @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Load single YAML document.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section "><h2>Contracts</h2><pre><code>in
|
||||
{
|
||||
assert (!done_, "<a href="dyaml/loader/Loader.html">Loader</a>: Trying to <a href="dyaml/loader/Loader.html#load">load</a> YAML twice");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If none or more than one YAML document is found, this throws a YAMLException.
|
||||
</p>
|
||||
<p> This can only be called once; this is enforced by contract.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> Root node of the document.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> YAMLException if there wasn't exactly one document
|
||||
or on a YAML parsing error.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="loadAll"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a>[] <a href="dyaml/loader/Loader.html#loadAll">loadAll</a>() @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Load all YAML documents.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This is just a shortcut that iterates over all documents and returns them
|
||||
all at once. Calling loadAll after iterating over the node or vice versa
|
||||
will not return any documents, as they have all been parsed already.
|
||||
</p>
|
||||
<p> This can only be called once; this is enforced by contract.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> Array of root nodes of all documents in the file/stream.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> YAMLException on a parsing error.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="opApply"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">int</a> <a href="dyaml/loader/Loader.html#opApply">opApply</a>(<a href="http://dlang.org/type.html#basic-data-types">int</a> delegate(ref <a href="dyaml/node/Node.html">Node</a>) dg) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Foreach over YAML documents.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section "><h2>Contracts</h2><pre><code>in
|
||||
{
|
||||
assert (!done_, "<a href="dyaml/loader/Loader.html">Loader</a>: Trying to <a href="dyaml/loader/Loader.html#load">load</a> YAML twice");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Parses documents lazily, when they are needed.
|
||||
</p>
|
||||
<p> Foreach over a Loader can only be used once; this is enforced by contract.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> YAMLException on a parsing error.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><div class="section members"><h2>Functions</h2><table><tr><td><a href="dyaml/loader/Loader.html#this">this</a></td><td></td><td><p>Construct a Loader to load YAML from a file.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-static">static</span></span></span><a href="dyaml/loader/Loader.html#fromString">fromString</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Construct a Loader to load YAML from a string (char []).
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/loader/Loader.html#this">this</a></td><td></td><td><p>Construct a Loader to load YAML from a buffer.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/loader/Loader.html#name">name</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span>, <span class="attr-nogc">@nogc</span></span></span></td><td></td><td><p>Set stream _name. Used in debugging messages.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/loader/Loader.html#resolver">resolver</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span>, <span class="attr-nogc">@nogc</span></span></span></td><td></td><td><p>Specify custom Resolver to use.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/loader/Loader.html#constructor">constructor</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span>, <span class="attr-nogc">@nogc</span></span></span></td><td></td><td><p>Specify custom Constructor to use.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/loader/Loader.html#load">load</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Load single YAML document.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/loader/Loader.html#loadAll">loadAll</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Load all YAML documents.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/loader/Loader.html#opApply">opApply</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Foreach over YAML documents.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
64
doc/html/api/dyaml/node.html
Normal file
64
doc/html/api/dyaml/node.html
Normal file
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css"/>
|
||||
<script src="../highlight.pack.js"></script>
|
||||
<title>dyaml.node</title>
|
||||
<base href="../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.node</small>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/node.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/node.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/node.html">node</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><div class="section "><p>Node of a YAML document. Used to read YAML data once it's loaded,
|
||||
and to prepare data to emit.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Structs</h2><table><tr><td><a href="dyaml/node/YAMLNull.html">YAMLNull</a></td><td></td><td><p>Null YAML type. Used in nodes with _null values.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html">Node</a></td><td></td><td><p>YAML node.
|
||||
</p>
|
||||
</td></tr></table><h2>Classes</h2><table><tr><td><a href="dyaml/node/NodeException.html">NodeException</a></td><td></td><td><p>Exception thrown at node related errors.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
866
doc/html/api/dyaml/node/Node.html
Normal file
866
doc/html/api/dyaml/node/Node.html
Normal file
|
@ -0,0 +1,866 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>Node</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/node.html>node</a>.</small><span class="highlight">Node</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/node.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/node.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/node.html">node</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public struct Node
|
||||
</code></pre>
|
||||
<div class="section "><p>YAML node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This is a pseudo-dynamic type that can store any YAML value, including a
|
||||
sequence or mapping of nodes. You can get data from a Node directly or
|
||||
iterate over it if it's a collection.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(T)(
|
||||
T value,
|
||||
const string tag = null) @trusted
|
||||
if(!scalarCtorNothrow!T && (!isArray!T && !isAssociativeArray!T))
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a Node from a value.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Any type except for Node can be stored in a Node, but default YAML
|
||||
types (integers, floats, strings, timestamps, etc.) will be stored
|
||||
more efficiently. To create a node representing a null value,
|
||||
construct it from YAMLNull.
|
||||
</p>
|
||||
<p> Note that to emit any non-default types you store
|
||||
in a node, you need a Representer to represent them in YAML -
|
||||
otherwise emitting will fail.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">value</td><td class="paramDoc"><p>Value to store in the node.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">tag</td><td class="paramDoc"><p>Overrides tag of the node when emitted, regardless of tag determined by Representer. Representer uses this to determine YAML data type when a D data type maps to multiple different YAML data types. Tag must be in full form, e.g. "tag:yaml.org,2002:int", not a shortcut, like "!!int".
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div></div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(T)(
|
||||
T value,
|
||||
const string tag = null) @safe pure nothrow
|
||||
if(scalarCtorNothrow!T)
|
||||
</code></pre>
|
||||
<div class="section "><p>Ditto.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(T)(
|
||||
T[] array,
|
||||
const string tag = null) @safe
|
||||
if(!isSomeString!(T[]))
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a node from an _array.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If _array is an _array of nodes or pairs, it is stored directly.
|
||||
Otherwise, every value in the array is converted to a node, and
|
||||
those nodes are stored.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">array</td><td class="paramDoc"><p>Values to store in the node.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">tag</td><td class="paramDoc"><p>Overrides tag of the node when emitted, regardless of tag determined by Representer. Representer uses this to determine YAML data type when a D data type maps to multiple different YAML data types. This is used to differentiate between YAML sequences ("!!seq") and sets ("!!set"), which both are internally represented as an array_ of nodes. Tag must be in full form, e.g. "tag:yaml.org,2002:set", not a shortcut, like "!!set".
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Examples</h2>
|
||||
|
||||
<pre><code> // Will be emitted <a href="dyaml/node/Node.html#as">as</a> a sequence (default for arrays)
|
||||
auto seq = <a href="dyaml/node/Node.html">Node</a>([1, 2, 3, 4, 5]);
|
||||
// Will be emitted <a href="dyaml/node/Node.html#as">as</a> a set (overriden <a href="dyaml/node/Node.html#tag">tag</a>)
|
||||
auto set = <a href="dyaml/node/Node.html">Node</a>([1, 2, 3, 4, 5], "<a href="dyaml/node/Node.html#tag">tag</a>:yaml.org,2002:set");
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(K, V)(
|
||||
V[K] array,
|
||||
const string tag = null) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a node from an associative _array.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If keys and/or values of _array are nodes, they stored directly.
|
||||
Otherwise they are converted to nodes and then stored.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">array</td><td class="paramDoc"><p>Values to store in the node.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">tag</td><td class="paramDoc"><p>Overrides tag of the node when emitted, regardless of tag determined by Representer. Representer uses this to determine YAML data type when a D data type maps to multiple different YAML data types. This is used to differentiate between YAML unordered mappings ("!!map"), ordered mappings ("!!omap"), and pairs ("!!pairs") which are all internally represented as an _array of node pairs. Tag must be in full form, e.g. "tag:yaml.org,2002:omap", not a shortcut, like "!!omap".
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Examples</h2>
|
||||
|
||||
<pre><code> // Will be emitted <a href="dyaml/node/Node.html#as">as</a> an unordered mapping (default for mappings)
|
||||
auto map = <a href="dyaml/node/Node.html">Node</a>([1 : "a", 2 : "b"]);
|
||||
// Will be emitted <a href="dyaml/node/Node.html#as">as</a> an ordered map (overriden <a href="dyaml/node/Node.html#tag">tag</a>)
|
||||
auto omap = <a href="dyaml/node/Node.html">Node</a>([1 : "a", 2 : "b"], "<a href="dyaml/node/Node.html#tag">tag</a>:yaml.org,2002:omap");
|
||||
// Will be emitted <a href="dyaml/node/Node.html#as">as</a> pairs (overriden <a href="dyaml/node/Node.html#tag">tag</a>)
|
||||
auto pairs = <a href="dyaml/node/Node.html">Node</a>([1 : "a", 2 : "b"], "<a href="dyaml/node/Node.html#tag">tag</a>:yaml.org,2002:pairs");
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(K, V)(
|
||||
K[] keys,
|
||||
V[] values,
|
||||
const string tag = null) @safe
|
||||
if(!(isSomeString!(K[]) || isSomeString!(V[])))
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a node from arrays of _keys and _values.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section "><h2>Contracts</h2><pre><code>in
|
||||
{
|
||||
assert (keys.<a href="dyaml/node/Node.html#length">length</a> == values.<a href="dyaml/node/Node.html#length">length</a>, "Lengths of keys and values arrays to construct ""a YAML node from don't match");
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Constructs a mapping node with key-value pairs from
|
||||
_keys and _values, keeping their order. Useful when order
|
||||
is important (ordered maps, pairs).
|
||||
</p>
|
||||
<p> keys and values must have equal length.
|
||||
</p>
|
||||
<p> If _keys and/or _values are nodes, they are stored directly/
|
||||
Otherwise they are converted to nodes and then stored.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">keys</td><td class="paramDoc"><p>Keys of the mapping, from first to last pair.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">values</td><td class="paramDoc"><p>Values of the mapping, from first to last pair.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">tag</td><td class="paramDoc"><p>Overrides tag of the node when emitted, regardless of tag determined by Representer. Representer uses this to determine YAML data type when a D data type maps to multiple different YAML data types. This is used to differentiate between YAML unordered mappings ("!!map"), ordered mappings ("!!omap"), and pairs ("!!pairs") which are all internally represented as an array of node pairs. Tag must be in full form, e.g. "tag:yaml.org,2002:omap", not a shortcut, like "!!omap".
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Examples</h2>
|
||||
|
||||
<pre><code> // Will be emitted <a href="dyaml/node/Node.html#as">as</a> an unordered mapping (default for mappings)
|
||||
auto map = <a href="dyaml/node/Node.html">Node</a>([1, 2], ["a", "b"]);
|
||||
// Will be emitted <a href="dyaml/node/Node.html#as">as</a> an ordered map (overriden <a href="dyaml/node/Node.html#tag">tag</a>)
|
||||
auto omap = <a href="dyaml/node/Node.html">Node</a>([1, 2], ["a", "b"], "<a href="dyaml/node/Node.html#tag">tag</a>:yaml.org,2002:omap");
|
||||
// Will be emitted <a href="dyaml/node/Node.html#as">as</a> pairs (overriden <a href="dyaml/node/Node.html#tag">tag</a>)
|
||||
auto pairs = <a href="dyaml/node/Node.html">Node</a>([1, 2], ["a", "b"], "<a href="dyaml/node/Node.html#tag">tag</a>:yaml.org,2002:pairs");
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="isValid"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">bool</a> <a href="dyaml/node/Node.html#isValid">isValid</a>() const @safe pure nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Is this node valid (initialized)?
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="isScalar"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">bool</a> <a href="dyaml/node/Node.html#isScalar">isScalar</a>() const @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Is this node a scalar value?
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="isSequence"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">bool</a> <a href="dyaml/node/Node.html#isSequence">isSequence</a>() const @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Is this node a sequence?
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="isMapping"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">bool</a> <a href="dyaml/node/Node.html#isMapping">isMapping</a>() const @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Is this node a mapping?
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="isUserType"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">bool</a> <a href="dyaml/node/Node.html#isUserType">isUserType</a>() const @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Is this node a user defined type?
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="isNull"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">bool</a> <a href="dyaml/node/Node.html#isNull">isNull</a>() const @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Is this node null?
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="tag"></a><div class="symbol"><div class="description"><pre><code>public @property string <a href="dyaml/node/Node.html#tag">tag</a>() const @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Return tag of the node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="opEquals"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">bool</a> <a href="dyaml/node/Node.html#opEquals">opEquals</a>(T)(const auto ref T rhs) const @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Equality test.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If T is Node, recursively compares all subnodes.
|
||||
This might be quite expensive if testing entire documents.
|
||||
</p>
|
||||
<p> If T is not Node, gets a value of type T from the node and tests
|
||||
equality with that.
|
||||
</p>
|
||||
<p> To test equality with a null YAML value, use YAMLNull.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">rhs</td><td class="paramDoc"><p>Variable to test equality with.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> true if equal, false otherwise.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section "><h2>Example</h2>
|
||||
<pre><code>auto node = <a href="dyaml/node/Node.html">Node</a>(42);
|
||||
|
||||
assert(node == 42);
|
||||
assert(node != "42");
|
||||
assert(node != "43");
|
||||
|
||||
auto node2 = <a href="dyaml/node/Node.html">Node</a>(<a href="dyaml/node/YAMLNull.html">YAMLNull</a>());
|
||||
assert(node2 == <a href="dyaml/node/YAMLNull.html">YAMLNull</a>());
|
||||
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="as"></a><div class="symbol"><div class="description"><pre><code>alias as = <a href="dyaml/node/Node.html#get">get</a>
|
||||
</code></pre>
|
||||
<div class="section "><p>Shortcut for get().
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="get"></a><div class="symbol"><div class="description"><pre><code>public @property T <a href="dyaml/node/Node.html#get">get</a>(T, Flag!"stringConversion" stringConversion = Yes.stringConversion)() @trusted
|
||||
if(!is(T == const))
|
||||
</code></pre>
|
||||
<div class="section "><p>Get the value of the node as specified type.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If the specifed type does not match type in the node,
|
||||
conversion is attempted. The stringConversion template
|
||||
parameter can be used to disable conversion from non-string
|
||||
types to strings.
|
||||
</p>
|
||||
<p> Numeric values are range checked, throwing if out of range of
|
||||
requested type.
|
||||
</p>
|
||||
<p> Timestamps are stored as std.datetime.SysTime.
|
||||
Binary values are decoded and stored as ubyte[].
|
||||
</p>
|
||||
<p> To get a null value, use get!YAMLNull . This is to
|
||||
prevent getting null values for types such as strings or classes.
|
||||
</p>
|
||||
<p> <b>Mapping default values:</b>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Examples</h2>
|
||||
|
||||
|
||||
Automatic type conversion:
|
||||
<pre><code> auto node = <a href="dyaml/node/Node.html">Node</a>(42);
|
||||
|
||||
assert(node.<a href="dyaml/node/Node.html#as">as</a>!int == 42);
|
||||
assert(node.<a href="dyaml/node/Node.html#as">as</a>!string == "42");
|
||||
assert(node.<a href="dyaml/node/Node.html#as">as</a>!double == 42.0);
|
||||
</code></pre>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> Value of the node as specified type.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> NodeException if unable to convert to specified type, or if
|
||||
the value is out of range of requested type.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="get"></a><div class="symbol"><div class="description"><pre><code>public @property T <a href="dyaml/node/Node.html#get">get</a>(T, Flag!"stringConversion" stringConversion = Yes.stringConversion)() const @trusted
|
||||
if(is(T == const))
|
||||
</code></pre>
|
||||
<div class="section "><p>Ditto.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="length"></a><div class="symbol"><div class="description"><pre><code>public @property size_t <a href="dyaml/node/Node.html#length">length</a>() const @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>If this is a collection, return its _length.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Otherwise, throw NodeException.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> Number of elements in a sequence or key-value pairs in a mapping.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> NodeException if this is not a sequence nor a mapping.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="opIndex"></a><div class="symbol"><div class="description"><pre><code>public ref <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/node/Node.html#opIndex">opIndex</a>(T)(T index) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Get the element at specified index.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If the node is a sequence, index must be integral.
|
||||
</p>
|
||||
<p> If the node is a mapping, return the value corresponding to the first
|
||||
key equal to index. containsKey() can be used to determine if a mapping
|
||||
has a specific key.
|
||||
</p>
|
||||
<p> To get element at a null index, use YAMLNull for index.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">index</td><td class="paramDoc"><p>Index to use.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> Value corresponding to the index.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> NodeException if the index could not be found,
|
||||
non-integral index is used with a sequence or the node is
|
||||
not a collection.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section "><h2>Example</h2>
|
||||
<pre><code>writeln("D:YAML <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/node/Node.html#opIndex">opIndex</a> unittest");
|
||||
alias <a href="dyaml/node/Node.html">Node</a>.Value Value;
|
||||
alias <a href="dyaml/node/Node.html">Node</a>.Pair Pair;
|
||||
|
||||
<a href="dyaml/node/Node.html">Node</a> narray = <a href="dyaml/node/Node.html">Node</a>([11, 12, 13, 14]);
|
||||
<a href="dyaml/node/Node.html">Node</a> nmap = <a href="dyaml/node/Node.html">Node</a>(["11", "12", "13", "14"], [11, 12, 13, 14]);
|
||||
|
||||
assert(narray[0].<a href="dyaml/node/Node.html#as">as</a>!int == 11);
|
||||
assert(null !is collectException(narray[42]));
|
||||
assert(nmap["11"].<a href="dyaml/node/Node.html#as">as</a>!int == 11);
|
||||
assert(nmap["14"].<a href="dyaml/node/Node.html#as">as</a>!int == 14);
|
||||
|
||||
</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="contains"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">bool</a> <a href="dyaml/node/Node.html#contains">contains</a>(T)(T rhs) const @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Determine if a collection contains specified value.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If the node is a sequence, check if it contains the specified value.
|
||||
If it's a mapping, check if it has a value that matches specified value.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">rhs</td><td class="paramDoc"><p>Item to look for. Use YAMLNull to check for a null value.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> true if rhs was found, false otherwise.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> NodeException if the node is not a collection.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="containsKey"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">bool</a> <a href="dyaml/node/Node.html#containsKey">containsKey</a>(T)(T rhs) const @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Determine if a mapping contains specified key.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">rhs</td><td class="paramDoc"><p>Key to look for. Use YAMLNull to check for a null key.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> true if rhs was found, false otherwise.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> NodeException if the node is not a mapping.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="opAssign"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/node/Node.html#opAssign">opAssign</a>(<a href="dyaml/node/Node.html">Node</a> rhs) @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Assignment (shallow copy) by value.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="opAssign"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/node/Node.html#opAssign">opAssign</a>(ref <a href="dyaml/node/Node.html">Node</a> rhs) @trusted nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Assignment (shallow copy) by reference.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="opIndexAssign"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/node/Node.html#opIndexAssign">opIndexAssign</a>(K, V)(
|
||||
V value,
|
||||
K index) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Set element at specified index in a collection.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This method can only be called on collection nodes.
|
||||
</p>
|
||||
<p> If the node is a sequence, index must be integral.
|
||||
</p>
|
||||
<p> If the node is a mapping, sets the _value corresponding to the first
|
||||
key matching index (including conversion, so e.g. "42" matches 42).
|
||||
</p>
|
||||
<p> If the node is a mapping and no key matches index, a new key-value
|
||||
pair is added to the mapping. In sequences the index must be in
|
||||
range. This ensures behavior siilar to D arrays and associative
|
||||
arrays.
|
||||
</p>
|
||||
<p> To set element at a null index, use YAMLNull for index.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">index</td><td class="paramDoc"><p>Index of the value to set.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> NodeException if the node is not a collection, index is out
|
||||
of range or if a non-integral index is used on a sequence node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="opApply"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">int</a> <a href="dyaml/node/Node.html#opApply">opApply</a>(T)(<a href="http://dlang.org/type.html#basic-data-types">int</a> delegate(ref T) dg) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Foreach over a sequence, getting each element as T.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If T is Node, simply iterate over the nodes in the sequence.
|
||||
Otherwise, convert each node to T during iteration.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> NodeException if the node is not a sequence or an
|
||||
element could not be converted to specified type.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="opApply"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">int</a> <a href="dyaml/node/Node.html#opApply">opApply</a>(K, V)(<a href="http://dlang.org/type.html#basic-data-types">int</a> delegate(
|
||||
ref K,
|
||||
ref V) dg) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Foreach over a mapping, getting each key/value as K/V.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If the K and/or V is Node, simply iterate over the nodes in the mapping.
|
||||
Otherwise, convert each key/value to T during iteration.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> NodeException if the node is not a mapping or an
|
||||
element could not be converted to specified type.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="add"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/node/Node.html#add">add</a>(T)(T value) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Add an element to a sequence.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This method can only be called on sequence nodes.
|
||||
</p>
|
||||
<p> If value is a node, it is copied to the sequence directly. Otherwise
|
||||
value is converted to a node and then stored in the sequence.
|
||||
</p>
|
||||
<p> <p>When emitting, all values in the sequence will be emitted. When
|
||||
using the !!set tag, the user needs to ensure that all elements in
|
||||
the sequence are unique, otherwise <b>invalid</b> YAML code will be
|
||||
emitted.</p>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">value</td><td class="paramDoc"><p>Value to _add to the sequence.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div></div><a class="anchor" id="add"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/node/Node.html#add">add</a>(K, V)(
|
||||
K key,
|
||||
V value) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Add a key-value pair to a mapping.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This method can only be called on mapping nodes.
|
||||
</p>
|
||||
<p> If key and/or value is a node, it is copied to the mapping directly.
|
||||
Otherwise it is converted to a node and then stored in the mapping.
|
||||
</p>
|
||||
<p> <p>It is possible for the same key to be present more than once in a
|
||||
mapping. When emitting, all key-value pairs will be emitted.
|
||||
This is useful with the "!!pairs" tag, but will result in
|
||||
<b>invalid</b> YAML with "!!map" and "!!omap" tags.</p>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">key</td><td class="paramDoc"><p>Key to _add.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">value</td><td class="paramDoc"><p>Value to _add.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div></div><a class="anchor" id="opBinaryRight"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a>* <a href="dyaml/node/Node.html#opBinaryRight">opBinaryRight</a>(string op, K)(K key) @system
|
||||
if(op == "in")
|
||||
</code></pre>
|
||||
<div class="section "><p>Determine whether a key is in a mapping, and access its value.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This method can only be called on mapping nodes.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">key</td><td class="paramDoc"><p>Key to search for.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> A pointer to the value (as a Node) corresponding to key,
|
||||
or null if not found.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section note"><h2>Note:</h2>
|
||||
<div class="note-content">
|
||||
<pre class="prettyprint"><code> Any modification to the node can invalidate the returned
|
||||
pointer.
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="section seealso">
|
||||
<h2>See Also:</h2>
|
||||
<div class="seealso-content">
|
||||
<p> contains
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div></div><a class="anchor" id="remove"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/node/Node.html#remove">remove</a>(T)(T rhs) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Remove first (if any) occurence of a value in a collection.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This method can only be called on collection nodes.
|
||||
</p>
|
||||
<p> If the node is a sequence, the first node matching value is removed.
|
||||
If the node is a mapping, the first key-value pair where _value
|
||||
matches specified value is removed.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">rhs</td><td class="paramDoc"><p>Value to _remove.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> NodeException if the node is not a collection.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="removeAt"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/node/Node.html#removeAt">removeAt</a>(T)(T index) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Remove element at the specified index of a collection.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This method can only be called on collection nodes.
|
||||
</p>
|
||||
<p> If the node is a sequence, index must be integral.
|
||||
</p>
|
||||
<p> If the node is a mapping, remove the first key-value pair where
|
||||
key matches index.
|
||||
</p>
|
||||
<p> If the node is a mapping and no key matches index, nothing is removed
|
||||
and no exception is thrown. This ensures behavior siilar to D arrays
|
||||
and associative arrays.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">index</td><td class="paramDoc"><p>Index to remove at.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> NodeException if the node is not a collection, index is out
|
||||
of range or if a non-integral index is used on a sequence node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="opCmp"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">int</a> <a href="dyaml/node/Node.html#opCmp">opCmp</a>(ref const <a href="dyaml/node/Node.html">Node</a> node) const @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Compare with another _node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><div class="section members"><h2>Aliases</h2><table><tr><td><a href="dyaml/node/Node.html#as">as</a></td><td><pre><code><a href="dyaml/node/Node.html#get">get</a>
|
||||
</code></pre>
|
||||
</td><td><p>Shortcut for get().
|
||||
</p>
|
||||
</td></tr></table><h2>Functions</h2><table><tr><td><a href="dyaml/node/Node.html#this">this</a></td><td></td><td><p>Construct a Node from a value.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#this">this</a></td><td></td><td><p>Ditto.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#this">this</a></td><td></td><td><p>Construct a node from an _array.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#this">this</a></td><td></td><td><p>Construct a node from an associative _array.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#this">this</a></td><td></td><td><p>Construct a node from arrays of _keys and _values.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/node/Node.html#isValid">isValid</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span>, <span class="attr-pure">pure</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Is this node valid (initialized)?
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/node/Node.html#isScalar">isScalar</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Is this node a scalar value?
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/node/Node.html#isSequence">isSequence</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Is this node a sequence?
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/node/Node.html#isMapping">isMapping</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Is this node a mapping?
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/node/Node.html#isUserType">isUserType</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Is this node a user defined type?
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/node/Node.html#isNull">isNull</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Is this node null?
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/node/Node.html#tag">tag</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Return tag of the node.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#opEquals">opEquals</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Equality test.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/node/Node.html#get">get</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Get the value of the node as specified type.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/node/Node.html#get">get</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Ditto.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/node/Node.html#length">length</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span></span></span></td><td></td><td><p>If this is a collection, return its _length.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-ref">ref</span></span></span><a href="dyaml/node/Node.html#opIndex">opIndex</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Get the element at specified index.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#contains">contains</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Determine if a collection contains specified value.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#containsKey">containsKey</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Determine if a mapping contains specified key.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#opAssign">opAssign</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Assignment (shallow copy) by value.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#opAssign">opAssign</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Assignment (shallow copy) by reference.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#opIndexAssign">opIndexAssign</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Set element at specified index in a collection.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#opApply">opApply</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Foreach over a sequence, getting each element as T.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#opApply">opApply</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Foreach over a mapping, getting each key/value as K/V.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#add">add</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Add an element to a sequence.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#add">add</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Add a key-value pair to a mapping.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#opBinaryRight">opBinaryRight</a><span class="extrainfo"><span class="method-attribs"><span class="attr-system">@system</span></span></span></td><td></td><td><p>Determine whether a key is in a mapping, and access its value.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#remove">remove</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Remove first (if any) occurence of a value in a collection.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#removeAt">removeAt</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Remove element at the specified index of a collection.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/node/Node.html#opCmp">opCmp</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Compare with another _node.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
57
doc/html/api/dyaml/node/NodeException.html
Normal file
57
doc/html/api/dyaml/node/NodeException.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>NodeException</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/node.html>node</a>.</small><span class="highlight">NodeException</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/node.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/node.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/node.html">node</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public class NodeException : <a href="dyaml/exception/YAMLException.html">YAMLException</a>
|
||||
</code></pre>
|
||||
<div class="section "><p>Exception thrown at node related errors.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
68
doc/html/api/dyaml/node/YAMLNull.html
Normal file
68
doc/html/api/dyaml/node/YAMLNull.html
Normal file
|
@ -0,0 +1,68 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>YAMLNull</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/node.html>node</a>.</small><span class="highlight">YAMLNull</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/node.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/node.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/node.html">node</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public struct YAMLNull
|
||||
</code></pre>
|
||||
<div class="section "><p>Null YAML type. Used in nodes with _null values.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><a class="anchor" id="toString"></a><div class="symbol"><div class="description"><pre><code>public string <a href="dyaml/node/YAMLNull.html#toString">toString</a>() const pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Used for string conversion.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><div class="section members"><h2>Functions</h2><table><tr><td><a href="dyaml/node/YAMLNull.html#toString">toString</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Used for string conversion.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
179
doc/html/api/dyaml/representer.html
Normal file
179
doc/html/api/dyaml/representer.html
Normal file
|
@ -0,0 +1,179 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css"/>
|
||||
<script src="../highlight.pack.js"></script>
|
||||
<title>dyaml.representer</title>
|
||||
<base href="../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.representer</small>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/representer.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/representer.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/representer.html">representer</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><a class="anchor" id="representNull"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer.html#representNull">representNull</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
<a href="dyaml/representer/Representer.html">Representer</a> representer) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a _null _node as a _null YAML value.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representString"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer.html#representString">representString</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
<a href="dyaml/representer/Representer.html">Representer</a> representer) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a string _node as a string scalar.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representBytes"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer.html#representBytes">representBytes</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
<a href="dyaml/representer/Representer.html">Representer</a> representer) @system
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a bytes _node as a binary scalar.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representBool"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer.html#representBool">representBool</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
<a href="dyaml/representer/Representer.html">Representer</a> representer) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a bool _node as a bool scalar.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representLong"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer.html#representLong">representLong</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
<a href="dyaml/representer/Representer.html">Representer</a> representer) @system
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a long _node as an integer scalar.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representReal"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer.html#representReal">representReal</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
<a href="dyaml/representer/Representer.html">Representer</a> representer) @system
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a real _node as a floating point scalar.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representSysTime"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer.html#representSysTime">representSysTime</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
<a href="dyaml/representer/Representer.html">Representer</a> representer) @system
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a SysTime _node as a timestamp.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representNodes"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer.html#representNodes">representNodes</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
<a href="dyaml/representer/Representer.html">Representer</a> representer) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a sequence _node as sequence/set.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><a class="anchor" id="representNodes.pairs"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a>.Pair[] pairs
|
||||
</code></pre>
|
||||
<div class="section "><p>YAML sets are mapping with null values.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><div class="section members"><h2>Variables</h2><table><tr><td><a href="dyaml/representer.html#representNodes.pairs">pairs</a></td><td><pre><code><a href="dyaml/node/Node.html">Node</a>.Pair[]
|
||||
</code></pre>
|
||||
</td><td><p>YAML sets are mapping with null values.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><a class="anchor" id="representPairs"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer.html#representPairs">representPairs</a>(
|
||||
ref <a href="dyaml/node/Node.html">Node</a> node,
|
||||
<a href="dyaml/representer/Representer.html">Representer</a> representer) @system
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a mapping _node as map/ordered map/pairs.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><div class="description"><div class="section "><p>YAML node _representer. Prepares YAML nodes for output. A tutorial can be
|
||||
found <a href="../tutorials/custom_types.html">here</a>. <br/>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Code based on <a href="http://www.pyyaml.org">PyYAML</a>.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Functions</h2><table><tr><td><a href="dyaml/representer.html#representNull">representNull</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Represent a _null _node as a _null YAML value.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer.html#representString">representString</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Represent a string _node as a string scalar.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer.html#representBytes">representBytes</a><span class="extrainfo"><span class="method-attribs"><span class="attr-system">@system</span></span></span></td><td></td><td><p>Represent a bytes _node as a binary scalar.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer.html#representBool">representBool</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Represent a bool _node as a bool scalar.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer.html#representLong">representLong</a><span class="extrainfo"><span class="method-attribs"><span class="attr-system">@system</span></span></span></td><td></td><td><p>Represent a long _node as an integer scalar.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer.html#representReal">representReal</a><span class="extrainfo"><span class="method-attribs"><span class="attr-system">@system</span></span></span></td><td></td><td><p>Represent a real _node as a floating point scalar.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer.html#representSysTime">representSysTime</a><span class="extrainfo"><span class="method-attribs"><span class="attr-system">@system</span></span></span></td><td></td><td><p>Represent a SysTime _node as a timestamp.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer.html#representNodes">representNodes</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Represent a sequence _node as sequence/set.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer.html#representPairs">representPairs</a><span class="extrainfo"><span class="method-attribs"><span class="attr-system">@system</span></span></span></td><td></td><td><p>Represent a mapping _node as map/ordered map/pairs.
|
||||
</p>
|
||||
</td></tr></table><h2>Classes</h2><table><tr><td><a href="dyaml/representer/RepresenterException.html">RepresenterException</a></td><td></td><td><p>Exception thrown on Representer errors.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer/Representer.html">Representer</a></td><td></td><td><p>Represents YAML nodes as scalar, sequence and mapping nodes ready for output.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
433
doc/html/api/dyaml/representer/Representer.html
Normal file
433
doc/html/api/dyaml/representer/Representer.html
Normal file
|
@ -0,0 +1,433 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>Representer</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/representer.html>representer</a>.</small><span class="highlight">Representer</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/representer.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/representer.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/representer.html">representer</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public final class Representer
|
||||
</code></pre>
|
||||
<div class="section "><p>Represents YAML nodes as scalar, sequence and mapping nodes ready for output.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This class is used to add support for dumping of custom data types.
|
||||
</p>
|
||||
<p>It can also override default node formatting styles for output.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(const Flag!"useDefaultRepresenters" useDefaultRepresenters = Yes.useDefaultRepresenters) @safe pure
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a Representer.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">useDefaultRepresenters</td><td class="paramDoc"><p>Use default representer functions for default YAML types? This can be disabled to use custom representer functions for default types.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div></div><a class="anchor" id="defaultScalarStyle"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/representer/Representer.html#defaultScalarStyle">defaultScalarStyle</a>(<a href="dyaml/style/ScalarStyle.html">ScalarStyle</a> style) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Set default _style for scalars. If style is <code class="d_inlinecode">ScalarStyle.Invalid</code>, the _style is chosen automatically.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="defaultCollectionStyle"></a><div class="symbol"><div class="description"><pre><code>public @property <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/representer/Representer.html#defaultCollectionStyle">defaultCollectionStyle</a>(<a href="dyaml/style/CollectionStyle.html">CollectionStyle</a> style) pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Set default _style for collections. If style is <code class="d_inlinecode">CollectionStyle.Invalid</code>, the _style is chosen automatically.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="addRepresenter"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/representer/Representer.html#addRepresenter">addRepresenter</a>(T)(<a href="dyaml/node/Node.html">Node</a> function(
|
||||
ref <a href="dyaml/node/Node.html">Node</a>,
|
||||
<a href="dyaml/representer/Representer.html">Representer</a>) representer) @trusted pure
|
||||
</code></pre>
|
||||
<div class="section "><p>Add a function to represent nodes with a specific data type.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>The representer function takes references to a <code class="d_inlinecode">Node</code> storing the data
|
||||
type and to the <code class="d_inlinecode">Representer</code>. It returns the represented node and may
|
||||
throw a <code class="d_inlinecode">RepresenterException</code>. See the example for more information.
|
||||
</p>
|
||||
<p>Only one function may be specified for one data type. Default data
|
||||
types already have representer functions unless disabled in the
|
||||
<code class="d_inlinecode">Representer</code> constructor.
|
||||
</p>
|
||||
<p>Structs and classes must implement the <code class="d_inlinecode">opCmp()</code> operator for D:YAML
|
||||
support. The signature of the operator that must be implemented
|
||||
is <code class="d_inlinecode">const int opCmp(ref const MyStruct s)</code> for structs where
|
||||
<i>MyStruct</i> is the struct type, and <code class="d_inlinecode">int opCmp(Object o)</code> for
|
||||
classes. Note that the class <code class="d_inlinecode">opCmp()</code> should not alter the compared
|
||||
values - it is not const for compatibility reasons.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">representer</td><td class="paramDoc"><p>Representer function to add.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Examples</h2>
|
||||
|
||||
|
||||
Representing a simple struct:
|
||||
<pre><code>import std.string;
|
||||
|
||||
import dyaml.all;
|
||||
|
||||
struct MyStruct
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
//Any D:YAML type must have a custom opCmp operator.
|
||||
//This is used for ordering in mappings.
|
||||
const int opCmp(ref const MyStruct s)
|
||||
{
|
||||
if(x != s.x){return x - s.x;}
|
||||
if(y != s.y){return y - s.y;}
|
||||
if(z != s.z){return z - s.z;}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
<a href="dyaml/node/Node.html">Node</a> representMyStruct(ref <a href="dyaml/node/Node.html">Node</a> node, <a href="dyaml/representer/Representer.html">Representer</a> representer)
|
||||
{
|
||||
//The node is guaranteed to be MyStruct as we add representer for MyStruct.
|
||||
auto value = node.as!MyStruct;
|
||||
//Using custom scalar format, x:y:z.
|
||||
auto scalar = format("%s:%s:%s", value.x, value.y, value.z);
|
||||
//Representing as a scalar, with custom tag to specify <a href="dyaml/representer/Representer.html#this">this</a> data type.
|
||||
return representer.<a href="dyaml/representer/Representer.html#representScalar">representScalar</a>("!mystruct.tag", scalar);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
auto dumper = <a href="dyaml/dumper/Dumper.html">Dumper</a>("file.yaml");
|
||||
auto representer = new <a href="dyaml/representer/Representer.html">Representer</a>;
|
||||
representer.<a href="dyaml/representer/Representer.html#addRepresenter">addRepresenter</a>!MyStruct(&representMyStruct);
|
||||
dumper.representer = representer;
|
||||
dumper.dump(<a href="dyaml/node/Node.html">Node</a>(MyStruct(1,2,3)));
|
||||
}</code></pre>
|
||||
|
||||
Representing a class:
|
||||
<pre><code>import std.string;
|
||||
|
||||
import dyaml.all;
|
||||
|
||||
class MyClass
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
<a href="dyaml/representer/Representer.html#this">this</a>(int x, int y, int z)
|
||||
{
|
||||
<a href="dyaml/representer/Representer.html#this">this</a>.x = x;
|
||||
<a href="dyaml/representer/Representer.html#this">this</a>.y = y;
|
||||
<a href="dyaml/representer/Representer.html#this">this</a>.z = z;
|
||||
}
|
||||
|
||||
//Any D:YAML type must have a custom opCmp operator.
|
||||
//This is used for ordering in mappings.
|
||||
override int opCmp(Object o)
|
||||
{
|
||||
MyClass s = cast(MyClass)o;
|
||||
if(s is null){return -1;}
|
||||
if(x != s.x){return x - s.x;}
|
||||
if(y != s.y){return y - s.y;}
|
||||
if(z != s.z){return z - s.z;}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///Useful for <a href="dyaml/node/Node.html#as">Node.as</a>!string .
|
||||
override string toString()
|
||||
{
|
||||
return format("MyClass(%s, %s, %s)", x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
//Same as representMyStruct.
|
||||
<a href="dyaml/node/Node.html">Node</a> representMyClass(ref <a href="dyaml/node/Node.html">Node</a> node, <a href="dyaml/representer/Representer.html">Representer</a> representer)
|
||||
{
|
||||
//The node is guaranteed to be MyClass as we add representer for MyClass.
|
||||
auto value = node.as!MyClass;
|
||||
//Using custom scalar format, x:y:z.
|
||||
auto scalar = format("%s:%s:%s", value.x, value.y, value.z);
|
||||
//Representing as a scalar, with custom tag to specify <a href="dyaml/representer/Representer.html#this">this</a> data type.
|
||||
return representer.<a href="dyaml/representer/Representer.html#representScalar">representScalar</a>("!myclass.tag", scalar);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
auto dumper = <a href="dyaml/dumper/Dumper.html">Dumper</a>("file.yaml");
|
||||
auto representer = new <a href="dyaml/representer/Representer.html">Representer</a>;
|
||||
representer.<a href="dyaml/representer/Representer.html#addRepresenter">addRepresenter</a>!MyClass(&representMyClass);
|
||||
dumper.representer = representer;
|
||||
dumper.dump(<a href="dyaml/node/Node.html">Node</a>(new MyClass(1,2,3)));
|
||||
}</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representScalar"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer/Representer.html#representScalar">representScalar</a>(
|
||||
string tag,
|
||||
string scalar,
|
||||
<a href="dyaml/style/ScalarStyle.html">ScalarStyle</a> style = <a href="dyaml/style/ScalarStyle.html">ScalarStyle</a>.Invalid) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a _scalar with specified _tag.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This is used by representer functions that produce scalars.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">tag</td><td class="paramDoc"><p>Tag of the _scalar.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">scalar</td><td class="paramDoc"><p>Scalar value.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">style</td><td class="paramDoc"><p>Style of the _scalar. If invalid, default _style will be used. If the node was loaded before, previous _style will always be used.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> The represented node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Example</h2>
|
||||
|
||||
<pre><code>struct MyStruct
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
//Any D:YAML type must have a custom opCmp operator.
|
||||
//This is used for ordering in mappings.
|
||||
const int opCmp(ref const MyStruct s)
|
||||
{
|
||||
if(x != s.x){return x - s.x;}
|
||||
if(y != s.y){return y - s.y;}
|
||||
if(z != s.z){return z - s.z;}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
<a href="dyaml/node/Node.html">Node</a> representMyStruct(ref <a href="dyaml/node/Node.html">Node</a> node, <a href="dyaml/representer/Representer.html">Representer</a> representer)
|
||||
{
|
||||
auto value = node.as!MyStruct;
|
||||
auto scalar = format("%s:%s:%s", value.x, value.y, value.z);
|
||||
return representer.<a href="dyaml/representer/Representer.html#representScalar">representScalar</a>("!mystruct.tag", scalar);
|
||||
}</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representSequence"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer/Representer.html#representSequence">representSequence</a>(
|
||||
string tag,
|
||||
<a href="dyaml/node/Node.html">Node</a>[] sequence,
|
||||
<a href="dyaml/style/CollectionStyle.html">CollectionStyle</a> style = <a href="dyaml/style/CollectionStyle.html">CollectionStyle</a>.Invalid) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a _sequence with specified _tag, representing children first.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This is used by representer functions that produce sequences.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">tag</td><td class="paramDoc"><p>Tag of the _sequence.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">sequence</td><td class="paramDoc"><p>Sequence of nodes.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">style</td><td class="paramDoc"><p>Style of the _sequence. If invalid, default _style will be used. If the node was loaded before, previous _style will always be used.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> The represented node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> <code class="d_inlinecode">RepresenterException</code> if a child could not be represented.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Example</h2>
|
||||
|
||||
<pre><code>struct MyStruct
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
//Any D:YAML type must have a custom opCmp operator.
|
||||
//This is used for ordering in mappings.
|
||||
const int opCmp(ref const MyStruct s)
|
||||
{
|
||||
if(x != s.x){return x - s.x;}
|
||||
if(y != s.y){return y - s.y;}
|
||||
if(z != s.z){return z - s.z;}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
<a href="dyaml/node/Node.html">Node</a> representMyStruct(ref <a href="dyaml/node/Node.html">Node</a> node, <a href="dyaml/representer/Representer.html">Representer</a> representer)
|
||||
{
|
||||
auto value = node.as!MyStruct;
|
||||
auto nodes = [<a href="dyaml/node/Node.html">Node</a>(value.x), <a href="dyaml/node/Node.html">Node</a>(value.y), <a href="dyaml/node/Node.html">Node</a>(value.z)];
|
||||
//use flow style
|
||||
return representer.<a href="dyaml/representer/Representer.html#representSequence">representSequence</a>("!mystruct.tag", nodes,
|
||||
<a href="dyaml/style/CollectionStyle.html#Flow">CollectionStyle.Flow</a>);
|
||||
}</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="representMapping"></a><div class="symbol"><div class="description"><pre><code>public <a href="dyaml/node/Node.html">Node</a> <a href="dyaml/representer/Representer.html#representMapping">representMapping</a>(
|
||||
string tag,
|
||||
<a href="dyaml/node/Node.html">Node</a>.Pair[] pairs,
|
||||
<a href="dyaml/style/CollectionStyle.html">CollectionStyle</a> style = <a href="dyaml/style/CollectionStyle.html">CollectionStyle</a>.Invalid) @trusted
|
||||
</code></pre>
|
||||
<div class="section "><p>Represent a mapping with specified _tag, representing children first.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>This is used by representer functions that produce mappings.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">tag</td><td class="paramDoc"><p>Tag of the mapping.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">pairs</td><td class="paramDoc"><p>Key-value _pairs of the mapping.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">style</td><td class="paramDoc"><p>Style of the mapping. If invalid, default _style will be used. If the node was loaded before, previous _style will always be used.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Returns</h2>
|
||||
<p> The represented node.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Throws</h2>
|
||||
<p> <code class="d_inlinecode">RepresenterException</code> if a child could not be represented.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Example</h2>
|
||||
|
||||
<pre><code>struct MyStruct
|
||||
{
|
||||
int x, y, z;
|
||||
|
||||
//Any D:YAML type must have a custom opCmp operator.
|
||||
//This is used for ordering in mappings.
|
||||
const int opCmp(ref const MyStruct s)
|
||||
{
|
||||
if(x != s.x){return x - s.x;}
|
||||
if(y != s.y){return y - s.y;}
|
||||
if(z != s.z){return z - s.z;}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
<a href="dyaml/node/Node.html">Node</a> representMyStruct(ref <a href="dyaml/node/Node.html">Node</a> node, <a href="dyaml/representer/Representer.html">Representer</a> representer)
|
||||
{
|
||||
auto value = node.as!MyStruct;
|
||||
auto pairs = [<a href="dyaml/node/Node.html">Node</a>.Pair("x", value.x),
|
||||
<a href="dyaml/node/Node.html">Node</a>.Pair("y", value.y),
|
||||
<a href="dyaml/node/Node.html">Node</a>.Pair("z", value.z)];
|
||||
return representer.<a href="dyaml/representer/Representer.html#representMapping">representMapping</a>("!mystruct.tag", pairs);
|
||||
}</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><div class="section members"><h2>Functions</h2><table><tr><td><a href="dyaml/representer/Representer.html#this">this</a></td><td></td><td><p>Construct a Representer.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/representer/Representer.html#defaultScalarStyle">defaultScalarStyle</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Set default _style for scalars. If style is <code class="d_inlinecode">ScalarStyle.Invalid</code>, the _style is chosen automatically.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/representer/Representer.html#defaultCollectionStyle">defaultCollectionStyle</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Set default _style for collections. If style is <code class="d_inlinecode">CollectionStyle.Invalid</code>, the _style is chosen automatically.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer/Representer.html#addRepresenter">addRepresenter</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span>, <span class="attr-pure">pure</span></span></span></td><td></td><td><p>Add a function to represent nodes with a specific data type.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer/Representer.html#representScalar">representScalar</a><span class="extrainfo"><span class="method-attribs"><span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Represent a _scalar with specified _tag.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer/Representer.html#representSequence">representSequence</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Represent a _sequence with specified _tag, representing children first.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/representer/Representer.html#representMapping">representMapping</a><span class="extrainfo"><span class="method-attribs"><span class="attr-trusted">@trusted</span></span></span></td><td></td><td><p>Represent a mapping with specified _tag, representing children first.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
57
doc/html/api/dyaml/representer/RepresenterException.html
Normal file
57
doc/html/api/dyaml/representer/RepresenterException.html
Normal file
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>RepresenterException</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/representer.html>representer</a>.</small><span class="highlight">RepresenterException</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/representer.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/representer.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/representer.html">representer</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public class RepresenterException : <a href="dyaml/exception/YAMLException.html">YAMLException</a>
|
||||
</code></pre>
|
||||
<div class="section "><p>Exception thrown on Representer errors.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
67
doc/html/api/dyaml/resolver.html
Normal file
67
doc/html/api/dyaml/resolver.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css"/>
|
||||
<script src="../highlight.pack.js"></script>
|
||||
<title>dyaml.resolver</title>
|
||||
<base href="../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.resolver</small>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/resolver.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/resolver.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/resolver.html">resolver</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><div class="section "><p>Implements a class that resolves YAML tags. This can be used to implicitly
|
||||
resolve tags for custom data types, removing the need to explicitly
|
||||
specify tags in YAML. A tutorial can be found
|
||||
<a href="../tutorials/custom_types.html">here</a>. <br/>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Code based on <a href="http://www.pyyaml.org">PyYAML</a>.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Classes</h2><table><tr><td><a href="dyaml/resolver/Resolver.html">Resolver</a></td><td></td><td><p>Resolves YAML tags (data types).
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
173
doc/html/api/dyaml/resolver/Resolver.html
Normal file
173
doc/html/api/dyaml/resolver/Resolver.html
Normal file
|
@ -0,0 +1,173 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>Resolver</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/resolver.html>resolver</a>.</small><span class="highlight">Resolver</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/resolver.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/resolver.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/resolver.html">resolver</a></span>
|
||||
</li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public final class Resolver
|
||||
</code></pre>
|
||||
<div class="section "><p>Resolves YAML tags (data types).
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>Can be used to implicitly resolve custom data types of scalar values.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><a class="anchor" id="this"></a><div class="symbol"><div class="description"><pre><code>public this(Flag!"useDefaultImplicitResolvers" defaultImplicitResolvers = Yes.useDefaultImplicitResolvers) @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Construct a Resolver.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If you don't want to implicitly resolve default YAML tags/data types,
|
||||
you can use defaultImplicitResolvers to disable default resolvers.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">defaultImplicitResolvers</td><td class="paramDoc"><p>Use default YAML implicit resolvers?
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div></div><a class="anchor" id="addImplicitResolver"></a><div class="symbol"><div class="description"><pre><code>public <a href="http://dlang.org/type.html#basic-data-types">void</a> <a href="dyaml/resolver/Resolver.html#addImplicitResolver">addImplicitResolver</a>(
|
||||
string tag,
|
||||
Regex!char regexp,
|
||||
string first) pure @safe
|
||||
</code></pre>
|
||||
<div class="section "><p>Add an implicit scalar resolver.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><p>If a scalar matches regexp and starts with any character in first,
|
||||
its _tag is set to tag. If it matches more than one resolver _regexp
|
||||
resolvers added _first override ones added later. Default resolvers
|
||||
override any user specified resolvers, but they can be disabled in
|
||||
Resolver constructor.
|
||||
</p>
|
||||
<p>If a scalar is not resolved to anything, it is assigned the default
|
||||
YAML _tag for strings.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="section"><h2>Parameters</h2>
|
||||
<table class="params">
|
||||
<tr class="param"><td class="paramName">tag</td><td class="paramDoc"><p>Tag to resolve to.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">regexp</td><td class="paramDoc"><p>Regular expression the scalar must match to have this _tag.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr class="param"><td class="paramName">first</td><td class="paramDoc"><p>String of possible starting characters of the scalar.
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="section"><h2>Examples</h2>
|
||||
|
||||
|
||||
Resolve scalars starting with 'A' to !_tag :
|
||||
<pre><code>import std.regex;
|
||||
|
||||
import dyaml.all;
|
||||
|
||||
void main()
|
||||
{
|
||||
auto loader = <a href="dyaml/loader/Loader.html">Loader</a>("file.txt");
|
||||
auto resolver = new <a href="dyaml/resolver/Resolver.html">Resolver</a>();
|
||||
resolver.<a href="dyaml/resolver/Resolver.html#addImplicitResolver">addImplicitResolver</a>("!tag", std.regex.regex("A.*"), "A");
|
||||
loader.resolver = resolver;
|
||||
|
||||
//Note that we have no constructor from tag "!tag", so we can't
|
||||
//actually load anything that resolves to <a href="dyaml/resolver/Resolver.html#this">this</a> tag.
|
||||
//See <a href="dyaml/constructor/Constructor.html">Constructor</a> API documentation and tutorial for more information.
|
||||
|
||||
auto node = loader.load();
|
||||
}</code></pre>
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="defaultScalarTag"></a><div class="symbol"><div class="description"><pre><code>package @property Tag <a href="dyaml/resolver/Resolver.html#defaultScalarTag">defaultScalarTag</a>() const pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Return default scalar tag.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="defaultSequenceTag"></a><div class="symbol"><div class="description"><pre><code>package @property Tag <a href="dyaml/resolver/Resolver.html#defaultSequenceTag">defaultSequenceTag</a>() const pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Return default sequence tag.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><a class="anchor" id="defaultMappingTag"></a><div class="symbol"><div class="description"><pre><code>package @property Tag <a href="dyaml/resolver/Resolver.html#defaultMappingTag">defaultMappingTag</a>() const pure @safe nothrow
|
||||
</code></pre>
|
||||
<div class="section "><p>Return default mapping tag.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div></div><div class="section members"><h2>Functions</h2><table><tr><td><a href="dyaml/resolver/Resolver.html#this">this</a></td><td></td><td><p>Construct a Resolver.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/resolver/Resolver.html#addImplicitResolver">addImplicitResolver</a><span class="extrainfo"><span class="method-attribs"><span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span></span></span></td><td></td><td><p>Add an implicit scalar resolver.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/resolver/Resolver.html#defaultScalarTag">defaultScalarTag</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Return default scalar tag.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/resolver/Resolver.html#defaultSequenceTag">defaultSequenceTag</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Return default sequence tag.
|
||||
</p>
|
||||
</td></tr><tr><td><span class="extrainfo"><span class="attribs"><span class="attr-property">@property</span></span></span><a href="dyaml/resolver/Resolver.html#defaultMappingTag">defaultMappingTag</a><span class="extrainfo"><span class="method-attribs"><span class="attr-const">const</span>, <span class="attr-pure">pure</span>, <span class="attr-safe">@safe</span>, <span class="attr-nothrow">nothrow</span></span></span></td><td></td><td><p>Return default mapping tag.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
61
doc/html/api/dyaml/style.html
Normal file
61
doc/html/api/dyaml/style.html
Normal file
|
@ -0,0 +1,61 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../style.css"/>
|
||||
<script src="../highlight.pack.js"></script>
|
||||
<title>dyaml.style</title>
|
||||
<base href="../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.style</small>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/style.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/style.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/style.html">style</a></span>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><div class="section "><p>YAML node formatting styles.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Enums</h2><table><tr><td><a href="dyaml/style/ScalarStyle.html">ScalarStyle</a></td><td></td><td><p>Scalar styles.
|
||||
</p>
|
||||
</td></tr><tr><td><a href="dyaml/style/CollectionStyle.html">CollectionStyle</a></td><td></td><td><p>Collection styles.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
65
doc/html/api/dyaml/style/CollectionStyle.html
Normal file
65
doc/html/api/dyaml/style/CollectionStyle.html
Normal file
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>CollectionStyle</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/style.html>style</a>.</small><span class="highlight">CollectionStyle</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/style.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/style.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/style.html">style</a></span>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public enum CollectionStyle : <a href="http://dlang.org/type.html#basic-data-types">ubyte</a>
|
||||
</code></pre>
|
||||
<div class="section "><p>Collection styles.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Values</h2><table><tr><td>Invalid</td><td></td><td><p>Invalid (uninitialized) style
|
||||
</p>
|
||||
</td></tr><tr><td>Block</td><td></td><td><p>Block style.
|
||||
</p>
|
||||
</td></tr><tr><td>Flow</td><td></td><td><p>Flow style.
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
71
doc/html/api/dyaml/style/ScalarStyle.html
Normal file
71
doc/html/api/dyaml/style/ScalarStyle.html
Normal file
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../style.css"/>
|
||||
<script src="../../highlight.pack.js"></script>
|
||||
<title>ScalarStyle</title>
|
||||
<base href="../../"/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
<small>dyaml.<a href=dyaml/style.html>style</a>.</small><span class="highlight">ScalarStyle</span>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href="dyaml/style.html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href="dyaml/style.html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml" style='display:block'>
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li><span class=" selected">dyaml.<a href="dyaml/style.html">style</a></span>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<div class="aggregate-symbol"><div class="description"><pre><code>public enum ScalarStyle : <a href="http://dlang.org/type.html#basic-data-types">ubyte</a>
|
||||
</code></pre>
|
||||
<div class="section "><p>Scalar styles.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div><div class="section members"><h2>Values</h2><table><tr><td>Invalid</td><td></td><td><p>Invalid (uninitialized) style
|
||||
</p>
|
||||
</td></tr><tr><td>Literal</td><td></td><td><p><code class="prettyprint">|</code> (Literal block style)
|
||||
</p>
|
||||
</td></tr><tr><td>Folded</td><td></td><td><p><code class="prettyprint">></code> (Folded block style)
|
||||
</p>
|
||||
</td></tr><tr><td>Plain</td><td></td><td><p>Plain scalar
|
||||
</p>
|
||||
</td></tr><tr><td>SingleQuoted</td><td></td><td><p>Single quoted scalar
|
||||
</p>
|
||||
</td></tr><tr><td>DoubleQuoted</td><td></td><td><p>Double quoted scalar
|
||||
</p>
|
||||
</td></tr></table>
|
||||
</div>
|
||||
</div><script>hljs.initHighlightingOnLoad();</script>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
1
doc/html/api/highlight.pack.js
Normal file
1
doc/html/api/highlight.pack.js
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
|
@ -1,65 +1,84 @@
|
|||
<!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>D:YAML 0.5 API documentation - 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>D:YAML 0.5 API documentation</h1>
|
||||
<!-- Generated by Ddoc from ../doc/html/api/index.dd -->
|
||||
|
||||
|
||||
<p>This is the complete API documentation for D:YAML. It describes all classes, methods and
|
||||
global functions provided by the library. This is not the best place to start learning;
|
||||
it should serve as a reference when detailed information about D:YAML functionality is
|
||||
needed. To get started with D:YAML see <a href="../index.html">tutorials</a>.
|
||||
</p>
|
||||
|
||||
<p>Although each D:YAML module is documented on a separate page, you don't need to import
|
||||
individual modules. Importing the <i>yaml</i> module automatically imports all D:YAML
|
||||
functionality.
|
||||
</p>
|
||||
|
||||
|
||||
</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>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
<script src="highlight.pack.js"></script>
|
||||
<title>Index</title>
|
||||
<base href=""/>
|
||||
<script src="search.js"></script>
|
||||
<script src="show_hide.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="breadcrumbs">
|
||||
<table id="results"></table>
|
||||
<a href="index.html" class="home">⌂</a><input type="search" id="search" placeholder="Search" onkeyup="searchSubmit(this.value, event)"/>
|
||||
Main Page
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<a href=".html#hide-toc" class="hide" id="hide-toc">«</a>
|
||||
<a href=".html#show-toc" class="show" id="show-toc">»</a>
|
||||
<div id="toc-id" class="toc">
|
||||
<ul><li><span class="package" onclick="show_hide('dyaml');">dyaml</span>
|
||||
<ul id="dyaml">
|
||||
<li>dyaml.<a href="dyaml/constructor.html">constructor</a></li>
|
||||
<li>dyaml.<a href="dyaml/dumper.html">dumper</a></li>
|
||||
<li>dyaml.<a href="dyaml/exception.html">exception</a></li>
|
||||
<li>dyaml.<a href="dyaml/hacks.html">hacks</a></li>
|
||||
<li>dyaml.<a href="dyaml/linebreak.html">linebreak</a></li>
|
||||
<li>dyaml.<a href="dyaml/loader.html">loader</a></li>
|
||||
<li>dyaml.<a href="dyaml/node.html">node</a></li>
|
||||
<li>dyaml.<a href="dyaml/representer.html">representer</a></li>
|
||||
<li>dyaml.<a href="dyaml/resolver.html">resolver</a></li>
|
||||
<li>dyaml.<a href="dyaml/style.html">style</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div></div>
|
||||
<div class="content">
|
||||
<table class="module-list">
|
||||
<tr><td class="module-name"><a href="dyaml/constructor.html">dyaml.constructor</a></td><td><p>Class that processes YAML mappings, sequences and scalars into nodes. This can be
|
||||
used to add custom data types. A tutorial can be found
|
||||
<a href="../tutorials/custom_types.html">here</a>.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td class="module-name"><a href="dyaml/dumper.html">dyaml.dumper</a></td><td><p>YAML dumper.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td class="module-name"><a href="dyaml/exception.html">dyaml.exception</a></td><td><p>Exceptions thrown by D:YAML and _exception related code.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td class="module-name"><a href="dyaml/hacks.html">dyaml.hacks</a></td><td><p>Functionality that may sometimes be needed but allows unsafe or unstandard behavior, and should only be used in specific cases.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td class="module-name"><a href="dyaml/linebreak.html">dyaml.linebreak</a></td><td></td></tr>
|
||||
<tr><td class="module-name"><a href="dyaml/loader.html">dyaml.loader</a></td><td><p>Class used to load YAML documents.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td class="module-name"><a href="dyaml/node.html">dyaml.node</a></td><td><p>Node of a YAML document. Used to read YAML data once it's loaded,
|
||||
and to prepare data to emit.
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td class="module-name"><a href="dyaml/representer.html">dyaml.representer</a></td><td><p>YAML node _representer. Prepares YAML nodes for output. A tutorial can be
|
||||
found <a href="../tutorials/custom_types.html">here</a>. <br/>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td class="module-name"><a href="dyaml/resolver.html">dyaml.resolver</a></td><td><p>Implements a class that resolves YAML tags. This can be used to implicitly
|
||||
resolve tags for custom data types, removing the need to explicitly
|
||||
specify tags in YAML. A tutorial can be found
|
||||
<a href="../tutorials/custom_types.html">here</a>. <br/>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td class="module-name"><a href="dyaml/style.html">dyaml.style</a></td><td><p>YAML node formatting styles.
|
||||
</p>
|
||||
</td></tr>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
Generated with <a href="https://github.com/kiith-sa/harbored-mod">harbored-mod</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
179
doc/html/api/search.js
Normal file
179
doc/html/api/search.js
Normal file
|
@ -0,0 +1,179 @@
|
|||
"use strict";
|
||||
var items = [
|
||||
{"dyaml.node" : "dyaml/node.html"},
|
||||
{"dyaml.node.NodeException" : "dyaml/node/NodeException.html"},
|
||||
{"dyaml.node.YAMLNull" : "dyaml/node/YAMLNull.html"},
|
||||
{"dyaml.node.YAMLNull.toString" : "dyaml/node/YAMLNull.html#toString"},
|
||||
{"dyaml.node.Node" : "dyaml/node/Node.html"},
|
||||
{"dyaml.node.Node.this" : "dyaml/node/Node.html#this"},
|
||||
{"dyaml.node.Node.this" : "dyaml/node/Node.html#this"},
|
||||
{"dyaml.node.Node.this" : "dyaml/node/Node.html#this"},
|
||||
{"dyaml.node.Node.this" : "dyaml/node/Node.html#this"},
|
||||
{"dyaml.node.Node.this" : "dyaml/node/Node.html#this"},
|
||||
{"dyaml.node.Node.isValid" : "dyaml/node/Node.html#isValid"},
|
||||
{"dyaml.node.Node.isScalar" : "dyaml/node/Node.html#isScalar"},
|
||||
{"dyaml.node.Node.isSequence" : "dyaml/node/Node.html#isSequence"},
|
||||
{"dyaml.node.Node.isMapping" : "dyaml/node/Node.html#isMapping"},
|
||||
{"dyaml.node.Node.isUserType" : "dyaml/node/Node.html#isUserType"},
|
||||
{"dyaml.node.Node.isNull" : "dyaml/node/Node.html#isNull"},
|
||||
{"dyaml.node.Node.tag" : "dyaml/node/Node.html#tag"},
|
||||
{"dyaml.node.Node.opEquals" : "dyaml/node/Node.html#opEquals"},
|
||||
{"dyaml.node.Node.as" : "dyaml/node/Node.html#as"},
|
||||
{"dyaml.node.Node.get" : "dyaml/node/Node.html#get"},
|
||||
{"dyaml.node.Node.get" : "dyaml/node/Node.html#get"},
|
||||
{"dyaml.node.Node.length" : "dyaml/node/Node.html#length"},
|
||||
{"dyaml.node.Node.opIndex" : "dyaml/node/Node.html#opIndex"},
|
||||
{"dyaml.node.Node.contains" : "dyaml/node/Node.html#contains"},
|
||||
{"dyaml.node.Node.containsKey" : "dyaml/node/Node.html#containsKey"},
|
||||
{"dyaml.node.Node.opAssign" : "dyaml/node/Node.html#opAssign"},
|
||||
{"dyaml.node.Node.opAssign" : "dyaml/node/Node.html#opAssign"},
|
||||
{"dyaml.node.Node.opIndexAssign" : "dyaml/node/Node.html#opIndexAssign"},
|
||||
{"dyaml.node.Node.opApply" : "dyaml/node/Node.html#opApply"},
|
||||
{"dyaml.node.Node.opApply" : "dyaml/node/Node.html#opApply"},
|
||||
{"dyaml.node.Node.add" : "dyaml/node/Node.html#add"},
|
||||
{"dyaml.node.Node.add" : "dyaml/node/Node.html#add"},
|
||||
{"dyaml.node.Node.opBinaryRight" : "dyaml/node/Node.html#opBinaryRight"},
|
||||
{"dyaml.node.Node.remove" : "dyaml/node/Node.html#remove"},
|
||||
{"dyaml.node.Node.removeAt" : "dyaml/node/Node.html#removeAt"},
|
||||
{"dyaml.node.Node.opCmp" : "dyaml/node/Node.html#opCmp"},
|
||||
{"dyaml.resolver" : "dyaml/resolver.html"},
|
||||
{"dyaml.resolver.Resolver" : "dyaml/resolver/Resolver.html"},
|
||||
{"dyaml.resolver.Resolver.this" : "dyaml/resolver/Resolver.html#this"},
|
||||
{"dyaml.resolver.Resolver.addImplicitResolver" : "dyaml/resolver/Resolver.html#addImplicitResolver"},
|
||||
{"dyaml.resolver.Resolver.defaultScalarTag" : "dyaml/resolver/Resolver.html#defaultScalarTag"},
|
||||
{"dyaml.resolver.Resolver.defaultSequenceTag" : "dyaml/resolver/Resolver.html#defaultSequenceTag"},
|
||||
{"dyaml.resolver.Resolver.defaultMappingTag" : "dyaml/resolver/Resolver.html#defaultMappingTag"},
|
||||
{"dyaml.hacks" : "dyaml/hacks.html"},
|
||||
{"dyaml.hacks.scalarStyleHack" : "dyaml/hacks.html#scalarStyleHack"},
|
||||
{"dyaml.hacks.collectionStyleHack" : "dyaml/hacks.html#collectionStyleHack"},
|
||||
{"dyaml.hacks.scalarStyleHack" : "dyaml/hacks.html#scalarStyleHack"},
|
||||
{"dyaml.hacks.collectionStyleHack" : "dyaml/hacks.html#collectionStyleHack"},
|
||||
{"dyaml.dumper" : "dyaml/dumper.html"},
|
||||
{"dyaml.dumper.Dumper" : "dyaml/dumper/Dumper.html"},
|
||||
{"dyaml.dumper.Dumper.this" : "dyaml/dumper/Dumper.html#this"},
|
||||
{"dyaml.dumper.Dumper.this" : "dyaml/dumper/Dumper.html#this"},
|
||||
{"dyaml.dumper.Dumper.name" : "dyaml/dumper/Dumper.html#name"},
|
||||
{"dyaml.dumper.Dumper.resolver" : "dyaml/dumper/Dumper.html#resolver"},
|
||||
{"dyaml.dumper.Dumper.representer" : "dyaml/dumper/Dumper.html#representer"},
|
||||
{"dyaml.dumper.Dumper.canonical" : "dyaml/dumper/Dumper.html#canonical"},
|
||||
{"dyaml.dumper.Dumper.indent" : "dyaml/dumper/Dumper.html#indent"},
|
||||
{"dyaml.dumper.Dumper.textWidth" : "dyaml/dumper/Dumper.html#textWidth"},
|
||||
{"dyaml.dumper.Dumper.lineBreak" : "dyaml/dumper/Dumper.html#lineBreak"},
|
||||
{"dyaml.dumper.Dumper.encoding" : "dyaml/dumper/Dumper.html#encoding"},
|
||||
{"dyaml.dumper.Dumper.explicitStart" : "dyaml/dumper/Dumper.html#explicitStart"},
|
||||
{"dyaml.dumper.Dumper.explicitEnd" : "dyaml/dumper/Dumper.html#explicitEnd"},
|
||||
{"dyaml.dumper.Dumper.YAMLVersion" : "dyaml/dumper/Dumper.html#YAMLVersion"},
|
||||
{"dyaml.dumper.Dumper.tagDirectives" : "dyaml/dumper/Dumper.html#tagDirectives"},
|
||||
{"dyaml.dumper.Dumper.dump" : "dyaml/dumper/Dumper.html#dump"},
|
||||
{"dyaml.representer" : "dyaml/representer.html"},
|
||||
{"dyaml.representer.RepresenterException" : "dyaml/representer/RepresenterException.html"},
|
||||
{"dyaml.representer.Representer" : "dyaml/representer/Representer.html"},
|
||||
{"dyaml.representer.Representer.this" : "dyaml/representer/Representer.html#this"},
|
||||
{"dyaml.representer.Representer.defaultScalarStyle" : "dyaml/representer/Representer.html#defaultScalarStyle"},
|
||||
{"dyaml.representer.Representer.defaultCollectionStyle" : "dyaml/representer/Representer.html#defaultCollectionStyle"},
|
||||
{"dyaml.representer.Representer.addRepresenter" : "dyaml/representer/Representer.html#addRepresenter"},
|
||||
{"dyaml.representer.Representer.representScalar" : "dyaml/representer/Representer.html#representScalar"},
|
||||
{"dyaml.representer.Representer.representSequence" : "dyaml/representer/Representer.html#representSequence"},
|
||||
{"dyaml.representer.Representer.representMapping" : "dyaml/representer/Representer.html#representMapping"},
|
||||
{"dyaml.representer.representNull" : "dyaml/representer.html#representNull"},
|
||||
{"dyaml.representer.representString" : "dyaml/representer.html#representString"},
|
||||
{"dyaml.representer.representBytes" : "dyaml/representer.html#representBytes"},
|
||||
{"dyaml.representer.representBool" : "dyaml/representer.html#representBool"},
|
||||
{"dyaml.representer.representLong" : "dyaml/representer.html#representLong"},
|
||||
{"dyaml.representer.representReal" : "dyaml/representer.html#representReal"},
|
||||
{"dyaml.representer.representSysTime" : "dyaml/representer.html#representSysTime"},
|
||||
{"dyaml.representer.representNodes" : "dyaml/representer.html#representNodes"},
|
||||
{"dyaml.representer.representNodes.pairs" : "dyaml/representer.html#representNodes.pairs"},
|
||||
{"dyaml.representer.representPairs" : "dyaml/representer.html#representPairs"},
|
||||
{"dyaml.exception" : "dyaml/exception.html"},
|
||||
{"dyaml.exception.YAMLException" : "dyaml/exception/YAMLException.html"},
|
||||
{"dyaml.exception.YAMLException.this" : "dyaml/exception/YAMLException.html#this"},
|
||||
{"dyaml.linebreak" : "dyaml/linebreak.html"},
|
||||
{"dyaml.linebreak.LineBreak" : "dyaml/linebreak/LineBreak.html"},
|
||||
{"dyaml.loader" : "dyaml/loader.html"},
|
||||
{"dyaml.loader.Loader" : "dyaml/loader/Loader.html"},
|
||||
{"dyaml.loader.Loader.this" : "dyaml/loader/Loader.html#this"},
|
||||
{"dyaml.loader.Loader.fromString" : "dyaml/loader/Loader.html#fromString"},
|
||||
{"dyaml.loader.Loader.this" : "dyaml/loader/Loader.html#this"},
|
||||
{"dyaml.loader.Loader.name" : "dyaml/loader/Loader.html#name"},
|
||||
{"dyaml.loader.Loader.resolver" : "dyaml/loader/Loader.html#resolver"},
|
||||
{"dyaml.loader.Loader.constructor" : "dyaml/loader/Loader.html#constructor"},
|
||||
{"dyaml.loader.Loader.load" : "dyaml/loader/Loader.html#load"},
|
||||
{"dyaml.loader.Loader.loadAll" : "dyaml/loader/Loader.html#loadAll"},
|
||||
{"dyaml.loader.Loader.opApply" : "dyaml/loader/Loader.html#opApply"},
|
||||
{"dyaml.style" : "dyaml/style.html"},
|
||||
{"dyaml.style.ScalarStyle" : "dyaml/style/ScalarStyle.html"},
|
||||
{"dyaml.style.CollectionStyle" : "dyaml/style/CollectionStyle.html"},
|
||||
{"dyaml.constructor" : "dyaml/constructor.html"},
|
||||
{"dyaml.constructor.Constructor" : "dyaml/constructor/Constructor.html"},
|
||||
{"dyaml.constructor.Constructor.this" : "dyaml/constructor/Constructor.html#this"},
|
||||
{"dyaml.constructor.Constructor.addConstructorScalar" : "dyaml/constructor/Constructor.html#addConstructorScalar"},
|
||||
{"dyaml.constructor.Constructor.addConstructorSequence" : "dyaml/constructor/Constructor.html#addConstructorSequence"},
|
||||
{"dyaml.constructor.Constructor.addConstructorMapping" : "dyaml/constructor/Constructor.html#addConstructorMapping"},
|
||||
{"dyaml.constructor.constructNull" : "dyaml/constructor.html#constructNull"},
|
||||
{"dyaml.constructor.constructMerge" : "dyaml/constructor.html#constructMerge"},
|
||||
{"dyaml.constructor.constructBool" : "dyaml/constructor.html#constructBool"},
|
||||
{"dyaml.constructor.constructLong" : "dyaml/constructor.html#constructLong"},
|
||||
{"dyaml.constructor.constructReal" : "dyaml/constructor.html#constructReal"},
|
||||
{"dyaml.constructor.constructBinary" : "dyaml/constructor.html#constructBinary"},
|
||||
{"dyaml.constructor.constructTimestamp" : "dyaml/constructor.html#constructTimestamp"},
|
||||
{"dyaml.constructor.constructString" : "dyaml/constructor.html#constructString"},
|
||||
{"dyaml.constructor.getPairs" : "dyaml/constructor.html#getPairs"},
|
||||
{"dyaml.constructor.constructOrderedMap" : "dyaml/constructor.html#constructOrderedMap"},
|
||||
{"dyaml.constructor.constructPairs" : "dyaml/constructor.html#constructPairs"},
|
||||
{"dyaml.constructor.constructSet" : "dyaml/constructor.html#constructSet"},
|
||||
{"dyaml.constructor.constructSequence" : "dyaml/constructor.html#constructSequence"},
|
||||
{"dyaml.constructor.constructMap" : "dyaml/constructor.html#constructMap"},
|
||||
];
|
||||
function search(str) {
|
||||
var re = new RegExp(str.toLowerCase());
|
||||
var ret = {};
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var k = Object.keys(items[i])[0];
|
||||
if (re.test(k.toLowerCase()))
|
||||
ret[k] = items[i][k];
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function searchSubmit(value, event) {
|
||||
console.log("searchSubmit");
|
||||
var resultTable = document.getElementById("results");
|
||||
while (resultTable.firstChild)
|
||||
resultTable.removeChild(resultTable.firstChild);
|
||||
if (value === "" || event.keyCode == 27) {
|
||||
resultTable.style.display = "none";
|
||||
return;
|
||||
}
|
||||
resultTable.style.display = "block";
|
||||
var results = search(value);
|
||||
var keys = Object.keys(results);
|
||||
if (keys.length === 0) {
|
||||
var row = resultTable.insertRow();
|
||||
var td = document.createElement("td");
|
||||
var node = document.createTextNode("No results");
|
||||
td.appendChild(node);
|
||||
row.appendChild(td);
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var k = keys[i];
|
||||
var v = results[keys[i]];
|
||||
var link = document.createElement("a");
|
||||
link.href = v;
|
||||
link.textContent = k;
|
||||
link.attributes.id = "link" + i;
|
||||
var row = resultTable.insertRow();
|
||||
row.appendChild(link);
|
||||
}
|
||||
}
|
||||
|
||||
function hideSearchResults(event) {
|
||||
if (event.keyCode != 27)
|
||||
return;
|
||||
var resultTable = document.getElementById("results");
|
||||
while (resultTable.firstChild)
|
||||
resultTable.removeChild(resultTable.firstChild);
|
||||
resultTable.style.display = "none";
|
||||
}
|
||||
|
17
doc/html/api/show_hide.js
Normal file
17
doc/html/api/show_hide.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
window.onload = function(e)
|
||||
{
|
||||
var elems = document.querySelectorAll( "div.toc ul ul" );
|
||||
for( i in elems )
|
||||
{
|
||||
if( elems[i].style.display != "block" )
|
||||
elems[i].style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function show_hide(id)
|
||||
{
|
||||
var elem = document.getElementById( id );
|
||||
if( elem.style.display == "block" )
|
||||
elem.style.display = "none";
|
||||
else elem.style.display = "block";
|
||||
}
|
726
doc/html/api/style.css
Normal file
726
doc/html/api/style.css
Normal file
|
@ -0,0 +1,726 @@
|
|||
html {
|
||||
font-family: Verdana, "DejaVu Sans", sans;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: #333;
|
||||
border-left: .2em solid #333;
|
||||
border-right: .2em solid #333;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.main {
|
||||
overflow: hidden;
|
||||
background-color: #F8F8F8;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**** BREADCRUMBS ****/
|
||||
|
||||
div.breadcrumbs {
|
||||
color: white;
|
||||
background-color: #333;
|
||||
padding: 1.0em 0.5em 0.0em 0.5em;
|
||||
left: 0;
|
||||
box-sizing: border-box;
|
||||
text-align: right;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
font-size: 95%;
|
||||
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
div.breadcrumbs a {
|
||||
color: white;
|
||||
}
|
||||
|
||||
div.breadcrumbs span.highlight, div.breadcrumbs span a {
|
||||
color: #DAAF07;
|
||||
}
|
||||
|
||||
div.breadcrumbs input {
|
||||
width: 7em;
|
||||
margin-top: -0.1em;
|
||||
}
|
||||
|
||||
div.breadcrumbs small {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
/** narrow screen hacks **/
|
||||
@media only screen and (max-width: 1000px)
|
||||
{
|
||||
div.breadcrumbs span, div.breadcrumbs small {
|
||||
font-size: 80%;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width: 800px)
|
||||
{
|
||||
div.breadcrumbs small {
|
||||
display: none;
|
||||
position: fixed;
|
||||
}
|
||||
div.breadcrumbs span {
|
||||
font-size: 75%;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width: 600px)
|
||||
{
|
||||
div.breadcrumbs span {
|
||||
font-size: 65%;
|
||||
}
|
||||
}
|
||||
|
||||
div.breadcrumbs a.home {
|
||||
float: left;
|
||||
font-weight: bold;
|
||||
font-size: 200%;
|
||||
margin: 0 2% 0 0%;
|
||||
margin-top: -0.3em;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div.breadcrumbs input {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
||||
/* anchors need to compensate for the fixed-pos breadcrumbs */
|
||||
a.anchor
|
||||
{
|
||||
display: block;
|
||||
position: relative;
|
||||
top: -48px;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/** SEARCH RESULTS **/
|
||||
#results {
|
||||
position: absolute;
|
||||
max-height: 30em;
|
||||
background-color: #eee;
|
||||
box-shadow: 0 .25em .25em black;
|
||||
display: none;
|
||||
text-align: left;
|
||||
color: black;
|
||||
margin-top: 2em;
|
||||
font-size: 70%;
|
||||
z-index: 1000;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#results a {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
|
||||
/**** SIDEBAR, TABLE OF CONTENTS ****/
|
||||
|
||||
div.sidebar {
|
||||
margin-top: 48px;
|
||||
float: left;
|
||||
margin-right: -1px;
|
||||
border-right: 1px solid #D0D0D0;
|
||||
background-color: #F8F8F0;
|
||||
}
|
||||
|
||||
|
||||
div.toc {
|
||||
padding: 1.5em 0.75em 1em 0.5em;
|
||||
font-size: 0.55em;
|
||||
line-height: 1.95em;
|
||||
display:block;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px)
|
||||
{
|
||||
div.toc {
|
||||
font-size: 0.5em;
|
||||
padding: 1.5em 0.4em 1em 0.2em;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* stuff for showing/hiding the sidebar */
|
||||
.hide, .show {
|
||||
display: block;
|
||||
float: right;
|
||||
border-right: 1px solid #D0D0D0;
|
||||
border-bottom: 1px solid #D0D0D0;
|
||||
border-left: 1px solid #D0D0D0;
|
||||
/* to avoid having double border */
|
||||
margin-right: -1px;
|
||||
font-size: 1.1em;
|
||||
padding: 0 0.6em;
|
||||
}
|
||||
a.hide, a.show {
|
||||
color: #111;
|
||||
text-decoration: none;
|
||||
}
|
||||
.hide {
|
||||
background-color: #F8F8F8;
|
||||
border-bottom-left-radius:3px;
|
||||
border-right: 1px solid #F8F8F8;
|
||||
}
|
||||
.show {
|
||||
background-color: #F8F8F0;
|
||||
border-bottom-right-radius:3px;
|
||||
display: none;
|
||||
}
|
||||
.hide:target + .show {
|
||||
display: inline;
|
||||
position: absolute;
|
||||
}
|
||||
.hide:target {
|
||||
display: none;
|
||||
}
|
||||
.hide:target ~ .toc {
|
||||
display:none;
|
||||
}
|
||||
|
||||
|
||||
div.toc .toc-additional {
|
||||
border-bottom: 1px dashed #333;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
div.toc .toc-additional p, div.toc .toc-additional ul {
|
||||
margin: 0.4em 0;
|
||||
}
|
||||
|
||||
div.toc ul {
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
|
||||
div.toc ul ul {
|
||||
list-style-type: none;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
|
||||
|
||||
div.toc a {
|
||||
color: #111;
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px)
|
||||
{
|
||||
div.toc ul ul {
|
||||
padding-left: 0.2em;
|
||||
}
|
||||
}
|
||||
|
||||
div.toc span.package {
|
||||
cursor: pointer;
|
||||
line-height: 1.8em;
|
||||
font-weight: bold;
|
||||
border: 1px solid rgba(0, 0, 0, 0.12);
|
||||
border-radius: 2px;
|
||||
background-color: #F0F0F0;
|
||||
font-size: 1.25em;
|
||||
padding: 0 0.2em;
|
||||
/* counteracts the text movement caused by the padding */
|
||||
margin: 0 -0.2em;
|
||||
}
|
||||
|
||||
div.toc span.package a {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/* Highlight the current module/package */
|
||||
div.toc .selected {
|
||||
border-radius: 2px;
|
||||
background-color: #DAAF07 !important;
|
||||
padding: 0.325em 0.2em;
|
||||
/* counteracts the text movement caused by the padding */
|
||||
margin: -0.325em -0.2em;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**** MAIN CONTENT ****/
|
||||
|
||||
div.content {
|
||||
margin-top: 48px;
|
||||
padding: 1.5em;
|
||||
font-size: 90%;
|
||||
line-height: 130%;
|
||||
overflow: hidden;
|
||||
border-left: 1px solid #D0D0D0;
|
||||
}
|
||||
@media only screen and (max-width: 800px)
|
||||
{
|
||||
div.content {
|
||||
font-size: 82%;
|
||||
}
|
||||
}
|
||||
@media only screen and (max-width: 600px)
|
||||
{
|
||||
div.content {
|
||||
font-size: 70%;
|
||||
padding: 1.5em 0.3em 1.5em 0.5em;
|
||||
}
|
||||
}
|
||||
|
||||
div.content h2 {
|
||||
margin: .35em 0 .45em 0;
|
||||
padding-top: .35em;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
div.content h3 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
div.content tr {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.content table {
|
||||
border-collapse: collapse;
|
||||
border-bottom: 1px dashed #333;
|
||||
font-size: 90%;
|
||||
line-height: 130%;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
div.content td {
|
||||
border-top: 1px dashed #333;
|
||||
margin: 0;
|
||||
padding: .32em;
|
||||
}
|
||||
|
||||
div.content td:first-child {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* prevent function attribs from wrapping, make the cell wider instead */
|
||||
div.content td:first-child * {
|
||||
white-space: nowrap
|
||||
}
|
||||
|
||||
/* The first markdown-generated paragraph in e.g. Params tables shouldn't add any vertical
|
||||
* space
|
||||
*/
|
||||
div.content td p:first-child {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.content p strong {
|
||||
font-size: 92%;
|
||||
}
|
||||
|
||||
.paramName {
|
||||
font-weight: bold;
|
||||
width: 6em;
|
||||
}
|
||||
|
||||
div.section {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**** EXTRA INFO IN FUNCTION/CLASS/ETC LISTS ****/
|
||||
|
||||
div.content td .extrainfo{
|
||||
display: block;
|
||||
line-height: 105%;
|
||||
font-family: monospace;
|
||||
font-size: 85%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.extrainfo div {
|
||||
display: block;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.extrainfo .attr-const { color: blueviolet; }
|
||||
.extrainfo .attr-pure { color: darkslategray; }
|
||||
.extrainfo .attr-nothrow { color: brown; }
|
||||
.extrainfo .attr-nogc { color: darkgreen; }
|
||||
.extrainfo .attr-safe { color: darkblue; }
|
||||
.extrainfo .attr-trusted { color: firebrick; }
|
||||
.extrainfo .attr-system { color: darkred; }
|
||||
.extrainfo .attr-final { color: darkolivegreen; }
|
||||
.extrainfo .attr-ref { color: fuchsia; }
|
||||
|
||||
|
||||
/**** SYMBOLS (not used by the one-file-for-every-variable writer backend) ****/
|
||||
|
||||
div.aggregate-symbol {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
display: -webkit-flex;
|
||||
-webkit-flex-direction: column;
|
||||
}
|
||||
|
||||
div.aggregate-symbol div.description {
|
||||
order: -2;
|
||||
-webkit-order: -2;
|
||||
}
|
||||
|
||||
div.aggregate-symbol div.members {
|
||||
order: -1;
|
||||
-webkit-order: -1;
|
||||
padding-bottom: 0.3em;
|
||||
border-bottom: 10px solid #333;
|
||||
margin: 1em 0em 1.5em 0em;
|
||||
}
|
||||
|
||||
div.symbol {
|
||||
border-radius: 3px;
|
||||
border: 1px solid #d0d0d0;
|
||||
padding: 1px 0.4em;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
a.anchor:target + div.symbol {
|
||||
border: 2px solid #DAAF07;
|
||||
border-radius: 0;
|
||||
background-color: #F8F8F0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**** SECTION-SPECIFIC STYLES ****/
|
||||
|
||||
.section.seealso, .section.note, .section.imports {
|
||||
font-size: 75%;
|
||||
line-height: 135%;
|
||||
/* background-color: #F0F0C0; */
|
||||
/* background-color: #DA7F07; */
|
||||
/* background-color: #DA8F07; */
|
||||
/* background-color: #DA9F07; */
|
||||
background-color: #DAAF07;
|
||||
/* background-color: #EABD08; */
|
||||
padding: 1em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.section.seealso h2, .section.note h2 {
|
||||
display: block;
|
||||
float: left;
|
||||
margin: 0 0.7em -0.05em 0em;
|
||||
padding: 0;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.section.imports h2 {
|
||||
display: inline;
|
||||
margin: 0.5em 0em;
|
||||
padding: 0;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.section.seealso div.seealso-content, .section.note div.note-content {
|
||||
display: block;
|
||||
margin-left: 6.5em;
|
||||
}
|
||||
|
||||
.section.imports ul {
|
||||
margin: 0;
|
||||
list-style-type: none;
|
||||
padding-left: 1.5em;
|
||||
|
||||
-moz-column-count: 4;
|
||||
-moz-column-gap: 20px;
|
||||
-webkit-column-count: 4;
|
||||
-webkit-column-gap: 20px;
|
||||
column-count: 4;
|
||||
column-gap: 20px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1400px)
|
||||
{
|
||||
.section.imports ul {
|
||||
-moz-column-count: 3;
|
||||
-moz-column-gap: 20px;
|
||||
-webkit-column-count: 3;
|
||||
-webkit-column-gap: 20px;
|
||||
column-count: 3;
|
||||
column-gap: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1100px)
|
||||
{
|
||||
.section.imports ul {
|
||||
-moz-column-count: 2;
|
||||
-moz-column-gap: 13px;
|
||||
-webkit-column-count: 2;
|
||||
-webkit-column-gap: 13px;
|
||||
column-count: 2;
|
||||
column-gap: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 800px)
|
||||
{
|
||||
.section.imports ul {
|
||||
-moz-column-count: 1;
|
||||
-moz-column-gap: 7px;
|
||||
-webkit-column-count: 1;
|
||||
-webkit-column-gap: 7px;
|
||||
column-count: 1;
|
||||
column-gap: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.section.imports ul a {
|
||||
color: #111;
|
||||
}
|
||||
|
||||
|
||||
.section.seealso *:first-child, .section.note *:first-child {
|
||||
margin-top: 0em;
|
||||
}
|
||||
|
||||
.section.seealso ul, .section.note ul {
|
||||
padding-left: 1.5em;
|
||||
}
|
||||
|
||||
.section.seealso *:last-child, .section.note *:last-child {
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
/**** FOOTER ****/
|
||||
|
||||
footer
|
||||
{
|
||||
text-align: center;
|
||||
font-size: 60%;
|
||||
color: white;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
footer a
|
||||
{
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**** CODE ****/
|
||||
|
||||
pre {
|
||||
margin-top: 0.4em;
|
||||
}
|
||||
|
||||
/* DDoc code examples */
|
||||
code {
|
||||
background-color: #333;
|
||||
color: #eee;
|
||||
padding: 0.8em;
|
||||
border-radius: .1em;
|
||||
display: block;
|
||||
}
|
||||
|
||||
code a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-bottom: 1px dotted #888;
|
||||
}
|
||||
|
||||
/* hmod/libddoc errors */
|
||||
div.error {
|
||||
color: darkred;
|
||||
}
|
||||
|
||||
/* Markdown inline code and $(D code) */
|
||||
code.prettyprint, .d_inlinecode {
|
||||
font-family: monospace;
|
||||
color: #333;
|
||||
background-color:rgba(0,0,0,0.04);
|
||||
border-radius: .15em;
|
||||
border: 1px solid #C0C0C0;
|
||||
padding: 0.22em;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
code.prettyprint a {
|
||||
color: black;
|
||||
border-color: #777;
|
||||
}
|
||||
|
||||
/*do not affect the first <pre>, which is not in a section*/
|
||||
div.section pre > code {
|
||||
margin: .5em;
|
||||
border-radius: .1em;
|
||||
padding: 0.8em;
|
||||
}
|
||||
|
||||
div.section td pre {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
div.section td code:not(.prettyprint) {
|
||||
margin: 0;
|
||||
padding: 0.6em;
|
||||
}
|
||||
|
||||
.hljs {
|
||||
display: block; padding: 1em;
|
||||
background: #282B2E;
|
||||
overflow-x: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-literal,
|
||||
.hljs-change,
|
||||
.hljs-winutils,
|
||||
.hljs-flow,
|
||||
.lisp .hljs-title,
|
||||
.clojure .hljs-built_in,
|
||||
.nginx .hljs-title,
|
||||
.css .hljs-id,
|
||||
.tex .hljs-special {
|
||||
color: #93C763;
|
||||
}
|
||||
|
||||
.hljs-number {
|
||||
color: #FFCD22;
|
||||
}
|
||||
|
||||
.hljs {
|
||||
color: #E0E2E4;
|
||||
}
|
||||
|
||||
.css .hljs-tag,
|
||||
.css .hljs-pseudo {
|
||||
color: #D0D2B5;
|
||||
}
|
||||
|
||||
.hljs-attribute,
|
||||
.hljs .hljs-constant {
|
||||
color: #668BB0;
|
||||
}
|
||||
|
||||
.xml .hljs-attribute {
|
||||
color: #B3B689;
|
||||
}
|
||||
|
||||
.xml .hljs-tag .hljs-value {
|
||||
color: #E8E2B7;
|
||||
}
|
||||
|
||||
.hljs-code,
|
||||
.hljs-class .hljs-title,
|
||||
.hljs-header {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.hljs-class,
|
||||
.hljs-hexcolor {
|
||||
color: #93C763;
|
||||
}
|
||||
|
||||
.hljs-regexp {
|
||||
color: #D39745;
|
||||
}
|
||||
|
||||
.hljs-at_rule,
|
||||
.hljs-at_rule .hljs-keyword {
|
||||
color: #A082BD;
|
||||
}
|
||||
|
||||
.hljs-doctype {
|
||||
color: #557182;
|
||||
}
|
||||
|
||||
.hljs-link_url,
|
||||
.hljs-tag,
|
||||
.hljs-tag .hljs-title,
|
||||
.hljs-bullet,
|
||||
.hljs-subst,
|
||||
.hljs-emphasis,
|
||||
.haskell .hljs-type,
|
||||
.hljs-preprocessor,
|
||||
.hljs-pragma,
|
||||
.ruby .hljs-class .hljs-parent,
|
||||
.hljs-built_in,
|
||||
.sql .hljs-aggregate,
|
||||
.django .hljs-template_tag,
|
||||
.django .hljs-variable,
|
||||
.smalltalk .hljs-class,
|
||||
.hljs-javadoc,
|
||||
.django .hljs-filter .hljs-argument,
|
||||
.smalltalk .hljs-localvars,
|
||||
.smalltalk .hljs-array,
|
||||
.hljs-attr_selector,
|
||||
.hljs-pseudo,
|
||||
.hljs-addition,
|
||||
.hljs-stream,
|
||||
.hljs-envvar,
|
||||
.apache .hljs-tag,
|
||||
.apache .hljs-cbracket,
|
||||
.tex .hljs-command,
|
||||
.hljs-prompt {
|
||||
color: #8CBBAD;
|
||||
}
|
||||
|
||||
.hljs-string {
|
||||
color: #EC7600;
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.java .hljs-annotation,
|
||||
.hljs-blockquote,
|
||||
.hljs-horizontal_rule,
|
||||
.python .hljs-decorator,
|
||||
.hljs-template_comment,
|
||||
.hljs-pi,
|
||||
.hljs-deletion,
|
||||
.hljs-shebang,
|
||||
.apache .hljs-sqbracket,
|
||||
.tex .hljs-formula {
|
||||
color: #818E96;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-literal,
|
||||
.css .hljs-id,
|
||||
.hljs-phpdoc,
|
||||
.hljs-title,
|
||||
.hljs-header,
|
||||
.haskell .hljs-type,
|
||||
.vbscript .hljs-built_in,
|
||||
.sql .hljs-aggregate,
|
||||
.rsl .hljs-built_in,
|
||||
.smalltalk .hljs-class,
|
||||
.diff .hljs-header,
|
||||
.hljs-chunk,
|
||||
.hljs-winutils,
|
||||
.bash .hljs-variable,
|
||||
.apache .hljs-tag,
|
||||
.tex .hljs-special,
|
||||
.hljs-request,
|
||||
.hljs-at_rule .hljs-keyword,
|
||||
.hljs-status {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.coffeescript .javascript,
|
||||
.javascript .xml,
|
||||
.tex .hljs-formula,
|
||||
.xml .javascript,
|
||||
.xml .vbscript,
|
||||
.xml .css,
|
||||
.xml .hljs-cdata {
|
||||
opacity: 0.5;
|
||||
}
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
<div class="section" id="welcome-to-d-yaml-documentation">
|
||||
<h1>Welcome to D:YAML documentation!<a class="headerlink" href="#welcome-to-d-yaml-documentation" title="Permalink to this headline">¶</a></h1>
|
||||
<p><a class="reference external" href="api/index.html">API Documentation</a></p>
|
||||
<p>API Documentation <a class="reference external" href="http://ddocs.org/dyaml/~master/index.html">(online)</a> <a class="reference external" href="api/index.html">(local copy)</a></p>
|
||||
<p>Tutorials:</p>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -273,7 +273,7 @@ course, you will need to use an identical <em>Resolver</em> when loading the out
|
|||
<span class="c1">//The node is guaranteed to be Color as we add representer for Color.</span>
|
||||
<span class="n">Color</span> <span class="n">color</span> <span class="p">=</span> <span class="n">node</span><span class="p">.</span><span class="n">as</span><span class="p">!</span><span class="n">Color</span><span class="p">;</span>
|
||||
|
||||
<span class="k">static</span> <span class="n">immutable</span> <span class="n">hex</span> <span class="p">=</span> <span class="s">"0123456789ABCDEF"</span><span class="p">;</span>
|
||||
<span class="k">static</span> <span class="k">immutable</span> <span class="n">hex</span> <span class="p">=</span> <span class="s">"0123456789ABCDEF"</span><span class="p">;</span>
|
||||
|
||||
<span class="c1">//Using the color format from the Constructor example.</span>
|
||||
<span class="nb">string</span> <span class="n">scalar</span><span class="p">;</span>
|
||||
|
|
|
@ -157,7 +157,7 @@ doesn’t affect the meaning of YAML contents.</p>
|
|||
<span class="nt">"mainSourceFile"</span><span class="p">:</span> <span class="s2">"main.d"</span><span class="p">,</span>
|
||||
<span class="nt">"dependencies"</span><span class="p">:</span>
|
||||
<span class="p">{</span>
|
||||
<span class="nt">"dyaml"</span><span class="p">:</span> <span class="p">{</span> <span class="nt">"version"</span> <span class="p">:</span> <span class="s2">"~>0.5.0"</span><span class="p">},</span>
|
||||
<span class="nt">"dyaml"</span><span class="p">:</span> <span class="p">{</span> <span class="nt">"version"</span> <span class="p">:</span> <span class="s2">"~>0.5.0"</span> <span class="p">},</span>
|
||||
<span class="p">},</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
|
@ -238,4 +238,4 @@ example in the <tt class="docutils literal"><span class="pre">example/getting_st
|
|||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
Loading…
Reference in a new issue