Doc fixes

This commit is contained in:
Ferdinand Majerech 2015-02-21 14:31:55 +01:00
parent 7f6b7cc2c3
commit 05270e5f60
8 changed files with 55 additions and 54 deletions

View file

@ -66,11 +66,11 @@ private alias ConstructorException Error;
final class Constructor final class Constructor
{ {
private: private:
/// Constructor functions from scalars. // Constructor functions from scalars.
Node.Value delegate(ref Node)[Tag] fromScalar_; Node.Value delegate(ref Node)[Tag] fromScalar_;
/// Constructor functions from sequences. // Constructor functions from sequences.
Node.Value delegate(ref Node)[Tag] fromSequence_; Node.Value delegate(ref Node)[Tag] fromSequence_;
/// Constructor functions from mappings. // Constructor functions from mappings.
Node.Value delegate(ref Node)[Tag] fromMapping_; Node.Value delegate(ref Node)[Tag] fromMapping_;
public: public:

View file

@ -5,7 +5,7 @@
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
/** /**
* YAML _dumper. * YAML dumper.
* *
* Code based on $(LINK2 http://www.pyyaml.org, PyYAML). * Code based on $(LINK2 http://www.pyyaml.org, PyYAML).
*/ */
@ -113,34 +113,34 @@ struct Dumper
} }
private: private:
///Resolver to resolve tags. //Resolver to resolve tags.
Resolver resolver_; Resolver resolver_;
///Representer to represent data types. //Representer to represent data types.
Representer representer_; Representer representer_;
///Stream to write to. //Stream to write to.
Stream stream_; Stream stream_;
///Write scalars in canonical form? //Write scalars in canonical form?
bool canonical_; bool canonical_;
///Indentation width. //Indentation width.
int indent_ = 2; int indent_ = 2;
///Preferred text width. //Preferred text width.
uint textWidth_ = 80; uint textWidth_ = 80;
///Line break to use. //Line break to use.
LineBreak lineBreak_ = LineBreak.Unix; LineBreak lineBreak_ = LineBreak.Unix;
///Character encoding to use. //Character encoding to use.
Encoding encoding_ = Encoding.UTF_8; Encoding encoding_ = Encoding.UTF_8;
///YAML version string. //YAML version string.
string YAMLVersion_ = "1.1"; string YAMLVersion_ = "1.1";
///Tag directives to use. //Tag directives to use.
TagDirective[] tags_ = null; TagDirective[] tags_ = null;
///Always write document start? //Always write document start?
Flag!"explicitStart" explicitStart_ = No.explicitStart; Flag!"explicitStart" explicitStart_ = No.explicitStart;
///Always write document end? //Always write document end?
Flag!"explicitEnd" explicitEnd_ = No.explicitEnd; Flag!"explicitEnd" explicitEnd_ = No.explicitEnd;
///Name of the output file or stream, used in error messages. //Name of the output file or stream, used in error messages.
string name_ = "<unknown>"; string name_ = "<unknown>";
public: public:

View file

