Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node::add_tag_name

void add_tag_name(const std::string& tag_name);
void add_tag_name(std::string&& tag_name);

Adds a tag name to the YAML node.
If the basic_node has already had any tag name, the new tag name overwrites the old one.

Parameters

tag_name [in]
A tag name. This should not be empty.
Example
#include <iostream>
#include <fkYAML/node.hpp>

int main() {
    // create a YAML node.
    fkyaml::node n = 123;

    // set a tag name to the node.
    n.add_tag_name("!!int");
    std::cout << n.get_tag_name() << std::endl;

    // overwrite it with a new one.
    n.add_tag_name("!!foo");
    std::cout << n.get_tag_name() << std::endl;

    return 0;
}

output:

!!int
!!foo

See Also