Qore yaml Module  0.7.0
YAML Functions

Modules

 YAML Emitter Option Constants
 

Functions

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

Detailed Description

Function Documentation

◆ get_yaml_info()

hash Qore::YAML::get_yaml_info ( )

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:
hash hash = get_yaml_info();
hash get_yaml_info()
Returns version information about libyaml being used by the yaml module.
Since
yaml 0.5 as a replacement for deprecated camel-case getYAMLInfo()

◆ getYAMLInfo()

hash Qore::YAML::getYAMLInfo ( )

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

Code Flags:
CONSTANT, DEPRECATED
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
Deprecated:
use get_yaml_info(); camel-case function names were deprecated in yaml 0.5

◆ make_yaml()

string Qore::YAML::make_yaml ( auto  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:
string str = make_yaml(data, YAML::Canonical);
const Canonical
emitter constant: Emit canonical YAML
Definition: ql_yaml.dox.h:140
string make_yaml(auto data, int flags=Qore::YAML::None, softint width=-1, softint indent=2)
Creates a YAML string from Qore data.
Exceptions
YAML-EMITTER-ERRORobject found; YAML library error
See also
parse_yaml()
Since
yaml 0.5 as a replacement for deprecated camel-case makeYAML()

◆ makeYAML()

string Qore::YAML::makeYAML ( auto  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, DEPRECATED
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
Exceptions
YAML-EMITTER-ERRORobject found; YAML library error
Deprecated:
use make_yaml(); camel-case function names were deprecated in yaml 0.5

◆ parse_yaml()

auto Qore::YAML::parse_yaml ( 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:
auto data = parse_yaml(yaml_string);
auto parse_yaml(string yaml)
Parses a YAML string and returns the corresponding Qore value or data structure.
Exceptions
YAML-PARSER-ERRORerror parsing YAML string
Since
yaml 0.5 as a replacement for deprecated camel-case parseYAML()
See also
make_yaml()

◆ parseYAML()

auto 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, DEPRECATED
Parameters
yamlThe YAML string to deserialize
Returns
Qore data as deserialized from the YAML string
Exceptions
YAML-PARSER-ERRORerror parsing YAML string
Deprecated:
use parse_yaml(); camel-case function names were deprecated in yaml 0.5