Defined in header <fkYAML/node.hpp>
fkyaml::basic_node::yaml_version_t¶
Deprecation
The enum class fkyaml::yaml_version_type
replaces the type alias fkyaml::basic_node::yaml_version_t
which has been deprecated in version 0.3.12. It will be removed in a future version. Please replace usages like
with
This enumeration collects the YAML specification versions. It is used as meta data of a basic_node and the functions get_yaml_version
and set_yaml_version
rely on it.
Examples¶
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);
// call get_yaml_version().
fkyaml::node::yaml_version_t yaml_ver = n.get_yaml_version();
std::cout << std::boolalpha;
std::cout << (n.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_2) << std::endl;
// overwrite the YAML version to 1.1.
n.set_yaml_version(fkyaml::node::yaml_version_t::VER_1_1);
// call get_yaml_version() again.
std::cout << (n.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_1) << std::endl;
return 0;
}
output: