ROSE  0.11.145.0
Classes | Functions
Sawyer::Yaml Namespace Reference

Description

YAML parser and unparser.

Classes

class  ConstIterator
 Iterator over constant YAML nodes. More...
 
class  Exception
 Base class for YAML exceptions. More...
 
class  InternalException
 Internal exception. More...
 
class  Iterator
 Iterator over YAML nodes. More...
 
class  Node
 YAML node. More...
 
class  OperationException
 Operation exception. More...
 
class  ParsingException
 Parsing exception. More...
 
struct  SerializeConfig
 Serialization configuration structure, describing output behavior. More...
 

Functions

void Parse (Node &root, const boost::filesystem::path &)
 
void Parse (Node &root, std::istream &)
 
void Parse (Node &root, const std::string &data)
 
void Parse (Node &root, const char *data, const size_t size)
 
Yaml::Node parse (const boost::filesystem::path &)
 Parse YAML from file. More...
 
Yaml::Node parse (std::istream &)
 Parse YAML from stream. More...
 
void Serialize (const Node &root, std::ostream &stream, const SerializeConfig &config=SerializeConfig())
 
Yaml::Node parse (const std::string &)
 Parse YAML from string. More...
 
Yaml::Node parse (const char *)
 Parse YAML from string. More...
 
void serialize (const Node &root, const char *filename, const SerializeConfig &config=SerializeConfig())
 Serialize YAML. More...
 
void serialize (const Node &root, std::ostream &stream, const SerializeConfig &config=SerializeConfig())
 Serialize YAML. More...
 
void serialize (const Node &root, std::string &string, const SerializeConfig &config=SerializeConfig())
 Serialize YAML. More...
 

Function Documentation

Yaml::Node Sawyer::Yaml::parse ( const boost::filesystem::path &  )

Parse YAML from file.

Yaml::Node Sawyer::Yaml::parse ( std::istream &  )

Parse YAML from stream.

Yaml::Node Sawyer::Yaml::parse ( const std::string &  s)

Parse YAML from string.

Parse YAML from string.

The input string must parse as a integer without leading white space and without trailing characters. For signed integer types, the integer may be immediately preceded by a minus ("-") or plus ("+") sign. The integer part may be preceded by a radix indicator: "0x" for hexadecimal or "0b" for binary. Octal and other bases are not supported. Digits may be separated from one another (or from the radix specifier) by a single underscore, as in "0b_0001_0010_0011_0100_0101_0110_0111_1000".

The IntegralType must be a signed or unsigned integer type of any width. The uint8_t and int8_t types are also accepted although they're aliases for unsigned char and signed char .

If a syntax error occurs, or if the magnitude of the value is too large to be represented by the specified IntegralType, then an error message is returned. The text of the message begins with either "syntax error:" or "overflow error:".

Definition at line 60 of file Parse.h.

References Sawyer::toDigit().

Yaml::Node Sawyer::Yaml::parse ( const char *  )

Parse YAML from string.

Parse YAML from string.

The input string must parse as a integer without leading white space and without trailing characters. For signed integer types, the integer may be immediately preceded by a minus ("-") or plus ("+") sign. The integer part may be preceded by a radix indicator: "0x" for hexadecimal or "0b" for binary. Octal and other bases are not supported. Digits may be separated from one another (or from the radix specifier) by a single underscore, as in "0b_0001_0010_0011_0100_0101_0110_0111_1000".

The IntegralType must be a signed or unsigned integer type of any width. The uint8_t and int8_t types are also accepted although they're aliases for unsigned char and signed char .

If a syntax error occurs, or if the magnitude of the value is too large to be represented by the specified IntegralType, then an error message is returned. The text of the message begins with either "syntax error:" or "overflow error:".

void Sawyer::Yaml::serialize ( const Node root,
const char *  filename,
const SerializeConfig config = SerializeConfig() 
)

Serialize YAML.

Parameters
rootRoot node to serialize.
filenamePath of output file.
streamOutput stream.
stringString of output data.
configSerialization configurations.
Exceptions
InternalExceptionAn internal error occurred.
OperationExceptionIf filename or buffer pointer is invalid. If config is invalid.
void Sawyer::Yaml::serialize ( const Node root,
std::ostream &  stream,
const SerializeConfig config = SerializeConfig() 
)

Serialize YAML.

Parameters
rootRoot node to serialize.
filenamePath of output file.
streamOutput stream.
stringString of output data.
configSerialization configurations.
Exceptions
InternalExceptionAn internal error occurred.
OperationExceptionIf filename or buffer pointer is invalid. If config is invalid.
void Sawyer::Yaml::serialize ( const Node root,
std::string &  string,
const SerializeConfig config = SerializeConfig() 
)

Serialize YAML.

Parameters
rootRoot node to serialize.
filenamePath of output file.
streamOutput stream.
stringString of output data.
configSerialization configurations.
Exceptions
InternalExceptionAn internal error occurred.
OperationExceptionIf filename or buffer pointer is invalid. If config is invalid.