Defined in header <fkYAML/yaml_version_type.hpp>
fkyaml::yaml_version_type¶
This enumeration collects the used versions of YAML specification. It is used as meta data of a basic_node and the following basic_node's functions rely on it:
Example
#include <iomanip>
#include <iostream>
#include <fkYAML/node.hpp>
int main() {
char input[] = "%YAML 1.2\n"
"---\n"
"foo: bar\n";
// deserialize a YAML formatted string.
fkyaml::node n = fkyaml::node::deserialize(input);
// query the YAML version by calling get_yaml_version_type().
std::cout << std::boolalpha;
std::cout << (n.get_yaml_version_type() == fkyaml::yaml_version_type::VERSION_1_2) << std::endl;
// overwrite the YAML version to 1.1.
n.set_yaml_version_type(fkyaml::yaml_version_type::VERSION_1_1);
// query the YAML version again.
std::cout << (n.get_yaml_version_type() == fkyaml::yaml_version_type::VERSION_1_1) << std::endl;
return 0;
}
output: