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
Specializations
- node - default specialization
Member Types
Node Value 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. |
Container Types
Miscellaneous
| Name |
Description |
| value_converter_type |
The type used to convert between node and native data. |
| initializer_list_t |
The type for initializer lists of basic_node values. |
| node_t |
(DEPRECATED) The type used to store the internal value type. |
| yaml_version_t |
(DEPRECATED) The type used to store the enable version of YAML. |
| map_range |
The helper type for the map_items() function. |
| const_map_range |
The helper type for the map_items() function. |
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 |
| get_type |
returns the type of a node value in a basic_node. |
| type |
(DEPRECATED) 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 the first YAML document into a basic_node. |
| deserialize_docs |
(static) |
deserializes all YAML documents into basic_node objects. |
| operator>> |
|
deserializes an input stream into a basic_node. |
| serialize |
(static) |
serializes a basic_node into a YAML formatted string. |
| serialize_docs |
(static) |
serializes basic_node objects into a YAML formatted string. |
| operator<< |
|
serializes a basic_node into an output stream. |
| get_value |
|
converts a basic_node into a target type. |
| get_value_inplace |
|
converts a basic_node into a target type and write it to a destination. |
| get_value_or |
|
tries to convert a basic_node into a target type. returns a default value if conversion fails. |
| as_seq |
|
get reference to the sequence node value. |
| as_map |
|
get reference to the mapping node value. |
| as_bool |
|
get reference to the boolean node value. |
| as_int |
|
get reference to the integer node value. |
| as_float |
|
get reference to the float node value. |
| as_str |
|
get reference to the string node value. |
| get_value_ref |
|
(DEPRECATED) converts a basic_node into reference to a target type. |
Iterators
| Name |
Description |
| begin |
returns a (const) iterator to the beginning of mapping/sequence |
| cbegin |
returns a const iterator to the beginning of mapping/sequence |
| end |
returns a (const) iterator to the past-the-last of mapping/sequence |
| cend |
returns a const iterator to the past-the-last of mapping/sequence |
| rbegin |
returns a (const) iterator to the first of reversed mapping/sequence |
| crbegin |
returns a const iterator to the first of reversed mapping/sequence |
| rend |
returns a (const) iterator to the past-the-last of reversed mapping/sequence |
| crend |
returns a const iterator to the past-the-last of reversed mapping/sequence |
| map_items |
returns a range of mapping entries, allowing access to iterator member functions in range-based for loops. |
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
Manipulations for Node Properties
| 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. |
| add_tag_name |
registers a tag name to a basic_node object. |
| get_tag_name |
gets a tag name associated with a basic_node object. |
| has_tag_name |
checks if a basic_node has any tag name. |
Manipulations for Document Properties
Modifiers
| Name |
Description |
| swap |
swaps the internally stored data |