Skip to content

Defined in header <fkYAML/node.hpp>

fkyaml::basic_node

template<
    template <typename, typename...> class SequenceType = std::vector,
    template <typename, typename, typename...> class MappingType = std::map,
    typename BooleanType = bool,
    typename IntegerType = std::int64_t,
    typename FloatNumberType = double,
    typename StringType = std::string,
    template <typename, typename = void> class ConverterType = node_value_converter>
class basic_node;

This class provides features to handle YAML nodes.

Template Paramters

Template parameter Description Default Derived type
SequenceType type for sequence node value containers std::vector sequence_type
MappingType type for mapping node value containers std::map mapping_type
BooleanType type for boolean node values bool boolean_type
IntegerType type for integer node values std::int64_t integer_type
FloatNumberType type for float number node values double float_number_type
StringType type for string node values std::string string_type
ConverterType type for converters between
nodes and native data types
node_value_converter value_converter_type

Specializations

  • node - default specialization

Member Types

Name Description
sequence_type The type used to store sequence node value containers.
mapping_type The type used to store mapping node value containers.
boolean_type The type used to store boolean node values.
integer_type The type used to store integer node values.
float_number_type The type used to store float number node values.
string_type The type used to store string node values.
value_converter_type The type used to convert between node and native data.
iterator The type for non-constant iterators.
const_iterator The type for constant iterators.
node_t The type used to store the internal value type.
yaml_version_t The type used to store the enable version of YAML.

Member Functions

Construction/Destruction

Name Description
(constructor) constructs a basic_node.
(destructor) destroys a basic_node, deallocating internal storage if used.
operator= assigns values to the basic_node.
mapping (static) constructs a basic_node with a mapping container.
sequence (static) constructs a basic_node with a sequence container.
alias_of (static) constructs a basic_node with an anchor node.

Inspection for Node Value Types

Name Description
type returns the type of a node value in a basic_node.
is_sequence checks if a basic_node has a sequence node value.
is_mapping checks if a basic_node has a mapping node value.
is_null checks if a basic_node has a null node value.
is_scalar checks if a basic_node has a scalar node value.
is_boolean checks if a basic_node has a boolean node value.
is_integer checks if a basic_node has an integer node value.
is_float_number checks if a basic_node has a float number node value.
is_string checks if a basic_node has a string node value.

Conversions

Name Description
deserialize (static) deserializes a YAML formatted string into a basic_node.
operator>> deserializes an input stream into a basic_node.
serialize (static) serializes a basic_node into a YAML formatted string.
operator<< serializes a basic_node into an output stream.
get_value converts a basic_node into a target native data type.
get_value_ref converts a basic_node into reference to a target native data type.

Iterators

Name Description
begin returns an iterator to the beginning of mapping/sequence
end returns an iterator to the end of mapping/sequence

Inspection for Container Node Values

Name Description
contains checks if a basic_node has the given key.
empty checks if a basic_node has an empty container.
size returns the size of a container value of a basic_node.

Accessors for Container Elements

Name Description
operator[] accesses an item specified by the key/index.
at accesses an item specified by the key/index with bounds checking.

Lexicographical Comparison Operators

Name Description
operator== comparison: equal
operator!= comparison: not equal
operator< comparison: less than
operator<= comparison: less than or equal
operator> comparison: greater than
operator>= comparison: greater than or equal

Aliasing Nodes

Name Description
is_alias checks if a basic_node is an alias node.
is_anchor checks if a basic_node is an anchor node.
add_anchor_name registers an anchor name to a basic_node object.
get_anchor_name gets an anchor name associated with a basic_node object.
has_anchor_name checks if a basic_node has any anchor name.

Modifiers

Name Description
swap swaps the internally stored data