dyaml/doc/html/api/dyaml/hacks.html
Ferdinand Majerech 0a0e966a26 Regenerated docs
2015-02-21 14:36:06 +01:00

165 lines
7.5 KiB
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>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">&#171;</a>
<a href="dyaml/hacks.html#show-toc" class="show" id="show-toc">&#187;</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>