<!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.1 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.1 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.exception.html">dyaml.exception</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.resolver.html">dyaml.resolver</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">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">this(in bool <b>defaultImplicitResolvers</b> = true); </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>bool <b>defaultImplicitResolvers</b></td> <td valign=top>Use default YAML implicit resolvers?</td></tr> </table></div> </dd> <dt class="d_decl">void <a name="addImplicitResolver"></a><span class="ddoc_psymbol">addImplicitResolver</span>(string <b>tag</b>, Regex!(char) <b>regexp</b>, in string <b>first</b>); </dt> <dd><p>Add an implicit scalar resolver. </p> <p>If a scalar matches <b>regexp</b> and starts with one of the characters in <b>first</b>, its tag is set to <b>tag</b>. If the scalar matches more than one resolver regular expression, resolvers added first override those added later. Default resolvers override any user specified resolvers. <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> </dd> </dl> </dd> </dl> </div> <div id="copyright"> Copyright © Ferdinand Majerech 2011. Based on <a href="http://www.pyyaml.org">PyYAML</a> by Kirill Simonov. | Page generated by Autodoc and <a href="http://www.digitalmars.com/d/2.0/ddoc.html">Ddoc</a>. </div> </body> </html>