Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::get_yaml_version

yaml_version_t get_yaml_version() const noexcept;

Deprecation

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

fkyaml::node::yaml_version_t v = n.get_yaml_version();
with

fkyaml::yaml_version_type v = n.get_yaml_version_type();

Returns the version of the YAML format applied for the basic_node object.

Return Value

The version of the YAML format applied to the basic_node object.

YAML version Return Value
1.1 yaml_version_t::VER_1_1
1.2 yaml_version_t::VER_1_2
Example
#include <iomanip>
#include <iostream>
#include <fkYAML/node.hpp>

int main() {
    // A `fkyaml::node` object has `yaml_version_t::VER_1_2` by default.
    fkyaml::node n;
    std::cout << std::boolalpha << (n.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_2) << std::endl;

    return 0;
}

output:

true

See Also