Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::set_yaml_version

void set_yaml_version(const yaml_version_t version) noexcept;

Deprecation

The function void set_yaml_version_type(const yaml_version_type) replaces the function void set_yaml_version(const basic_node::yaml_version_t) which has been deprecated in version 0.3.12. It will be removed in version 0.4.0. Please replace calls like

n.set_yaml_version(fkyaml::node::yaml_version_t::VER_1_2);

with

n.set_yaml_version_type(fkyaml::yaml_version_type::VERSION_1_2);

Sets a target YAML version to the basic_node object.

Parameters

version [in]
A target YAML version.
Example
#include <iomanip>
#include <iostream>
#include <fkYAML/node.hpp>

int main() {
    fkyaml::node n;
    n.set_yaml_version(fkyaml::node::yaml_version_t::VER_1_1);
    fkyaml::node n2;
    n2.set_yaml_version(fkyaml::node::yaml_version_t::VER_1_2);

    std::cout << std::boolalpha;
    std::cout << (n.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_1) << std::endl;
    std::cout << (n2.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_2) << std::endl;

    return 0;
}

output:

true
true

See Also