Qore YAML Module  0.4
 All Namespaces Functions Variables Groups
YAML Functions

Functions

hash Qore::YAML::getYAMLInfo ()
 Returns version information about libyaml being used by the yaml module. More...
 
string Qore::YAML::makeYAML (any data, int flags=Qore::YAML::None, softint width=-1, softint indent=2)
 Creates a YAML string from Qore data. More...
 
any Qore::YAML::parseYAML (string yaml)
 Parses a YAML string and returns the corresponding Qore value or data structure. More...
 

Detailed Description

Function Documentation

hash Qore::YAML::getYAMLInfo ( )

Returns version information about libyaml being used by the yaml module.

Returns
a hash with keys as in the following table:
  • version: the version string for the library, ex: "0.1.3"
  • major: the integer major version for the library, ex: 0
  • minor: the integer minor version for the library, ex: 1
  • patch: the integer patch version for the library, ex: 3
Code Flags:
CONSTANT
Example:
my hash $hash = getYAMLInfo();
string Qore::YAML::makeYAML ( any  data,
int  flags = Qore::YAML::None,
softint  width = -1,
softint  indent = 2 
)

Creates a YAML string from Qore data.

For information on Qore to YAML serialization, see Qore to YAML Type Mappings

Code Flags:
RET_VALUE_ONLY
Parameters
dataQore data to convert; cannot contain any objects or a YAML-EMITTER-ERROR exception will be raised
flagsbinary OR'ed YAML Emitter Option Constants
widthdefault line width for output, -1 = no line length limit
indentthe number of spaces to use for indentation when outputting block format or multiple lines; note that libyaml seems to be ignoring this parameter for now, so it may not have any effect
Returns
the YAML string corresponding to the input
Example:
my string $str = makeYAML($data, YAML::Canonical);
Exceptions
YAML-EMITTER-ERRORobject found; YAML library error
any Qore::YAML::parseYAML ( string  yaml)

Parses a YAML string and returns the corresponding Qore value or data structure.

For information on YAML to Qore deserialization, see Qore to YAML Type Mappings

Code Flags:
RET_VALUE_ONLY
Parameters
yamlThe YAML string to deserialize
Returns
Qore data as deserialized from the YAML string
Example:
my any $data = parseYAML($yaml_string);
Exceptions
YAML-PARSER-ERRORerror parsing YAML string