@ -46,11 +46,12 @@ unittest
assert(node.scalarStyleHack() == ScalarStyle.Invalid); assert(node.scalarStyleHack() == ScalarStyle.Invalid);
} }
/// Get the collection style a YAML node had in the file it was loaded from. /** Get the collection style a YAML node had in the file it was loaded from.
/// *
/// May only be called on collection nodes (nodes where node.isScalar() != true). * May only be called on collection nodes (nodes where node.isScalar() != true).
/// *
/// See_Also: scalarStyleHack * See_Also: scalarStyleHack
*/
CollectionStyle collectionStyleHack(ref const(Node) node) @safe nothrow CollectionStyle collectionStyleHack(ref const(Node) node) @safe nothrow
{ {
assert(!node.isScalar, "Trying to get collection style of a scalar node"); assert(!node.isScalar, "Trying to get collection style of a scalar node");
@ -64,12 +65,12 @@ unittest
} }
/// Set the scalar style node should have when written to a file. /** Set the scalar style node should have when written to a file.
/// *
/// Setting the style might be useful when generating YAML or reformatting existing * Setting the style might be useful when generating YAML or reformatting existing files.
/// files. *
/// * May only be called on scalar nodes (nodes where node.isScalar() == true).
/// May only be called on scalar nodes (nodes where node.isScalar() == true). */
void scalarStyleHack(ref Node node, const ScalarStyle rhs) @safe nothrow void scalarStyleHack(ref Node node, const ScalarStyle rhs) @safe nothrow
{ {
assert(node.isScalar, "Trying to set scalar style of a non-scalar node"); assert(node.isScalar, "Trying to set scalar style of a non-scalar node");
@ -84,12 +85,12 @@ unittest
assert(node.scalarStyleHack() == ScalarStyle.DoubleQuoted); assert(node.scalarStyleHack() == ScalarStyle.DoubleQuoted);
} }
/// Set the collection style node should have when written to a file. /** Set the collection style node should have when written to a file.
/// *
/// Setting the style might be useful when generating YAML or reformatting existing * Setting the style might be useful when generating YAML or reformatting existing files.
/// files. *
/// * May only be called on collection nodes (nodes where node.isScalar() != true).
/// May only be called on collection nodes (nodes where node.isScalar() != true). */
void collectionStyleHack(ref Node node, const CollectionStyle rhs) @safe nothrow void collectionStyleHack(ref Node node, const CollectionStyle rhs) @safe nothrow
{ {
assert(!node.isScalar, "Trying to set collection style of a scalar node"); assert(!node.isScalar, "Trying to set collection style of a scalar node");

View file

@ -100,19 +100,19 @@ import dyaml.token;
struct Loader struct Loader
{ {
private: private:
/// Reads character data from a stream. // Reads character data from a stream.
Reader reader_; Reader reader_;
/// Processes character data to YAML tokens. // Processes character data to YAML tokens.
Scanner scanner_; Scanner scanner_;
/// Processes tokens to YAML events. // Processes tokens to YAML events.
Parser parser_; Parser parser_;
/// Resolves tags (data types). // Resolves tags (data types).
Resolver resolver_; Resolver resolver_;
/// Constructs YAML data types. // Constructs YAML data types.
Constructor constructor_; Constructor constructor_;
/// Name of the input file or stream, used in error messages. // Name of the input file or stream, used in error messages.
string name_ = "<unknown>"; string name_ = "<unknown>";
/// Are we done loading? // Are we done loading?
bool done_ = false; bool done_ = false;
public: public:

View file

@ -118,7 +118,7 @@ package class YAMLContainer(T) if (!Node.allowed!T): YAMLObject
} }
/// Key-value pair of YAML nodes, used in mappings. // Key-value pair of YAML nodes, used in mappings.
private struct Pair private struct Pair
{ {
public: public:
@ -204,9 +204,9 @@ struct Node
} }
private: private:
/// Stored value. // Stored value.
Value value_; Value value_;
/// Start position of the node. // Start position of the node.
Mark startMark_; Mark startMark_;
package: package:

View file

@ -48,11 +48,11 @@ class RepresenterException : YAMLException
final class Representer final class Representer
{ {
private: private:
///Representer functions indexed by types. // Representer functions indexed by types.
Node function(ref Node, Representer)[TypeInfo] representers_; Node function(ref Node, Representer)[TypeInfo] representers_;
///Default style for scalar nodes. // Default style for scalar nodes.
ScalarStyle defaultScalarStyle_ = ScalarStyle.Invalid; ScalarStyle defaultScalarStyle_ = ScalarStyle.Invalid;
///Default style for collection nodes. // Default style for collection nodes.
CollectionStyle defaultCollectionStyle_ = CollectionStyle.Invalid; CollectionStyle defaultCollectionStyle_ = CollectionStyle.Invalid;
public: public:

View file

@ -34,14 +34,14 @@ import dyaml.tag;
final class Resolver final class Resolver
{ {
private: private:
///Default tag to use for scalars. // Default tag to use for scalars.
Tag defaultScalarTag_; Tag defaultScalarTag_;
///Default tag to use for sequences. // Default tag to use for sequences.
Tag defaultSequenceTag_; Tag defaultSequenceTag_;
///Default tag to use for mappings. // Default tag to use for mappings.
Tag defaultMappingTag_; Tag defaultMappingTag_;
/** /*
* Arrays of scalar resolver tuples indexed by starting character of a scalar. * Arrays of scalar resolver tuples indexed by starting character of a scalar.
* *
* Each tuple stores regular expression the scalar must match, * Each tuple stores regular expression the scalar must match,
@ -222,7 +222,7 @@ final class Resolver
@property Tag defaultMappingTag() const pure @safe nothrow {return defaultMappingTag_;} @property Tag defaultMappingTag() const pure @safe nothrow {return defaultMappingTag_;}
private: private:
///Add default implicit resolvers. // Add default implicit resolvers.
void addImplicitResolvers() @safe void addImplicitResolvers() @safe
{ {
addImplicitResolver("tag:yaml.org,2002:bool", addImplicitResolver("tag:yaml.org,2002:bool",

View file

@ -12,8 +12,8 @@ module dyaml.style;
enum ScalarStyle : ubyte enum ScalarStyle : ubyte
{ {
Invalid = 0, /// Invalid (uninitialized) style Invalid = 0, /// Invalid (uninitialized) style
Literal, /// | (Literal block style) Literal, /// `|` (Literal block style)
Folded, /// > (Folded block style) Folded, /// `>` (Folded block style)
Plain, /// Plain scalar Plain, /// Plain scalar
SingleQuoted, /// Single quoted scalar SingleQuoted, /// Single quoted scalar
DoubleQuoted /// Double quoted scalar DoubleQuoted /// Double quoted scalar