From 2b8f92552218a25be01635eed80db78bd3530ef0 Mon Sep 17 00:00:00 2001 From: fktn Date: Sat, 14 Dec 2024 00:07:42 +0900 Subject: [PATCH 01/18] Resolve CMake deprecation warning (#442) --- CMakeLists.txt | 2 +- test/cmake_add_subdirectory_test/project/CMakeLists.txt | 2 +- test/cmake_fetch_content_test/project/CMakeLists.txt | 2 +- test/cmake_find_package_test/project/CMakeLists.txt | 2 +- .../project/CMakeLists.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2a7896f..4577d3e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.8...3.10) ################################ # Project name and version # diff --git a/test/cmake_add_subdirectory_test/project/CMakeLists.txt b/test/cmake_add_subdirectory_test/project/CMakeLists.txt index 352a5c88..bc13a073 100644 --- a/test/cmake_add_subdirectory_test/project/CMakeLists.txt +++ b/test/cmake_add_subdirectory_test/project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.8...3.10) project(CMakeAddSubDirectoryTestProject) diff --git a/test/cmake_fetch_content_test/project/CMakeLists.txt b/test/cmake_fetch_content_test/project/CMakeLists.txt index f05dc93c..a6697d0d 100644 --- a/test/cmake_fetch_content_test/project/CMakeLists.txt +++ b/test/cmake_fetch_content_test/project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.11.0) +cmake_minimum_required(VERSION 3.11) project("CMakeFetchContentTestProject") diff --git a/test/cmake_find_package_test/project/CMakeLists.txt b/test/cmake_find_package_test/project/CMakeLists.txt index fcab1cb1..df9ae236 100644 --- a/test/cmake_find_package_test/project/CMakeLists.txt +++ b/test/cmake_find_package_test/project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.8...3.10) project(CMakeFindPackageTestProject) diff --git a/test/cmake_target_include_directories_test/project/CMakeLists.txt b/test/cmake_target_include_directories_test/project/CMakeLists.txt index 71b7bf09..a182449b 100644 --- a/test/cmake_target_include_directories_test/project/CMakeLists.txt +++ b/test/cmake_target_include_directories_test/project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.8...3.10) project(CMakeTargetIncludeDirectoriesTestProject) From 5aaa028ac0983fbb1805f73af9031bf5bdd6c208 Mon Sep 17 00:00:00 2001 From: fktn Date: Mon, 16 Dec 2024 03:19:50 +0900 Subject: [PATCH 02/18] Add get_value_inplace API to basic_node (#443) * added get_value_inplace() to basic_node * updated API documentation contents * fixed some typos in doc * added link to the documentation page for get_value_inplace() * fixed error in building test suite with older compilers * added test case for get_value_inplace * fixed issue reported from codacy --- .../ex_basic_node_get_value_inplace.cpp | 54 ++ .../ex_basic_node_get_value_inplace.output | 4 + docs/mkdocs/docs/api/basic_node/get_value.md | 30 +- .../docs/api/basic_node/get_value_inplace.md | 64 ++ docs/mkdocs/docs/api/basic_node/index.md | 21 +- docs/mkdocs/mkdocs.yml | 1 + .../fkYAML/detail/conversions/from_node.hpp | 92 ++- include/fkYAML/node.hpp | 26 +- single_include/fkYAML/node.hpp | 118 ++- test/unit_test/test_node_class.cpp | 766 +++++++++++++++++- 10 files changed, 1110 insertions(+), 66 deletions(-) create mode 100644 docs/examples/ex_basic_node_get_value_inplace.cpp create mode 100644 docs/examples/ex_basic_node_get_value_inplace.output create mode 100644 docs/mkdocs/docs/api/basic_node/get_value_inplace.md diff --git a/docs/examples/ex_basic_node_get_value_inplace.cpp b/docs/examples/ex_basic_node_get_value_inplace.cpp new file mode 100644 index 00000000..3aa4cc47 --- /dev/null +++ b/docs/examples/ex_basic_node_get_value_inplace.cpp @@ -0,0 +1,54 @@ +// _______ __ __ __ _____ __ __ __ +// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +// +// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-License-Identifier: MIT + +#include +#include + +struct not_default_constructible { + not_default_constructible() = delete; + explicit not_default_constructible(int v) noexcept + : value(v) { + } + not_default_constructible(const not_default_constructible&) = default; + + int value {0}; +}; +// Custom implementation of from_node() for not_default_constructible objects. +// This function is called inside get_value_inplace(). +// See https://fktn-k.github.io/fkYAML/api/node_value_converter/from_node/ for details. +inline void from_node(const fkyaml::node& n, not_default_constructible& ndc) { + ndc.value = n.get_value(); +} + +int main() { + // create a sequence node. + fkyaml::node seq = {true, false}; + + // fill the node values into a 1D C-style array + bool bools[2] {}; + seq.get_value_inplace(bools); + for (auto b : bools) { + std::cout << std::boolalpha << b << " "; + } + std::cout << "\n\n"; + + // create an integer scalar node + fkyaml::node integer = 123; + + // get_value_inplace() accepts a type which is not default constructible. + not_default_constructible ndc {0}; + integer.get_value_inplace(ndc); + std::cout << ndc.value << std::endl; + + // of course, you can pass a value of default constructible type as well. + integer = -123; + integer.get_value_inplace(ndc.value); + std::cout << ndc.value << std::endl; + + return 0; +} diff --git a/docs/examples/ex_basic_node_get_value_inplace.output b/docs/examples/ex_basic_node_get_value_inplace.output new file mode 100644 index 00000000..3f4600c4 --- /dev/null +++ b/docs/examples/ex_basic_node_get_value_inplace.output @@ -0,0 +1,4 @@ +true false + +123 +-123 diff --git a/docs/mkdocs/docs/api/basic_node/get_value.md b/docs/mkdocs/docs/api/basic_node/get_value.md index c9d88f0d..909a2625 100644 --- a/docs/mkdocs/docs/api/basic_node/get_value.md +++ b/docs/mkdocs/docs/api/basic_node/get_value.md @@ -11,7 +11,7 @@ template BasicNodeType get_value() const; // (2) ``` -This function converts a [fkyaml::basic_node](./index.md) to either +This function converts a [`fkyaml::basic_node`](./index.md) to either 1. a compatible value ([copy-constructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible) and [default-constructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible)) The function is equivalent to executing @@ -21,7 +21,8 @@ This function converts a [fkyaml::basic_node](./index.md) to either return ret; ``` This library implements conversions from a node to a number of STL container types and scalar types. (see the notes down below) - Note that ValueType cannot be either a reference, pointer or C-style array type except `std::nullptr_t`. + Note that ValueType cannot be either a reference, pointer or C-style array type except `std::nullptr_t` since safe conversion is impossible with such types. + If you want to convert a node into a C-style array, consider using the [`get_value_inplace`](./get_value_inplace.md) function instead. 2. a [fkyaml::basic_node](./index.md) object The function is equivalent to executing ```cpp @@ -35,15 +36,15 @@ This API makes a copy of the value, and if the copying costs too much, or if you This library implements conversions from a sequence node to a number of STL container types whose element type is not a key-value pair. The implementation can be used for custom container types, but they need to have both `iterator` member type and `insert()` member function. The test suite confirms successful conversions to the following types. - * std::vector, std::deque, std::list *(sequence containers)* - * std::set, std::multiset *(associative containers for keys)* - * std::unordered_set, std::unordered_multiset *(unordered associative containers for keys)* + * [std::vector](https://en.cppreference.com/w/cpp/container/vector), [std::deque](https://en.cppreference.com/w/cpp/container/deque), [std::list](https://en.cppreference.com/w/cpp/container/list) *(sequence containers)* + * [std::set](https://en.cppreference.com/w/cpp/container/set), [std::multiset](https://en.cppreference.com/w/cpp/container/multiset) *(associative containers for keys)* + * [std::unordered_set](https://en.cppreference.com/w/cpp/container/unordered_set), [std::unordered_multiset](https://en.cppreference.com/w/cpp/container/unordered_multiset) *(unordered associative containers for keys)* And you can also convert to these types which do not have `insert()` member function though. - * std::array, std::valarray *(sequence containers)* - * std::stack, std::queue, std::priority_queue *(sequence container adapters)* - * std::pair, std::tuple + * [std::array](https://en.cppreference.com/w/cpp/container/array), [std::valarray](https://en.cppreference.com/w/cpp/numeric/valarray) *(sequence containers)* + * [std::stack](https://en.cppreference.com/w/cpp/container/stack), [std::queue](https://en.cppreference.com/w/cpp/container/queue), [std::priority_queue](https://en.cppreference.com/w/cpp/container/priority_queue) *(sequence container adapters)* + * [std::pair](https://en.cppreference.com/w/cpp/utility/pair), [std::tuple](https://en.cppreference.com/w/cpp/utility/tuple) Note that the above types cannot be converted from a non-sequence node, which results in throwing a [type_error](../exception/type_error.md). @@ -51,8 +52,8 @@ This API makes a copy of the value, and if the copying costs too much, or if you This library implements conversions from a mapping node to STL container types whose element type is a key-value pair. The implementation can be used for custom container types, but they need to have `key_type`, `mapped_type` and `value_type` member types and `emplace()` member function. The test suite confirms successful conversions to the following types. - * std::map, std::multimap *(associative containers for key-value pairs)* - * std::unordered_map, std::unordered_multi_map *(unordered associative containers for key-value pairs)* + * [std::map](https://en.cppreference.com/w/cpp/container/map), [std::multimap](https://en.cppreference.com/w/cpp/container/multimap) *(associative containers for key-value pairs)* + * [std::unordered_map](https://en.cppreference.com/w/cpp/container/unordered_map), [std::unordered_multi_map](https://en.cppreference.com/w/cpp/container/unordered_multimap) *(unordered associative containers for key-value pairs)* ???+ Note "Convert from a Null or Numeric Scalar Node" @@ -78,8 +79,12 @@ This API makes a copy of the value, and if the copying costs too much, or if you String scalar nodes can be converted to STL container types which can be constructible from `const fkyaml::basic_node::string_type&` (`const std::string&` by default). The test suite confirms successful conversions to the following types. - * std::string - * std::string_view (from C++17) + * [std::string](https://en.cppreference.com/w/cpp/string/basic_string) + * [std::string_view](https://en.cppreference.com/w/cpp/string/basic_string_view) (from C++17) + +???+ Note "Convert as an optional value" + + Since C++17, [std::optional](https://en.cppreference.com/w/cpp/utility/optional) can be used as `ValueType` to indicate the conversion result to be optional. In such cases, a returned [std::optional](https://en.cppreference.com/w/cpp/utility/optional) value contains a value only if the conversion was successful, or [`std::nullopt`](https://en.cppreference.com/w/cpp/utility/optional/nullopt) otherwise. ## **Template Parameters** @@ -112,5 +117,6 @@ A compatible native data value converted from the [basic_node](./index.md) objec ## **See Also** * [basic_node](index.md) +* [get_value_inplace](get_value_inplace.md) * [get_value_ref](get_value_ref.md) * [node_value_converter::from_node](../node_value_converter/from_node.md) diff --git a/docs/mkdocs/docs/api/basic_node/get_value_inplace.md b/docs/mkdocs/docs/api/basic_node/get_value_inplace.md new file mode 100644 index 00000000..b2aa4f96 --- /dev/null +++ b/docs/mkdocs/docs/api/basic_node/get_value_inplace.md @@ -0,0 +1,64 @@ +Defined in header [``](https://github.com/fktn-k/fkYAML/blob/develop/include/fkYAML/node.hpp) + +# fkyaml::basic_node::get_value + +```cpp +template +void get_value_inplace(T& value_ref) const noexcept( + noexcept(ConverterType::from_node(std::declval(), std::declval()))); // (1) + +template +void get_value_inplace(BasicNodeType& value_ref) const; // (2) +``` + +This function converts a [`fkyaml::basic_node`](./index.md) to either of the followings and fills the conversion result into the given `value_ref` parameter. + +1. a compatible value ([copy-constructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible)) + The function is equivalent to executing + ```cpp + ConverterType::from_node(*this, value_ref); + ``` + Unlike the [`get_value`](./get_value.md) function, this function does not require the template parameter type `T` to be [default-constructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible) since no instantiation of `T` is necessary inside the function to return the conversion result. +2. a [fkyaml::basic_node](./index.md) object + The function is equivalent to executing + ```cpp + value_ref = *this; // Copy-assigns a current basic_node object. + ``` + +This function shares internal implementation with the [`get_value`](./get_value.md). +Thus, all the STL container & scalar types which are supported by that function, is also supported by this function as well. +See the notes there for details. + +???+ Note "Difference from `get_value()`" + + One crutial difference from the [`get_value`](./get_value.md) function is, this function does not require the template parameter type `T` to be [default-constructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible) since no instantiation of `T` is necessary inside the function to return the conversion result anymore. + So, you might prefer this function, for example, if you already created a `T` object as a member variable and want to assign a node value to it. + + Another is C-style array support. + While [`get_value`](./get_value.md) cannot accept any kind of C-style array types since returning such array objects is impossible due to its implementation, this function accepts 1D, 2D and 3D arrays. Note that, if `T` is one of them, the target basic_node object must be a sequence. A [`type_error`](../exception/type_error.md) is thrown otherwise. + +## **Template Parameters** + +***T*** +: A compatible value type. + +***BasicNodeType*** +: A basic_node template instance type. + +???+ Example + + ```cpp + --8<-- "examples/ex_basic_node_get_value_inplace.cpp:9" + ``` + + output: + ```bash + --8<-- "examples/ex_basic_node_get_value_inplace.output" + ``` + +## **See Also** + +* [basic_node](index.md) +* [get_value](get_value.md) +* [get_value_ref](get_value_ref.md) +* [node_value_converter::from_node](../node_value_converter/from_node.md) diff --git a/docs/mkdocs/docs/api/basic_node/index.md b/docs/mkdocs/docs/api/basic_node/index.md index 2a5e7f24..edce0694 100644 --- a/docs/mkdocs/docs/api/basic_node/index.md +++ b/docs/mkdocs/docs/api/basic_node/index.md @@ -93,16 +93,17 @@ This class provides features to handle YAML nodes. | [is_string](is_string.md) | checks if a basic_node has a string node value. | ### Conversions -| Name | | Description | -| --------------------------------------- | -------- | ------------------------------------------------------------------ | -| [deserialize](deserialize.md) | (static) | deserializes the first YAML document into a basic_node. | -| [deserialize_docs](deserialize_docs.md) | (static) | deserializes all YAML documents into basic_node objects. | -| [operator>>](extraction_operator.md) | | deserializes an input stream into a basic_node. | -| [serialize](serialize.md) | (static) | serializes a basic_node into a YAML formatted string. | -| [serialize_docs](serialize_docs.md) | (static) | serializes basic_node objects into a YAML formatted string. | -| [operator<<](insertion_operator.md) | | serializes a basic_node into an output stream. | -| [get_value](get_value.md) | | converts a basic_node into a target native data type. | -| [get_value_ref](get_value_ref.md) | | converts a basic_node into reference to a target native data type. | +| Name | | Description | +| ----------------------------------------- | -------- | ----------------------------------------------------------------------- | +| [deserialize](deserialize.md) | (static) | deserializes the first YAML document into a basic_node. | +| [deserialize_docs](deserialize_docs.md) | (static) | deserializes all YAML documents into basic_node objects. | +| [operator>>](extraction_operator.md) | | deserializes an input stream into a basic_node. | +| [serialize](serialize.md) | (static) | serializes a basic_node into a YAML formatted string. | +| [serialize_docs](serialize_docs.md) | (static) | serializes basic_node objects into a YAML formatted string. | +| [operator<<](insertion_operator.md) | | serializes a basic_node into an output stream. | +| [get_value](get_value.md) | | converts a basic_node into a target type. | +| [get_value_inplace](get_value_inplace.md) | | converts a basic_node into a target type and write it to a destination. | +| [get_value_ref](get_value_ref.md) | | converts a basic_node into reference to a target type. | ### Iterators | Name | Description | diff --git a/docs/mkdocs/mkdocs.yml b/docs/mkdocs/mkdocs.yml index d6dc322b..a2e36482 100644 --- a/docs/mkdocs/mkdocs.yml +++ b/docs/mkdocs/mkdocs.yml @@ -123,6 +123,7 @@ nav: - get_tag_name: api/basic_node/get_tag_name.md - get_type: api/basic_node/get_type.md - get_value: api/basic_node/get_value.md + - get_value_inplace: api/basic_node/get_value_inplace.md - get_value_ref: api/basic_node/get_value_ref.md - get_yaml_version: api/basic_node/get_yaml_version.md - get_yaml_version_type: api/basic_node/get_yaml_version_type.md diff --git a/include/fkYAML/detail/conversions/from_node.hpp b/include/fkYAML/detail/conversions/from_node.hpp index 4e1801b6..f06c8f9d 100644 --- a/include/fkYAML/detail/conversions/from_node.hpp +++ b/include/fkYAML/detail/conversions/from_node.hpp @@ -63,8 +63,6 @@ using is_sequence_container_adapter = conjunction< template struct call_reserve_if_available { /// @brief Do nothing since ContainerType does not have reserve function. - /// @param - /// @param static void call(ContainerType& /*unused*/, typename ContainerType::size_type /*unused*/) { } }; @@ -83,6 +81,75 @@ struct call_reserve_if_available +inline auto from_node(const BasicNodeType& n, T (&array)[N]) + -> decltype(n.get_value_inplace(std::declval()), void()) { + if FK_YAML_UNLIKELY (!n.is_sequence()) { + throw type_error("The target node value type is not sequence type.", n.get_type()); + } + + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + for (std::size_t i = 0; i < N; i++) { + n.at(i).get_value_inplace(array[i]); + } +} + +/// @brief from_node function for C-style 2D arrays whose element type must be a basic_node template instance type or a +/// compatible type. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam T Element type of C-style 2D array. +/// @tparam N0 Size of the outer dimension. +/// @tparam N1 Size of the inner dimension. +/// @param n A basic_node object. +/// @param array An array object. +template +inline auto from_node(const BasicNodeType& n, T (&array)[N0][N1]) + -> decltype(n.get_value_inplace(std::declval()), void()) { + if FK_YAML_UNLIKELY (!n.is_sequence()) { + throw type_error("The target node value type is not sequence type.", n.get_type()); + } + + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + for (std::size_t i0 = 0; i0 < N0; i0++) { + for (std::size_t i1 = 0; i1 < N1; i1++) { + n.at(i0).at(i1).get_value_inplace(array[i0][i1]); + } + } +} + +/// @brief from_node function for C-style 2D arrays whose element type must be a basic_node template instance type or a +/// compatible type. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam T Element type of C-style 2D array. +/// @tparam N0 Size of the outermost dimension. +/// @tparam N1 Size of the middle dimension. +/// @tparam N2 Size of the innermost dimension. +/// @param n A basic_node object. +/// @param array An array object. +template +inline auto from_node(const BasicNodeType& n, T (&array)[N0][N1][N2]) + -> decltype(n.get_value_inplace(std::declval()), void()) { + if FK_YAML_UNLIKELY (!n.is_sequence()) { + throw type_error("The target node value type is not sequence type.", n.get_type()); + } + + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + for (std::size_t i0 = 0; i0 < N0; i0++) { + for (std::size_t i1 = 0; i1 < N1; i1++) { + for (std::size_t i2 = 0; i2 < N2; i2++) { + n.at(i0).at(i1).at(i2).get_value_inplace(array[i0][i1][i2]); + } + } + } +} + /// @brief from_node function for std::array objects whose element type must be a basic_node template instance type or a /// compatible type. This function is necessary since insert function is not implemented for std::array. /// @tparam BasicNodeType A basic_node template instance type. @@ -91,14 +158,15 @@ struct call_reserve_if_available -inline auto from_node(const BasicNodeType& n, std::array& arr) -> decltype(n.template get_value(), void()) { +inline auto from_node(const BasicNodeType& n, std::array& arr) + -> decltype(n.get_value_inplace(std::declval()), void()) { if FK_YAML_UNLIKELY (!n.is_sequence()) { throw type_error("The target node value type is not sequence type.", n.get_type()); } - std::size_t count = std::min(n.size(), N); - for (std::size_t i = 0; i < count; i++) { - arr.at(i) = n.at(i).template get_value(); + for (std::size_t i = 0; i < N; i++) { + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + n.at(i).get_value_inplace(arr.at(i)); } } @@ -109,7 +177,8 @@ inline auto from_node(const BasicNodeType& n, std::array& arr) -> decltype /// @param n A basic_node object. /// @param va A std::valarray object. template -inline auto from_node(const BasicNodeType& n, std::valarray& va) -> decltype(n.template get_value(), void()) { +inline auto from_node(const BasicNodeType& n, std::valarray& va) + -> decltype(n.get_value_inplace(std::declval()), void()) { if FK_YAML_UNLIKELY (!n.is_sequence()) { throw type_error("The target node value type is not sequence type.", n.get_type()); } @@ -117,7 +186,8 @@ inline auto from_node(const BasicNodeType& n, std::valarray& va) -> decltype( std::size_t count = n.size(); va.resize(count); for (std::size_t i = 0; i < count; i++) { - va[i] = n.at(i).template get_value(); + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + n.at(i).get_value_inplace(va[i]); } } @@ -161,7 +231,7 @@ template < enable_if_t< conjunction, is_sequence_container_adapter>::value, int> = 0> inline auto from_node(const BasicNodeType& n, SeqContainerAdapter& ca) - -> decltype(n.template get_value(), ca.emplace(std::declval()), void()) { + -> decltype(n.template get_value(), ca.push(std::declval()), void()) { if FK_YAML_UNLIKELY (!n.is_sequence()) { throw type_error("The target node value is not sequence type.", n.get_type()); } @@ -479,7 +549,9 @@ inline auto from_node(const BasicNodeType& n, std::pair& p) throw type_error("The target node value type is not sequence type.", n.get_type()); } - p = {n.at(0).template get_value(), n.at(1).template get_value()}; + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + n.at(0).get_value_inplace(p.first); + n.at(1).get_value_inplace(p.second); } /// @brief concrete implementation of from_node function for std::tuple objects. diff --git a/include/fkYAML/node.hpp b/include/fkYAML/node.hpp index c9218d43..53744541 100644 --- a/include/fkYAML/node.hpp +++ b/include/fkYAML/node.hpp @@ -1341,7 +1341,8 @@ class basic_node { } /// @brief Get the node value object converted into a given type. - /// @note This function requires T objects to be default constructible. + /// @note This function requires T objects to be default constructible. Also, T cannot be either a reference, + /// pointer or C-style array type. /// @tparam T A compatible value type which might be cv-qualified. /// @tparam ValueType A compatible value type with cv-qualifiers removed by default. /// @return A compatible native data value converted from the basic_node object. @@ -1350,13 +1351,15 @@ class basic_node { typename T, typename ValueType = detail::remove_cv_t, detail::enable_if_t::value, int> = 0> T get_value() const noexcept( - noexcept(std::declval().template get_value_impl(std::declval()))) { + noexcept(std::declval().template get_value_impl(std::declval()))) { // emit a compile error if T is either a reference, pointer or C-style array type. static_assert( !std::is_reference::value, "get_value() cannot be called with reference types. you might want to call get_value_ref()."); static_assert(!std::is_pointer::value, "get_value() cannot be called with pointer types."); - static_assert(!std::is_array::value, "get_value() cannot be called with C-style array types."); + static_assert( + !std::is_array::value, + "get_value() cannot be called with C-style array types. you might want to call get_value_inplace()."); auto ret = ValueType(); if (has_anchor_name()) { @@ -1370,6 +1373,23 @@ class basic_node { return ret; } + /// @brief Get the node value object converted into a given type. The conversion result is filled into `value_ref`. + /// @tparam T A compatible value type. + /// @param value_ref A storage into which the conversion result is filled. + /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/get_value_inplace/ + template + void get_value_inplace(T& value_ref) const + noexcept(noexcept(std::declval().template get_value_impl(std::declval()))) { + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, detail::node_attr_bits::get_anchor_offset(m_attrs)); + itr->second.get_value_impl(value_ref); + } + else { + get_value_impl(value_ref); + } + } + /// @brief Explicit reference access to the internally stored YAML node value. /// @tparam ReferenceType Reference type to the target YAML node value. /// @return Reference to the internally stored YAML node value. diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 77badf72..10967c1e 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -11056,8 +11056,6 @@ using is_sequence_container_adapter = conjunction< template struct call_reserve_if_available { /// @brief Do nothing since ContainerType does not have reserve function. - /// @param - /// @param static void call(ContainerType& /*unused*/, typename ContainerType::size_type /*unused*/) { } }; @@ -11076,6 +11074,75 @@ struct call_reserve_if_available +inline auto from_node(const BasicNodeType& n, T (&array)[N]) + -> decltype(n.get_value_inplace(std::declval()), void()) { + if FK_YAML_UNLIKELY (!n.is_sequence()) { + throw type_error("The target node value type is not sequence type.", n.get_type()); + } + + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + for (std::size_t i = 0; i < N; i++) { + n.at(i).get_value_inplace(array[i]); + } +} + +/// @brief from_node function for C-style 2D arrays whose element type must be a basic_node template instance type or a +/// compatible type. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam T Element type of C-style 2D array. +/// @tparam N0 Size of the outer dimension. +/// @tparam N1 Size of the inner dimension. +/// @param n A basic_node object. +/// @param array An array object. +template +inline auto from_node(const BasicNodeType& n, T (&array)[N0][N1]) + -> decltype(n.get_value_inplace(std::declval()), void()) { + if FK_YAML_UNLIKELY (!n.is_sequence()) { + throw type_error("The target node value type is not sequence type.", n.get_type()); + } + + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + for (std::size_t i0 = 0; i0 < N0; i0++) { + for (std::size_t i1 = 0; i1 < N1; i1++) { + n.at(i0).at(i1).get_value_inplace(array[i0][i1]); + } + } +} + +/// @brief from_node function for C-style 2D arrays whose element type must be a basic_node template instance type or a +/// compatible type. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam T Element type of C-style 2D array. +/// @tparam N0 Size of the outermost dimension. +/// @tparam N1 Size of the middle dimension. +/// @tparam N2 Size of the innermost dimension. +/// @param n A basic_node object. +/// @param array An array object. +template +inline auto from_node(const BasicNodeType& n, T (&array)[N0][N1][N2]) + -> decltype(n.get_value_inplace(std::declval()), void()) { + if FK_YAML_UNLIKELY (!n.is_sequence()) { + throw type_error("The target node value type is not sequence type.", n.get_type()); + } + + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + for (std::size_t i0 = 0; i0 < N0; i0++) { + for (std::size_t i1 = 0; i1 < N1; i1++) { + for (std::size_t i2 = 0; i2 < N2; i2++) { + n.at(i0).at(i1).at(i2).get_value_inplace(array[i0][i1][i2]); + } + } + } +} + /// @brief from_node function for std::array objects whose element type must be a basic_node template instance type or a /// compatible type. This function is necessary since insert function is not implemented for std::array. /// @tparam BasicNodeType A basic_node template instance type. @@ -11084,14 +11151,15 @@ struct call_reserve_if_available -inline auto from_node(const BasicNodeType& n, std::array& arr) -> decltype(n.template get_value(), void()) { +inline auto from_node(const BasicNodeType& n, std::array& arr) + -> decltype(n.get_value_inplace(std::declval()), void()) { if FK_YAML_UNLIKELY (!n.is_sequence()) { throw type_error("The target node value type is not sequence type.", n.get_type()); } - std::size_t count = std::min(n.size(), N); - for (std::size_t i = 0; i < count; i++) { - arr.at(i) = n.at(i).template get_value(); + for (std::size_t i = 0; i < N; i++) { + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + n.at(i).get_value_inplace(arr.at(i)); } } @@ -11102,7 +11170,8 @@ inline auto from_node(const BasicNodeType& n, std::array& arr) -> decltype /// @param n A basic_node object. /// @param va A std::valarray object. template -inline auto from_node(const BasicNodeType& n, std::valarray& va) -> decltype(n.template get_value(), void()) { +inline auto from_node(const BasicNodeType& n, std::valarray& va) + -> decltype(n.get_value_inplace(std::declval()), void()) { if FK_YAML_UNLIKELY (!n.is_sequence()) { throw type_error("The target node value type is not sequence type.", n.get_type()); } @@ -11110,7 +11179,8 @@ inline auto from_node(const BasicNodeType& n, std::valarray& va) -> decltype( std::size_t count = n.size(); va.resize(count); for (std::size_t i = 0; i < count; i++) { - va[i] = n.at(i).template get_value(); + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + n.at(i).get_value_inplace(va[i]); } } @@ -11154,7 +11224,7 @@ template < enable_if_t< conjunction, is_sequence_container_adapter>::value, int> = 0> inline auto from_node(const BasicNodeType& n, SeqContainerAdapter& ca) - -> decltype(n.template get_value(), ca.emplace(std::declval()), void()) { + -> decltype(n.template get_value(), ca.push(std::declval()), void()) { if FK_YAML_UNLIKELY (!n.is_sequence()) { throw type_error("The target node value is not sequence type.", n.get_type()); } @@ -11472,7 +11542,9 @@ inline auto from_node(const BasicNodeType& n, std::pair& p) throw type_error("The target node value type is not sequence type.", n.get_type()); } - p = {n.at(0).template get_value(), n.at(1).template get_value()}; + // call get_value_inplace(), not get_value(), since the storage to fill the result into is already created. + n.at(0).get_value_inplace(p.first); + n.at(1).get_value_inplace(p.second); } /// @brief concrete implementation of from_node function for std::tuple objects. @@ -13433,7 +13505,8 @@ class basic_node { } /// @brief Get the node value object converted into a given type. - /// @note This function requires T objects to be default constructible. + /// @note This function requires T objects to be default constructible. Also, T cannot be either a reference, + /// pointer or C-style array type. /// @tparam T A compatible value type which might be cv-qualified. /// @tparam ValueType A compatible value type with cv-qualifiers removed by default. /// @return A compatible native data value converted from the basic_node object. @@ -13442,13 +13515,15 @@ class basic_node { typename T, typename ValueType = detail::remove_cv_t, detail::enable_if_t::value, int> = 0> T get_value() const noexcept( - noexcept(std::declval().template get_value_impl(std::declval()))) { + noexcept(std::declval().template get_value_impl(std::declval()))) { // emit a compile error if T is either a reference, pointer or C-style array type. static_assert( !std::is_reference::value, "get_value() cannot be called with reference types. you might want to call get_value_ref()."); static_assert(!std::is_pointer::value, "get_value() cannot be called with pointer types."); - static_assert(!std::is_array::value, "get_value() cannot be called with C-style array types."); + static_assert( + !std::is_array::value, + "get_value() cannot be called with C-style array types. you might want to call get_value_inplace()."); auto ret = ValueType(); if (has_anchor_name()) { @@ -13462,6 +13537,23 @@ class basic_node { return ret; } + /// @brief Get the node value object converted into a given type. The conversion result is filled into `value_ref`. + /// @tparam T A compatible value type. + /// @param value_ref A storage into which the conversion result is filled. + /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/get_value_inplace/ + template + void get_value_inplace(T& value_ref) const + noexcept(noexcept(std::declval().template get_value_impl(std::declval()))) { + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, detail::node_attr_bits::get_anchor_offset(m_attrs)); + itr->second.get_value_impl(value_ref); + } + else { + get_value_impl(value_ref); + } + } + /// @brief Explicit reference access to the internally stored YAML node value. /// @tparam ReferenceType Reference type to the target YAML node value. /// @return Reference to the internally stored YAML node value. diff --git a/test/unit_test/test_node_class.cpp b/test/unit_test/test_node_class.cpp index 1773361a..c865436c 100644 --- a/test/unit_test/test_node_class.cpp +++ b/test/unit_test/test_node_class.cpp @@ -2364,23 +2364,78 @@ TEST_CASE("Node_AddTagName") { // test cases for value getters (copy) // +struct not_default_constructible { + not_default_constructible() = delete; + explicit not_default_constructible(int i) + : value(i) { + } + not_default_constructible(const not_default_constructible&) = default; + int value; +}; +inline void from_node(const fkyaml::node& n, not_default_constructible& ndc) noexcept { + ndc.value = n.get_value(); +} + struct string_wrap { string_wrap() = default; string_wrap& operator=(const std::string& _str) { str = _str; return *this; } - std::string str; + std::string str {}; }; template using get_fn_t = decltype(std::declval().template get()); -TEST_CASE("Node_GetValue") { - +TEST_CASE("Node_GetValue_GetValueInplace") { SECTION("sequence") { fkyaml::node node {true, false}; + SECTION("sequence value (1D C-style array)") { + STATIC_REQUIRE_FALSE(fkyaml::detail::is_detected::value); + + int ints_1d[2] {0, 0}; + fkyaml::node array_1d {1, 2}; + array_1d.get_value_inplace(ints_1d); + REQUIRE(ints_1d[0] == 1); + REQUIRE(ints_1d[1] == 2); + } + + SECTION("sequence value (2D C-style array)") { + STATIC_REQUIRE_FALSE(fkyaml::detail::is_detected::value); + + int ints_2d[3][3] {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; + fkyaml::node array_2d {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; + array_2d.get_value_inplace(ints_2d); + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + REQUIRE(ints_2d[i][j] == i * 3 + j + 1); + } + } + } + + SECTION("sequence value (3D C-style array)") { + STATIC_REQUIRE_FALSE(fkyaml::detail::is_detected::value); + + int ints_3d[3][3][3] { + {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, + {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, + {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}}; + fkyaml::node array_3d { + {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}, + {{10, 11, 12}, {13, 14, 15}, {16, 17, 18}}, + {{19, 20, 21}, {22, 23, 24}, {25, 26, 27}}}; + array_3d.get_value_inplace(ints_3d); + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + for (int k = 0; k < 3; k++) { + REQUIRE(ints_3d[i][j][k] == i * 9 + j * 3 + k + 1); + } + } + } + } + SECTION("sequence value (std::vector)") { auto vector_node = node.get_value>(); REQUIRE(vector_node.size() == 2); @@ -2389,10 +2444,24 @@ TEST_CASE("Node_GetValue") { REQUIRE(vector_node[1].is_boolean()); REQUIRE(vector_node[1].get_value() == false); + std::vector vector_node_inplace {}; + node.get_value_inplace(vector_node_inplace); + REQUIRE(vector_node_inplace.size() == 2); + REQUIRE(vector_node_inplace[0].is_boolean()); + REQUIRE(vector_node_inplace[0].get_value() == true); + REQUIRE(vector_node_inplace[1].is_boolean()); + REQUIRE(vector_node_inplace[1].get_value() == false); + auto vector_bool = node.get_value>(); REQUIRE(vector_bool.size() == 2); REQUIRE(vector_bool[0] == true); REQUIRE(vector_bool[1] == false); + + std::vector vector_bool_inplace {}; + node.get_value_inplace(vector_bool_inplace); + REQUIRE(vector_bool_inplace.size() == 2); + REQUIRE(vector_bool_inplace[0] == true); + REQUIRE(vector_bool_inplace[1] == false); } SECTION("sequence value (std::array)") { @@ -2402,9 +2471,21 @@ TEST_CASE("Node_GetValue") { REQUIRE(array_node[1].is_boolean()); REQUIRE(array_node[1].get_value() == false); + std::array array_node_inplace {{}}; + node.get_value_inplace(array_node_inplace); + REQUIRE(array_node_inplace[0].is_boolean()); + REQUIRE(array_node_inplace[0].get_value() == true); + REQUIRE(array_node_inplace[1].is_boolean()); + REQUIRE(array_node_inplace[1].get_value() == false); + auto array_bool = node.get_value>(); REQUIRE(array_bool[0] == true); REQUIRE(array_bool[1] == false); + + std::array array_bool_inplace {{}}; + node.get_value_inplace(array_bool_inplace); + REQUIRE(array_bool_inplace[0] == true); + REQUIRE(array_bool_inplace[1] == false); } SECTION("sequence value (std::valarray)") { @@ -2414,9 +2495,21 @@ TEST_CASE("Node_GetValue") { REQUIRE(valarray_node[1].is_boolean()); REQUIRE(valarray_node[1].get_value() == false); + std::valarray valarray_node_inplace {}; + node.get_value_inplace(valarray_node_inplace); + REQUIRE(valarray_node_inplace[0].is_boolean()); + REQUIRE(valarray_node_inplace[0].get_value() == true); + REQUIRE(valarray_node_inplace[1].is_boolean()); + REQUIRE(valarray_node_inplace[1].get_value() == false); + auto valarray_bool = node.get_value>(); REQUIRE(valarray_bool[0] == true); REQUIRE(valarray_bool[1] == false); + + std::valarray valarray_bool_inplace {}; + node.get_value_inplace(valarray_bool_inplace); + REQUIRE(valarray_bool_inplace[0] == true); + REQUIRE(valarray_bool_inplace[1] == false); } SECTION("sequence value (std::deque)") { @@ -2427,10 +2520,24 @@ TEST_CASE("Node_GetValue") { REQUIRE(deque_node[1].is_boolean()); REQUIRE(deque_node[1].get_value() == false); + std::deque deque_node_inplace {}; + node.get_value_inplace(deque_node_inplace); + REQUIRE(deque_node_inplace.size() == 2); + REQUIRE(deque_node_inplace[0].is_boolean()); + REQUIRE(deque_node_inplace[0].get_value() == true); + REQUIRE(deque_node_inplace[1].is_boolean()); + REQUIRE(deque_node_inplace[1].get_value() == false); + auto deque_bool = node.get_value>(); REQUIRE(deque_bool.size() == 2); REQUIRE(deque_bool[0] == true); REQUIRE(deque_bool[1] == false); + + std::deque deque_bool_inplace {}; + node.get_value_inplace(deque_bool_inplace); + REQUIRE(deque_bool_inplace.size() == 2); + REQUIRE(deque_bool_inplace[0] == true); + REQUIRE(deque_bool_inplace[1] == false); } SECTION("sequence value (std::list)") { @@ -2443,10 +2550,26 @@ TEST_CASE("Node_GetValue") { REQUIRE(list_node_itr->is_boolean()); REQUIRE(list_node_itr->get_value() == false); + std::list list_node_inplace {}; + node.get_value_inplace(list_node_inplace); + REQUIRE(list_node_inplace.size() == 2); + auto list_node_inplace_itr = list_node_inplace.begin(); + REQUIRE(list_node_inplace_itr->is_boolean()); + REQUIRE(list_node_inplace_itr->get_value() == true); + list_node_inplace_itr++; + REQUIRE(list_node_inplace_itr->is_boolean()); + REQUIRE(list_node_inplace_itr->get_value() == false); + auto list_bool = node.get_value>(); REQUIRE(list_bool.size() == 2); REQUIRE(*list_bool.begin() == true); REQUIRE(*(std::next(list_bool.begin())) == false); + + std::list list_bool_inplace {}; + node.get_value_inplace(list_bool_inplace); + REQUIRE(list_bool_inplace.size() == 2); + REQUIRE(*list_bool_inplace.begin() == true); + REQUIRE(*(std::next(list_bool_inplace.begin())) == false); } SECTION("sequence value (std::set)") { @@ -2455,10 +2578,22 @@ TEST_CASE("Node_GetValue") { REQUIRE(set_node.find(fkyaml::node(true)) != set_node.end()); REQUIRE(set_node.find(fkyaml::node(false)) != set_node.end()); + std::set set_node_inplace {}; + node.get_value_inplace(set_node_inplace); + REQUIRE(set_node_inplace.size() == 2); + REQUIRE(set_node_inplace.find(fkyaml::node(true)) != set_node_inplace.end()); + REQUIRE(set_node_inplace.find(fkyaml::node(false)) != set_node_inplace.end()); + auto set_bool = node.get_value>(); REQUIRE(set_bool.size() == 2); REQUIRE(set_bool.find(true) != set_bool.end()); REQUIRE(set_bool.find(false) != set_bool.end()); + + std::set set_bool_inplace {}; + node.get_value_inplace(set_bool_inplace); + REQUIRE(set_bool_inplace.size() == 2); + REQUIRE(set_bool_inplace.find(true) != set_bool_inplace.end()); + REQUIRE(set_bool_inplace.find(false) != set_bool_inplace.end()); } SECTION("sequence value (std::multiset)") { @@ -2467,10 +2602,22 @@ TEST_CASE("Node_GetValue") { REQUIRE(mset_node.find(fkyaml::node(true)) != mset_node.end()); REQUIRE(mset_node.find(fkyaml::node(false)) != mset_node.end()); + std::multiset mset_node_inplace {}; + node.get_value_inplace(mset_node_inplace); + REQUIRE(mset_node_inplace.size() == 2); + REQUIRE(mset_node_inplace.find(fkyaml::node(true)) != mset_node_inplace.end()); + REQUIRE(mset_node_inplace.find(fkyaml::node(false)) != mset_node_inplace.end()); + auto mset_bool = node.get_value>(); REQUIRE(mset_bool.size() == 2); REQUIRE(mset_bool.find(true) != mset_bool.end()); REQUIRE(mset_bool.find(false) != mset_bool.end()); + + std::multiset mset_bool_inplace {}; + node.get_value_inplace(mset_bool_inplace); + REQUIRE(mset_bool_inplace.size() == 2); + REQUIRE(mset_bool_inplace.find(true) != mset_bool_inplace.end()); + REQUIRE(mset_bool_inplace.find(false) != mset_bool_inplace.end()); } SECTION("sequence value (std::unordered_set)") { @@ -2479,10 +2626,22 @@ TEST_CASE("Node_GetValue") { REQUIRE(uset_node.find(fkyaml::node(true)) != uset_node.end()); REQUIRE(uset_node.find(fkyaml::node(false)) != uset_node.end()); + std::unordered_set uset_node_inplace {}; + node.get_value_inplace(uset_node_inplace); + REQUIRE(uset_node_inplace.size() == 2); + REQUIRE(uset_node_inplace.find(fkyaml::node(true)) != uset_node_inplace.end()); + REQUIRE(uset_node_inplace.find(fkyaml::node(false)) != uset_node_inplace.end()); + auto uset_bool = node.get_value>(); REQUIRE(uset_bool.size() == 2); REQUIRE(uset_bool.find(true) != uset_bool.end()); REQUIRE(uset_bool.find(false) != uset_bool.end()); + + std::unordered_set uset_bool_inplace {}; + node.get_value_inplace(uset_bool_inplace); + REQUIRE(uset_bool_inplace.size() == 2); + REQUIRE(uset_bool_inplace.find(true) != uset_bool_inplace.end()); + REQUIRE(uset_bool_inplace.find(false) != uset_bool_inplace.end()); } SECTION("sequence value (std::unordered_set)") { @@ -2491,10 +2650,22 @@ TEST_CASE("Node_GetValue") { REQUIRE(umset_node.find(fkyaml::node(true)) != umset_node.end()); REQUIRE(umset_node.find(fkyaml::node(false)) != umset_node.end()); + std::unordered_multiset umset_node_inplace {}; + node.get_value_inplace(umset_node_inplace); + REQUIRE(umset_node_inplace.size() == 2); + REQUIRE(umset_node_inplace.find(fkyaml::node(true)) != umset_node_inplace.end()); + REQUIRE(umset_node_inplace.find(fkyaml::node(false)) != umset_node_inplace.end()); + auto umset_bool = node.get_value>(); REQUIRE(umset_bool.size() == 2); REQUIRE(umset_bool.find(true) != umset_bool.end()); REQUIRE(umset_bool.find(false) != umset_bool.end()); + + std::unordered_multiset umset_bool_inplace {}; + node.get_value_inplace(umset_bool_inplace); + REQUIRE(umset_bool_inplace.size() == 2); + REQUIRE(umset_bool_inplace.find(true) != umset_bool_inplace.end()); + REQUIRE(umset_bool_inplace.find(false) != umset_bool_inplace.end()); } SECTION("sequence value (std::stack)") { @@ -2506,11 +2677,27 @@ TEST_CASE("Node_GetValue") { REQUIRE(stack_node.top().is_boolean()); REQUIRE(stack_node.top().get_value() == true); + std::stack stack_node_inplace {}; + node.get_value_inplace(stack_node_inplace); + REQUIRE(stack_node_inplace.size() == 2); + REQUIRE(stack_node_inplace.top().is_boolean()); + REQUIRE(stack_node_inplace.top().get_value() == false); + stack_node_inplace.pop(); + REQUIRE(stack_node_inplace.top().is_boolean()); + REQUIRE(stack_node_inplace.top().get_value() == true); + auto stack_bool = node.get_value>(); REQUIRE(stack_bool.size() == 2); REQUIRE(stack_bool.top() == false); stack_bool.pop(); REQUIRE(stack_bool.top() == true); + + std::stack stack_bool_inplace {}; + node.get_value_inplace(stack_bool_inplace); + REQUIRE(stack_bool_inplace.size() == 2); + REQUIRE(stack_bool_inplace.top() == false); + stack_bool_inplace.pop(); + REQUIRE(stack_bool_inplace.top() == true); } SECTION("sequence value (std::queue)") { @@ -2522,14 +2709,30 @@ TEST_CASE("Node_GetValue") { REQUIRE(queue_node.front().is_boolean()); REQUIRE(queue_node.front().get_value() == false); + std::queue queue_node_inplace {}; + node.get_value_inplace(queue_node_inplace); + REQUIRE(queue_node_inplace.size() == 2); + REQUIRE(queue_node_inplace.front().is_boolean()); + REQUIRE(queue_node_inplace.front().get_value() == true); + queue_node_inplace.pop(); + REQUIRE(queue_node_inplace.front().is_boolean()); + REQUIRE(queue_node_inplace.front().get_value() == false); + auto queue_bool = node.get_value>(); REQUIRE(queue_bool.size() == 2); REQUIRE(queue_bool.front() == true); queue_bool.pop(); REQUIRE(queue_bool.front() == false); + + std::queue queue_bool_inplace {}; + node.get_value_inplace(queue_bool_inplace); + REQUIRE(queue_bool_inplace.size() == 2); + REQUIRE(queue_bool_inplace.front() == true); + queue_bool_inplace.pop(); + REQUIRE(queue_bool_inplace.front() == false); } - SECTION("sequence value (std::queue)") { + SECTION("sequence value (std::priority_queue)") { auto pqueue_node = node.get_value>(); REQUIRE(pqueue_node.size() == 2); REQUIRE(pqueue_node.top().is_boolean()); @@ -2538,11 +2741,27 @@ TEST_CASE("Node_GetValue") { REQUIRE(pqueue_node.top().is_boolean()); REQUIRE(pqueue_node.top().get_value() == false); + std::priority_queue pqueue_node_inplace {}; + node.get_value_inplace(pqueue_node_inplace); + REQUIRE(pqueue_node_inplace.size() == 2); + REQUIRE(pqueue_node_inplace.top().is_boolean()); + REQUIRE(pqueue_node_inplace.top().get_value() == true); + pqueue_node_inplace.pop(); + REQUIRE(pqueue_node_inplace.top().is_boolean()); + REQUIRE(pqueue_node_inplace.top().get_value() == false); + auto pqueue_bool = node.get_value>(); REQUIRE(pqueue_bool.size() == 2); REQUIRE(pqueue_bool.top() == true); pqueue_bool.pop(); REQUIRE(pqueue_bool.top() == false); + + std::priority_queue pqueue_bool_inplace {}; + node.get_value_inplace(pqueue_bool_inplace); + REQUIRE(pqueue_bool_inplace.size() == 2); + REQUIRE(pqueue_bool_inplace.top() == true); + pqueue_bool_inplace.pop(); + REQUIRE(pqueue_bool_inplace.top() == false); } SECTION("non-sequence value") { @@ -2569,12 +2788,30 @@ TEST_CASE("Node_GetValue") { REQUIRE(map_node.at("foo").is_integer()); REQUIRE(map_node.at("foo").get_value() == -456); + std::map map_node_inplace {}; + node.get_value_inplace(map_node_inplace); + REQUIRE(map_node_inplace.size() == 2); + REQUIRE(map_node_inplace.find("test") != map_node_inplace.end()); + REQUIRE(map_node_inplace.at("test").is_integer()); + REQUIRE(map_node_inplace.at("test").get_value() == 123); + REQUIRE(map_node_inplace.find("foo") != map_node_inplace.end()); + REQUIRE(map_node_inplace.at("foo").is_integer()); + REQUIRE(map_node_inplace.at("foo").get_value() == -456); + auto map_compat = node.get_value>(); REQUIRE(map_compat.size() == 2); REQUIRE(map_compat.find("test") != map_compat.end()); REQUIRE(map_compat.at("test") == 123); REQUIRE(map_compat.find("foo") != map_compat.end()); REQUIRE(map_compat.at("foo") == -456); + + std::map map_compat_inplace {}; + node.get_value_inplace(map_compat_inplace); + REQUIRE(map_compat_inplace.size() == 2); + REQUIRE(map_compat_inplace.find("test") != map_compat_inplace.end()); + REQUIRE(map_compat_inplace.at("test") == 123); + REQUIRE(map_compat_inplace.find("foo") != map_compat_inplace.end()); + REQUIRE(map_compat_inplace.at("foo") == -456); } SECTION("mapping value (std::multimap)") { @@ -2591,6 +2828,20 @@ TEST_CASE("Node_GetValue") { REQUIRE(mmap_node_foo_range.first->second.is_integer()); REQUIRE(mmap_node_foo_range.first->second.get_value() == -456); + std::multimap mmap_node_inplace {}; + node.get_value_inplace(mmap_node_inplace); + REQUIRE(mmap_node_inplace.size() == 2); + REQUIRE(mmap_node_inplace.find("test") != mmap_node_inplace.end()); + auto mmap_node_inplace_test_range = mmap_node_inplace.equal_range("test"); + REQUIRE(std::distance(mmap_node_inplace_test_range.first, mmap_node_inplace_test_range.second) == 1); + REQUIRE(mmap_node_inplace_test_range.first->second.is_integer()); + REQUIRE(mmap_node_inplace_test_range.first->second.get_value() == 123); + REQUIRE(mmap_node_inplace.find("foo") != mmap_node_inplace.end()); + auto mmap_node_inplace_foo_range = mmap_node_inplace.equal_range("foo"); + REQUIRE(std::distance(mmap_node_inplace_test_range.first, mmap_node_inplace_test_range.second) == 1); + REQUIRE(mmap_node_inplace_foo_range.first->second.is_integer()); + REQUIRE(mmap_node_inplace_foo_range.first->second.get_value() == -456); + auto mmap_compat = node.get_value>(); REQUIRE(mmap_compat.size() == 2); REQUIRE(mmap_compat.find("test") != mmap_compat.end()); @@ -2601,6 +2852,18 @@ TEST_CASE("Node_GetValue") { auto mmap_compat_foo_range = mmap_compat.equal_range("foo"); REQUIRE(std::distance(mmap_compat_test_range.first, mmap_compat_test_range.second) == 1); REQUIRE(mmap_compat_foo_range.first->second == -456); + + std::multimap mmap_compat_inplace {}; + node.get_value_inplace(mmap_compat_inplace); + REQUIRE(mmap_compat_inplace.size() == 2); + REQUIRE(mmap_compat_inplace.find("test") != mmap_compat_inplace.end()); + auto mmap_compat_inplace_test_range = mmap_compat_inplace.equal_range("test"); + REQUIRE(std::distance(mmap_compat_inplace_test_range.first, mmap_compat_inplace_test_range.second) == 1); + REQUIRE(mmap_compat_inplace_test_range.first->second == 123); + REQUIRE(mmap_compat_inplace.find("foo") != mmap_compat_inplace.end()); + auto mmap_compat_inplace_foo_range = mmap_compat_inplace.equal_range("foo"); + REQUIRE(std::distance(mmap_compat_inplace_test_range.first, mmap_compat_inplace_test_range.second) == 1); + REQUIRE(mmap_compat_inplace_foo_range.first->second == -456); } SECTION("mapping value (std::unordered_map)") { @@ -2613,6 +2876,16 @@ TEST_CASE("Node_GetValue") { REQUIRE(umap_node.at("foo").is_integer()); REQUIRE(umap_node.at("foo").get_value() == -456); + std::unordered_map umap_node_inplace {}; + node.get_value_inplace(umap_node_inplace); + REQUIRE(umap_node_inplace.size() == 2); + REQUIRE(umap_node_inplace.find("test") != umap_node_inplace.end()); + REQUIRE(umap_node_inplace.at("test").is_integer()); + REQUIRE(umap_node_inplace.at("test").get_value() == 123); + REQUIRE(umap_node_inplace.find("foo") != umap_node_inplace.end()); + REQUIRE(umap_node_inplace.at("foo").is_integer()); + REQUIRE(umap_node_inplace.at("foo").get_value() == -456); + auto umap_compat = node.get_value>(); REQUIRE(umap_compat.size() == 2); REQUIRE(umap_compat.find("test") != umap_compat.end()); @@ -2620,16 +2893,13 @@ TEST_CASE("Node_GetValue") { REQUIRE(umap_compat.find("foo") != umap_compat.end()); REQUIRE(umap_compat.at("foo") == -456); - fkyaml::node various_type_nodes = { - {nullptr, nullptr}, - {true, nullptr}, - {123, nullptr}, - {3.14, nullptr}, - {"foo", nullptr}, - {{{"foo", "bar"}}, nullptr}, - {{"foo", "bar"}, nullptr}, - }; - auto umap = various_type_nodes.get_value>(); + std::unordered_map umap_compat_inplace {}; + node.get_value_inplace(umap_compat_inplace); + REQUIRE(umap_compat_inplace.size() == 2); + REQUIRE(umap_compat_inplace.find("test") != umap_compat_inplace.end()); + REQUIRE(umap_compat_inplace.at("test") == 123); + REQUIRE(umap_compat_inplace.find("foo") != umap_compat_inplace.end()); + REQUIRE(umap_compat_inplace.at("foo") == -456); } SECTION("mapping value (std::unordered_multimap)") { @@ -2646,6 +2916,20 @@ TEST_CASE("Node_GetValue") { REQUIRE(ummap_node_foo_range.first->second.is_integer()); REQUIRE(ummap_node_foo_range.first->second.get_value() == -456); + std::unordered_multimap ummap_node_inplace {}; + node.get_value_inplace(ummap_node_inplace); + REQUIRE(ummap_node_inplace.size() == 2); + REQUIRE(ummap_node_inplace.find("test") != ummap_node_inplace.end()); + auto ummap_node_inplace_test_range = ummap_node_inplace.equal_range("test"); + REQUIRE(std::distance(ummap_node_inplace_test_range.first, ummap_node_inplace_test_range.second) == 1); + REQUIRE(ummap_node_inplace_test_range.first->second.is_integer()); + REQUIRE(ummap_node_inplace_test_range.first->second.get_value() == 123); + REQUIRE(ummap_node_inplace.find("foo") != ummap_node_inplace.end()); + auto ummap_node_inplace_foo_range = ummap_node_inplace.equal_range("foo"); + REQUIRE(std::distance(ummap_node_inplace_test_range.first, ummap_node_inplace_test_range.second) == 1); + REQUIRE(ummap_node_inplace_foo_range.first->second.is_integer()); + REQUIRE(ummap_node_inplace_foo_range.first->second.get_value() == -456); + auto ummap_compat = node.get_value>(); REQUIRE(ummap_compat.size() == 2); REQUIRE(ummap_compat.find("test") != ummap_compat.end()); @@ -2656,6 +2940,18 @@ TEST_CASE("Node_GetValue") { auto ummap_compat_foo_range = ummap_compat.equal_range("foo"); REQUIRE(std::distance(ummap_compat_test_range.first, ummap_compat_test_range.second) == 1); REQUIRE(ummap_compat_foo_range.first->second == -456); + + std::unordered_multimap ummap_compat_inplace {}; + node.get_value_inplace(ummap_compat_inplace); + REQUIRE(ummap_compat_inplace.size() == 2); + REQUIRE(ummap_compat_inplace.find("test") != ummap_compat_inplace.end()); + auto ummap_compat_inplace_test_range = ummap_compat_inplace.equal_range("test"); + REQUIRE(std::distance(ummap_compat_inplace_test_range.first, ummap_compat_inplace_test_range.second) == 1); + REQUIRE(ummap_compat_inplace_test_range.first->second == 123); + REQUIRE(ummap_compat_inplace.find("foo") != ummap_compat_inplace.end()); + auto ummap_compat_inplace_foo_range = ummap_compat_inplace.equal_range("foo"); + REQUIRE(std::distance(ummap_compat_inplace_test_range.first, ummap_compat_inplace_test_range.second) == 1); + REQUIRE(ummap_compat_inplace_foo_range.first->second == -456); } SECTION("non-mapping values") { @@ -2683,21 +2979,72 @@ TEST_CASE("Node_GetValue") { SECTION("null type") { auto null = node.get_value(); REQUIRE(null == nullptr); + + std::nullptr_t null_inplace; + node.get_value_inplace(null_inplace); + REQUIRE(null_inplace == nullptr); } SECTION("non-null compatible types") { REQUIRE(node.get_value() == false); + bool bool_inplace = true; + node.get_value_inplace(bool_inplace); + REQUIRE(bool_inplace == false); + REQUIRE(node.get_value() == 0); + uint8_t ui8_inplace = 1; + node.get_value_inplace(ui8_inplace); + REQUIRE(ui8_inplace == 0); + REQUIRE(node.get_value() == 0); + uint16_t ui16_inplace = 1; + node.get_value_inplace(ui16_inplace); + REQUIRE(ui16_inplace == 0); + REQUIRE(node.get_value() == 0); + uint32_t ui32_inplace = 1; + node.get_value_inplace(ui32_inplace); + REQUIRE(ui32_inplace == 0); + REQUIRE(node.get_value() == 0); + uint64_t ui64_inplace = 1; + node.get_value_inplace(ui64_inplace); + REQUIRE(ui64_inplace == 0); + REQUIRE(node.get_value() == 0); + int8_t i8_inplace = 1; + node.get_value_inplace(i8_inplace); + REQUIRE(i8_inplace == 0); + REQUIRE(node.get_value() == 0); + int16_t i16_inplace = 1; + node.get_value_inplace(i16_inplace); + REQUIRE(i16_inplace == 0); + REQUIRE(node.get_value() == 0); + int32_t i32_inplace = 1; + node.get_value_inplace(i32_inplace); + REQUIRE(i32_inplace == 0); + REQUIRE(node.get_value() == 0); + int64_t i64_inplace = 1; + node.get_value_inplace(i64_inplace); + REQUIRE(i64_inplace == 0); + REQUIRE(node.get_value() == 0.f); + float float_inplace = 1; + node.get_value_inplace(float_inplace); + REQUIRE(float_inplace == 0.f); + REQUIRE(node.get_value() == 0.); + double double_inplace = 1; + node.get_value_inplace(double_inplace); + REQUIRE(double_inplace == 0.); + REQUIRE(node.get_value() == 0.l); + long double long_double_inplace = 1; + node.get_value_inplace(long_double_inplace); + REQUIRE(long_double_inplace == 0.l); } SECTION("non-null incompatible types") { @@ -2715,32 +3062,127 @@ TEST_CASE("Node_GetValue") { SECTION("boolean type") { REQUIRE(true_node.get_value() == true); REQUIRE(false_node.get_value() == false); + + bool true_inplace = false; + bool false_inplace = true; + true_node.get_value_inplace(true_inplace); + false_node.get_value_inplace(false_inplace); + REQUIRE(true_inplace == true); + REQUIRE(false_inplace == false); } - SECTION("non-boolean compatible types") { + SECTION("non-boolean compatible types (true)") { REQUIRE(true_node.get_value() == 1); + uint8_t ui8_inplace = 0; + true_node.get_value_inplace(ui8_inplace); + REQUIRE(ui8_inplace == 1); + REQUIRE(true_node.get_value() == 1); + uint16_t ui16_inplace = 0; + true_node.get_value_inplace(ui16_inplace); + REQUIRE(ui16_inplace == 1); + REQUIRE(true_node.get_value() == 1); + uint32_t ui32_inplace = 0; + true_node.get_value_inplace(ui32_inplace); + REQUIRE(ui32_inplace == 1); + REQUIRE(true_node.get_value() == 1); + uint64_t ui64_inplace = 0; + true_node.get_value_inplace(ui64_inplace); + REQUIRE(ui64_inplace == 1); + REQUIRE(true_node.get_value() == 1); + int8_t i8_inplace = 0; + true_node.get_value_inplace(i8_inplace); + REQUIRE(i8_inplace == 1); + REQUIRE(true_node.get_value() == 1); + int16_t i16_inplace = 0; + true_node.get_value_inplace(i16_inplace); + REQUIRE(i16_inplace == 1); + REQUIRE(true_node.get_value() == 1); + int32_t i32_inplace = 0; + true_node.get_value_inplace(i32_inplace); + REQUIRE(i32_inplace == 1); + REQUIRE(true_node.get_value() == 1); + int64_t i64_inplace = 0; + true_node.get_value_inplace(i64_inplace); + REQUIRE(i64_inplace == 1); + REQUIRE(true_node.get_value() == 1.f); + float float_inplace = 0; + true_node.get_value_inplace(float_inplace); + REQUIRE(float_inplace == 1.f); + REQUIRE(true_node.get_value() == 1.); + double double_inplace = 0; + true_node.get_value_inplace(double_inplace); + REQUIRE(double_inplace == 1.); + REQUIRE(true_node.get_value() == 1.l); + long double long_double_inplace = 0; + true_node.get_value_inplace(long_double_inplace); + REQUIRE(long_double_inplace == 1.l); + } + SECTION("non-boolean compatible types (false)") { REQUIRE(false_node.get_value() == 0); + uint8_t ui8_inplace = 1; + false_node.get_value_inplace(ui8_inplace); + REQUIRE(ui8_inplace == 0); + REQUIRE(false_node.get_value() == 0); + uint16_t ui16_inplace = 1; + false_node.get_value_inplace(ui16_inplace); + REQUIRE(ui16_inplace == 0); + REQUIRE(false_node.get_value() == 0); + uint32_t ui32_inplace = 1; + false_node.get_value_inplace(ui32_inplace); + REQUIRE(ui32_inplace == 0); + REQUIRE(false_node.get_value() == 0); + uint64_t ui64_inplace = 1; + false_node.get_value_inplace(ui64_inplace); + REQUIRE(ui64_inplace == 0); + REQUIRE(false_node.get_value() == 0); + int8_t i8_inplace = 1; + false_node.get_value_inplace(i8_inplace); + REQUIRE(i8_inplace == 0); + REQUIRE(false_node.get_value() == 0); + int16_t i16_inplace = 1; + false_node.get_value_inplace(i16_inplace); + REQUIRE(i16_inplace == 0); + REQUIRE(false_node.get_value() == 0); + int32_t i32_inplace = 1; + false_node.get_value_inplace(i32_inplace); + REQUIRE(i32_inplace == 0); + REQUIRE(false_node.get_value() == 0); + int64_t i64_inplace = 1; + false_node.get_value_inplace(i64_inplace); + REQUIRE(i64_inplace == 0); + REQUIRE(false_node.get_value() == 0.f); + float float_inplace = 1; + false_node.get_value_inplace(float_inplace); + REQUIRE(float_inplace == 0.f); + REQUIRE(false_node.get_value() == 0.); + double double_inplace = 1; + false_node.get_value_inplace(double_inplace); + REQUIRE(double_inplace == 0.); + REQUIRE(false_node.get_value() == 0.l); + long double long_double_inplace = 1; + false_node.get_value_inplace(long_double_inplace); + REQUIRE(long_double_inplace == 0.l); } SECTION("non-boolean incompatible types") { @@ -2757,32 +3199,112 @@ TEST_CASE("Node_GetValue") { SECTION("integer types") { REQUIRE(node.get_value() == 123); + int8_t i8_inplace = 0; + node.get_value_inplace(i8_inplace); + REQUIRE(i8_inplace == 123); + REQUIRE(node.get_value() == 123); + int16_t i16_inplace = 0; + node.get_value_inplace(i16_inplace); + REQUIRE(i16_inplace == 123); + REQUIRE(node.get_value() == 123); + int32_t i32_inplace = 0; + node.get_value_inplace(i32_inplace); + REQUIRE(i32_inplace == 123); + REQUIRE(node.get_value() == 123); + int64_t i64_inplace = 0; + node.get_value_inplace(i64_inplace); + REQUIRE(i64_inplace == 123); + REQUIRE(node.get_value() == 123); + uint8_t ui8_inplace = 0; + node.get_value_inplace(ui8_inplace); + REQUIRE(ui8_inplace == 123); + REQUIRE(node.get_value() == 123); + uint16_t ui16_inplace = 0; + node.get_value_inplace(ui16_inplace); + REQUIRE(ui16_inplace == 123); + REQUIRE(node.get_value() == 123); + uint32_t ui32_inplace = 0; + node.get_value_inplace(ui32_inplace); + REQUIRE(ui32_inplace == 123); + REQUIRE(node.get_value() == 123); + uint64_t ui64_inplace = 0; + node.get_value_inplace(ui64_inplace); + REQUIRE(ui64_inplace == 123); } - SECTION("non-integer compatible types") { + SECTION("non-integer compatible types (positive)") { REQUIRE(node.get_value() == true); + bool bool_inplace = false; + node.get_value_inplace(bool_inplace); + REQUIRE(bool_inplace == true); + REQUIRE(node.get_value() == 123.f); + float float_inplace = 0.f; + node.get_value_inplace(float_inplace); + REQUIRE(float_inplace == 123.f); + REQUIRE(node.get_value() == 123.); + double double_inplace = 0.; + node.get_value_inplace(double_inplace); + REQUIRE(double_inplace == 123.); + REQUIRE(node.get_value() == 123.l); + long double long_double_inplace = 0.l; + node.get_value_inplace(long_double_inplace); + REQUIRE(long_double_inplace == 123.l); + } + SECTION("non-integer compatible types (negative)") { node = -123; REQUIRE(node.get_value() == true); + bool bool_inplace = false; + node.get_value_inplace(bool_inplace); + REQUIRE(bool_inplace == true); + REQUIRE(node.get_value() == -123.f); + float float_inplace = 0.f; + node.get_value_inplace(float_inplace); + REQUIRE(float_inplace == -123.f); + REQUIRE(node.get_value() == -123.); + double double_inplace = 0.; + node.get_value_inplace(double_inplace); + REQUIRE(double_inplace == -123.); + REQUIRE(node.get_value() == -123.l); + long double long_double_inplace = 0.l; + node.get_value_inplace(long_double_inplace); + REQUIRE(long_double_inplace == -123.l); + } + SECTION("non-integer compatible types (zero)") { node = 0; REQUIRE(node.get_value() == false); + bool bool_inplace = true; + node.get_value_inplace(bool_inplace); + REQUIRE(bool_inplace == false); + REQUIRE(node.get_value() == 0.f); + float float_inplace = 1.f; + node.get_value_inplace(float_inplace); + REQUIRE(float_inplace == 0.f); + REQUIRE(node.get_value() == 0.); + double double_inplace = 1.; + node.get_value_inplace(double_inplace); + REQUIRE(double_inplace == 0.); + REQUIRE(node.get_value() == 0.l); + long double long_double_inplace = 1.l; + node.get_value_inplace(long_double_inplace); + REQUIRE(long_double_inplace == 0.l); } SECTION("non-integer incompatible types") { @@ -2810,52 +3332,178 @@ TEST_CASE("Node_GetValue") { SECTION("positive float values") { REQUIRE(std::abs(node.get_value() - 3.14) < std::numeric_limits::epsilon()); + float float_inplace = 0.f; + node.get_value_inplace(float_inplace); + REQUIRE(std::abs(float_inplace - 3.14) < std::numeric_limits::epsilon()); + REQUIRE(std::abs(node.get_value() - 3.14) < std::numeric_limits::epsilon()); + double double_inplace = 0.; + node.get_value_inplace(double_inplace); + REQUIRE(std::abs(double_inplace - 3.14) < std::numeric_limits::epsilon()); + REQUIRE(std::abs(node.get_value() - 3.14) < std::numeric_limits::epsilon()); + long double long_double_inplace = 0.; + node.get_value_inplace(long_double_inplace); + REQUIRE(std::abs(long_double_inplace - 3.14) < std::numeric_limits::epsilon()); } SECTION("zero float values") { node = 0.0; REQUIRE(std::abs(node.get_value() - 0.0) < std::numeric_limits::epsilon()); + float float_inplace = 1.f; + node.get_value_inplace(float_inplace); + REQUIRE(std::abs(float_inplace - 0.0) < std::numeric_limits::epsilon()); + REQUIRE(std::abs(node.get_value() - 0.0) < std::numeric_limits::epsilon()); + double double_inplace = 1.; + node.get_value_inplace(double_inplace); + REQUIRE(std::abs(double_inplace - 0.0) < std::numeric_limits::epsilon()); + REQUIRE(std::abs(node.get_value() - 0.0) < std::numeric_limits::epsilon()); + long double long_double_inplace = 1.l; + node.get_value_inplace(long_double_inplace); + REQUIRE(std::abs(long_double_inplace - 0.0) < std::numeric_limits::epsilon()); } SECTION("negative float values") { node = -3.14; REQUIRE(std::abs(node.get_value() - (-3.14)) < std::numeric_limits::epsilon()); + float float_inplace = 0.f; + node.get_value_inplace(float_inplace); + REQUIRE(std::abs(float_inplace - (-3.14)) < std::numeric_limits::epsilon()); + REQUIRE(std::abs(node.get_value() - (-3.14)) < std::numeric_limits::epsilon()); + double double_inplace = 0.; + node.get_value_inplace(double_inplace); + REQUIRE(std::abs(double_inplace - (-3.14)) < std::numeric_limits::epsilon()); + REQUIRE(std::abs(node.get_value() - (-3.14)) < std::numeric_limits::epsilon()); + long double long_double_inplace = 0.; + node.get_value_inplace(long_double_inplace); + REQUIRE(std::abs(long_double_inplace - (-3.14)) < std::numeric_limits::epsilon()); } - SECTION("non-float compatible types") { + SECTION("non-float compatible types (positive)") { REQUIRE(node.get_value() == true); + bool bool_inplace = false; + node.get_value_inplace(bool_inplace); + REQUIRE(bool_inplace == true); + REQUIRE(node.get_value() == 3); + uint8_t ui8_inplace = 0; + node.get_value_inplace(ui8_inplace); + REQUIRE(ui8_inplace == 3); + REQUIRE(node.get_value() == 3); + uint16_t ui16_inplace = 0; + node.get_value_inplace(ui16_inplace); + REQUIRE(ui16_inplace == 3); + REQUIRE(node.get_value() == 3); + uint32_t ui32_inplace = 0; + node.get_value_inplace(ui32_inplace); + REQUIRE(ui32_inplace == 3); + REQUIRE(node.get_value() == 3); + uint64_t ui64_inplace = 0; + node.get_value_inplace(ui64_inplace); + REQUIRE(ui64_inplace == 3); + REQUIRE(node.get_value() == 3); + int8_t i8_inplace = 0; + node.get_value_inplace(i8_inplace); + REQUIRE(i8_inplace == 3); + REQUIRE(node.get_value() == 3); + int16_t i16_inplace = 0; + node.get_value_inplace(i16_inplace); + REQUIRE(i16_inplace == 3); + REQUIRE(node.get_value() == 3); + int32_t i32_inplace = 0; + node.get_value_inplace(i32_inplace); + REQUIRE(i32_inplace == 3); + REQUIRE(node.get_value() == 3); + int64_t i64_inplace = 0; + node.get_value_inplace(i64_inplace); + REQUIRE(i64_inplace == 3); + } + SECTION("non-float compatible types (negative)") { node = -3.14; REQUIRE(node.get_value() == true); + bool bool_inplace = false; + node.get_value_inplace(bool_inplace); + REQUIRE(bool_inplace == true); + REQUIRE(node.get_value() == -3); + int8_t i8_inplace = 0; + node.get_value_inplace(i8_inplace); + REQUIRE(i8_inplace == -3); + REQUIRE(node.get_value() == -3); + int16_t i16_inplace = 0; + node.get_value_inplace(i16_inplace); + REQUIRE(i16_inplace == -3); + REQUIRE(node.get_value() == -3); + int32_t i32_inplace = 0; + node.get_value_inplace(i32_inplace); + REQUIRE(i32_inplace == -3); + REQUIRE(node.get_value() == -3); + int64_t i64_inplace = 0; + node.get_value_inplace(i64_inplace); + REQUIRE(i64_inplace == -3); + } + SECTION("non-float compatible types (zero)") { node = 0.0; REQUIRE(node.get_value() == false); + bool bool_inplace = true; + node.get_value_inplace(bool_inplace); + REQUIRE(bool_inplace == false); + REQUIRE(node.get_value() == 0); + uint8_t ui8_inplace = 1; + node.get_value_inplace(ui8_inplace); + REQUIRE(ui8_inplace == 0); + REQUIRE(node.get_value() == 0); + uint16_t ui16_inplace = 1; + node.get_value_inplace(ui16_inplace); + REQUIRE(ui16_inplace == 0); + REQUIRE(node.get_value() == 0); + uint32_t ui32_inplace = 1; + node.get_value_inplace(ui32_inplace); + REQUIRE(ui32_inplace == 0); + REQUIRE(node.get_value() == 0); + uint64_t ui64_inplace = 1; + node.get_value_inplace(ui64_inplace); + REQUIRE(ui64_inplace == 0); + REQUIRE(node.get_value() == 0); + int8_t i8_inplace = 1; + node.get_value_inplace(i8_inplace); + REQUIRE(i8_inplace == 0); + REQUIRE(node.get_value() == 0); + int16_t i16_inplace = 1; + node.get_value_inplace(i16_inplace); + REQUIRE(i16_inplace == 0); + REQUIRE(node.get_value() == 0); + int32_t i32_inplace = 1; + node.get_value_inplace(i32_inplace); + REQUIRE(i32_inplace == 0); + REQUIRE(node.get_value() == 0); + int64_t i64_inplace = 1; + node.get_value_inplace(i64_inplace); + REQUIRE(i64_inplace == 0); } SECTION("non-float incompatible types") { @@ -2893,18 +3541,33 @@ TEST_CASE("Node_GetValue") { auto str = node.get_value(); REQUIRE(str.size() == 4); REQUIRE(str == "test"); + + std::string str_inplace {}; + node.get_value_inplace(str_inplace); + REQUIRE(str_inplace.size() == 4); + REQUIRE(str_inplace == "test"); } SECTION("string value (string_wrap)") { auto str_wrap = node.get_value(); REQUIRE(str_wrap.str.size() == 4); REQUIRE(str_wrap.str == "test"); + + string_wrap str_wrap_inplace {}; + node.get_value_inplace(str_wrap_inplace); + REQUIRE(str_wrap_inplace.str.size() == 4); + REQUIRE(str_wrap_inplace.str == "test"); } SECTION("string value (fkyaml::detail::str_view)") { auto str_view = node.get_value(); REQUIRE(str_view.size() == 4); REQUIRE(str_view == "test"); + + fkyaml::detail::str_view str_view_inplace {}; + node.get_value_inplace(str_view_inplace); + REQUIRE(str_view_inplace.size() == 4); + REQUIRE(str_view_inplace == "test"); } #ifdef FK_YAML_HAS_CXX_17 @@ -2912,6 +3575,11 @@ TEST_CASE("Node_GetValue") { auto str_view = node.get_value(); REQUIRE(str_view.size() == 4); REQUIRE(str_view == "test"); + + std::string_view str_view_inplace {}; + node.get_value_inplace(str_view_inplace); + REQUIRE(str_view_inplace.size() == 4); + REQUIRE(str_view_inplace == "test"); } #endif @@ -2934,9 +3602,21 @@ TEST_CASE("Node_GetValue") { REQUIRE(pair_node.second.is_string()); REQUIRE(pair_node.second.get_value() == "test"); + std::pair pair_node_inplace {}; + n.get_value_inplace(pair_node_inplace); + REQUIRE(pair_node_inplace.first.is_integer()); + REQUIRE(pair_node_inplace.first.get_value() == 123); + REQUIRE(pair_node_inplace.second.is_string()); + REQUIRE(pair_node_inplace.second.get_value() == "test"); + auto pair_val = n.get_value>(); REQUIRE(pair_val.first == 123); REQUIRE(pair_val.second == "test"); + + std::pair pair_val_inplace {}; + n.get_value_inplace(pair_val_inplace); + REQUIRE(pair_val_inplace.first == 123); + REQUIRE(pair_val_inplace.second == "test"); } SECTION("std::tuple") { @@ -2950,29 +3630,79 @@ TEST_CASE("Node_GetValue") { REQUIRE(std::get<2>(tuple_node).is_boolean()); REQUIRE(std::get<2>(tuple_node).get_value() == true); + std::tuple tuple_node_inplace {}; + n.get_value_inplace(tuple_node_inplace); + REQUIRE(std::get<0>(tuple_node_inplace).is_integer()); + REQUIRE(std::get<0>(tuple_node_inplace).get_value() == 123); + REQUIRE(std::get<1>(tuple_node_inplace).is_string()); + REQUIRE(std::get<1>(tuple_node_inplace).get_value() == "test"); + REQUIRE(std::get<2>(tuple_node_inplace).is_boolean()); + REQUIRE(std::get<2>(tuple_node_inplace).get_value() == true); + auto tuple_val = n.get_value>(); REQUIRE(std::get<0>(tuple_val) == 123); REQUIRE(std::get<1>(tuple_val) == "test"); REQUIRE(std::get<2>(tuple_val) == true); + + std::tuple tuple_val_inplace {}; + n.get_value_inplace(tuple_val_inplace); + REQUIRE(std::get<0>(tuple_val_inplace) == 123); + REQUIRE(std::get<1>(tuple_val_inplace) == "test"); + REQUIRE(std::get<2>(tuple_val_inplace) == true); } #ifdef FK_YAML_HAS_CXX_17 SECTION("std::optional") { fkyaml::node n {true, false}; + auto opt_vec = n.get_value>>(); REQUIRE(opt_vec.has_value()); REQUIRE(opt_vec.value().size() == 2); REQUIRE(opt_vec.value().at(0) == true); REQUIRE(opt_vec.value().at(1) == false); + std::optional> opt_vec_inplace {}; + n.get_value_inplace(opt_vec_inplace); + REQUIRE(opt_vec_inplace.has_value()); + REQUIRE(opt_vec_inplace.value().size() == 2); + REQUIRE(opt_vec_inplace.value().at(0) == true); + REQUIRE(opt_vec_inplace.value().at(1) == false); + auto opt_bool = n.get_value>(); REQUIRE_FALSE(opt_bool.has_value()); + + std::optional opt_bool_inplace {}; + n.get_value_inplace(opt_bool_inplace); + REQUIRE_FALSE(opt_bool_inplace.has_value()); } #endif + SECTION("from alias node") { + fkyaml::node anchor = 123; + anchor.add_anchor_name("anchor"); + fkyaml::node alias = fkyaml::node::alias_of(anchor); + REQUIRE(alias.get_value() == 123); + + int int_inplace = 0; + alias.get_value_inplace(int_inplace); + REQUIRE(int_inplace == 123); + } + + SECTION("not default constructible type") { + // get_value() requires its output type to be default constructible + STATIC_REQUIRE_FALSE( + fkyaml::detail::is_detected::value); + + // but get_value_inplace() accepts types which are not default constructible. + not_default_constructible ndc(0); + fkyaml::node int_node = 1; + int_node.get_value_inplace(ndc); + REQUIRE(ndc.value == 1); + } + SECTION("unsupported types") { STATIC_REQUIRE_FALSE(fkyaml::detail::is_detected::value); - STATIC_REQUIRE_FALSE(fkyaml::detail::is_detected::value); + STATIC_REQUIRE_FALSE(fkyaml::detail::is_detected::value); STATIC_REQUIRE_FALSE(fkyaml::detail::is_detected::value); } } From ec133cda8d5172a8cb82e55cbea2b097bbb69bbf Mon Sep 17 00:00:00 2001 From: fktn Date: Mon, 16 Dec 2024 22:45:27 +0900 Subject: [PATCH 03/18] support std::forward_list in from_node (#444) --- docs/mkdocs/docs/api/basic_node/get_value.md | 37 +++++++++---- .../fkYAML/detail/conversions/from_node.hpp | 33 ++++++++++++ single_include/fkYAML/node.hpp | 33 ++++++++++++ test/unit_test/test_node_class.cpp | 54 +++++++++++++++++++ 4 files changed, 146 insertions(+), 11 deletions(-) diff --git a/docs/mkdocs/docs/api/basic_node/get_value.md b/docs/mkdocs/docs/api/basic_node/get_value.md index 909a2625..145f4df2 100644 --- a/docs/mkdocs/docs/api/basic_node/get_value.md +++ b/docs/mkdocs/docs/api/basic_node/get_value.md @@ -36,15 +36,26 @@ This API makes a copy of the value, and if the copying costs too much, or if you This library implements conversions from a sequence node to a number of STL container types whose element type is not a key-value pair. The implementation can be used for custom container types, but they need to have both `iterator` member type and `insert()` member function. The test suite confirms successful conversions to the following types. - * [std::vector](https://en.cppreference.com/w/cpp/container/vector), [std::deque](https://en.cppreference.com/w/cpp/container/deque), [std::list](https://en.cppreference.com/w/cpp/container/list) *(sequence containers)* - * [std::set](https://en.cppreference.com/w/cpp/container/set), [std::multiset](https://en.cppreference.com/w/cpp/container/multiset) *(associative containers for keys)* - * [std::unordered_set](https://en.cppreference.com/w/cpp/container/unordered_set), [std::unordered_multiset](https://en.cppreference.com/w/cpp/container/unordered_multiset) *(unordered associative containers for keys)* - - And you can also convert to these types which do not have `insert()` member function though. - - * [std::array](https://en.cppreference.com/w/cpp/container/array), [std::valarray](https://en.cppreference.com/w/cpp/numeric/valarray) *(sequence containers)* - * [std::stack](https://en.cppreference.com/w/cpp/container/stack), [std::queue](https://en.cppreference.com/w/cpp/container/queue), [std::priority_queue](https://en.cppreference.com/w/cpp/container/priority_queue) *(sequence container adapters)* - * [std::pair](https://en.cppreference.com/w/cpp/utility/pair), [std::tuple](https://en.cppreference.com/w/cpp/utility/tuple) + * *Sequence Containers* + * [std::array](https://en.cppreference.com/w/cpp/container/array) + * [std::vector](https://en.cppreference.com/w/cpp/container/vector) + * [std::deque](https://en.cppreference.com/w/cpp/container/deque) + * [std::forward_list](https://en.cppreference.com/w/cpp/container/forward_list) + * [std::list](https://en.cppreference.com/w/cpp/container/list) + * *Associative Containers for Keys* + * [std::set](https://en.cppreference.com/w/cpp/container/set) + * [std::multiset](https://en.cppreference.com/w/cpp/container/multiset) + * *Unordered Associative Containers for Keys* + * [std::unordered_set](https://en.cppreference.com/w/cpp/container/unordered_set) + * [std::unordered_multiset](https://en.cppreference.com/w/cpp/container/unordered_multiset) + * *Container Adapters* + * [std::stack](https://en.cppreference.com/w/cpp/container/stack) + * [std::queue](https://en.cppreference.com/w/cpp/container/queue) + * [std::priority_queue](https://en.cppreference.com/w/cpp/container/priority_queue) + * *Others* + * [std::valarray](https://en.cppreference.com/w/cpp/numeric/valarray) + * [std::pair](https://en.cppreference.com/w/cpp/utility/pair) + * [std::tuple](https://en.cppreference.com/w/cpp/utility/tuple) Note that the above types cannot be converted from a non-sequence node, which results in throwing a [type_error](../exception/type_error.md). @@ -52,8 +63,12 @@ This API makes a copy of the value, and if the copying costs too much, or if you This library implements conversions from a mapping node to STL container types whose element type is a key-value pair. The implementation can be used for custom container types, but they need to have `key_type`, `mapped_type` and `value_type` member types and `emplace()` member function. The test suite confirms successful conversions to the following types. - * [std::map](https://en.cppreference.com/w/cpp/container/map), [std::multimap](https://en.cppreference.com/w/cpp/container/multimap) *(associative containers for key-value pairs)* - * [std::unordered_map](https://en.cppreference.com/w/cpp/container/unordered_map), [std::unordered_multi_map](https://en.cppreference.com/w/cpp/container/unordered_multimap) *(unordered associative containers for key-value pairs)* + * *Associative Containers for Key-Value Pairs* + * [std::map](https://en.cppreference.com/w/cpp/container/map) + * [std::multimap](https://en.cppreference.com/w/cpp/container/multimap) + * *Unordered Associative Containers for Key-Value Pairs* + * [std::unordered_map](https://en.cppreference.com/w/cpp/container/unordered_map) + * [std::unordered_multi_map](https://en.cppreference.com/w/cpp/container/unordered_multimap) *(unordered associative containers for key-value pairs)* ???+ Note "Convert from a Null or Numeric Scalar Node" diff --git a/include/fkYAML/detail/conversions/from_node.hpp b/include/fkYAML/detail/conversions/from_node.hpp index f06c8f9d..808f6cae 100644 --- a/include/fkYAML/detail/conversions/from_node.hpp +++ b/include/fkYAML/detail/conversions/from_node.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -191,6 +192,30 @@ inline auto from_node(const BasicNodeType& n, std::valarray& va) } } +/// @brief from_node function for std::forward_list objects whose element type must be a basic_node template instance +/// type or a compatible type. This function is necessary since insert function is not implemented for +/// std::forward_list. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam T Element type of std::forward_list. +/// @tparam Alloc Allocator type of std::forward_list. +/// @param n A basic_node object. +/// @param fl A std::forward_list object. +template +inline auto from_node(const BasicNodeType& n, std::forward_list& fl) + -> decltype(n.template get_value(), void()) { + if FK_YAML_UNLIKELY (!n.is_sequence()) { + throw type_error("The target node value is not sequence type.", n.get_type()); + } + + fl.clear(); + + // std::forward_list does not have insert function. + auto insert_pos_itr = fl.before_begin(); + for (const auto& elem : n) { + insert_pos_itr = fl.emplace_after(insert_pos_itr, elem.template get_value()); + } +} + /// @brief from_node function for container objects of only keys or values, e.g., std::vector or std::set, whose element /// type must be a basic_node template instance type or a compatible type. /// @tparam BasicNodeType A basic_node template instance type. @@ -210,6 +235,8 @@ inline auto from_node(const BasicNodeType& n, CompatSeqType& s) throw type_error("The target node value is not sequence type.", n.get_type()); } + s.clear(); + // call reserve function first if it's available (like std::vector). call_reserve_if_available::call(s, n.size()); @@ -236,6 +263,11 @@ inline auto from_node(const BasicNodeType& n, SeqContainerAdapter& ca) throw type_error("The target node value is not sequence type.", n.get_type()); } + // clear existing elements manually since clear function is not implemeneted for container adapter classes. + while (!ca.empty()) { + ca.pop(); + } + for (const auto& elem : n) { // container adapter classes commonly have push function. // emplace function cannot be used in case SeqContainerAdapter::container_type is std::vector in C++11. @@ -262,6 +294,7 @@ inline auto from_node(const BasicNodeType& n, CompatMapType& m) throw type_error("The target node value type is not mapping type.", n.get_type()); } + m.clear(); call_reserve_if_available::call(m, n.size()); for (const auto& pair : n.template get_value_ref()) { diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 10967c1e..925b4138 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -10998,6 +10998,7 @@ FK_YAML_DETAIL_NAMESPACE_END #include #include +#include #include #include #include @@ -11184,6 +11185,30 @@ inline auto from_node(const BasicNodeType& n, std::valarray& va) } } +/// @brief from_node function for std::forward_list objects whose element type must be a basic_node template instance +/// type or a compatible type. This function is necessary since insert function is not implemented for +/// std::forward_list. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam T Element type of std::forward_list. +/// @tparam Alloc Allocator type of std::forward_list. +/// @param n A basic_node object. +/// @param fl A std::forward_list object. +template +inline auto from_node(const BasicNodeType& n, std::forward_list& fl) + -> decltype(n.template get_value(), void()) { + if FK_YAML_UNLIKELY (!n.is_sequence()) { + throw type_error("The target node value is not sequence type.", n.get_type()); + } + + fl.clear(); + + // std::forward_list does not have insert function. + auto insert_pos_itr = fl.before_begin(); + for (const auto& elem : n) { + insert_pos_itr = fl.emplace_after(insert_pos_itr, elem.template get_value()); + } +} + /// @brief from_node function for container objects of only keys or values, e.g., std::vector or std::set, whose element /// type must be a basic_node template instance type or a compatible type. /// @tparam BasicNodeType A basic_node template instance type. @@ -11203,6 +11228,8 @@ inline auto from_node(const BasicNodeType& n, CompatSeqType& s) throw type_error("The target node value is not sequence type.", n.get_type()); } + s.clear(); + // call reserve function first if it's available (like std::vector). call_reserve_if_available::call(s, n.size()); @@ -11229,6 +11256,11 @@ inline auto from_node(const BasicNodeType& n, SeqContainerAdapter& ca) throw type_error("The target node value is not sequence type.", n.get_type()); } + // clear existing elements manually since clear function is not implemeneted for container adapter classes. + while (!ca.empty()) { + ca.pop(); + } + for (const auto& elem : n) { // container adapter classes commonly have push function. // emplace function cannot be used in case SeqContainerAdapter::container_type is std::vector in C++11. @@ -11255,6 +11287,7 @@ inline auto from_node(const BasicNodeType& n, CompatMapType& m) throw type_error("The target node value type is not mapping type.", n.get_type()); } + m.clear(); call_reserve_if_available::call(m, n.size()); for (const auto& pair : n.template get_value_ref()) { diff --git a/test/unit_test/test_node_class.cpp b/test/unit_test/test_node_class.cpp index c865436c..258623f8 100644 --- a/test/unit_test/test_node_class.cpp +++ b/test/unit_test/test_node_class.cpp @@ -2512,6 +2512,30 @@ TEST_CASE("Node_GetValue_GetValueInplace") { REQUIRE(valarray_bool_inplace[1] == false); } + SECTION("sequence value (std::forward_list)") { + auto forward_list_node = node.get_value>(); + REQUIRE(forward_list_node.begin()->is_boolean()); + REQUIRE(forward_list_node.begin()->get_value() == true); + REQUIRE((std::next(forward_list_node.begin()))->is_boolean()); + REQUIRE((std::next(forward_list_node.begin()))->get_value() == false); + + std::forward_list forward_list_node_inplace {}; + node.get_value_inplace(forward_list_node_inplace); + REQUIRE(forward_list_node_inplace.begin()->is_boolean()); + REQUIRE(forward_list_node_inplace.begin()->get_value() == true); + REQUIRE((std::next(forward_list_node_inplace.begin()))->is_boolean()); + REQUIRE((std::next(forward_list_node_inplace.begin()))->get_value() == false); + + auto forward_list_bool = node.get_value>(); + REQUIRE(*forward_list_bool.begin() == true); + REQUIRE(*std::next(forward_list_bool.begin()) == false); + + std::forward_list forward_list_bool_inplace {}; + node.get_value_inplace(forward_list_bool_inplace); + REQUIRE(*forward_list_bool_inplace.begin() == true); + REQUIRE(*std::next(forward_list_bool_inplace.begin()) == false); + } + SECTION("sequence value (std::deque)") { auto deque_node = node.get_value>(); REQUIRE(deque_node.size() == 2); @@ -2693,6 +2717,8 @@ TEST_CASE("Node_GetValue_GetValueInplace") { REQUIRE(stack_bool.top() == true); std::stack stack_bool_inplace {}; + stack_bool_inplace.push(true); + stack_bool_inplace.push(false); node.get_value_inplace(stack_bool_inplace); REQUIRE(stack_bool_inplace.size() == 2); REQUIRE(stack_bool_inplace.top() == false); @@ -2900,6 +2926,27 @@ TEST_CASE("Node_GetValue_GetValueInplace") { REQUIRE(umap_compat_inplace.at("test") == 123); REQUIRE(umap_compat_inplace.find("foo") != umap_compat_inplace.end()); REQUIRE(umap_compat_inplace.at("foo") == -456); + + fkyaml::node mapping { + {{123, 456, 789}, nullptr}, + {{{true, false}}, nullptr}, + {nullptr, nullptr}, + {true, nullptr}, + {123, nullptr}, + {3.14, nullptr}, + {"foo", nullptr}}; + auto umap_various_keys = mapping.get_value>(); + REQUIRE(umap_various_keys.size() == 7); + REQUIRE(umap_various_keys.find({123, 456, 789}) != umap_various_keys.end()); + REQUIRE(umap_various_keys.find({{true, false}}) != umap_various_keys.end()); + REQUIRE(umap_various_keys.find(nullptr) != umap_various_keys.end()); + REQUIRE(umap_various_keys.find(true) != umap_various_keys.end()); + REQUIRE(umap_various_keys.find(123) != umap_various_keys.end()); + REQUIRE(umap_various_keys.find(3.14) != umap_various_keys.end()); + REQUIRE(umap_various_keys.find("foo") != umap_various_keys.end()); + for (auto itr : umap_various_keys) { + REQUIRE(itr.second.is_null()); + } } SECTION("mapping value (std::unordered_multimap)") { @@ -2956,9 +3003,16 @@ TEST_CASE("Node_GetValue_GetValueInplace") { SECTION("non-mapping values") { REQUIRE_THROWS_AS(node.get_value(), fkyaml::type_error); + int dummy_array_1d[2] {}; + REQUIRE_THROWS_AS(node.get_value_inplace(dummy_array_1d), fkyaml::type_error); + int dummy_array_2d[2][2] {}; + REQUIRE_THROWS_AS(node.get_value_inplace(dummy_array_2d), fkyaml::type_error); + int dummy_array_3d[2][2][2] {}; + REQUIRE_THROWS_AS(node.get_value_inplace(dummy_array_3d), fkyaml::type_error); using array_t = std::array; REQUIRE_THROWS_AS(node.get_value(), fkyaml::type_error); REQUIRE_THROWS_AS(node.get_value>(), fkyaml::type_error); + REQUIRE_THROWS_AS(node.get_value>(), fkyaml::type_error); REQUIRE_THROWS_AS(node.get_value>(), fkyaml::type_error); using pair_t = std::pair; REQUIRE_THROWS_AS(node.get_value(), fkyaml::type_error); From 4361556b3d3d591b2abd22af2171837b05bc715d Mon Sep 17 00:00:00 2001 From: fktn Date: Wed, 18 Dec 2024 00:45:35 +0900 Subject: [PATCH 04/18] Revise the contents of API References (#445) * updated mkdocs-material & mkdocs-git-revision-date-localized-plugin * updated copyright year in the license files * restructured document pages * revised documentation contents in the API references section * organized structure of documentation contents in the API references section * added top page & reordered documentation pages in the API references section --- LICENSE.txt | 2 +- README.md | 2 +- docs/examples/ex_basic_node_constructor_7.cpp | 7 +- .../ex_basic_node_constructor_7.output | 2 + .../ex_basic_node_constructor_8.output | 5 - ...x_basic_node_move_assignment_operator.cpp} | 10 +- ...basic_node_move_assignment_operator.output | 2 + docs/mkdocs/Makefile | 7 + .../docs/api/basic_node/add_anchor_name.md | 4 +- .../docs/api/basic_node/add_tag_name.md | 4 +- docs/mkdocs/docs/api/basic_node/alias_of.md | 10 +- docs/mkdocs/docs/api/basic_node/at.md | 136 +++----- docs/mkdocs/docs/api/basic_node/begin.md | 12 +- .../docs/api/basic_node/boolean_type.md | 12 +- .../mkdocs/docs/api/basic_node/constructor.md | 276 ++++++--------- docs/mkdocs/docs/api/basic_node/contains.md | 36 +- .../mkdocs/docs/api/basic_node/deserialize.md | 78 ++--- .../docs/api/basic_node/deserialize_docs.md | 69 +--- docs/mkdocs/docs/api/basic_node/empty.md | 8 +- docs/mkdocs/docs/api/basic_node/end.md | 14 +- .../api/basic_node/extraction_operator.md | 6 +- .../docs/api/basic_node/float_number_type.md | 21 +- .../docs/api/basic_node/get_anchor_name.md | 12 +- .../docs/api/basic_node/get_tag_name.md | 10 +- docs/mkdocs/docs/api/basic_node/get_type.md | 10 +- docs/mkdocs/docs/api/basic_node/get_value.md | 14 +- .../docs/api/basic_node/get_value_inplace.md | 11 +- .../docs/api/basic_node/get_value_ref.md | 38 ++- .../docs/api/basic_node/get_yaml_version.md | 12 +- .../api/basic_node/get_yaml_version_type.md | 10 +- .../docs/api/basic_node/has_anchor_name.md | 8 +- .../docs/api/basic_node/has_tag_name.md | 8 +- docs/mkdocs/docs/api/basic_node/index.md | 9 +- .../docs/api/basic_node/insertion_operator.md | 11 +- .../docs/api/basic_node/integer_type.md | 14 +- docs/mkdocs/docs/api/basic_node/is_alias.md | 8 +- docs/mkdocs/docs/api/basic_node/is_anchor.md | 8 +- docs/mkdocs/docs/api/basic_node/is_boolean.md | 14 +- .../docs/api/basic_node/is_float_number.md | 14 +- docs/mkdocs/docs/api/basic_node/is_integer.md | 14 +- docs/mkdocs/docs/api/basic_node/is_mapping.md | 14 +- docs/mkdocs/docs/api/basic_node/is_null.md | 14 +- docs/mkdocs/docs/api/basic_node/is_scalar.md | 19 +- .../mkdocs/docs/api/basic_node/is_sequence.md | 14 +- docs/mkdocs/docs/api/basic_node/is_string.md | 14 +- docs/mkdocs/docs/api/basic_node/iterator.md | 8 +- docs/mkdocs/docs/api/basic_node/mapping.md | 14 +- .../docs/api/basic_node/mapping_type.md | 27 +- docs/mkdocs/docs/api/basic_node/node.md | 8 +- docs/mkdocs/docs/api/basic_node/node_t.md | 10 +- docs/mkdocs/docs/api/basic_node/operator=.md | 55 +-- docs/mkdocs/docs/api/basic_node/operator[].md | 135 +++----- .../mkdocs/docs/api/basic_node/operator_eq.md | 15 +- .../mkdocs/docs/api/basic_node/operator_ge.md | 10 +- .../mkdocs/docs/api/basic_node/operator_gt.md | 8 +- .../mkdocs/docs/api/basic_node/operator_le.md | 8 +- .../mkdocs/docs/api/basic_node/operator_lt.md | 29 +- .../mkdocs/docs/api/basic_node/operator_ne.md | 8 +- docs/mkdocs/docs/api/basic_node/rbegin.md | 12 +- docs/mkdocs/docs/api/basic_node/rend.md | 12 +- .../docs/api/basic_node/reverse_iterator.md | 24 +- docs/mkdocs/docs/api/basic_node/sequence.md | 11 +- .../docs/api/basic_node/sequence_type.md | 14 +- docs/mkdocs/docs/api/basic_node/serialize.md | 16 +- .../docs/api/basic_node/serialize_docs.md | 14 +- .../docs/api/basic_node/set_yaml_version.md | 10 +- .../api/basic_node/set_yaml_version_type.md | 8 +- docs/mkdocs/docs/api/basic_node/size.md | 10 +- .../mkdocs/docs/api/basic_node/string_type.md | 14 +- docs/mkdocs/docs/api/basic_node/swap.md | 39 +-- docs/mkdocs/docs/api/basic_node/type.md | 12 +- .../api/basic_node/value_converter_type.md | 16 +- .../docs/api/basic_node/yaml_version_t.md | 10 +- docs/mkdocs/docs/api/exception/constructor.md | 29 +- docs/mkdocs/docs/api/exception/destructor.md | 2 +- docs/mkdocs/docs/api/exception/index.md | 5 +- docs/mkdocs/docs/api/exception/invalid_tag.md | 19 ++ docs/mkdocs/docs/api/exception/what.md | 12 +- docs/mkdocs/docs/api/index.md | 18 + docs/mkdocs/docs/api/macros.md | 12 +- docs/mkdocs/docs/api/node_type.md | 6 +- .../api/node_value_converter/from_node.md | 16 +- .../docs/api/node_value_converter/index.md | 4 +- .../docs/api/node_value_converter/to_node.md | 20 +- docs/mkdocs/docs/api/operator_literal_yaml.md | 8 +- docs/mkdocs/docs/api/ordered_map/at.md | 16 +- .../docs/api/ordered_map/constructor.md | 28 +- .../mkdocs/docs/api/ordered_map/destructor.md | 2 +- docs/mkdocs/docs/api/ordered_map/emplace.md | 12 +- docs/mkdocs/docs/api/ordered_map/find.md | 14 +- docs/mkdocs/docs/api/ordered_map/index.md | 18 +- .../mkdocs/docs/api/ordered_map/operator[].md | 12 +- docs/mkdocs/docs/api/yaml_version_type.md | 6 +- docs/mkdocs/docs/home/license.md | 2 +- .../docs/tutorials/cmake_integration.md | 6 +- docs/mkdocs/mkdocs.yml | 317 +++++++++--------- docs/mkdocs/requirements.txt | 45 +-- include/fkYAML/exception.hpp | 16 + include/fkYAML/ordered_map.hpp | 31 +- single_include/fkYAML/node.hpp | 47 ++- 100 files changed, 1109 insertions(+), 1194 deletions(-) delete mode 100644 docs/examples/ex_basic_node_constructor_8.output rename docs/examples/{ex_basic_node_constructor_8.cpp => ex_basic_node_move_assignment_operator.cpp} (70%) create mode 100644 docs/examples/ex_basic_node_move_assignment_operator.output create mode 100644 docs/mkdocs/docs/api/exception/invalid_tag.md create mode 100644 docs/mkdocs/docs/api/index.md diff --git a/LICENSE.txt b/LICENSE.txt index a736ba15..50eaec62 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Kensuke Fukutani +Copyright (c) 2023-2024 Kensuke Fukutani Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index adf16d50..028d2bf2 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ Note that, since fkYAML deserializes scalars into native booleans or integers du This project is distributed under the [MIT License](https://opensource.org/license/mit/): -Copyright (c) 2023 Kensuke Fukutani +Copyright (c) 2023-2024 Kensuke Fukutani Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/examples/ex_basic_node_constructor_7.cpp b/docs/examples/ex_basic_node_constructor_7.cpp index 831533de..fe6b141a 100644 --- a/docs/examples/ex_basic_node_constructor_7.cpp +++ b/docs/examples/ex_basic_node_constructor_7.cpp @@ -10,7 +10,12 @@ #include int main() { - fkyaml::node n({true, false}); + // create a sequence. + fkyaml::node n = {true, false}; std::cout << n << std::endl; + + // create a mapping. + fkyaml::node n2 = {{"foo", 1024}}; + std::cout << n2 << std::endl; return 0; } diff --git a/docs/examples/ex_basic_node_constructor_7.output b/docs/examples/ex_basic_node_constructor_7.output index 70c48721..ee41427a 100644 --- a/docs/examples/ex_basic_node_constructor_7.output +++ b/docs/examples/ex_basic_node_constructor_7.output @@ -1,3 +1,5 @@ - true - false +foo: 1024 + diff --git a/docs/examples/ex_basic_node_constructor_8.output b/docs/examples/ex_basic_node_constructor_8.output deleted file mode 100644 index ee41427a..00000000 --- a/docs/examples/ex_basic_node_constructor_8.output +++ /dev/null @@ -1,5 +0,0 @@ -- true -- false - -foo: 1024 - diff --git a/docs/examples/ex_basic_node_constructor_8.cpp b/docs/examples/ex_basic_node_move_assignment_operator.cpp similarity index 70% rename from docs/examples/ex_basic_node_constructor_8.cpp rename to docs/examples/ex_basic_node_move_assignment_operator.cpp index e0482113..b8d17c5b 100644 --- a/docs/examples/ex_basic_node_constructor_8.cpp +++ b/docs/examples/ex_basic_node_move_assignment_operator.cpp @@ -10,10 +10,12 @@ #include int main() { - fkyaml::node n = {true, false}; - std::cout << n << std::endl; + fkyaml::node n = true; + fkyaml::node n2 = 123; + n = std::move(n2); + + std::cout << std::boolalpha << n.is_integer() << std::endl; + std::cout << n.get_value() << std::endl; - fkyaml::node n2 = {{"foo", 1024}}; - std::cout << n2 << std::endl; return 0; } diff --git a/docs/examples/ex_basic_node_move_assignment_operator.output b/docs/examples/ex_basic_node_move_assignment_operator.output new file mode 100644 index 00000000..892bea09 --- /dev/null +++ b/docs/examples/ex_basic_node_move_assignment_operator.output @@ -0,0 +1,2 @@ +true +123 diff --git a/docs/mkdocs/Makefile b/docs/mkdocs/Makefile index 22a9776f..3a459bba 100644 --- a/docs/mkdocs/Makefile +++ b/docs/mkdocs/Makefile @@ -7,6 +7,13 @@ serve: build venv/bin/mkdocs serve # install a Python virtual environment +# requirements.txt was generated by running the following commands. +# ``` +# python3 -m venv venv +# venv/bin/pip install --upgrade pip +# venv/bin/pip install mkdocs-material mkdocs-git-revision-date-localized-plugin +# venv/bin/pip freeze > ./requirements.txt +# ``` install-venv: requirements.txt python3 -m venv venv venv/bin/pip install --upgrade pip diff --git a/docs/mkdocs/docs/api/basic_node/add_anchor_name.md b/docs/mkdocs/docs/api/basic_node/add_anchor_name.md index 6154a3a7..b0784638 100644 --- a/docs/mkdocs/docs/api/basic_node/add_anchor_name.md +++ b/docs/mkdocs/docs/api/basic_node/add_anchor_name.md @@ -15,7 +15,9 @@ If the basic_node has already had any anchor name, the new anchor name overwrite ***`anchor_name`*** [in] : An anchor name. This should not be empty. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_add_anchor_name.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/add_tag_name.md b/docs/mkdocs/docs/api/basic_node/add_tag_name.md index 55965862..e865e951 100644 --- a/docs/mkdocs/docs/api/basic_node/add_tag_name.md +++ b/docs/mkdocs/docs/api/basic_node/add_tag_name.md @@ -15,7 +15,9 @@ If the basic_node has already had any tag name, the new tag name overwrites the ***`tag_name`*** [in] : A tag name. This should not be empty. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_add_tag_name.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/alias_of.md b/docs/mkdocs/docs/api/basic_node/alias_of.md index 2c091381..e0db2d26 100644 --- a/docs/mkdocs/docs/api/basic_node/alias_of.md +++ b/docs/mkdocs/docs/api/basic_node/alias_of.md @@ -7,23 +7,25 @@ static basic_node alias_of(const basic_node& anchor); ``` Creates an alias YAML node from an anchor node. +If the given anchor node does not have any non-empty anchor name, an [`fkyaml::exception`](../exception/index.md) will be thrown. ## **Parameters** ***anchor*** [in] : A basic_node object with an anchor name. - This node must have some anchor name. + This node must have a non-empty anchor name. ## **Return Value** -An alias YAML node which is created from the given anchor node. -If the given anchor node does not have any non-empty anchor name, an [`fkyaml::exception`](../exception/index.md) will be thrown. +An alias node which refers to the given anchor node. !!! Note If this API throws an exception, the internally stored YAML node value in the given anchor node stays intact. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_alias_of.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/at.md b/docs/mkdocs/docs/api/basic_node/at.md index 041fa9fc..c63d30ff 100644 --- a/docs/mkdocs/docs/api/basic_node/at.md +++ b/docs/mkdocs/docs/api/basic_node/at.md @@ -3,77 +3,61 @@ # fkyaml::basic_node::at ```cpp -template < - typename KeyType, detail::enable_if_t< - detail::conjunction< - detail::negation>, - detail::is_node_compatible_type>::value, - int> = 0> -basic_node& at(KeyType&& key); // (1) - -template < - typename KeyType, detail::enable_if_t< - detail::conjunction< - detail::negation>, - detail::is_node_compatible_type>::value, - int> = 0> -const basic_node& at(KeyType&& key) const; // (2) - -template < - typename KeyType, detail::enable_if_t>::value, int> = 0> -basic_node& at(KeyType&& key); // (3) - -template < - typename KeyType, detail::enable_if_t>::value, int> = 0> -const basic_node& at(KeyType&& key) const; // (4) +// (1) +template +basic_node& at(KeyType&& key); + +template +const basic_node& at(KeyType&& key) const; + +// (2) +template +basic_node& at(BasicNodeType&& key); + +template +const basic_node& at(BasicNodeType&& key) const; ``` -Access to a YAML node element with either an index (for sequences) or a key (for mappings). -Before accessing the element, this function checks the bounds in the case of a sequence or the existence of a key in the case of a mapping. -This function therefore costs a bit more than [`basic_node::operator[]()`](operator[].md) function due to the extra checks. -Furthermore, this function may throw the following exceptions: +Access to an element in a container node with either an index or key value. +This function must be called on a container node, or a [`fkyaml::type_error`](../exception/type_error.md) would be thrown. -* [`fkyaml::type_error`](../exception/type_error.md) - * if the queried node is neither a sequence nor a mapping, or - * if the queried node is a sequence but the given `key` is not an integer. -* [`fkyaml::out_of_range`](../exception/out_of_range.md) - * if the given key does not exist in the queried mapping, or - * if the given index exceeds the size of the queried sequence. +The input parameter `key` must be either a [`basic_node`](index.md) object or an object of a compatible type, i.e., a type with which a [`basic_node`](index.md) object can be constructible. +Note that the overload (1) internally constructs a temporal [`basic_node`](index.md) object. +So, if you use the same key multiple times, for example, in a for loop, consider creating a [`basic_node`](index.md) as a key first for better performance. -## Overload (1), (2) +Furthermore, unlike the [`operator[]`](operator[].md), this function executes one of the following checks depending on the target node value type. -```cpp -template < - typename KeyType, detail::enable_if_t< - detail::conjunction< - detail::negation>, - detail::is_node_compatible_type>::value, - int> = 0> -basic_node& at(KeyType&& key); // (1) - -template < - typename KeyType, detail::enable_if_t< - detail::conjunction< - detail::negation>, - detail::is_node_compatible_type>::value, - int> = 0> -const basic_node& at(KeyType&& key) const; // (2) -``` +* For sequence nodes + * Whether `key` is of an integeral type (e.g., `int`, `size_t`) or an integer node. + If not, a [`fkyaml::type_error`](../exception/type_error.md) will be thrown. + * Whether the value of `key` is more than or equal to the size of the queried sequence. + If not, a [`fkyaml::out_of_range`](../exception/out_of_range.md) will be thrown. +* For mapping nodes + * Whether a given key exists in the target container. + If not, [`fkyaml::out_of_range`](../exception/out_of_range.md) will be thrown. + +This function therefore costs a bit more than [`operator[]`](operator[].md) due to the above extra checks. -Accesses to an element in the YAML sequence/mapping node with the given key object of a compatible type with the [`basic_node`](index.md) class, i.e., a type with which a [`basic_node`](index.md) object is constructible. -These overloads internally construct a [`basic_node`](index.md) object with `key`. +## **Template Parameters** +***KeyType*** +: A compatible key type. + +***BasicNodeType*** +: A basic_node template instance type. + +## **Parameters** -### **Parameters** +***`key`*** [in] +: A key to a target element in the sequence/mapping node. -***`index`*** [in] -: An index/key for an element in the YAML sequence/mapping node. +## **Return Value** -### **Return Value** +(Constant) reference to the node value which is associated with the given key. -Reference, or constant reference, to the YAML node object associated with the given index/key. +## **Examples** -???+ Example +??? Example "Access an element with compatible keys" ```cpp --8<-- "examples/ex_basic_node_at_compatible_type.cpp:9" @@ -84,37 +68,7 @@ Reference, or constant reference, to the YAML node object associated with the gi --8<-- "examples/ex_basic_node_at_compatible_type.output" ``` -## Overload (3), (4) - -```cpp -template < - typename KeyType, detail::enable_if_t>::value, int> = 0> -basic_node& at(KeyType&& key); // (3) - -template < - typename KeyType, detail::enable_if_t>::value, int> = 0> -const basic_node& at(KeyType&& key) const; // (4) -``` - -Accesses to an element in the YAML sequence/mapping node with the given [`basic_node`](index.md) key object. -Unlike the overloads (1) and (2) above, these overloads do not internally construct a [`basic_node`](index.md) object. -So, these overloads works more effectively when some key objects are used multiple times, for instance, in a for-loop. - -### **Template Parameters** - -***KeyType*** -: A key type which is a kind of the [`basic_node`](index.md) template class. - -### **Parameters** - -***`key`*** [in] -: An index/key for an element in the YAML sequence/mapping node. - -### **Return Value** - -Reference, or constant reference, to the YAML node object associated with the given index/key. - -???+ Example +??? Example "Access an element with `basic_node` keys" ```cpp --8<-- "examples/ex_basic_node_at_basic_node.cpp:9" @@ -128,8 +82,6 @@ Reference, or constant reference, to the YAML node object associated with the gi ## **See Also** * [basic_node](index.md) -* [size](size.md) -* [contains](contains.md) * [operator[]](operator[].md) * [operator<<](insertion_operator.md) * [out_of_range](../exception/out_of_range.md) diff --git a/docs/mkdocs/docs/api/basic_node/begin.md b/docs/mkdocs/docs/api/basic_node/begin.md index 5c71383b..376aac37 100644 --- a/docs/mkdocs/docs/api/basic_node/begin.md +++ b/docs/mkdocs/docs/api/basic_node/begin.md @@ -8,16 +8,18 @@ const_iterator begin() const; const_iterator cbegin() const; ``` -Returns an iterator to the first element of a container node. -Throws a [`fkyaml::type_error`](../exception/type_error.md) if a basic_node is neither a sequence nor mapping node. +Returns a (constant) iterator to the first element of a container node. +If a basic_node is neither a sequence nor mapping, a [`fkyaml::type_error`](../exception/type_error.md) will be thrown. ![Image from https://en.cppreference.com/w/cpp/iterator/begin](../../img/range-begin-end.svg) -### **Return Value** +## **Return Value** -An iterator to the first element of a container node. +A (constant) iterator to the first element of a container node. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_begin.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/boolean_type.md b/docs/mkdocs/docs/api/basic_node/boolean_type.md index d22eead8..dd38164b 100644 --- a/docs/mkdocs/docs/api/basic_node/boolean_type.md +++ b/docs/mkdocs/docs/api/basic_node/boolean_type.md @@ -6,17 +6,19 @@ using boolean_type = BooleanType; ``` -The type used to store boolean node values. +The type used to store boolean values. The YAML specification describes a boolean as a type which differentiates the following literals: * true, True, TRUE -> `true` * false, False, FALSE -> `false` -To store boolean objects in [`basic_node`](index.md) class, the type is defined by the template parameter `BooleanType` which chooses the type to use for boolean objects. -If not explicitly specified, the default type `bool` will be chosen. -With the decided type, boolean objects are stored directly inside a [`basic_node`](index.md). +The actual type is defined by the template parameter `BooleanType`. +If not explicitly specified, the default type `bool` is defined. +With the decided type, boolean values are stored directly inside a [`basic_node`](index.md). -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_boolean_type.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/constructor.md b/docs/mkdocs/docs/api/basic_node/constructor.md index b9f42a3e..bc2ca0e7 100644 --- a/docs/mkdocs/docs/api/basic_node/constructor.md +++ b/docs/mkdocs/docs/api/basic_node/constructor.md @@ -13,36 +13,108 @@ basic_node(const basic_node& rhs); // (4) basic_node(basic_node&& rhs) noexcept; // (5) -template < - typename CompatibleType, typename U = detail::remove_cv_ref_t, - detail::enable_if_t< - detail::conjunction< - detail::negation>, - detail::disjunction>>::value, - int> = 0> +template > basic_node(CompatibleType&& val) noexcept( noexcept(ConverterType::to_node(std::declval(), std::declval()))); // (6) -template < - typename NodeRefStorageType, - detail::enable_if_t::value, int> = 0> -basic_node(const NodeRefStorageType& node_ref_storage) noexcept; // (7) - -basic_node(initializer_list_t init); // (8) +basic_node(initializer_list_t init); // (7) ``` Constructs a new basic_node from a variety of data sources. -Available overloads are described down below. +Available overloads are: + +1. Constructs a basic_node with a null value. + The resulting basic_node has the [`node_type::NULL_OBJECT`](../node_type.md) type. +2. Constructs a basic_node with the given type. + The resulting basic_node has a default value for the given type. + + | `type` | default value | + | --------------------- | ---------------- | + | node_type::SEQUENCE | (empty sequence) | + | node_type::MAPPING | (empty mapping) | + | node_type::NULL_VALUE | `#!cpp nullptr` | + | node_type::BOOLEAN | `#!cpp false` | + | node_type::INTEGER | `#!cpp 0` | + | node_type::FLOAT | `#!cpp 0.0` | + | node_type::STRING | (empty string) | + +3. Constructs a basic_node with the given type. + The resulting basic_node has a default value for the given type. + Default values are the same as those in the above table. + + !!! warning "Deprecation" + + The overload(2) `#!cpp basic_node(const node_type);` replaces the overload(3) `#!cpp basic_node(const node_t);` which has been deprecated in version 0.3.12. It will be removed in a future version. Please replace calls like + + ```cpp + fkyaml::node n(fkyaml::node::node_t::MAPPING); + ``` + + with + + ```cpp + fkyaml::node n(fkyaml::node_type::MAPPING); + ``` + +4. Copy constructs a basic_node with an existing basic_node. +5. Move constructs a basic_node with an existing basic_node. + The existing basic_node will be the same as a default-constructed basic_node at the end of this constructor. +6. Constructs a basic_node with a value of a compatible type (see below). + The resulting basic_node has the value of `val` and the type which is associated with `CompatibleType`. + Template parameter `CompatibleType` includes, but not limited to, the following types: + * sequences: + * [`sequence_type`](sequence_type.md) + * mappings + * [`mapping_type`](mapping_type.md) + * null + * [`std::nullptr_t`](https://en.cppreference.com/w/cpp/types/nullptr_t) + * booleans + * [`boolean_type`](boolean_type.md) + * integers + * [`integer_type`](integer_type.md) + * all integral types except `bool` such as `int`, `uint32_t` or `size_t`. + * floating point values + * [`float_number_type`](float_number_type.md) + * `float`, `double` or `long double` + * strings + * [`string_type`](string_type.md) + * types with which [`string_type`](string_type.md) is constructible such as `char[]`, `char*` or [`std::string_view`](https://en.cppreference.com/w/cpp/string/basic_string_view) (since C++17) + + You can add types to meet your needs by implementing custom `to_node()` functions. See [`node_value_converter`](../node_value_converter/to_node.md) for details. +7. Constructs a basic_node with a initializer_list_t object. + The resulting basic_node has the value of a container (sequence or mapping) which has the contents of `init`. + Basically, `init` is considered to be a sequence. + If `init` contains a sequence where each element contains 2 basic_node objects, however, such a sequence is interpreted as a mapping. + + !!! Note "initializer lists which have a single element" + + `#!cpp fkyaml::node n {true};` will create a sequence of 1 boolean value, not a boolean value alone. This is because [overload resolution in C++ prioritizes a constructor with a single initializer list argument is prioritized to the others](https://en.cppreference.com/w/cpp/language/overload_resolution). In such cases, change the code to `#! fkyaml::node n(true);` instead. + +## **Template Parameters** + +***CompatibleType*** +: A type such that `ConverterType` has a `to_node` function. + +***U*** +: A type referred to by `ValueType` with its topmost cv-qualifiers removed. + +## **Parameters** -## Overload (1) +***`type`*** [in] +: the type of the value to create -```cpp -basic_node() = default; -``` -Default constructor. Constructs a basic_node with a null value. -The resulting basic_node has the [`node_t::NULL_OBJECT`](node_t.md) type. +***`rhs`*** [in] +: the basic_node object to copy/move the value from -???+ Example +***`val`*** [in] +: the value of a compatible type. + +***`init`*** [in] +: initializer list of basic_node objects + +## **Examples** + +??? Example "Overload(1): create a default value" ```cpp --8<-- "examples/ex_basic_node_constructor_1.cpp:9" @@ -53,20 +125,7 @@ The resulting basic_node has the [`node_t::NULL_OBJECT`](node_t.md) type. --8<-- "examples/ex_basic_node_constructor_1.output" ``` -## Overload (2) - -```cpp -explicit basic_node(const node_type type); -``` -Constructs a basic_node with the given type. -The resulting basic_node has a default value for the given type. - -### **Parameters** - -***`type`*** [in] -: A YAML node type. - -???+ Example +??? Example "Overload(2): create an empty value with a given type" ```cpp --8<-- "examples/ex_basic_node_constructor_2.cpp:9" @@ -77,35 +136,7 @@ The resulting basic_node has a default value for the given type. --8<-- "examples/ex_basic_node_constructor_2.output" ``` -## Overload (3) - -```cpp -explicit basic_node(const node_t type); -``` - -!!! warning "Deprecation" - - The constructor `#!cpp basic_node(const node_type)` replaces the constructor `#!cpp basic_node(const node_t)` which has been deprecated in version 0.3.12. It will be removed in version 0.4.0. Please replace calls like - - ```cpp - fkyaml::node n(fkyaml::node::node_t::MAPPING); - ``` - - with - - ```cpp - fkyaml::node n(fkyaml::node_type::MAPPING); - ``` - -Constructs a basic_node with the given type. -The resulting basic_node has a default value for the given type. - -### **Parameters** - -***`type`*** [in] -: A YAML node type. - -???+ Example +??? Example "Overload(3): create an empty value with a given type (deprecated)" ```cpp --8<-- "examples/ex_basic_node_constructor_3.cpp:9" @@ -116,20 +147,7 @@ The resulting basic_node has a default value for the given type. --8<-- "examples/ex_basic_node_constructor_3.output" ``` -## Overload (4) - -```cpp -basic_node(const basic_node& rhs); -``` -Copy constructor. Copies the internal data of `rhs` into the resulting basic_node. -The resulting basic_node has the same type and value as `rhs`. - -### **Parameters** - -***`rhs`*** [in] -: A basic_node object to be copied with. - -???+ Example +??? Example "Overload(4): copy construct a basic_node object" ```cpp --8<-- "examples/ex_basic_node_constructor_4.cpp:9" @@ -140,21 +158,7 @@ The resulting basic_node has the same type and value as `rhs`. --8<-- "examples/ex_basic_node_constructor_4.output" ``` -## Overload (5) - -```cpp -basic_node(basic_node&& rhs) noexcept; -``` -Move constructor. Move the internal data of `rhs` into the resulting basic_node. -The resulting basic_node has the same type and value as `rhs`. -The value of the argument `rhs` after calling this move constructor, will be the same as a default-constructed basic_node. - -### **Parameters** - -***`rhs`*** [in] -: A basic_node object to be moved from. - -???+ Example +??? Example "Overload(5): move construct a basic_node object" ```cpp --8<-- "examples/ex_basic_node_constructor_5.cpp:9" @@ -165,36 +169,7 @@ The value of the argument `rhs` after calling this move constructor, will be the --8<-- "examples/ex_basic_node_constructor_5.output" ``` -## Overload (6) - -```cpp -template < - typename CompatibleType, typename U = detail::remove_cv_ref_t, - detail::enable_if_t< - detail::conjunction< - detail::negation>, - detail::disjunction>>::value, - int> = 0> -basic_node(CompatibleType&& val) noexcept( - noexcept(ConverterType::to_node(std::declval(), std::declval()))); // (5) -``` -Constructs a basic_node with a value of a compatible type. -The resulting basic_node has the value of `val` and the type which is associated with `CompatibleType`. - -### **Template Parameters** - -***`CompatibleType`*** -: Type of native data which is compatible with node values. - -***`U`*** -: Type of compatible native data without cv-qualifiers and reference. - -### **Parameters** - -***`val`*** [in] -: The value of a compatible type. - -???+ Example +??? Example "Overload(6): create a basic_node object with compatible types" ```cpp --8<-- "examples/ex_basic_node_constructor_6.cpp:9" @@ -205,34 +180,7 @@ The resulting basic_node has the value of `val` and the type which is associated --8<-- "examples/ex_basic_node_constructor_6.output" ``` -## Overload (7) - -```cpp -template < - typename NodeRefStorageType, - detail::enable_if_t::value, int> = 0> -basic_node(const NodeRefStorageType& node_ref_storage) noexcept; -``` -Constructs a basic_node with a node_ref_storage. -The resulting basic_node has the value of the referenced basic_node by `node_ref_storage`. - -!!! Warning - - This constructor is mainly for the one with std::initializer_list, and the argument type is too detailed to be used from outside the fkYAML library. - So, this overload might become unavailable in the future major version. - Please refrain from intentionally using this overload, and use the overload with std::initializer_list instead. - -### **Template Parameters** - -***`NodeRefStorageType`*** -: Type of basic_node with reference. - -### **Parameters** - -***`node_ref_storage`*** [in] -: A node_ref_storage template class object. - -???+ Example +??? Example "Overload(7): create a basic_node object from an initializer list" ```cpp --8<-- "examples/ex_basic_node_constructor_7.cpp:9" @@ -242,32 +190,6 @@ The resulting basic_node has the value of the referenced basic_node by `node_ref ```bash --8<-- "examples/ex_basic_node_constructor_7.output" ``` - -## Overload (8) - -```cpp -basic_node(initializer_list_t init); -``` -Constructs a basic_node with a initializer_list_t object. -The resulting basic_node has the value of a container (sequence or mapping) which has the contents of `init`. -Basically, the basic_node objects in `init` are considered as a sequence node. -If `init` contains a sequence of basic_node objects in which the number of basic_node objects is 2 and the first has the type of `node_t::STRING`, however, such a sequence is reinterpreted as a mapping node. - -### **Parameters** - -***`init`*** [in] -: A initializer list of basic_node objects. - -???+ Example - - ```cpp - --8<-- "examples/ex_basic_node_constructor_8.cpp:9" - ``` - - output: - ```bash - --8<-- "examples/ex_basic_node_constructor_8.output" - ``` --- ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/contains.md b/docs/mkdocs/docs/api/basic_node/contains.md index 662bd0dc..1f04a430 100644 --- a/docs/mkdocs/docs/api/basic_node/contains.md +++ b/docs/mkdocs/docs/api/basic_node/contains.md @@ -3,38 +3,38 @@ # fkyaml::basic_node::contains ```cpp -template < - typename KeyType, detail::enable_if_t< - detail::conjunction< - detail::negation>>, - detail::is_node_compatible_type>>::value, - int> = 0> -bool contains(KeyType&& key) const; // (1) A compatible key object with basic_node type - -template < - typename KeyType, detail::enable_if_t>::value, int> = 0> -bool contains(KeyType&& key) const; // (2) A basic_node object +template +bool contains(KeyType&& key) const; // (1) + +template +bool contains(BasicNodeType&& key) const; // (2) ``` -Checks if the YAML node has the given key. -If the node value is not a mapping, this API will throw an [`fkyaml::type_error`](../exception/type_error.md). -The `KeyType` can be a compatible type with [`fkyaml::basic_node`](index.md) or a kind of [`fkyaml::basic_node`](index.md) template class. +Checks if the YAML node has the given key in the queried mapping. +If the node value is not a mapping, a [`fkyaml::type_error`](../exception/type_error.md) will be thrown. + +The input parameter `key` must be either a [`basic_node`](index.md) obejct or an object of a compatible type, i.e., a type with which a [`basic_node`](index.md) object can be constructible. +Note that the overload (1) internally constructs a temporal [`basic_node`](index.md) object. +So, if you use the same key multiple times, for example, in a for loop, consider creating a [`basic_node`](index.md) as a key first for better performance. ## **Template Parameters** ***KeyType*** -: A type which is compatible with or a kind of [`fkyaml::basic_node`](index.md). +: A type with which a [`basic_node`](index.md) object can be constructible. + +***BasicNodeType*** +: A basic_node template instance type. ## **Parameters** ***`key`*** [in] -: A key to the target value in the YAML mapping node value. +: A key to check existence in the queried mapping. ## **Return Value** -`true` if the YAML node is a mapping and has the given key, `false` otherwise. +`true` if the key exists in the queried mapping, `false` otherwise. -???+ Example +??? Example ```cpp --8<-- "examples/ex_basic_node_contains.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/deserialize.md b/docs/mkdocs/docs/api/basic_node/deserialize.md index 599a644e..c81cea62 100644 --- a/docs/mkdocs/docs/api/basic_node/deserialize.md +++ b/docs/mkdocs/docs/api/basic_node/deserialize.md @@ -7,74 +7,58 @@ template static basic_node deserialize(InputType&& input); // (1) template -static basic_node deserialize(ItrType&& begin, ItrType&& end); // (2) +static basic_node deserialize(ItrType begin, ItrType end); // (2) ``` Deserializes from compatible inputs. Note that this function deserializes only the first YAML document in the given input and ignore the rest. -Use this function when the input consists of a single YAML document or only the first one needs to be deserialized. +Use this function when the input consists of a single YAML document or only the first needs to be deserialized. Otherwise, use the [`deserialize_docs()`](deserialize_docs.md) function instead. Throws a [`fkyaml::exception`](../exception/index.md) if the deserialization process detects an error from the input. !!! note "Supported Unicode Encodings" fkYAML supports UTF-8, UTF-16 and UTF-32 encodings for input characters. - As the YAML specification shows [(here)](https://yaml.org/spec/1.2.2/#52-character-encodings), all input streams must begin with either a byte order mark(BOM) or an ASCII character, which will allow the encoding to be deduced by the pattern of the first few bytes of the input sequence. - If an input fails to meet the above requirement, the input is interpreted as a UTF-8 encoded character sequence starting without a BOM. - If a stream with `char` as a character type is used (including FILE pointers), the encoding will be automatically detected in the deserialization process, while an array/container of `char16_t` and `char32_t` denotes that its contents are encoded in the UTF-16BE/LE and UTF-32BE/LE format, respectively. - Furthermore, a byte order mark (BOM) can be put only at the beginning of an input sequence. - The deserialization process internally converts input characters into the UTF-8 encoded ones if they are encoded in the UTF-16 or UTF-32 format. + As the YAML specification shows [here](https://yaml.org/spec/1.2.2/#52-character-encodings), all input streams must begin with either a byte order mark(BOM) or an ASCII character, which will allow the encoding to be deduced by the pattern of the first few bytes. + If an input does not start either of them, the input is considered to be encoded in the UTF-8 encoding starting with no BOM. + Furthermore, allowed encoding types differ depending on the type of input characters. If a deduced encoding type is not allowed for the type, a [fkyaml::exception] will be thrown. -!!! note "Supported newline codes" + | type | allowed encodings | + | ---------------------------------------------------------------------------- | --------------------- | + | [`char`](https://en.cppreference.com/w/cpp/keyword/char) | UTF-8, UTF-16, UTF-32 | + | [`char8_t`](https://en.cppreference.com/w/cpp/keyword/char8_t) (since C++20) | UTF-8 | + | [`char16_t`](https://en.cppreference.com/w/cpp/keyword/char16_t) | UTF-16 | + | [`char32_t`](https://en.cppreference.com/w/cpp/keyword/char32_t) | UTF-32 | - fkYAML supports LF (Unix style) and CR+LF (Windows style) as line break formats. - Inside the deserialization processes, however, fkYAML normalizes them into line feeds (LF, `0x0A`) just as described in the YAML specification (see the ["5.4. Line Break Characters"](https://yaml.org/spec/1.2.2/#54-line-break-characters) section). - Currently, there is no way to restore the original line break style in the serialization processes. - -## Overload (1) +!!! note "Supported line break formats" -```cpp -template -static basic_node deserialize(InputType&& input); -``` + fkYAML supports LF (Unix style) and CR+LF (Windows style) as line break formats. + Inside the deserialization processes, fkYAML normalizes them into line feeds (LF, `0x0A`). + In other words, if an input uses the Windows style as its line break format, there happens a copy of the input contents. So, the Unix style is recommended for better performance. + Currently, there is no way to restore the original line break style. -### **Template Parameters** +## **Template Parameters** ***`InputType`*** -: Type of a compatible input, for instance: +: the type of a compatible input, for instance: * an `std::istream` object * a `FILE` pointer (must not be `nullptr`) * a C-style array of characters (`char`, `char16_t` or `char32_t`. See the "Supported Unicode Encodings" above.) * char[N], char16_t[N], or char32_t[N] (N is the size of an array) - * a container `obj` with which `begin(obj)` and `end(obj)` produces a valid pair of iterators + * a container with which `begin(input)` and `end(input)` produces a valid pair of iterators * std::basic_string, std::array, std::string_view (with C++17 or better) and the likes. -### **Parameters** - -***`input`*** [in] -: An input source in the YAML format. - -### **Return Value** - -The resulting `basic_node` object deserialized from the input source. - -## Overload (2) - -```cpp -template -static basic_node deserialize(ItrType&& begin, ItrType&& end); -``` - -### **Template Parameters** - ***`ItrType`*** : Type of a compatible iterator, for instance: * a pair of iterators such as return values of `std::string::begin()` and `std::string::end()` * a pair of pointers such as `ptr` and `ptr + len` -### **Parameters** +## **Parameters** + +***`input`*** [in] +: An input source such as streams or arrays. ***`begin`*** [in] : An iterator to the first element of an input sequence @@ -82,13 +66,13 @@ static basic_node deserialize(ItrType&& begin, ItrType&& end); ***`end`*** [in] : An iterator to the past-the-last element of an input sequence -### **Return Value** +## **Return Value** -The resulting `basic_node` object deserialized from the pair of iterators. +The resulting `basic_node` object of deserialization. -## Examples +## **Examples** -???+ Example "Example (a character array)" +??? Example "Example (a character array)" ```cpp --8<-- "examples/ex_basic_node_deserialize_char_array.cpp:9" @@ -99,7 +83,7 @@ The resulting `basic_node` object deserialized from the pair of iterators. --8<-- "examples/ex_basic_node_deserialize_char_array.output" ``` -???+ Example "Example (a std::string object)" +??? Example "Example (a std::string object)" ```cpp --8<-- "examples/ex_basic_node_deserialize_string.cpp:9" @@ -110,7 +94,7 @@ The resulting `basic_node` object deserialized from the pair of iterators. --8<-- "examples/ex_basic_node_deserialize_string.output" ``` -???+ Example "Example (a FILE pointer)" +??? Example "Example (a FILE pointer)" ```yaml title="input.yaml" --8<-- "examples/input.yaml" @@ -125,7 +109,7 @@ The resulting `basic_node` object deserialized from the pair of iterators. --8<-- "examples/ex_basic_node_deserialize_file_pointer.output" ``` -???+ Example "Example (a pair of iterators)" +??? Example "Example (a pair of iterators)" ```cpp --8<-- "examples/ex_basic_node_deserialize_iterators.cpp:9" @@ -136,7 +120,7 @@ The resulting `basic_node` object deserialized from the pair of iterators. --8<-- "examples/ex_basic_node_deserialize_iterators.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) * [deserialize_docs](deserialize_docs.md) diff --git a/docs/mkdocs/docs/api/basic_node/deserialize_docs.md b/docs/mkdocs/docs/api/basic_node/deserialize_docs.md index d47a8cb0..2e654c1b 100644 --- a/docs/mkdocs/docs/api/basic_node/deserialize_docs.md +++ b/docs/mkdocs/docs/api/basic_node/deserialize_docs.md @@ -13,69 +13,34 @@ static std::vector deserialize_docs(ItrType&& begin, ItrType&& end); Deserializes from compatible inputs. Unlike the [`deserialize()`](deserialize.md) function, this function deserializes all YAML documents in the input into [`fkyaml::basic_node`](index.md) objects. Prefer this function when your input may contain more than one YAML documents and all of them must be processed. -Otherwise, use the [`deserialize()`](deserialize.md) function which is optimized for processing single YAML documents. +Otherwise, use the [`deserialize()`](deserialize.md) function which is optimized for processing a single YAML document. Throws a [`fkyaml::exception`](../exception/index.md) if the deserialization process detects an error from the input. -!!! note "Supported Unicode Encodings" +Since this function shares a large portion of internal implementation with the [`deserialize()`](deserialize.md) function, supported unicode encodings and line break formats are the same. Refer to its documentation for details. - fkYAML supports UTF-8, UTF-16 and UTF-32 encodings for input characters. - As the YAML specification shows [(here)](https://yaml.org/spec/1.2.2/#52-character-encodings), all input streams must begin with either a byte order mark(BOM) or an ASCII character, which will allow the encoding to be deduced by the pattern of the first few bytes of the input sequence. - If an input fails to meet the above requirement, the input is interpreted as a UTF-8 encoded character sequence starting without a BOM. - If a stream with `char` as a character type is used (including FILE pointers), the encoding will be automatically detected in the deserialization process, while an array/container of `char16_t` and `char32_t` denotes that its contents are encoded in the UTF-16BE/LE and UTF-32BE/LE format, respectively. - Furthermore, a byte order mark (BOM) can be put only at the beginning of an input sequence. - The deserialization process internally converts input characters into the UTF-8 encoded ones if they are encoded in the UTF-16 or UTF-32 format. - -!!! note "Supported newline codes" - - fkYAML supports LF (Unix style) and CR+LF (Windows style) as line break formats. - Inside the deserialization processes, however, fkYAML normalizes them into line feeds (LF, `0x0A`) just as described in the YAML specification (see the ["5.4. Line Break Characters"](https://yaml.org/spec/1.2.2/#54-line-break-characters) section). - Currently, there is no way to restore the original line break style in the serialization processes. - -## Overload (1) - -```cpp -template -static std::vector deserialize_docs(InputType&& input); -``` - -### **Template Parameters** +## **Template Parameters** ***`InputType`*** -: Type of a compatible input, for instance: +: the type of a compatible input, for instance: * an `std::istream` object * a `FILE` pointer (must not be `nullptr`) * a C-style array of characters (`char`, `char16_t` or `char32_t`. See the "Supported Unicode Encodings" above.) * char[N], char16_t[N], or char32_t[N] (N is the size of an array) - * a container `obj` with which `begin(obj)` and `end(obj)` produces a valid pair of iterators + * a container with which `begin(input)` and `end(input)` produces a valid pair of iterators * std::basic_string, std::array, std::string_view (with C++17 or better) and the likes. -### **Parameters** - -***`input`*** [in] -: An input source in the YAML format. - -### **Return Value** - -The resulting `basic_node` objects deserialized from the input source. - -## Overload (2) - -```cpp -template -static std::vector deserialize_docs(ItrType&& begin, ItrType&& end); -``` - -### **Template Parameters** - ***`ItrType`*** : Type of a compatible iterator, for instance: * a pair of iterators such as return values of `std::string::begin()` and `std::string::end()` * a pair of pointers such as `ptr` and `ptr + len` -### **Parameters** +## **Parameters** + +***`input`*** [in] +: An input source such as streams or arrays. ***`begin`*** [in] : An iterator to the first element of an input sequence @@ -83,13 +48,13 @@ static std::vector deserialize_docs(ItrType&& begin, ItrType&& end); ***`end`*** [in] : An iterator to the past-the-last element of an input sequence -### **Return Value** +## **Return Value** -The resulting `basic_node` objects deserialized from the pair of iterators. +The resulting `basic_node` objects of deserialization. -## Examples +## **Examples** -???+ Example "Example (a character array)" +??? Example "Example (a character array)" ```cpp --8<-- "examples/ex_basic_node_deserialize_docs_char_array.cpp:9" @@ -100,7 +65,7 @@ The resulting `basic_node` objects deserialized from the pair of iterators. --8<-- "examples/ex_basic_node_deserialize_docs_char_array.output" ``` -???+ Example "Example (a std::string object)" +??? Example "Example (a std::string object)" ```cpp --8<-- "examples/ex_basic_node_deserialize_docs_string.cpp:9" @@ -111,7 +76,7 @@ The resulting `basic_node` objects deserialized from the pair of iterators. --8<-- "examples/ex_basic_node_deserialize_docs_string.output" ``` -???+ Example "Example (a FILE pointer)" +??? Example "Example (a FILE pointer)" ```yaml title="input_multi.yaml" --8<-- "examples/input_multi.yaml" @@ -126,7 +91,7 @@ The resulting `basic_node` objects deserialized from the pair of iterators. --8<-- "examples/ex_basic_node_deserialize_docs_file_pointer.output" ``` -???+ Example "Example (a pair of iterators)" +??? Example "Example (a pair of iterators)" ```cpp --8<-- "examples/ex_basic_node_deserialize_docs_iterators.cpp:9" @@ -137,7 +102,7 @@ The resulting `basic_node` objects deserialized from the pair of iterators. --8<-- "examples/ex_basic_node_deserialize_docs_iterators.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) * [deserialize](deserialize.md) diff --git a/docs/mkdocs/docs/api/basic_node/empty.md b/docs/mkdocs/docs/api/basic_node/empty.md index 669eb1cf..0b87f302 100644 --- a/docs/mkdocs/docs/api/basic_node/empty.md +++ b/docs/mkdocs/docs/api/basic_node/empty.md @@ -7,13 +7,15 @@ boolean empty() const; ``` Tests whether the node value is empty. -Throws a [`fkyaml::exception`](../exception/index.md) if a basic_node does not have a conatiner nor string value. +If a basic_node is neither a sequence, mapping nor string, a [`fkyaml::type_error`](../exception/type_error.md) will be thrown. -### **Return Value** +## **Return Value** `true` if the node value is empty, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_empty.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/end.md b/docs/mkdocs/docs/api/basic_node/end.md index 1b966468..c5a6996f 100644 --- a/docs/mkdocs/docs/api/basic_node/end.md +++ b/docs/mkdocs/docs/api/basic_node/end.md @@ -8,16 +8,18 @@ const_iterator end() const; const_iterator cend() const; ``` -Returns an iterator to the past-the-last element of a container node. -Throws a [`fkyaml::type_error`](../exception/type_error.md) if a basic_node is neither a sequence nor mapping node. +Returns a (constant) iterator to the past-the-last element of a container node. +If a basic_node is neither a sequence nor mapping, a [`fkyaml::type_error`](../exception/type_error.md) will be thrown. ![Image from https://en.cppreference.com/w/cpp/iterator/end](../../img/range-begin-end.svg) -### **Return Value** +## **Return Value** -An iterator to the past-the-last element of a container node. +A (constant) iterator to the past-the-last element of a container node. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_end.cpp:9" @@ -28,7 +30,7 @@ An iterator to the past-the-last element of a container node. --8<-- "examples/ex_basic_node_end.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) * [node](node.md) diff --git a/docs/mkdocs/docs/api/basic_node/extraction_operator.md b/docs/mkdocs/docs/api/basic_node/extraction_operator.md index a4282c4c..ef0a57e3 100644 --- a/docs/mkdocs/docs/api/basic_node/extraction_operator.md +++ b/docs/mkdocs/docs/api/basic_node/extraction_operator.md @@ -23,7 +23,9 @@ Note that the contents of the input stream must be encoded in either the UTF-8, Reference to the input stream object `is`. -???+ Example +## **Examples** + +??? Example ```yaml --8<-- "examples/input.yaml" @@ -38,7 +40,7 @@ Reference to the input stream object `is`. --8<-- "examples/ex_basic_node_extraction_operator.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) * [deserialize](deserialize.md) diff --git a/docs/mkdocs/docs/api/basic_node/float_number_type.md b/docs/mkdocs/docs/api/basic_node/float_number_type.md index f1654e83..f3b17221 100644 --- a/docs/mkdocs/docs/api/basic_node/float_number_type.md +++ b/docs/mkdocs/docs/api/basic_node/float_number_type.md @@ -6,17 +6,20 @@ using float_number_type = FloatNumberType; ``` -The type used to store boolean node values. -The YAML specification describes a floating point number as a type which differentiates the following literals: +The type used to store floating point values. +The YAML specification describes a floating point value as a type which differentiates the following literals: -* .inf, .Inf, .INF -> an infinite number -* .nan, .NaN, .NAN -> Not a Number +* real numbers (with scientific notation) → a floating point value +* (+/-).inf, (+/-).Inf, (+/-).INF → the positive/negative infinity +* .nan, .NaN, .NAN → Not a Number -To store floating point number objects in [`basic_node`](index.md) class, the type is defined by the template parameter `FloatNumberType` which chooses the type to use for floating point number objects. -If not explicitly specified, the default type `double` will be chosen. -With the decided type, floating point number objects are stored directly inside a [`basic_node`](index.md). +The actual type is defined by the template parameter `FloatNumberType`. +If not explicitly specified, the default type `double` is defined. +With the decided type, floating point values are stored directly inside a [`basic_node`](index.md). -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_float_number_type.cpp:9" @@ -27,6 +30,6 @@ With the decided type, floating point number objects are stored directly inside --8<-- "examples/ex_basic_node_float_number_type.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) diff --git a/docs/mkdocs/docs/api/basic_node/get_anchor_name.md b/docs/mkdocs/docs/api/basic_node/get_anchor_name.md index 58cbc669..ed8f5e04 100644 --- a/docs/mkdocs/docs/api/basic_node/get_anchor_name.md +++ b/docs/mkdocs/docs/api/basic_node/get_anchor_name.md @@ -6,16 +6,18 @@ const std::string& get_anchor_name() const; ``` -Gets the anchor name associated with the YAML node. -Some anchor name must be set before calling this API. -Calling [`has_anchor_name`](has_anchor_name.md) to see if the node has any anchor name beforehand. +Gets an anchor name associated with the YAML node. +Some anchor name must be set before calling this function. +Call [`has_anchor_name`](has_anchor_name.md) to see if the node has any anchor name beforehand. +If no anchor name has been set, an [`fkyaml::exception`](../exception/index.md) will be thrown. ## **Return Value** The anchor name associated to the node. -If no anchor name has been set, an [`fkyaml::exception`](../exception/index.md) will be thrown. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_get_anchor_name.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/get_tag_name.md b/docs/mkdocs/docs/api/basic_node/get_tag_name.md index 101f9704..0a50e048 100644 --- a/docs/mkdocs/docs/api/basic_node/get_tag_name.md +++ b/docs/mkdocs/docs/api/basic_node/get_tag_name.md @@ -6,16 +6,18 @@ const std::string& get_tag_name() const; ``` -Gets the tag name associated to the YAML node. +Gets a tag name associated to the YAML node. Some tag name must be set before calling this API. -Calling [`has_tag_name`](has_tag_name.md) to see if the node has any tag name beforehand. +Call [`has_tag_name`](has_tag_name.md) to see if the node has any tag name beforehand. +If no tag name has been set, an [`fkyaml::exception`](../exception/index.md) will be thrown. ## **Return Value** The tag name associated to the node. -If no tag name has been set, an [`fkyaml::exception`](../exception/index.md) will be thrown. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_get_tag_name.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/get_type.md b/docs/mkdocs/docs/api/basic_node/get_type.md index b8ad5cd2..8f092523 100644 --- a/docs/mkdocs/docs/api/basic_node/get_type.md +++ b/docs/mkdocs/docs/api/basic_node/get_type.md @@ -6,9 +6,9 @@ node_type get_type() const noexcept; ``` -Returns the type of the YAML node value as a value from the [`node_type`](../node_type.md) enumeration. +Returns the type of the node value. -### **Return Value** +## **Return Value** The type of the YAML node value. @@ -22,7 +22,9 @@ The type of the YAML node value. | floating point number | node_type::FLOAT | | string | node_type::STRING | -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_get_type.cpp:9" @@ -33,6 +35,6 @@ The type of the YAML node value. --8<-- "examples/ex_basic_node_get_type.output" ``` -### **See Also** +## **See Also** * [node_type](../node_type.md) diff --git a/docs/mkdocs/docs/api/basic_node/get_value.md b/docs/mkdocs/docs/api/basic_node/get_value.md index 145f4df2..2cf9930c 100644 --- a/docs/mkdocs/docs/api/basic_node/get_value.md +++ b/docs/mkdocs/docs/api/basic_node/get_value.md @@ -32,7 +32,7 @@ This function converts a [`fkyaml::basic_node`](./index.md) to either Actual conversions rely on the [`node_value_converter`](../node_value_converter/index.md)::[`from_node`](../node_value_converter/from_node.md) function. This API makes a copy of the value, and if the copying costs too much, or if you need an address of the original value, then you should call [`get_value_ref`](get_value_ref.md) instead. -???+ Note "Convert from a Sequence Node" +??? Note "Convert from a Sequence Node" This library implements conversions from a sequence node to a number of STL container types whose element type is not a key-value pair. The implementation can be used for custom container types, but they need to have both `iterator` member type and `insert()` member function. The test suite confirms successful conversions to the following types. @@ -59,7 +59,7 @@ This API makes a copy of the value, and if the copying costs too much, or if you Note that the above types cannot be converted from a non-sequence node, which results in throwing a [type_error](../exception/type_error.md). -???+ Note "Convert from a Mapping Node" +??? Note "Convert from a Mapping Node" This library implements conversions from a mapping node to STL container types whose element type is a key-value pair. The implementation can be used for custom container types, but they need to have `key_type`, `mapped_type` and `value_type` member types and `emplace()` member function. The test suite confirms successful conversions to the following types. @@ -70,7 +70,7 @@ This API makes a copy of the value, and if the copying costs too much, or if you * [std::unordered_map](https://en.cppreference.com/w/cpp/container/unordered_map) * [std::unordered_multi_map](https://en.cppreference.com/w/cpp/container/unordered_multimap) *(unordered associative containers for key-value pairs)* -???+ Note "Convert from a Null or Numeric Scalar Node" +??? Note "Convert from a Null or Numeric Scalar Node" If the YAML node value is a null, boolean, integer or floating point, this function internally executes type conversion according to the following rules which all depend on the template paramter type `T`: @@ -90,14 +90,14 @@ This API makes a copy of the value, and if the copying costs too much, or if you Note that those scalar type cannot be converted to a sequence, mapping, string scalar, which results in throwing a [`type_error`](../exception/type_error.md). -???+ Note "Convert from a String Scalar Node" +??? Note "Convert from a String Scalar Node" String scalar nodes can be converted to STL container types which can be constructible from `const fkyaml::basic_node::string_type&` (`const std::string&` by default). The test suite confirms successful conversions to the following types. * [std::string](https://en.cppreference.com/w/cpp/string/basic_string) * [std::string_view](https://en.cppreference.com/w/cpp/string/basic_string_view) (from C++17) -???+ Note "Convert as an optional value" +??? Note "Convert as an optional value" Since C++17, [std::optional](https://en.cppreference.com/w/cpp/utility/optional) can be used as `ValueType` to indicate the conversion result to be optional. In such cases, a returned [std::optional](https://en.cppreference.com/w/cpp/utility/optional) value contains a value only if the conversion was successful, or [`std::nullopt`](https://en.cppreference.com/w/cpp/utility/optional/nullopt) otherwise. @@ -118,7 +118,9 @@ This API makes a copy of the value, and if the copying costs too much, or if you A compatible native data value converted from the [basic_node](./index.md) object. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_get_value.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/get_value_inplace.md b/docs/mkdocs/docs/api/basic_node/get_value_inplace.md index b2aa4f96..9d010f2c 100644 --- a/docs/mkdocs/docs/api/basic_node/get_value_inplace.md +++ b/docs/mkdocs/docs/api/basic_node/get_value_inplace.md @@ -29,7 +29,7 @@ This function shares internal implementation with the [`get_value`](./get_value. Thus, all the STL container & scalar types which are supported by that function, is also supported by this function as well. See the notes there for details. -???+ Note "Difference from `get_value()`" +??? Note "Difference from `get_value()`" One crutial difference from the [`get_value`](./get_value.md) function is, this function does not require the template parameter type `T` to be [default-constructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible) since no instantiation of `T` is necessary inside the function to return the conversion result anymore. So, you might prefer this function, for example, if you already created a `T` object as a member variable and want to assign a node value to it. @@ -45,7 +45,14 @@ See the notes there for details. ***BasicNodeType*** : A basic_node template instance type. -???+ Example +### **Parameters** + +***`value_ref`*** [out] +: A storage into which the conversion result is filled. + +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_get_value_inplace.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/get_value_ref.md b/docs/mkdocs/docs/api/basic_node/get_value_ref.md index 9a8142e1..76ec2cc5 100644 --- a/docs/mkdocs/docs/api/basic_node/get_value_ref.md +++ b/docs/mkdocs/docs/api/basic_node/get_value_ref.md @@ -3,38 +3,40 @@ # fkyaml::basic_node::get_value_ref ```cpp -template ::value, int> = 0> -ReferenceType get_value_ref() const noexcept( - noexcept(ConverterType::from_node(std::declval(), std::declval()))); - -template < - typename ReferenceType, - detail::enable_if_t< - detail::conjunction< - std::is_reference, std::is_const>>::value, - int> = 0> +template +ReferenceType get_value_ref(); + +template ReferenceType get_value_ref() const; ``` Explicit reference access to the internally stored YAML node value. -This API makes no copies. +If the requested reference type does not match the current node value, a [`fkyaml::type_error`](../exception/type_error.md) will be thrown. + +!!! Note + + If this function throws an exception, the internally stored YAML node value stays intact. ## **Template Parameters** ***ReferenceType*** : reference type to the target YAML node value. - This must be a (const) reference type to [`sequence_type`](sequence_type.md), [`mapping_type`](mapping_type.md), [`boolean_type`](boolean_type.md), [`integer_type`](integer_type.md), [`float_number_type`](float_number_type.md) or [`string_type`](string_type.md). + It must be a (const) reference type to -## **Return Value** + * [`sequence_type`](sequence_type.md) + * [`mapping_type`](mapping_type.md) + * [`boolean_type`](boolean_type.md) + * [`integer_type`](integer_type.md) + * [`float_number_type`](float_number_type.md) + * [`string_type`](string_type.md) -Reference to the internally stored YAML node value if the requested reference type fits to the YAML node value. -A [`fkyaml::exception`](../exception/index.md) would be thrown otherwise. +## **Return Value** -!!! Note +Reference to the internally stored YAML node value. - If this API throws an exception, the internally stored YAML node value stays intact. +## **Examples** -???+ Example +??? Example ```cpp --8<-- "examples/ex_basic_node_get_value_ref.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/get_yaml_version.md b/docs/mkdocs/docs/api/basic_node/get_yaml_version.md index eabc0f9b..b54c0a04 100644 --- a/docs/mkdocs/docs/api/basic_node/get_yaml_version.md +++ b/docs/mkdocs/docs/api/basic_node/get_yaml_version.md @@ -8,7 +8,7 @@ yaml_version_t get_yaml_version() const noexcept; !!! warning "Deprecation" - The function [`#!cpp yaml_version_type get_yaml_version_type()`](set_yaml_version_type.md) replaces the function `#!cpp 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 + The function [`#!cpp yaml_version_type get_yaml_version_type()`](set_yaml_version_type.md) replaces the function `#!cpp basic_node::yaml_version_t get_yaml_version()` which has been deprecated in version 0.3.12. It will be removed in a future version. Please replace calls like ```cpp fkyaml::node::yaml_version_t v = n.get_yaml_version(); @@ -19,18 +19,20 @@ yaml_version_t get_yaml_version() const noexcept; fkyaml::yaml_version_type v = n.get_yaml_version_type(); ``` -Returns the version of the YAML format applied for the `basic_node` object. +Returns the YAML specification version applied for a `basic_node`. -### **Return Value** +## **Return Value** -The version of the YAML format applied to the basic_node object. +The YAML specification version applied to a basic_node. | YAML version | Return Value | | ------------ | ----------------------- | | 1.1 | yaml_version_t::VER_1_1 | | 1.2 | yaml_version_t::VER_1_2 | -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_get_yaml_version.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/get_yaml_version_type.md b/docs/mkdocs/docs/api/basic_node/get_yaml_version_type.md index 122e836c..595b72af 100644 --- a/docs/mkdocs/docs/api/basic_node/get_yaml_version_type.md +++ b/docs/mkdocs/docs/api/basic_node/get_yaml_version_type.md @@ -6,18 +6,20 @@ yaml_version_type get_yaml_version_type() const noexcept; ``` -Returns the version of the YAML format applied for the `basic_node` object. +Returns the YAML specification version applied to a `basic_node`. -### **Return Value** +## **Return Value** -The version of the YAML format applied to the basic_node object. +The YAML specification version applied to a basic_node. | YAML version | Return Value | | ------------ | ------------------------------ | | 1.1 | yaml_version_type::VERSION_1_1 | | 1.2 | yaml_version_type::VERSION_1_2 | -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_get_yaml_version_type.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/has_anchor_name.md b/docs/mkdocs/docs/api/basic_node/has_anchor_name.md index d8b4c78c..71821ed4 100644 --- a/docs/mkdocs/docs/api/basic_node/has_anchor_name.md +++ b/docs/mkdocs/docs/api/basic_node/has_anchor_name.md @@ -6,13 +6,15 @@ bool has_anchor_name() const noexcept; ``` -Check if the YAML node has an anchor name. +Check if the node has an anchor name. ## **Return Value** -`true` if the YAML node has an anchor name, `false` otherwise. +`true` if the node has an anchor name, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_has_anchor_name.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/has_tag_name.md b/docs/mkdocs/docs/api/basic_node/has_tag_name.md index a353f36a..b91c32f8 100644 --- a/docs/mkdocs/docs/api/basic_node/has_tag_name.md +++ b/docs/mkdocs/docs/api/basic_node/has_tag_name.md @@ -6,13 +6,15 @@ bool has_tag_name() const noexcept; ``` -Check if the YAML node has a tag name. +Check if the node has a tag name. ## **Return Value** -`true` if the YAML node has a tag name, `false` otherwise. +`true` if the node has a tag name, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_has_tag_name.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/index.md b/docs/mkdocs/docs/api/basic_node/index.md index edce0694..9ae7aa4b 100644 --- a/docs/mkdocs/docs/api/basic_node/index.md +++ b/docs/mkdocs/docs/api/basic_node/index.md @@ -16,7 +16,7 @@ class basic_node; This class provides features to handle YAML nodes. -## Template Paramters +## **Template Paramters** | Template parameter | Description | Default | Derived type | |--------------------|--------------------------------------------------------------|----------------------------------------------------------------------|---------------------------------------------------| @@ -28,11 +28,11 @@ This class provides features to handle YAML nodes. | `StringType` | type for string node values | [std::string](https://en.cppreference.com/w/cpp/string/basic_string) | [`string_type`](string_type.md) | | `ConverterType` | type for converters between
nodes and native data types | [node_value_converter](../node_value_converter/index.md) | [`value_converter_type`](value_converter_type.md) | -## Specializations +## **Specializations** * [node](node.md) - default specialization -## Member Types +## **Member Types** ### Node Value Types | Name | Description | @@ -63,10 +63,11 @@ This class provides features to handle YAML nodes. | Name | Description | | ----------------------------------------------- | ------------------------------------------------------------------- | | [value_converter_type](value_converter_type.md) | The type used to convert between node and native data. | +| initializer_list_t | The type for initializer lists of `basic_node` values. | | [node_t](node_t.md) | **(DEPRECATED)** The type used to store the internal value type. | | [yaml_version_t](yaml_version_t.md) | **(DEPRECATED)** The type used to store the enable version of YAML. | -## Member Functions +## **Member Functions** ### Construction/Destruction | Name | | Description | diff --git a/docs/mkdocs/docs/api/basic_node/insertion_operator.md b/docs/mkdocs/docs/api/basic_node/insertion_operator.md index 33c17103..104973c5 100644 --- a/docs/mkdocs/docs/api/basic_node/insertion_operator.md +++ b/docs/mkdocs/docs/api/basic_node/insertion_operator.md @@ -6,10 +6,9 @@ inline std::ostream& operator<<(std::ostream& os, const basic_node& n); ``` -Extraction operator for basic_node template class. -Serializes YAML node values into an output stream. -This API is a wrapper of [`basic_node::serialize()`](serialize.md) function to simplify the implementation in the client code. -For more detailed descriptions, please visit the reference page for the [`basic_node::serialize()`](serialize.md) function. +Serializes a node value into an output stream. +This operator is a wrapper of the [`basic_node::serialize()`](serialize.md) function to simplify the implementation in the client code. +For details, please visit the documentation of the [`serialize()`](serialize.md) function. ## **Template Parameters** @@ -46,7 +45,9 @@ For more detailed descriptions, please visit the reference page for the [`basic_ Reference to the output stream object `os`. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_insertion_operator.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/integer_type.md b/docs/mkdocs/docs/api/basic_node/integer_type.md index 4e70c810..1e37d4a9 100644 --- a/docs/mkdocs/docs/api/basic_node/integer_type.md +++ b/docs/mkdocs/docs/api/basic_node/integer_type.md @@ -6,13 +6,15 @@ using integer_type = IntegerType; ``` -The type used to store boolean node values. +The type used to store integer values. -To store integer objects in [`basic_node`](index.md) class, the type is defined by the template parameter `IntegerType` which chooses the type to use for integer objects. -If not explicitly specified, the default type `std::int64_t` will be chosen. -With the decided type, integer objects are stored directly inside a [`basic_node`](index.md). +The actual type is defined by the template parameter `IntegerType`. +If not explicitly specified, the default type `std::int64_t` is defined. +With the decided type, integer values are stored directly inside a [`basic_node`](index.md). -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_integer_type.cpp:9" @@ -23,6 +25,6 @@ With the decided type, integer objects are stored directly inside a [`basic_node --8<-- "examples/ex_basic_node_integer_type.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) diff --git a/docs/mkdocs/docs/api/basic_node/is_alias.md b/docs/mkdocs/docs/api/basic_node/is_alias.md index 0c9b215c..6575654b 100644 --- a/docs/mkdocs/docs/api/basic_node/is_alias.md +++ b/docs/mkdocs/docs/api/basic_node/is_alias.md @@ -8,11 +8,13 @@ bool is_alias() const noexcept; Tests whether the node is an alias node. -### **Return Value** +## **Return Value** `true` if the node is an alias node, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_is_alias.cpp:9" @@ -23,7 +25,7 @@ Tests whether the node is an alias node. --8<-- "examples/ex_basic_node_is_alias.output" ``` -### **See Also** +## **See Also** * [add_anchor_name](add_anchor_name.md) * [alias_of](alias_of.md) diff --git a/docs/mkdocs/docs/api/basic_node/is_anchor.md b/docs/mkdocs/docs/api/basic_node/is_anchor.md index 2921ecd0..c7bd8a43 100644 --- a/docs/mkdocs/docs/api/basic_node/is_anchor.md +++ b/docs/mkdocs/docs/api/basic_node/is_anchor.md @@ -8,11 +8,13 @@ bool is_anchor() const noexcept; Tests whether the node is an anchor node. -### **Return Value** +## **Return Value** `true` if the node is an anchor node, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_is_anchor.cpp:9" @@ -23,6 +25,6 @@ Tests whether the node is an anchor node. --8<-- "examples/ex_basic_node_is_anchor.output" ``` -### **See Also** +## **See Also** * [add_anchor_name](add_anchor_name.md) diff --git a/docs/mkdocs/docs/api/basic_node/is_boolean.md b/docs/mkdocs/docs/api/basic_node/is_boolean.md index 492e74a2..afb130ae 100644 --- a/docs/mkdocs/docs/api/basic_node/is_boolean.md +++ b/docs/mkdocs/docs/api/basic_node/is_boolean.md @@ -6,13 +6,15 @@ bool is_boolean() const noexcept; ``` -Tests whether the node value type is [`node_t::BOOLEAN`](node_t.md). +Tests whether the node is a boolean node. -### **Return Value** +## **Return Value** -`true` if the type is [`node_t::BOOLEAN`](node_t.md), `false` otherwise. +`true` if the node is a boolean node, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_is_boolean.cpp:9" @@ -23,6 +25,6 @@ Tests whether the node value type is [`node_t::BOOLEAN`](node_t.md). --8<-- "examples/ex_basic_node_is_boolean.output" ``` -### **See Also** +## **See Also** -* [node_t](node_t.md) +* [node_type](../node_type.md) diff --git a/docs/mkdocs/docs/api/basic_node/is_float_number.md b/docs/mkdocs/docs/api/basic_node/is_float_number.md index cccb12d3..c22493a5 100644 --- a/docs/mkdocs/docs/api/basic_node/is_float_number.md +++ b/docs/mkdocs/docs/api/basic_node/is_float_number.md @@ -6,13 +6,15 @@ bool is_float_number() const noexcept; ``` -Tests whether the node value type is [`node_t::FLOAT_NUMBER`](node_t.md). +Tests whether the node is a floating point value node. -### **Return Value** +## **Return Value** -`true` if the type is [`node_t::FLOAT_NUMBER`](node_t.md), `false` otherwise. +`true` if the node is a floating point value node, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_is_float_number.cpp:9" @@ -23,6 +25,6 @@ Tests whether the node value type is [`node_t::FLOAT_NUMBER`](node_t.md). --8<-- "examples/ex_basic_node_is_float_number.output" ``` -### **See Also** +## **See Also** -* [node_t](node_t.md) +* [node_type](../node_type.md) diff --git a/docs/mkdocs/docs/api/basic_node/is_integer.md b/docs/mkdocs/docs/api/basic_node/is_integer.md index c18a8bca..c223376f 100644 --- a/docs/mkdocs/docs/api/basic_node/is_integer.md +++ b/docs/mkdocs/docs/api/basic_node/is_integer.md @@ -6,13 +6,15 @@ bool is_integer() const noexcept; ``` -Tests whether the node value type is [`node_t::INTEGER`](node_t.md). +Tests whether the node is an integer node. -### **Return Value** +## **Return Value** -`true` if the type is [`node_t::INTEGER`](node_t.md), `false` otherwise. +`true` if the node is an integer node, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_is_integer.cpp:9" @@ -23,6 +25,6 @@ Tests whether the node value type is [`node_t::INTEGER`](node_t.md). --8<-- "examples/ex_basic_node_is_integer.output" ``` -### **See Also** +## **See Also** -* [node_t](node_t.md) +* [node_type](../node_type.md) diff --git a/docs/mkdocs/docs/api/basic_node/is_mapping.md b/docs/mkdocs/docs/api/basic_node/is_mapping.md index ddbd0b54..9658dd6b 100644 --- a/docs/mkdocs/docs/api/basic_node/is_mapping.md +++ b/docs/mkdocs/docs/api/basic_node/is_mapping.md @@ -6,13 +6,15 @@ bool is_mapping() const noexcept; ``` -Tests whether the node value type is [`node_t::MAPPING`](node_t.md). +Tests whether the node is a mapping node. -### **Return Value** +## **Return Value** -`true` if the type is [`node_t::MAPPING`](node_t.md), `false` otherwise. +`true` if the node is a mapping node, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_is_mapping.cpp:9" @@ -23,6 +25,6 @@ Tests whether the node value type is [`node_t::MAPPING`](node_t.md). --8<-- "examples/ex_basic_node_is_mapping.output" ``` -### **See Also** +## **See Also** -* [node_t](node_t.md) +* [node_type](../node_type.md) diff --git a/docs/mkdocs/docs/api/basic_node/is_null.md b/docs/mkdocs/docs/api/basic_node/is_null.md index 215c1335..e09fd182 100644 --- a/docs/mkdocs/docs/api/basic_node/is_null.md +++ b/docs/mkdocs/docs/api/basic_node/is_null.md @@ -6,13 +6,15 @@ bool is_null() const noexcept; ``` -Tests whether the node value type is [`node_t::NULL_OBJECT`](node_t.md). +Tests whether the node is a null node. -### **Return Value** +## **Return Value** -`true` if the type is [`node_t::NULL_OBJECT`](node_t.md), `false` otherwise. +`true` if the node is a null node, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_is_null.cpp:9" @@ -23,6 +25,6 @@ Tests whether the node value type is [`node_t::NULL_OBJECT`](node_t.md). --8<-- "examples/ex_basic_node_is_null.output" ``` -### **See Also** +## **See Also** -* [node_t](node_t.md) +* [node_type](../node_type.md) diff --git a/docs/mkdocs/docs/api/basic_node/is_scalar.md b/docs/mkdocs/docs/api/basic_node/is_scalar.md index e78f2027..88932f40 100644 --- a/docs/mkdocs/docs/api/basic_node/is_scalar.md +++ b/docs/mkdocs/docs/api/basic_node/is_scalar.md @@ -6,18 +6,15 @@ bool is_scalar() const noexcept; ``` -Tests whether the node value type is one of the followings: -* [`node_t::NULL_OBJECT`](node_t.md) -* [`node_t::BOOLEAN`](node_t.md) -* [`node_t::INTEGER`](node_t.md) -* [`node_t::FLOAT_NUMBER`](node_t.md) -* [`node_t::STRING`](node_t.md) +Tests whether the node is a scalar node: either a null, boolean, integer, floating point or string node. -### **Return Value** +## **Return Value** -`true` if the type is a scalar type, `false` otherwise. +`true` if the node is a scalar node, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_is_scalar.cpp:9" @@ -28,6 +25,6 @@ Tests whether the node value type is one of the followings: --8<-- "examples/ex_basic_node_is_scalar.output" ``` -### **See Also** +## **See Also** -* [node_t](node_t.md) +* [node_type](../node_type.md) diff --git a/docs/mkdocs/docs/api/basic_node/is_sequence.md b/docs/mkdocs/docs/api/basic_node/is_sequence.md index 108c900d..79765c95 100644 --- a/docs/mkdocs/docs/api/basic_node/is_sequence.md +++ b/docs/mkdocs/docs/api/basic_node/is_sequence.md @@ -6,13 +6,15 @@ bool is_sequence() const noexcept; ``` -Tests whether the node value type is [`node_t::SEQUENCE`](node_t.md). +Tests whether the node is a sequence node. -### **Return Value** +## **Return Value** -`true` if the type is [`node_t::SEQUENCE`](node_t.md), `false` otherwise. +`true` if the node is a sequence node, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_is_sequence.cpp:9" @@ -23,6 +25,6 @@ Tests whether the node value type is [`node_t::SEQUENCE`](node_t.md). --8<-- "examples/ex_basic_node_is_sequence.output" ``` -### **See Also** +## **See Also** -* [node_t](node_t.md) +* [node_type](../node_type.md) diff --git a/docs/mkdocs/docs/api/basic_node/is_string.md b/docs/mkdocs/docs/api/basic_node/is_string.md index f92c9fd4..3b0b3ebe 100644 --- a/docs/mkdocs/docs/api/basic_node/is_string.md +++ b/docs/mkdocs/docs/api/basic_node/is_string.md @@ -6,13 +6,15 @@ bool is_string() const noexcept; ``` -Tests whether the node value type is [`node_t::STRING`](node_t.md). +Tests whether the node is a string node. -### **Return Value** +## **Return Value** -`true` if the type is [`node_t::STRING`](node_t.md), `false` otherwise. +`true` if the node is a string node, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_is_string.cpp:9" @@ -23,6 +25,6 @@ Tests whether the node value type is [`node_t::STRING`](node_t.md). --8<-- "examples/ex_basic_node_is_string.output" ``` -### **See Also** +## **See Also** -* [node_t](node_t.md) +* [node_type](../node_type.md) diff --git a/docs/mkdocs/docs/api/basic_node/iterator.md b/docs/mkdocs/docs/api/basic_node/iterator.md index 75e3e877..acee0644 100644 --- a/docs/mkdocs/docs/api/basic_node/iterator.md +++ b/docs/mkdocs/docs/api/basic_node/iterator.md @@ -10,7 +10,7 @@ using iterator = detail::iterator; The types of non-const/const iterators for [`basic_node`](index.md) containers. They satisfies [LegacyBidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator) and are commonly used for sequence and mapping container nodes. -## Member Types +## **Member Types** * iterator | Type | Definition | @@ -29,14 +29,16 @@ They satisfies [LegacyBidirectionalIterator](https://en.cppreference.com/w/cpp/n | `difference_type` | [`std::ptrdiff_t`](https://en.cppreference.com/w/cpp/types/ptrdiff_t) | | `iterator_category` | [`std::bidirectional_iterator_tag`](https://en.cppreference.com/w/cpp/iterator/iterator_tags) | -## Member Functions +## **Member Functions** | Name | Description | | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | key | Returns const reference to a key node of the current key-value pair.
`fkyaml::exception` is thrown if an iterator points to a sequence element. | | value | Returns reference to a sequence element if an element points to a sequence element, or a mapping value otherwise. | -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_iterator.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/mapping.md b/docs/mkdocs/docs/api/basic_node/mapping.md index 43040cb7..5750d564 100644 --- a/docs/mkdocs/docs/api/basic_node/mapping.md +++ b/docs/mkdocs/docs/api/basic_node/mapping.md @@ -8,11 +8,13 @@ static basic_node mapping(const mapping_type& seq); static basic_node mapping(mapping_type&& seq); ``` -The factory method which constructs a basic_node with the [`node_t::MAPPING`](node_t.md) type from a mapping node value. -Calling this API with no arguments will constructs a basic_node with an empty mapping node value. -The resulting basic_node has the [`node_t::MAPPING`](node_t.md) type. +The factory method which constructs a basic_node with the [`node_type::MAPPING`](../node_type.md) type. +Calling this function with no arguments will constructs a basic_node with an empty mapping node value. +The resulting basic_node has the [`node_type::MAPPING`](../node_type.md) type. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_mapping.cpp:9" @@ -24,8 +26,8 @@ The resulting basic_node has the [`node_t::MAPPING`](node_t.md) type. ``` -### **See Also** +## **See Also** * [basic_node](index.md) -* [node_t](node_t.md) +* [node_type](../node_type.md) * [operator<<](insertion_operator.md) diff --git a/docs/mkdocs/docs/api/basic_node/mapping_type.md b/docs/mkdocs/docs/api/basic_node/mapping_type.md index b8141b67..6e3db014 100644 --- a/docs/mkdocs/docs/api/basic_node/mapping_type.md +++ b/docs/mkdocs/docs/api/basic_node/mapping_type.md @@ -3,37 +3,32 @@ # fkyaml::basic_node::mapping_type ```cpp -using mapping_type = MappingType; +using mapping_type = MappingType; ``` -The type used to store mapping node values. +The type used to store mapping values. -To store mapping objects in [`basic_node`](index.md) class, the container type is defined by the template parameter `MappingType` which chooses the type to use for integer objects. -If not explicitly specified, the default type `std::map` will be chosen. -With the decided container type, the type of mapping objects will then be decided in the form of `MappingType` with which mapping objects are stored inside a [`basic_node`](index.md). -Note that mapping objects are stored as pointers in a [`basic_node`](index.md) so that the internal storage size will at most be 8 bytes. +The actual type is defined by the template parameter `MappingType`. +If not explicitly specified, the default type `std::map` is defined. +With the decided container type, the type of mapping objects will then be decided in the form of `MappingType` with which mapping objects are stored inside a [`basic_node`](index.md). + +Note that mapping values are stored as a pointer to an allocated memory area on the heap in a [`basic_node`](index.md) so that the internal storage size will at most be 8 bytes. !!! Note "Preserve the insertion order of key-value pairs" The YAML specification describes as a mapping node as "an unordered association of unique keys to values". Which means that **the insertion order of key-value pairs are not guranteed by the YAML specification**. To follow the specification, the fkYAML library uses `std::map` as the mapping container type by default with the intention of better integration with other C++ programs. - If your YAML documents really needs to be dependent on the insertion order (the YAML specification discourages that though), you can force preserving the insertion order by specifying [`fkyaml::ordered_map`](../ordered_map/index.md) as the MappingType template parameter as follows: + If mapping values needs to be dependent on the insertion order, you can force preserving the insertion order by specifying [`fkyaml::ordered_map`](../ordered_map/index.md) as the MappingType template parameter as follows: ```cpp #include using ordered_node = basic_node; ``` -### **Template Paramters** - -`MappingType` -: The container to store key-value pairs. Defaults to `std::map`. - -`StringType` -: The type of keys and string scalar values. Defaults to `std::string`. +## **Examples** -???+ Example +??? Example ```cpp --8<-- "examples/ex_basic_node_mapping_type.cpp:9" @@ -44,7 +39,7 @@ Note that mapping objects are stored as pointers in a [`basic_node`](index.md) s --8<-- "examples/ex_basic_node_mapping_type.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) * [ordered_map](../ordered_map/index.md) diff --git a/docs/mkdocs/docs/api/basic_node/node.md b/docs/mkdocs/docs/api/basic_node/node.md index b27ccb73..32236087 100644 --- a/docs/mkdocs/docs/api/basic_node/node.md +++ b/docs/mkdocs/docs/api/basic_node/node.md @@ -6,9 +6,11 @@ using node = basic_node<>; ``` -This type is the default specialization of the [basic_node](index.md) class which uses the standard template types. +This type is a specialization of the [basic_node](index.md) template class and uses the default template parameter types. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_node.cpp:9" @@ -19,7 +21,7 @@ This type is the default specialization of the [basic_node](index.md) class whic --8<-- "examples/ex_basic_node_node.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) * [operator<<](insertion_operator.md) diff --git a/docs/mkdocs/docs/api/basic_node/node_t.md b/docs/mkdocs/docs/api/basic_node/node_t.md index d337fd44..cf3ec9fb 100644 --- a/docs/mkdocs/docs/api/basic_node/node_t.md +++ b/docs/mkdocs/docs/api/basic_node/node_t.md @@ -17,7 +17,7 @@ enum class node_t !!! warning "Deprecation" - The enum class [`#!cpp fkyaml::node_type`](../node_type.md) replaces the type alias `#!cpp fkyaml::basic_node::node_t` which has been deprecated in version 0.3.12. It will be removed in version 0.4.0. Please replace usages like + The enum class [`#!cpp fkyaml::node_type`](../node_type.md) replaces the type alias `#!cpp fkyaml::basic_node::node_t` which has been deprecated in version 0.3.12. It will be removed in a future version. Please replace usages like ```cpp fkyaml::node::node_t t; @@ -29,7 +29,7 @@ enum class node_t fkyaml::node_type t; ``` -This enumeration collects the different YAML value types. They are internally used to distinguish the stored values, and the functions [`is_sequence`](is_sequence.md), [`is_mapping`](is_mapping.md) and [`is_scalar`](is_scalar.md) (with [`is_null`](is_null.md), [`is_boolean`](is_boolean.md), [`is_integer`](is_integer.md), [`is_float_number`](is_float_number.md), [`is_string`](is_string.md)) rely on it. +This enumeration collects the different YAML value types. !!! Note "Types of scalars" @@ -40,7 +40,9 @@ This enumeration collects the different YAML value types. They are internally us * [`float_number_type`](float_number_type.md) for float number scalar values * [`string_type`](string_type.md) for string scalar values -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_node_t.cpp:9" @@ -51,7 +53,7 @@ This enumeration collects the different YAML value types. They are internally us --8<-- "examples/ex_basic_node_node_t.output" ``` -### **See Also** +## **See Also** * [type](type.md) * [is_sequence](is_sequence.md) diff --git a/docs/mkdocs/docs/api/basic_node/operator=.md b/docs/mkdocs/docs/api/basic_node/operator=.md index 9d9dde97..1766fde2 100644 --- a/docs/mkdocs/docs/api/basic_node/operator=.md +++ b/docs/mkdocs/docs/api/basic_node/operator=.md @@ -9,27 +9,18 @@ basic_node& operator=(basic_node&& rhs) noexcept; // (2) ``` Assignment operator. -The `basic_node` class supports both copy and move assignments. - -## Overload (1) - -```cpp -basic_node& operator=(const basic_node& rhs) noexcept; -``` - -Copy assignment operator. -Copies a YAML node value via the "copy and swap" strategy to enhance exception safety. +The `basic_node` class supports both copy(1) and move(2) assignments. ### **Parameters** ***`rhs`*** [in] -: A lvalue basic_node object to be copied with. +: A basic_node to copy/move from. ### **Return Value** -Reference to this basic_node object. +Reference to `this` basic_node object. -???+ Example +??? Example "Overload(1): copy assignments a basic_node" ```cpp --8<-- "examples/ex_basic_node_copy_assignment_operator.cpp:9" @@ -40,47 +31,17 @@ Reference to this basic_node object. --8<-- "examples/ex_basic_node_copy_assignment_operator.output" ``` -## Overload (2) +## **Examples** -```cpp -basic_node& operator=(basic_node&& rhs) noexcept; -``` - -Move assignment operator. -Moves a YAML node value from the given node. - -### **Parameters** - -***`rhs`*** [in] -: A rvalue basic_node object to be moved from. - -### **Return Value** - -Reference to this basic_node object. - -???+ Example +??? Example "Overload(2): move assignments a basic_node" ```cpp - #include - #include - - int main() - { - fkyaml::node n = true; - fkyaml::node n2 = 123; - n = std::move(n2); - - std::cout << std::boolalpha << n.is_integer() << std::endl; - std::cout << n.get_value() << std::endl; - - return 0; - } + --8<-- "examples/ex_basic_node_move_assignment_operator.cpp:9" ``` output: ```bash - true - 123 + --8<-- "examples/ex_basic_node_move_assignment_operator.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/operator[].md b/docs/mkdocs/docs/api/basic_node/operator[].md index 548f5d16..17dd6cbb 100644 --- a/docs/mkdocs/docs/api/basic_node/operator[].md +++ b/docs/mkdocs/docs/api/basic_node/operator[].md @@ -3,80 +3,63 @@ # fkyaml::basic_node::operator[] ```cpp -template < - typename KeyType, detail::enable_if_t< - detail::conjunction< - detail::negation>, - detail::is_node_compatible_type>::value, - int> = 0> -basic_node& operator[](KeyType&& key); // (1) - -template < - typename KeyType, detail::enable_if_t< - detail::conjunction< - detail::negation>, - detail::is_node_compatible_type>::value, - int> = 0> -const basic_node& operator[](KeyType&& key) const; // (2) - -template < - typename KeyType, detail::enable_if_t>::value, int> = 0> -basic_node& operator[](KeyType&& key); // (3) - -template < - typename KeyType, detail::enable_if_t>::value, int> = 0> -const basic_node& operator[](KeyType&& key) const; // (4) +// (1) +template +basic_node& operator[](KeyType&& key); + +template +const basic_node& operator[](KeyType&& key) const; + +// (2) +template +basic_node& operator[](BasicNodeType&& key); + +template +const basic_node& operator[](BasicNodeType&& key) const; ``` -Access to a YAML node element with either an index (for sequences) or a key (for mappings). -If the node is neither a sequence nor a mapping, or if the node is a sequence but the given `key` is not an integer, a [`fkyaml::type_error`](../exception/type_error.md) will be thrown. +Access to an element in a container node with either an index or key value. +This function must be called on a container node, or a [`fkyaml::type_error`](../exception/type_error.md) would be thrown. -!!! Danger +The input parameter `key` must be either a [`basic_node`](index.md) object or an object of a compatible type, i.e., a type with which a [`basic_node`](index.md) object can be constructible. - This API does not check the size of a sequence node before accessing the element. - To avoid undefined behaviors, please make sure the argument `key` is smaller than the actual sequence size with a return value of the [`basic_node::size()`](size.md) function. - If bounds check is necessary, prefer [`basic_node::at()`](at.md) function. +Note that the overload (1) internally constructs a temporal [`basic_node`](index.md) object. +So, if you use the same key multiple times, for example, in a for loop, consider creating a [`basic_node`](index.md) as a key first for better performance. -!!! Warning +!!! Danger "Accessing an element with an invalid index (Undefined Behavior)" - This API does not check the existence of the given `key` in a mapping node. - If the key does not exist, a default [basic_node](index.md) object will be created. - Please make sure that the node has the given key in advance by calling the [`basic_node::contains()`](contains.md) function. - If such a behavior is unwanted, prefer [`basic_node::at()`](at.md) function. + This function does not check the size of the queried sequence before accessing the element. + To avoid undefined behaviors, please make sure the argument `key` is smaller than the queried sequence size with the [`size()`](size.md) function in advance. + Or use [`at()`](at.md) function instead, which executes the bounds check before accessing an element with a given index. -## Overload (1), (2) +!!! Warning "Accessing an element with a non-existent key" -```cpp -template < - typename KeyType, detail::enable_if_t< - detail::conjunction< - detail::negation>, - detail::is_node_compatible_type>::value, - int> = 0> -basic_node& operator[](KeyType&& key); // (1) - -template < - typename KeyType, detail::enable_if_t< - detail::conjunction< - detail::negation>, - detail::is_node_compatible_type>::value, - int> = 0> -const basic_node& operator[](KeyType&& key) const; // (2) -``` + This function does not check the existence of the given `key` in the queried mapping. + If the key does not exist, a [basic_node](index.md) object will be default-constructed. + If such a behavior is unwanted, choose one of the followings. + * use [`at()`](at.md) function instead, which executes additional checks before accessing an element. + * call the [`contains()`](contains.md) function in advance to make sure that the key exists in the queried mapping. + +## **Template Parameters** -Accesses to an element in the YAML sequence/mapping node with the given key object of a compatible type with the [`basic_node`](index.md) class, i.e., a type with which a [`basic_node`](index.md) object is constructible. -These overloads internally construct a [`basic_node`](index.md) object with `key`. +***KeyType*** +: A compatible key type. + +***BasicNodeType*** +: A basic_node template instance type. + +## **Parameters** -### **Parameters** +***`key`*** [in] +: A key to a target element in the sequence/mapping node. -***`index`*** [in] -: An index/key for an element in the YAML sequence/mapping node. +## **Return Value** -### **Return Value** +(Constant) reference to the node value which is associated with the given key. -Reference, or constant reference, to the YAML node object associated with the given index/key. +## **Examples** -???+ Example +??? Example "Overload(1): access an element with compatible keys" ```cpp --8<-- "examples/ex_basic_node_subscript_operator_compatible_type.cpp:9" @@ -87,37 +70,7 @@ Reference, or constant reference, to the YAML node object associated with the gi --8<-- "examples/ex_basic_node_subscript_operator_compatible_type.output" ``` -## Overload (3), (4) - -```cpp -template < - typename KeyType, detail::enable_if_t>::value, int> = 0> -basic_node& operator[](KeyType&& key); // (3) - -template < - typename KeyType, detail::enable_if_t>::value, int> = 0> -const basic_node& operator[](KeyType&& key) const; // (4) -``` - -Accesses to an element in the YAML sequence/mapping node with the given [`basic_node`](index.md) key object. -Unlike the overloads (1) and (2) above, these overloads do not internally construct a [`basic_node`](index.md) object. -So, these overloads works more effectively when some key objects are used multiple times, for instance, in a for-loop. - -### **Template Parameters** - -***KeyType*** -: A key type which is a kind of the [`basic_node`](index.md) template class. - -### **Parameters** - -***`key`*** [in] -: An index/key for an element in the YAML sequence/mapping node. - -### **Return Value** - -Reference, or constant reference, to the YAML node object associated with the given index/key. - -???+ Example +??? Example "Overload(2): access an element with `basic_node` keys" ```cpp --8<-- "examples/ex_basic_node_subscript_operator_basic_node.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/operator_eq.md b/docs/mkdocs/docs/api/basic_node/operator_eq.md index fb51fdb6..b5d09dd5 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_eq.md +++ b/docs/mkdocs/docs/api/basic_node/operator_eq.md @@ -6,22 +6,23 @@ bool operator==(const basic_node& rhs) const noexcept; ``` -Equal-to operator. -Compares two `basic_node` objects for equality according to the following rules: +Compares two `basic_node` objects for equality according to the following rules: -* Two `basic_node` objects are equal if they are of the same [`node_t`](node_t.md) type and their stored values are the same according to their respective `operator==`. -* Two `basic_node` objects are always equal if both of them are of the [`node_t::NULL_OBJECT`](node_t.md) type. +* Two `basic_node` objects are equal if they are of the same [`node_type`](../node_type.md) type and their stored values are the same according to their respective `operator==`. +* Two `basic_node` objects are always equal if both of them are of the [`node_type::NULL_OBJECT`](../node_type.md) type. ## **Parameters** ***`rhs`*** [in] -: A `basic_node` object to be compared with `this` object. +: A `basic_node` object to compare with. ## **Return Value** -`true` if both types and values are equal, `false` otherwise. +`true` if both basic_node objects are equal, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_operator_eq.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/operator_ge.md b/docs/mkdocs/docs/api/basic_node/operator_ge.md index d1a873ab..a2c97943 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_ge.md +++ b/docs/mkdocs/docs/api/basic_node/operator_ge.md @@ -6,20 +6,20 @@ bool operator>=(const basic_node& rhs) const noexcept; ``` -Greater-than-or-equal-to operator. Check if `this` object is greater than or equal to `rhs`. -The operator returns the result of `!(*this < rhs)`. (see [`operator<`](operator_lt.md)) ## **Parameters** ***`rhs`*** [in] -: A `basic_node` object to be compared with `this` object. +: A `basic_node` object to compare with. ## **Return Value** -`true` if `this` is greater than `rhs`, `false` otherwise. +`true` if `this` is greater than or equal to `rhs`, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_operator_ge.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/operator_gt.md b/docs/mkdocs/docs/api/basic_node/operator_gt.md index d3630ae2..c95ac0e5 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_gt.md +++ b/docs/mkdocs/docs/api/basic_node/operator_gt.md @@ -6,20 +6,20 @@ bool operator>(const basic_node& rhs) const noexcept; ``` -Greater-than operator. Check if `this` object is greater than `rhs`. -The operator returns the result of `!(*this <= rhs)`. (see [`operator<=`](operator_le.md)) ## **Parameters** ***`rhs`*** [in] -: A `basic_node` object to be compared with `this` object. +: A `basic_node` object to compare with. ## **Return Value** `true` if `this` is greater than `rhs`, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_operator_gt.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/operator_le.md b/docs/mkdocs/docs/api/basic_node/operator_le.md index 566701ae..9fb6396c 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_le.md +++ b/docs/mkdocs/docs/api/basic_node/operator_le.md @@ -6,20 +6,20 @@ bool operator<=(const basic_node& rhs) const noexcept; ``` -Less-than-or-equal-to operator. Check if `this` object is less than or equal to `rhs`. -The operator returns the result of `!(rhs < *this)`. (see [`operator<`](operator_lt.md)) ## **Parameters** ***`rhs`*** [in] -: A `basic_node` object to be compared with `this` object. +: A `basic_node` object to compare with. ## **Return Value** `true` if `this` is less than or equal to `rhs`, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_operator_le.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/operator_lt.md b/docs/mkdocs/docs/api/basic_node/operator_lt.md index 3678d9d1..46d75cba 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_lt.md +++ b/docs/mkdocs/docs/api/basic_node/operator_lt.md @@ -6,31 +6,32 @@ bool operator<(const basic_node& rhs) const noexcept; ``` -Less-than operator. Check if `this` object is less than `rhs` according to the following rules: -* If the values are of the same [`node_t`](node_t.md) type, their stored values are compared according to their respective `operator<`. -* Two `basic_node` objects are always equal if both of them are of the [`node_t::NULL_OBJECT`](node_t.md) type. -* If the values are of different [`node_t`](node_t.md) types, the stored values are ignored and the order of the types are considered. The order of the types is as followed (top < bottom): - * node_t::SEQUENCE - * node_t::MAPPING - * node_t::NULL_OBJECT - * node_t::BOOLEAN - * node_t::INTEGER - * node_t::FLOAT_NUMBER - * node_t::STRING -* If the values are of the [`node_t::BOOLEAN`](node_t.md) type, a value whose stored value is `false` is less than a value whose stored value is `true`. +* If the values are of the same [`node_type`](../node_type.md) type, their stored values are compared according to their respective `operator<`. +* Two `basic_node` objects are always equal if both of them are of the [`node_type::NULL_OBJECT`](../node_type.md) type. +* If the values are of different [`node_type`](../node_type.md) types, the stored values are ignored and the order of the types are considered. The order of the types is as followed (top < bottom): + * node_type::SEQUENCE + * node_type::MAPPING + * node_type::NULL_OBJECT + * node_type::BOOLEAN + * node_type::INTEGER + * node_type::FLOAT + * node_type::STRING +* If the values are of the [`node_type::BOOLEAN`](../node_type.md) type, a value whose stored value is `false` is less than a value whose stored value is `true`. ## **Parameters** ***`rhs`*** [in] -: A `basic_node` object to be compared with `this` object. +: A `basic_node` object to compared with. ## **Return Value** `true` if `this` is less than `rhs`, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_operator_lt.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/operator_ne.md b/docs/mkdocs/docs/api/basic_node/operator_ne.md index 5291094b..2f7ab060 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_ne.md +++ b/docs/mkdocs/docs/api/basic_node/operator_ne.md @@ -6,20 +6,20 @@ bool operator!=(const basic_node& rhs) const noexcept; ``` -Not-Equal-to operator. Compares two `basic_node` objects for inequality. -This operator returns the result of `!(*this == rhs)`. (see [`operator==`](operator_eq.md)) ## **Parameters** ***`rhs`*** [in] -: A `basic_node` object to be compared with `this` object. +: A `basic_node` object to compare with. ## **Return Value** `true` if either types or values are not equal, `false` otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_operator_ne.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/rbegin.md b/docs/mkdocs/docs/api/basic_node/rbegin.md index b3e2cf6a..33d0e662 100644 --- a/docs/mkdocs/docs/api/basic_node/rbegin.md +++ b/docs/mkdocs/docs/api/basic_node/rbegin.md @@ -8,16 +8,18 @@ const_reverse_iterator rbegin() const; const_reverse_iterator crbegin() const; ``` -Returns an iterator to the reverse-beginning (= last) element of a container node. +Returns a (constant) iterator to the reverse-beginning (= last) element of a container node. Throws a [`fkyaml::type_error`](../exception/type_error.md) if a basic_node is neither a sequence nor mapping node. ![Image from https://en.cppreference.com/w/cpp/iterator/reverse_iterator](../../img/range-rbegin-rend.svg) -### **Return Value** +## **Return Value** -A (constant) reverse iterator to the reverse-beginning (= last) element of a container node. +A (constant) iterator to the reverse-beginning (= last) element of a container node. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_rbegin.cpp:9" @@ -28,7 +30,7 @@ A (constant) reverse iterator to the reverse-beginning (= last) element of a con --8<-- "examples/ex_basic_node_rbegin.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) * [node](node.md) diff --git a/docs/mkdocs/docs/api/basic_node/rend.md b/docs/mkdocs/docs/api/basic_node/rend.md index 8ac5e93f..e73788c0 100644 --- a/docs/mkdocs/docs/api/basic_node/rend.md +++ b/docs/mkdocs/docs/api/basic_node/rend.md @@ -8,16 +8,18 @@ const_reverse_iterator rend() const; const_reverse_iterator crend() const; ``` -Returns an iterator to the reverse-end (= one before the first) element of a container node. +Returns a (constant) iterator to the reverse-end (= one before the first) element of a container node. Throws a [`fkyaml::type_error`](../exception/type_error.md) if a basic_node is neither a sequence nor mapping node. ![Image from https://en.cppreference.com/w/cpp/iterator/reverse_iterator](../../img/range-rbegin-rend.svg) -### **Return Value** +## **Return Value** -A (constant) reverse iterator to the reverse-end (= one before the first) element of a container node. +A (constant) iterator to the reverse-end (= one before the first) element of a container node. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_rend.cpp:9" @@ -28,7 +30,7 @@ A (constant) reverse iterator to the reverse-end (= one before the first) elemen --8<-- "examples/ex_basic_node_rend.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) * [node](node.md) diff --git a/docs/mkdocs/docs/api/basic_node/reverse_iterator.md b/docs/mkdocs/docs/api/basic_node/reverse_iterator.md index d0ebe24a..4efe66ae 100644 --- a/docs/mkdocs/docs/api/basic_node/reverse_iterator.md +++ b/docs/mkdocs/docs/api/basic_node/reverse_iterator.md @@ -3,43 +3,45 @@ # fkyaml::basic_node::reverse_iterator, fkyaml::basic_node::const_reverse_iterator ```cpp -using reverse_iterator = detail::reverse_iterator; -using const_reverse_iterator = detail::reverse_iterator; +using reverse_iterator = detail::reverse_iterator; +using const_reverse_iterator = detail::reverse_iterator; ``` The types of non-const/const reverse iterators for [`basic_node`](index.md) containers. They satisfies [LegacyBidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator) and are commonly used for sequence and mapping container nodes. -## Member Types +## **Member Types** ### reverse_iterator | Type | Definition | | ------------------- | --------------------------------------------------------------------------------------------- | | `iterator_type` | `basic_node::iterator` | +| `iterator_category` | [`std::bidirectional_iterator_tag`](https://en.cppreference.com/w/cpp/iterator/iterator_tags) | | `value_type` | `basic_node` | -| `reference` | `basic_node&` | -| `pointer` | `basic_node*` | | `difference_type` | [`std::ptrdiff_t`](https://en.cppreference.com/w/cpp/types/ptrdiff_t) | -| `iterator_category` | [`std::bidirectional_iterator_tag`](https://en.cppreference.com/w/cpp/iterator/iterator_tags) | +| `pointer` | `basic_node*` | +| `reference` | `basic_node&` | ### const_reverse_iterator | Type | Definition | | ------------------- | --------------------------------------------------------------------------------------------- | | `iterator_type` | `basic_node::const_iterator` | +| `iterator_category` | [`std::bidirectional_iterator_tag`](https://en.cppreference.com/w/cpp/iterator/iterator_tags) | | `value_type` | `basic_node` | -| `reference` | `const basic_node&` | -| `pointer` | `const basic_node*` | | `difference_type` | [`std::ptrdiff_t`](https://en.cppreference.com/w/cpp/types/ptrdiff_t) | -| `iterator_category` | [`std::bidirectional_iterator_tag`](https://en.cppreference.com/w/cpp/iterator/iterator_tags) | +| `pointer` | `const basic_node*` | +| `reference` | `const basic_node&` | -## Member Functions +## **Member Functions** | Name | Description | | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | key | Returns const reference to a key node of the current key-value pair.
`fkyaml::exception` is thrown if an iterator points to a sequence element. | | value | Returns reference to a sequence element if an element points to a sequence element, or a mapping value otherwise. | -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_reverse_iterator.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/sequence.md b/docs/mkdocs/docs/api/basic_node/sequence.md index b305fdde..ba7abedf 100644 --- a/docs/mkdocs/docs/api/basic_node/sequence.md +++ b/docs/mkdocs/docs/api/basic_node/sequence.md @@ -10,9 +10,11 @@ static basic_node sequence(sequence_type&& seq); The factory method which constructs a basic_node with the [`node_t::SEQUENCE`](node_t.md) type from a sequence node value. Calling this API with no arguments will constructs a basic_node with an empty sequence node value. -The resulting basic_node has the [`node_t::SEQUENCE`](node_t.md) type. +The resulting basic_node has the [`node_type::SEQUENCE`](../node_type.md) type. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_sequence.cpp:9" @@ -23,9 +25,8 @@ The resulting basic_node has the [`node_t::SEQUENCE`](node_t.md) type. --8<-- "examples/ex_basic_node_sequence.output" ``` - -### **See Also** +## **See Also** * [basic_node](index.md) -* [node_t](node_t.md) +* [node_type](../node_type.md) * [operator<<](insertion_operator.md) diff --git a/docs/mkdocs/docs/api/basic_node/sequence_type.md b/docs/mkdocs/docs/api/basic_node/sequence_type.md index f8cfb6e0..edabaa72 100644 --- a/docs/mkdocs/docs/api/basic_node/sequence_type.md +++ b/docs/mkdocs/docs/api/basic_node/sequence_type.md @@ -8,11 +8,15 @@ using sequence_type = SequenceType; The type used to store sequence node values. -To store sequence objects in [`basic_node`](index.md) class, the type is defined by the template parameter `SequenceType` which chooses the type to use for sequence objects. -If not explicitly specified, the default type `std::vector` will be chosen. -Note that sequence objects are stored as pointers to the decided type in a [`basic_node`](index.md) so that the internal storage size will at most be 8 bytes. +The type is defined by the template parameter `SequenceType`. +If not explicitly specified, the default type `std::vector` is defined. +With the decided container type, the type of sequence objects will then be decided in the form of `SequenceType` with which sequence objects are stored inside a [`basic_node`](index.md). -???+ Example +Note that sequence objects are stored as a pointer to an allocated memory area on the heap in a [`basic_node`](index.md) so that the internal storage size will at most be 8 bytes. + +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_sequence_type.cpp:9" @@ -23,6 +27,6 @@ Note that sequence objects are stored as pointers to the decided type in a [`bas --8<-- "examples/ex_basic_node_sequence_type.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) diff --git a/docs/mkdocs/docs/api/basic_node/serialize.md b/docs/mkdocs/docs/api/basic_node/serialize.md index 1861ef62..17370f54 100644 --- a/docs/mkdocs/docs/api/basic_node/serialize.md +++ b/docs/mkdocs/docs/api/basic_node/serialize.md @@ -8,8 +8,8 @@ static std::string serialize(const basic_node& node); Serializes YAML node values recursively. Currently, the serialization of mappings and sequences only supports block styles. -That means that, even if a deserialized source input contains container nodes written in flow styles, this function forces them to be emitted in block styles. -Moreover, fkYAML unconditionally uses LFs as the line break format in serialization outputs, and there is currently no way to change it to use CR+LFs instead. +That means that, even if an original YAML document contains container nodes written in the flow style, this function forces them to be emitted in the block style. +Moreover, fkYAML unconditionally uses LFs (Unix Style) as the line break format in serialization outputs, and there is currently no way to change it to use CR+LFs (Windows Style) instead. This function serializes the given `node` parameter in the following format. ```yaml @@ -47,16 +47,18 @@ This function serializes the given `node` parameter in the following format. : ``` -### **Parameters** +## **Parameters** ***`node`*** [in] : A `basic_node` object to be serialized. -### **Return Value** +## **Return Value** -The resulting string object from the serialization of the `node` object. +The resulting string object of the serialization. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_serialize.cpp:9" @@ -67,7 +69,7 @@ The resulting string object from the serialization of the `node` object. --8<-- "examples/ex_basic_node_serialize.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) * [add_anchor_name](add_anchor_name.md) diff --git a/docs/mkdocs/docs/api/basic_node/serialize_docs.md b/docs/mkdocs/docs/api/basic_node/serialize_docs.md index 39cc43be..444dd70c 100644 --- a/docs/mkdocs/docs/api/basic_node/serialize_docs.md +++ b/docs/mkdocs/docs/api/basic_node/serialize_docs.md @@ -8,7 +8,7 @@ static std::string serialize_docs(const std::vector& docs); Serializes YAML documents into a string. This function serializes the given `docs` parameter with the separation line (...) between YAML documents. -Regarding the serialization of each document, see the documentation for the [`serialize()`](serialize.md) function which this function calls internally. +Regarding the serialization of each document, see the documentation for the [`serialize()`](serialize.md) function with which this function shares internal implementation. Just as the [`serialize()`](serialize.md) function does, fkYAML unconditionally uses LFs as the line break format in serialization outputs, and there is currently no way to change it to use CR+LFs instead. ```yaml @@ -18,16 +18,18 @@ Just as the [`serialize()`](serialize.md) function does, fkYAML unconditionally # the last document end marker (...) is omitted since it's redundant. ``` -### **Parameters** +## **Parameters** ***`docs`*** [in] : `basic_node` objects to be serialized. -### **Return Value** +## **Return Value** -The resulting string object from the serialization of the `docs` object. +The resulting string object of the serialization. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_serialize_docs.cpp:9" @@ -38,7 +40,7 @@ The resulting string object from the serialization of the `docs` object. --8<-- "examples/ex_basic_node_serialize_docs.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) * [add_anchor_name](add_anchor_name.md) diff --git a/docs/mkdocs/docs/api/basic_node/set_yaml_version.md b/docs/mkdocs/docs/api/basic_node/set_yaml_version.md index 9090762e..2234e391 100644 --- a/docs/mkdocs/docs/api/basic_node/set_yaml_version.md +++ b/docs/mkdocs/docs/api/basic_node/set_yaml_version.md @@ -8,7 +8,7 @@ void set_yaml_version(const yaml_version_t version) noexcept; !!! warning "Deprecation" - The function [`#!cpp void set_yaml_version_type(const yaml_version_type)`](set_yaml_version_type.md) replaces the function `#!cpp 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 + The function [`#!cpp void set_yaml_version_type(const yaml_version_type)`](set_yaml_version_type.md) replaces the function `#!cpp void set_yaml_version(const basic_node::yaml_version_t)` which has been deprecated in version 0.3.12. It will be removed in a future version. Please replace calls like ```cpp n.set_yaml_version(fkyaml::node::yaml_version_t::VER_1_2); @@ -20,14 +20,16 @@ void set_yaml_version(const yaml_version_t version) noexcept; n.set_yaml_version_type(fkyaml::yaml_version_type::VERSION_1_2); ``` -Sets a target YAML version to the `basic_node` object. +Sets a target YAML specification version to the `basic_node` object. -### **Parameters** +## **Parameters** ***version*** [in] : A target YAML version. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_set_yaml_version.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/set_yaml_version_type.md b/docs/mkdocs/docs/api/basic_node/set_yaml_version_type.md index 5884d71f..f933c16c 100644 --- a/docs/mkdocs/docs/api/basic_node/set_yaml_version_type.md +++ b/docs/mkdocs/docs/api/basic_node/set_yaml_version_type.md @@ -6,14 +6,16 @@ void set_yaml_version_type(const yaml_version_type version) noexcept; ``` -Sets a target YAML version to the `basic_node` object. +Sets a target YAML specification version to the `basic_node` object. -### **Parameters** +## **Parameters** ***version*** [in] : A target YAML version. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_set_yaml_version_type.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/size.md b/docs/mkdocs/docs/api/basic_node/size.md index e48dca10..71ccce08 100644 --- a/docs/mkdocs/docs/api/basic_node/size.md +++ b/docs/mkdocs/docs/api/basic_node/size.md @@ -7,13 +7,15 @@ std::size_t size() const; ``` Gets the size of a node value. -Throws a [`fkyaml::exception`](../exception/index.md) if a basic_node does not have a conatiner nor string value. +Throws a [`fkyaml::exception`](../exception/index.md) if a basic_node is neither a sequence, mapping nor string value. -### **Return Value** +## **Return Value** The size of a node value. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_size.cpp:9" @@ -24,6 +26,6 @@ The size of a node value. --8<-- "examples/ex_basic_node_size.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) diff --git a/docs/mkdocs/docs/api/basic_node/string_type.md b/docs/mkdocs/docs/api/basic_node/string_type.md index 92861edd..b07fe8d9 100644 --- a/docs/mkdocs/docs/api/basic_node/string_type.md +++ b/docs/mkdocs/docs/api/basic_node/string_type.md @@ -8,11 +8,15 @@ using string_type = StringType; The type used to store integer node values and keys for mapping nodes. -To store string objects in [`basic_node`](index.md) class, the type is defined by the template parameter `StringType` which chooses the type to use for string objects. -If not explicitly specified, the default type `std::string` will be chosen. -Note that string objects are stored as pointers to the decided type in a [`basic_node`](index.md) so that the internal storage size will at most be 8 bytes. +The type is defined by the template parameter `StringType`. +If not explicitly specified, the default type `std::string` is defined. +With the decided type, string values are stored directly inside a [`basic_node`](index.md). -???+ Example +Note that string objects are stored as a pointer to an allocated memory area on the heap in a [`basic_node`](index.md) so that the internal storage size will at most be 8 bytes. + +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_string_type.cpp:9" @@ -23,6 +27,6 @@ Note that string objects are stored as pointers to the decided type in a [`basic --8<-- "examples/ex_basic_node_string_type.output" ``` -### **See Also** +## **See Also** * [basic_node](index.md) diff --git a/docs/mkdocs/docs/api/basic_node/swap.md b/docs/mkdocs/docs/api/basic_node/swap.md index 03017cad..bc2401c3 100644 --- a/docs/mkdocs/docs/api/basic_node/swap.md +++ b/docs/mkdocs/docs/api/basic_node/swap.md @@ -11,23 +11,20 @@ template < template class ConverterType> inline void swap( basic_node& lhs, - basic_node& rhs) noexcept(noexcept(lhs.swap(rhs))); // (2) + basic_node& rhs) noexcept(noexcept(lhs.swap(rhs))); // (2) non-member function ``` Swaps the internally stored data with the given basic_node object. -## Overload (1) +## **Parameters** -```cpp -void swap(basic_node& rhs) noexcept; // (1) -``` - -### **Parameters** +***`lhs`*** [in, out] +: A basic_node to swap the contents with. -***`rhs`*** [in] -: A basic_node object to be swapped with. +***`rhs`*** [in, out] +: A basic_node to swap the contents with. -???+ Example +??? Example "member function: Swap the contents with another basic_node" ```cpp --8<-- "examples/ex_basic_node_swap_member.cpp:9" @@ -38,27 +35,9 @@ void swap(basic_node& rhs) noexcept; // (1) --8<-- "examples/ex_basic_node_swap_member.output" ``` -## Overload (2) - -```cpp -template < - template class SequenceType, template class MappingType, - typename BooleanType, typename IntegerType, typename FloatNumberType, typename StringType, - template class ConverterType> -inline void swap( - basic_node& lhs, - basic_node& rhs) noexcept(noexcept(lhs.swap(rhs))); // (2) -``` - -### **Parameters** - -***`lhs`*** [in] -: A left-hand-side basic_node object to be swapped with. - -***`rhs`*** -: A right-hand-side basic_node object to be swapped with. +## **Examples** -???+ Example +??? Example "non-member function: Swap the contents between basic_node objects" ```cpp --8<-- "examples/ex_basic_node_swap_std.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/type.md b/docs/mkdocs/docs/api/basic_node/type.md index 8a3f0038..51e1bc8c 100644 --- a/docs/mkdocs/docs/api/basic_node/type.md +++ b/docs/mkdocs/docs/api/basic_node/type.md @@ -8,7 +8,7 @@ node_t type() const noexcept; !!! warning "Deprecation" - The function [`#!cpp node_type get_type()`](get_type.md) replaces the function `basic_node::node_t type()` which has been deprecated in version 0.3.12. It will be removed in version 0.4.0. Please replace calls like + The function [`#!cpp node_type get_type()`](get_type.md) replaces the function `basic_node::node_t type()` which has been deprecated in version 0.3.12. It will be removed in a future version. Please replace calls like ```cpp fkyaml::node::node_t t = n.type(); @@ -20,9 +20,9 @@ node_t type() const noexcept; fkyaml::node_type t = n.get_type(); ``` -Returns the type of the YAML node value as a value from the [`node_t`](node_t.md) enumeration. +Returns the type of the YAML node value. -### **Return Value** +## **Return Value** The type of the YAML node value. @@ -36,7 +36,9 @@ The type of the YAML node value. | floating point number | node_t::FLOAT_NUMBER | | string | node_t::STRING | -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_type.cpp:9" @@ -47,6 +49,6 @@ The type of the YAML node value. --8<-- "examples/ex_basic_node_type.output" ``` -### **See Also** +## **See Also** * [node_t](node_t.md) diff --git a/docs/mkdocs/docs/api/basic_node/value_converter_type.md b/docs/mkdocs/docs/api/basic_node/value_converter_type.md index a1b103b4..c67c5553 100644 --- a/docs/mkdocs/docs/api/basic_node/value_converter_type.md +++ b/docs/mkdocs/docs/api/basic_node/value_converter_type.md @@ -7,21 +7,23 @@ template using value_converter_type = ValueConverterType; ``` -A helper type alias to determine converter type for the given target native data type `T`. +A helper type alias to determine converter type for the target type `T`. The default type of the template parameter `ValueConverterType` is [`node_value_converter`](../node_value_converter/index.md). -This type alias is used to determine the target type `T` is convertible from/to [`basic_node`](index.md). -The function [`get_value`](get_value.md) relies on it internally. -If you want to convert some type from/to `basic_node`, however, it is recommended to use [`basic_node::get_value`](get_value.md) instead, in order both to make your program more understandable and to avoid too much dependency on the fkYAML library implementation. +This type alias is used to determine the target type `T` is convertible from/to [`basic_node`](index.md) and quite a few functions rely on it such as the [`get_value()`](get_value.md) function. -### **Template Parameters** +If you want to convert some type from/to `basic_node`, however, it is recommended to use [`basic_node::get_value`](get_value.md) instead, in order for your program to avoid too much dependency on the fkYAML library implementation. + +## **Template Parameters** ***T*** : The target native data type. ***SFINAE*** -: Type to add compile type checks via SFINAE. Usually `void` is given. +: Type for [SFINAE](https://en.cppreference.com/w/cpp/language/sfinae). If you do not need compile-time type checks, pass just `void`. + +## **Examples** -???+ Example +??? Example ```cpp --8<-- "examples/ex_basic_node_value_converter_type.cpp:9" diff --git a/docs/mkdocs/docs/api/basic_node/yaml_version_t.md b/docs/mkdocs/docs/api/basic_node/yaml_version_t.md index ad9d6700..a9029901 100644 --- a/docs/mkdocs/docs/api/basic_node/yaml_version_t.md +++ b/docs/mkdocs/docs/api/basic_node/yaml_version_t.md @@ -12,7 +12,7 @@ enum class yaml_version_t !!! warning "Deprecation" - The enum class [`fkyaml::yaml_version_type`](../yaml_version_type.md) replaces the type alias `fkyaml::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 usages like + The enum class [`fkyaml::yaml_version_type`](../yaml_version_type.md) replaces the type alias `fkyaml::basic_node::yaml_version_t` which has been deprecated in version 0.3.12. It will be removed in a future version. Please replace usages like ```cpp fkyaml::node::yaml_version_t v; @@ -24,9 +24,11 @@ enum class yaml_version_t fkyaml::yaml_version_type v; ``` -This enumeration collects the used versions of YAML specification. It is used as meta data of a basic_node and the functions [`get_yaml_version`](get_yaml_version.md) and [`set_yaml_version`](set_yaml_version.md) rely on it. +This enumeration collects the YAML specification versions. It is used as meta data of a basic_node and the functions [`get_yaml_version`](get_yaml_version.md) and [`set_yaml_version`](set_yaml_version.md) rely on it. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_basic_node_yaml_version_t.cpp:9" @@ -37,7 +39,7 @@ This enumeration collects the used versions of YAML specification. It is used as --8<-- "examples/ex_basic_node_yaml_version_t.output" ``` -### **See Also** +## **See Also** * [deserialize](deserialize.md) * [get_yaml_version](get_yaml_version.md) diff --git a/docs/mkdocs/docs/api/exception/constructor.md b/docs/mkdocs/docs/api/exception/constructor.md index 0b0ba0ae..1efb6233 100644 --- a/docs/mkdocs/docs/api/exception/constructor.md +++ b/docs/mkdocs/docs/api/exception/constructor.md @@ -9,17 +9,14 @@ explicit exception(const char* msg) noexcept; // (2) ``` Constructs an exception object. -You can specify an error message on constructing an exception with an overloaded constructor. +You can specify an error message on constructing an object with an overloaded constructor. -## Overload (1) +## **Parameters** -```cpp -exception() = default; // (1) -``` - -Constructs an exception object without an error message. +***`msg`*** [in] +: An error message for the exception. If `nullptr` is given, the resulting error message will be empty. -???+ Example +??? Example "Overload(1): create a default value" ```cpp --8<-- "examples/ex_exception_constructor_noarg.cpp:9" @@ -30,21 +27,9 @@ Constructs an exception object without an error message. --8<-- "examples/ex_exception_constructor_noarg.output" ``` -## Overloads (2) - -```cpp -explicit exception(const char* msg) noexcept; // (2) -``` - -Constructs an exception with a given error message. -The given error message can be retrieved by calling [`exception::what()`](what.md) function. - -### **Parameters** - -***`msg`*** [in] -: An error message for the exception. If `nullptr` is given, the resulting error message will be empty. +## **Examples** -???+ Example +??? Example "Overload(2): create an object with an error message" ```cpp --8<-- "examples/ex_exception_constructor_msg.cpp:9" diff --git a/docs/mkdocs/docs/api/exception/destructor.md b/docs/mkdocs/docs/api/exception/destructor.md index b490ca46..18db8c8e 100644 --- a/docs/mkdocs/docs/api/exception/destructor.md +++ b/docs/mkdocs/docs/api/exception/destructor.md @@ -3,7 +3,7 @@ # fkyaml::exception::(destructor) ```cpp -~exception() noexcept; +~exception(); ``` Destroy an exception. diff --git a/docs/mkdocs/docs/api/exception/index.md b/docs/mkdocs/docs/api/exception/index.md index 876ab06b..2e91daf6 100644 --- a/docs/mkdocs/docs/api/exception/index.md +++ b/docs/mkdocs/docs/api/exception/index.md @@ -8,16 +8,17 @@ class exception : public std::exception; A basic exception class used in the fkYAML library. -## Derived Classes +## **Derived Classes** | Type | Description | | --------------------------------------- | ---------------------------------------------------- | | [invalid_encoding](invalid_encoding.md) | The exception indicating an encoding error. | +| [invalid_tag](invalid_tag.md) | The exception indicating an invalid tag. | | [out_of_range](out_of_range.md) | The exception indicating an out-of-range error. | | [parse_error](parse_error.md) | The exception indicating an error in parsing. | | [type_error](type_error.md) | The exception indicating an invalid type conversion. | -## Member Functions +## **Member Functions** ### Construction/Destruction diff --git a/docs/mkdocs/docs/api/exception/invalid_tag.md b/docs/mkdocs/docs/api/exception/invalid_tag.md new file mode 100644 index 00000000..755da61c --- /dev/null +++ b/docs/mkdocs/docs/api/exception/invalid_tag.md @@ -0,0 +1,19 @@ +Defined in header [``](https://github.com/fktn-k/fkYAML/blob/develop/include/fkYAML/exception.hpp) + +# fkyaml::invalid_tag + +```cpp +class invalid_tag : public exception; +``` + +A exception class indicating an invalid tag. +This class extends the [`fkyaml::exception`](index.md) class and the [`what()`](what.md) function emits an error message in the following format. + +``` +invalid_tag: [error message] tag=[invalid tag contents] +``` + +## **See Also** + +* [exception](index.md) +* [what](what.md) diff --git a/docs/mkdocs/docs/api/exception/what.md b/docs/mkdocs/docs/api/exception/what.md index 4526d47a..c20fe981 100644 --- a/docs/mkdocs/docs/api/exception/what.md +++ b/docs/mkdocs/docs/api/exception/what.md @@ -6,9 +6,15 @@ const char* what() const noexcept; ``` -Returns an error message for an exception. If nothing, a non-null, empty string will be returned. +Returns an error message for an exception. If nothing, a non-null pointer to an empty string will be returned. -???+ Example +## **Return Value** + +An error message for an exception or a non-null pointer to an empty string. + +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_exception_what.cpp:9" @@ -19,6 +25,6 @@ Returns an error message for an exception. If nothing, a non-null, empty string --8<-- "examples/ex_exception_what.output" ``` -### **See Also** +## **See Also** * [(constructor)](constructor.md) diff --git a/docs/mkdocs/docs/api/index.md b/docs/mkdocs/docs/api/index.md new file mode 100644 index 00000000..a7410848 --- /dev/null +++ b/docs/mkdocs/docs/api/index.md @@ -0,0 +1,18 @@ +# API References + +This section provides fkYAML API references. +Each sub-section contains API specifications and example snippets. + +* Classes + * [basic_node](./basic_node/index.md) + * [exception](./exception/index.md) + * [node_value_converter](./node_value_converter/index.md) + * [ordered_map](./ordered_map/index.md) +* Enumeration Types + * [node_type](./node_type.md) + * [yaml_version_type](./yaml_version_type.md) +* Non-member functions/operators + * [operator"" _yaml](./operator_literal_yaml.md) + * [operator<<(basic_node)](./basic_node/insertion_operator.md) + * [operator>>(basic_node)](./basic_node/extraction_operator.md) +* [Preprocessor Macros](./macros.md) diff --git a/docs/mkdocs/docs/api/macros.md b/docs/mkdocs/docs/api/macros.md index 263bc8a6..30ba0b6e 100644 --- a/docs/mkdocs/docs/api/macros.md +++ b/docs/mkdocs/docs/api/macros.md @@ -14,7 +14,7 @@ These macros are available for client applications as the metadata of this libra | FK_YAML_MINOR_VERSION | the minor version of the fkYAML library | | FK_YAML_PATCH_VERSION | the patch version of the fkYAML library | -??? Example annotate "Example: print the library version" +??? Example "print the library version" ```cpp --8<-- "examples/ex_macros_versions.cpp:9" @@ -42,16 +42,16 @@ You can also override the implementation by defining the following preprocessor | ----------------- | ---------------------------------------- | | FK_YAML_ASSERT(x) | controls behavior of runtime assertions. | -??? Example annotate "Example: disable runtime assertions" +??? Example "disable runtime assertions" ```cpp - #define NDEBUG + #define FK_YAML_ASSERT(x) #include // your code from here ``` -??? Example annotate "Example: override the implementation of runtime assertions" +??? Example "override the implementation of runtime assertions" ```cpp #include @@ -66,7 +66,7 @@ You can also override the implementation by defining the following preprocessor ## Language Supports The fkYAML library targets C++11, but also supports some features introduced in later C++ standards. -For those new features, the library implements some preprocessor checks to determine the active C++ standard based on preprocessor macros `__cplusplus` and `_MSVC_LANG`. +For such features, the library implements some preprocessor checks to determine the active C++ standard based on preprocessor macros `__cplusplus` or `_MSVC_LANG`. By defining any of the following macros, the internal check is overridden and the provided C++ standard is unconditionally assumed. This can be helpful for compilers that only implement parts of the standard and the standard would be detected incorrectly. @@ -78,7 +78,7 @@ This can be helpful for compilers that only implement parts of the standard and | FK_YAML_HAS_CXX_20 | supports C++20 features. | | FK_YAML_HAS_CXX_23 | supports C++23 features. | -??? Example annotate "Example: force the fkYAML library to use a specific C++ standard" +??? Example "force enabling features in specific C++ standard" ```cpp // force fkYAML to use the C++14 standard. diff --git a/docs/mkdocs/docs/api/node_type.md b/docs/mkdocs/docs/api/node_type.md index 24c573de..b72a6b9f 100644 --- a/docs/mkdocs/docs/api/node_type.md +++ b/docs/mkdocs/docs/api/node_type.md @@ -36,7 +36,9 @@ This enumeration collects the different YAML value types. They are internally us * [`basic_node::float_number_type`](basic_node/float_number_type.md) for float number scalar values * [`basic_node::string_type`](basic_node/string_type.md) for string scalar values -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_node_type.cpp:9" @@ -47,7 +49,7 @@ This enumeration collects the different YAML value types. They are internally us --8<-- "examples/ex_node_type.output" ``` -### **See Also** +## **See Also** * [basic_node](basic_node/index.md) * [get_type](basic_node/get_type.md) diff --git a/docs/mkdocs/docs/api/node_value_converter/from_node.md b/docs/mkdocs/docs/api/node_value_converter/from_node.md index 41d98cb9..19500c90 100644 --- a/docs/mkdocs/docs/api/node_value_converter/from_node.md +++ b/docs/mkdocs/docs/api/node_value_converter/from_node.md @@ -1,6 +1,6 @@ Defined in header [``](https://github.com/fktn-k/fkYAML/blob/develop/include/fkYAML/node_value_converter.hpp) -# fkyaml::basic_node::from_node +# fkyaml::node_value_converter::from_node ```cpp template @@ -13,12 +13,12 @@ Converts a [`basic_node`](../basic_node/index.md) object to the target native da This function is usually called by the [`get_value()`](../basic_node/get_value.md) function of the [`basic_node`](../basic_node/index.md) class. Note that the `TargetType` must be default-constructible. -!!! Tips +!!! Tips "Customization for non-standard types" This function can be used for user-defined types by implementing (partial) specialization for `from_node()` function which is called internally by this function. - Note that the specialization **must be implemented in the same namespace as the user-defined types (including the global namespace)** so that the specialization can successfully be found by ADL (Argument Dependent Lookup). + Note that the specialization **must be implemented in the same namespace as the user-defined types (including the global namespace)** so that the specialization can successfully be found by [ADL (Argument Dependent Lookup)](https://en.cppreference.com/w/cpp/language/adl). You can find a detailed explanation of how this customization point works at [this link](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html). - Also, see the example below for the feel of how it can be achieved. + Also, see the example below to get the feel of how it can be achieved. ## **Template Parameters** @@ -36,7 +36,13 @@ Note that the `TargetType` must be default-constructible. ***`val`*** [out] : A native data object to which the converted value is assigned. -???+ Example +## **Return Value** + +A value of a compatible type converted from a basic_node. + +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_node_value_converter_from_node.cpp:9" diff --git a/docs/mkdocs/docs/api/node_value_converter/index.md b/docs/mkdocs/docs/api/node_value_converter/index.md index b5d4445b..974b9b52 100644 --- a/docs/mkdocs/docs/api/node_value_converter/index.md +++ b/docs/mkdocs/docs/api/node_value_converter/index.md @@ -9,13 +9,13 @@ class node_value_converter; An ADL friendly converter between [basic_node](../basic_node/index.md) objects and native data objects. -## Template Paramters +## **Template Paramters** | Template parameter | Description | |--------------------|--------------------------------------| | `ValueType` | The default target native data type. | -## Member Functions +## **Member Functions** ### Conversions diff --git a/docs/mkdocs/docs/api/node_value_converter/to_node.md b/docs/mkdocs/docs/api/node_value_converter/to_node.md index 420f808e..91466409 100644 --- a/docs/mkdocs/docs/api/node_value_converter/to_node.md +++ b/docs/mkdocs/docs/api/node_value_converter/to_node.md @@ -1,6 +1,6 @@ Defined in header [``](https://github.com/fktn-k/fkYAML/blob/develop/include/fkYAML/node_value_converter.hpp) -# fkyaml::basic_node::from_node +# fkyaml::node_value_converter::from_node ```cpp template @@ -9,14 +9,14 @@ static auto to_node(BasicNodeType& n, TargetType&& val) noexcept( -> decltype(::fkyaml::to_node(n, std::forward(val))) ``` -Converts a native data to a [`basic_node`](../basic_node/index.md) object. -This function is usually called by the constructors of the [`basic_node`](../basic_node/index.md) class. +Converts a value to a [`basic_node`](../basic_node/index.md) object. +This function is usually called by the [`constructors`](../basic_node/constructor.md) of the [`basic_node`](../basic_node/index.md) class. -!!! Tips +!!! Tips "Customization for non-standard types" This function can be used for user-defined types by implementing (partial) specialization for `to_node()` function which is called internally by this function. - Note that the specialization **must be implemented in the same namespace as the user-defined types** so that the specialization can successfully be found by ADL (Argument Dependent Lookup). - See the example below for more information. + Note that the specialization **must be implemented in the same namespace as the user-defined types** so that the specialization can successfully be found by [ADL (Argument-Dependent Lookup)](https://en.cppreference.com/w/cpp/language/adl). + See the example below to get the feel of how it can be achieved. ## **Template Parameters** @@ -34,7 +34,13 @@ This function is usually called by the constructors of the [`basic_node`](../bas ***`val`*** [in] : A native data object used for conversion. -???+ Example +## **Return Value** + +A basic_node object converted from a value of a compatible type. + +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_node_value_converter_to_node.cpp:9" diff --git a/docs/mkdocs/docs/api/operator_literal_yaml.md b/docs/mkdocs/docs/api/operator_literal_yaml.md index bc8da3c0..da0f36d0 100644 --- a/docs/mkdocs/docs/api/operator_literal_yaml.md +++ b/docs/mkdocs/docs/api/operator_literal_yaml.md @@ -14,10 +14,10 @@ It can be used by adding `#!cpp _yaml` to a string literal encoded in either UTF Calling this operator is equivalent with calling [`#!cpp fkyaml::basic_node::deserialize(s, s + n)`](basic_node/deserialize.md). This operator is declared in the namespace `fkyaml::literals::yaml_literals`, where both `literals` and `yaml_literals` are [inline namespaces](https://en.cppreference.com/w/cpp/language/namespace#Inline_namespaces). -Access to this operator can be gained with: +Access to this operator can therefore be gained with one of the followings: * `#!cpp using namespace fkyaml::literals;`, -* `#!cpp using namespace fkyaml::yaml_literals;`, or +* `#!cpp using namespace fkyaml::yaml_literals;` * `#!cpp using namespace fkyaml::literals::yaml_literals;` ## **Parameters** @@ -33,7 +33,9 @@ Access to this operator can be gained with: The resulting basic_node object deserialized from the input string `s`. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_operator_literal_yaml.cpp:9" diff --git a/docs/mkdocs/docs/api/ordered_map/at.md b/docs/mkdocs/docs/api/ordered_map/at.md index ba052bb1..3b659dee 100644 --- a/docs/mkdocs/docs/api/ordered_map/at.md +++ b/docs/mkdocs/docs/api/ordered_map/at.md @@ -3,19 +3,15 @@ # fkyaml::ordered_map::at ```cpp -template < - typename KeyType, - detail::enable_if_t::value, int> = 0> +template mapped_type& at(KeyType&& key) noexcept; -template < - typename KeyType, - detail::enable_if_t::value, int> = 0> +template const mapped_type& at(KeyType&& key) const ``` Accesses an element with the given key. -This API throws a [`fkyaml::exception`] if the given key does not exist in the ordered_map object. +This function throws a [`fkyaml::exception`] if the given key does not exist in the ordered_map object. ## **Template Parameters** @@ -29,9 +25,11 @@ This API throws a [`fkyaml::exception`] if the given key does not exist in the o ## **Return Value** -Reference, or constant reference, to a `mapped_type` object associated with the given key. +(Constant) reference to a `mapped_type` object associated with the given key. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_ordered_map_at.cpp:9" diff --git a/docs/mkdocs/docs/api/ordered_map/constructor.md b/docs/mkdocs/docs/api/ordered_map/constructor.md index 33498f8a..9517a9c1 100644 --- a/docs/mkdocs/docs/api/ordered_map/constructor.md +++ b/docs/mkdocs/docs/api/ordered_map/constructor.md @@ -11,16 +11,14 @@ ordered_map(std::initializer_list init); // (2) Constructs a new ordered_map. You can specify the initial value on constructing an ordered_map with an overloaded constructor. -## Overload (1) +## **Parameters** -```cpp -ordered_map(); // (1) -``` +***`init`*** [in] +: An initializer list of key-value pairs. -Constructs an ordered_map object without an initial value. -The content of a newly constructed ordered_map is an empty list of key-value pairs. +## **Examples** -???+ Example +??? Example "Overload(1): create a default value." ```cpp --8<-- "examples/ex_ordered_map_constructor_noarg.cpp:9" @@ -31,21 +29,7 @@ The content of a newly constructed ordered_map is an empty list of key-value pai --8<-- "examples/ex_ordered_map_constructor_noarg.output" ``` -## Overload (2) - -```cpp -ordered_map(std::initializer_list init); // (2) -``` - -Constructs a new ordered_map with an initializer list. -The resulting ordered_map object has the same list of key-value pairs as the given initializer list. - -## **Parameters** - -***`init`*** [in] -: An initializer list of key-value pairs. - -???+ Example +??? Example "Overload(2): create an ordered_map object with an initializer list" ```cpp --8<-- "examples/ex_ordered_map_constructor_initializer_list.cpp:9" diff --git a/docs/mkdocs/docs/api/ordered_map/destructor.md b/docs/mkdocs/docs/api/ordered_map/destructor.md index aeb8eef3..0c5568fd 100644 --- a/docs/mkdocs/docs/api/ordered_map/destructor.md +++ b/docs/mkdocs/docs/api/ordered_map/destructor.md @@ -1,6 +1,6 @@ Defined in header [``](https://github.com/fktn-k/fkYAML/blob/develop/include/fkYAML/ordered_map.hpp) -# fkyaml::ordered_map::(constructor) +# fkyaml::ordered_map::(destructor) ```cpp ~ordered_map() = default; diff --git a/docs/mkdocs/docs/api/ordered_map/emplace.md b/docs/mkdocs/docs/api/ordered_map/emplace.md index ebd1c3f4..1e5616a6 100644 --- a/docs/mkdocs/docs/api/ordered_map/emplace.md +++ b/docs/mkdocs/docs/api/ordered_map/emplace.md @@ -3,13 +3,11 @@ # fkyaml::ordered_map::emplace ```cpp -template < - typename KeyType, - detail::enable_if_t::value, int> = 0> +template std::pair emplace(KeyType&& key, const mapped_type& value) noexcept; ``` -Emplaces a new key-value pair if the new key does not exist in the ordered_map object. +Emplaces a new key-value pair if the given key does not exist in the ordered_map object. ***KeyType*** : A type compatible with the key type. @@ -24,9 +22,11 @@ Emplaces a new key-value pair if the new key does not exist in the ordered_map o ## **Return Value** -A pair consisting of an iterator to the inserted element, or the already-existing element if no insertion happend, and a boolean denoting the insertion took place (`true` if insertion happened, `false` otherwise). +A pair consisting of an iterator to the inserted element or the already-existing element, and a boolean denoting the insertion took place (`true` if insertion happened, `false` otherwise). -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_ordered_map_constructor_initializer_list.cpp:9" diff --git a/docs/mkdocs/docs/api/ordered_map/find.md b/docs/mkdocs/docs/api/ordered_map/find.md index ad492b9f..c183c893 100644 --- a/docs/mkdocs/docs/api/ordered_map/find.md +++ b/docs/mkdocs/docs/api/ordered_map/find.md @@ -3,14 +3,10 @@ # fkyaml::ordered_map::find ```cpp -template < - typename KeyType, - detail::enable_if_t::value, int> = 0> +template iterator find(KeyType&& key) noexcept; -template < - typename KeyType, - detail::enable_if_t::value, int> = 0> +template const_iterator find(KeyType&& key) const noexcept; ``` @@ -28,9 +24,11 @@ Find a value with the given key. ## **Return Value** -An iterator to the target value if found, the result of end() otherwise. +A (constant) iterator to the target value if found, the result of end() otherwise. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_ordered_map_emplace.cpp:9" diff --git a/docs/mkdocs/docs/api/ordered_map/index.md b/docs/mkdocs/docs/api/ordered_map/index.md index 60203f41..8b1f9f97 100644 --- a/docs/mkdocs/docs/api/ordered_map/index.md +++ b/docs/mkdocs/docs/api/ordered_map/index.md @@ -19,17 +19,17 @@ This documentation only describes APIs which are not of the parent class [`std:: However, the above recommendation with a sequence of key-value pair does not work so efficiently on the application layer because it cannot be a direct representation of the deserialization result and could also break the original order when the deserialized node is serialized again. The ordered_map class is thus provided to help resolve those issues. -## Template Parameters +## **Template Parameters** -| Template parameter | Description | Derived type | -|--------------------|---------------------------------------------------------|--------------| -| `Key` | type for sequence node value containers | key_type | -| `Value` | type for mapping node value containers | mapped_type | -| `IgnoredCompare` | type for boolean node values | - | -| `Allocator` | type for integer node values | - | +| Template parameter | Description | Derived type | +| ------------------ | ------------------------------------ | ------------ | +| `Key` | type for keys | key_type | +| `Value` | type for values | mapped_type | +| `IgnoredCompare` | placeholder type for key comparisons | - | +| `Allocator` | type for allocators | - | -## Member Types +## **Member Types** | Name | Description | |----------------|-------------------------------------------------| @@ -42,7 +42,7 @@ This documentation only describes APIs which are not of the parent class [`std:: | size_type | The type for size parameters used in the class. | | key_compare | The type for comparison between keys. | -## Member Functions +## **Member Functions** ### Construction/Destruction | Name | Description | diff --git a/docs/mkdocs/docs/api/ordered_map/operator[].md b/docs/mkdocs/docs/api/ordered_map/operator[].md index 7e16c694..5b21b36b 100644 --- a/docs/mkdocs/docs/api/ordered_map/operator[].md +++ b/docs/mkdocs/docs/api/ordered_map/operator[].md @@ -3,9 +3,7 @@ # fkyaml::ordered_map::operator[] ```cpp -template < - typename KeyType, - detail::enable_if_t::value, int> = 0> +template mapped_type& operator[](KeyType&& key) noexcept; ``` @@ -14,8 +12,8 @@ Accesses an element with the given key. !!! Tip This API behaves like the [`std::map`](https://en.cppreference.com/w/cpp/container/map) class does. - In other words, it does not check the existence of the given key, and could return a default value if the key does not exist. - To avoid such a behavior, you can use [`at()`](at.md) function which throws a [`fkyaml::exception`](../exception/index.md) if the given key does not match any keys in the ordered_map object. + In other words, it does not check the existence of the given key, and could create and return a default value if the key does not exist. + To avoid such a behavior, you can use [`at()`](at.md) function which throws a [`fkyaml::exception`](../exception/index.md) if the given key does not exist in the ordered_map object. ## **Template Parameters** @@ -32,7 +30,9 @@ Accesses an element with the given key. Reference to a `mapped_type` object associated with the given key. Possibly a default value of the `mapped_type` if the ordered_map does not contain the given key. -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_ordered_map_subscript_operator.cpp:9" diff --git a/docs/mkdocs/docs/api/yaml_version_type.md b/docs/mkdocs/docs/api/yaml_version_type.md index bba81947..b0069023 100644 --- a/docs/mkdocs/docs/api/yaml_version_type.md +++ b/docs/mkdocs/docs/api/yaml_version_type.md @@ -15,7 +15,9 @@ This enumeration collects the used versions of YAML specification. It is used as * [`get_yaml_version_type()`](basic_node/get_yaml_version_type.md) * [`set_yaml_version_type()`](basic_node/set_yaml_version_type.md) -???+ Example +## **Examples** + +??? Example ```cpp --8<-- "examples/ex_yaml_version_type.cpp:9" @@ -26,7 +28,7 @@ This enumeration collects the used versions of YAML specification. It is used as --8<-- "examples/ex_yaml_version_type.output" ``` -### **See Also** +## **See Also** * [deserialize](basic_node/deserialize.md) * [get_yaml_version_type](basic_node/get_yaml_version_type.md) diff --git a/docs/mkdocs/docs/home/license.md b/docs/mkdocs/docs/home/license.md index a736ba15..50eaec62 100644 --- a/docs/mkdocs/docs/home/license.md +++ b/docs/mkdocs/docs/home/license.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Kensuke Fukutani +Copyright (c) 2023-2024 Kensuke Fukutani Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/mkdocs/docs/tutorials/cmake_integration.md b/docs/mkdocs/docs/tutorials/cmake_integration.md index d46f56f8..987f6afb 100644 --- a/docs/mkdocs/docs/tutorials/cmake_integration.md +++ b/docs/mkdocs/docs/tutorials/cmake_integration.md @@ -14,7 +14,7 @@ To use fkYAML from a CMake project, you can locate it directly with [`find_packa Note that this method requires a release package to be installed somewhere on your machine. The package configuration file, `fkYAMLConfig.cmake`, can be used either from an install tree or directly out of the build tree. -???+ Example +??? Example ```cmake title="CMakeLists.txt" cmake_minimum_required(VERSION 3.8) @@ -30,7 +30,7 @@ The package configuration file, `fkYAMLConfig.cmake`, can be used either from an To embed the library directory into an existing CMake project, place the entire source tree in a subdirectory and call [`add_subdirectory()`](https://cmake.org/cmake/help/latest/command/add_subdirectory.html) in your `CMakeLists.txt` file. -???+ Example +??? Example ```cmake title="CMakeLists.txt" cmake_minimum_required(VERSION 3.8) @@ -46,7 +46,7 @@ To embed the library directory into an existing CMake project, place the entire Since CMake v3.11, [`FetchContent`](https://cmake.org/cmake/help/latest/module/FetchContent.html) is available which automatically downloads a release as a dependency during configuration. -???+ Example +??? Example ```cmake title="CMakeLists.txt" cmake_minimum_required(VERSION 3.11) diff --git a/docs/mkdocs/mkdocs.yml b/docs/mkdocs/mkdocs.yml index a2e36482..df61fe58 100644 --- a/docs/mkdocs/mkdocs.yml +++ b/docs/mkdocs/mkdocs.yml @@ -11,186 +11,183 @@ theme: name: material language: en palette: - - media: '(prefers-color-scheme: light)' - scheme: default - primary: teal - accent: green - toggle: - icon: material/brightness-7 - name: Switch to dark mode - - media: '(prefers-color-scheme: dark)' - scheme: slate - primary: blue grey - accent: blue - toggle: - icon: material/brightness-4 - name: Switch to light mode + - media: '(prefers-color-scheme: light)' + scheme: default + primary: teal + accent: green + toggle: + icon: material/brightness-7 + name: Switch to dark mode + - media: '(prefers-color-scheme: dark)' + scheme: slate + primary: blue grey + accent: blue + toggle: + icon: material/brightness-4 + name: Switch to light mode font: text: Roboto code: JetBrains Mono icon: repo: fontawesome/brands/github features: - - navigation.instant - - navigation.tracking - - navigation.tabs - - navigation.indexes - - navigation.top - - content.tabs.link - - content.code.copy - - search.suggest + - navigation.instant + - navigation.tracking + - navigation.tabs + - navigation.indexes + - navigation.top + - content.tabs.link + - content.code.copy + - search.suggest markdown_extensions: - - abbr - - admonition - - attr_list - - def_list - - pymdownx.details - - pymdownx.emoji: - emoji_index: !!python/name:material.extensions.emoji.twemoji - emoji_generator: !!python/name:material.extensions.emoji.to_svg - - pymdownx.highlight: - anchor_linenums: true - line_spans: __span - pygments_lang_class: true - - pymdownx.inlinehilite - - pymdownx.magiclink - - pymdownx.superfences - - pymdownx.tabbed: - alternate_style: true - - pymdownx.tilde - - pymdownx.snippets: - base_path: .. - check_paths: true - - toc: - permalink: true +- abbr +- admonition +- attr_list +- def_list +- pymdownx.details +- pymdownx.emoji: + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg +- pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true +- pymdownx.inlinehilite +- pymdownx.magiclink +- pymdownx.superfences +- pymdownx.tabbed: + alternate_style: true +- pymdownx.tilde +- pymdownx.snippets: + base_path: .. + check_paths: true +- toc: + permalink: true extra: social: - - icon: fontawesome/brands/github - link: https://github.com/fktn-k + - icon: fontawesome/brands/github + link: https://github.com/fktn-k generator: false analytics: provider: google property: G-3KS8Y4E3DZ extra_javascript: - - https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/hightlight.min.js - - javascripts/config.js +- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/hightlight.min.js +- javascripts/config.js extra_css: - - https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/default.min.css +- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/default.min.css plugins: - - search - - git-revision-date-localized +- search +- git-revision-date-localized nav: - - Home: - - Home: index.md - - License: home/license.md - - Releases: home/releases.md - - Supported Compilers: home/supported_compilers.md - - Community Support: home/community_support.md - - Tutorials: - - The First Steps: tutorials/index.md - - CMake Integration: tutorials/cmake_integration.md - - API References: - - basic_node: - - basic_node: api/basic_node/index.md - - (constructor): api/basic_node/constructor.md - - (destructor): api/basic_node/destructor.md - - operator=: api/basic_node/operator=.md - - add_anchor_name: api/basic_node/add_anchor_name.md - - add_tag_name: api/basic_node/add_tag_name.md - - alias_of: api/basic_node/alias_of.md - - at: api/basic_node/at.md - - begin: api/basic_node/begin.md - - boolean_type: api/basic_node/boolean_type.md - - cbegin: api/basic_node/begin.md - - cend: api/basic_node/end.md - - crbegin: api/basic_node/rbegin.md - - crend: api/basic_node/rend.md - - const_iterator: api/basic_node/iterator.md - - const_reverse_iterator: api/basic_node/reverse_iterator.md - - contains: api/basic_node/contains.md - - deserialize: api/basic_node/deserialize.md - - deserialize_docs: api/basic_node/deserialize_docs.md - - empty: api/basic_node/empty.md - - end: api/basic_node/end.md - - float_number_type: api/basic_node/float_number_type.md - - get_anchor_name: api/basic_node/get_anchor_name.md - - get_tag_name: api/basic_node/get_tag_name.md - - get_type: api/basic_node/get_type.md - - get_value: api/basic_node/get_value.md - - get_value_inplace: api/basic_node/get_value_inplace.md - - get_value_ref: api/basic_node/get_value_ref.md - - get_yaml_version: api/basic_node/get_yaml_version.md - - get_yaml_version_type: api/basic_node/get_yaml_version_type.md - - has_anchor_name: api/basic_node/has_anchor_name.md - - has_tag_name: api/basic_node/has_tag_name.md - - integer_type: api/basic_node/integer_type.md - - is_alias: api/basic_node/is_alias.md - - is_anchor: api/basic_node/is_anchor.md - - is_boolean: api/basic_node/is_boolean.md - - is_float_number: api/basic_node/is_float_number.md - - is_integer: api/basic_node/is_integer.md - - is_mapping: api/basic_node/is_mapping.md - - is_null: api/basic_node/is_null.md - - is_scalar: api/basic_node/is_scalar.md - - is_sequence: api/basic_node/is_sequence.md - - is_string: api/basic_node/is_string.md - - iterator: api/basic_node/iterator.md - - mapping_type: api/basic_node/mapping_type.md - - mapping: api/basic_node/mapping.md - - node_t: api/basic_node/node_t.md - - node: api/basic_node/node.md - - rbegin: api/basic_node/rbegin.md - - rend: api/basic_node/rend.md - - reverse_iterator: api/basic_node/reverse_iterator.md - - sequence_type: api/basic_node/sequence_type.md - - sequence: api/basic_node/sequence.md - - serialize: api/basic_node/serialize.md - - serialize_docs: api/basic_node/serialize_docs.md - - set_yaml_version: api/basic_node/set_yaml_version.md - - set_yaml_version_type: api/basic_node/set_yaml_version_type.md - - size: api/basic_node/size.md - - string_type: api/basic_node/string_type.md - - swap: api/basic_node/swap.md - - type: api/basic_node/type.md - - value_converter_type: api/basic_node/value_converter_type.md - - yaml_version_t: api/basic_node/yaml_version_t.md - - operator[]: api/basic_node/operator[].md - - operator==: api/basic_node/operator_eq.md - - operator!=: api/basic_node/operator_ne.md - - operator<: api/basic_node/operator_lt.md - - operator<=: api/basic_node/operator_le.md - - operator>: api/basic_node/operator_gt.md - - operator>=: api/basic_node/operator_ge.md - - exception: - - exception: api/exception/index.md - - (constructor): api/exception/constructor.md - - (destructor): api/exception/destructor.md - - what: api/exception/what.md - - invalid_encoding: api/exception/invalid_encoding.md - - out_of_range: api/exception/out_of_range.md - - parse_error: api/exception/parse_error.md - - type_error: api/exception/type_error.md - - macros: api/macros.md - - node_type: api/node_type.md - - node_value_converter: - - node_value_converter: api/node_value_converter/index.md - - from_node: api/node_value_converter/from_node.md - - to_node: api/node_value_converter/to_node.md - - operator"" _yaml(): api/operator_literal_yaml.md - - operator<<(basic_node): api/basic_node/insertion_operator.md - - operator>>(basic_node): api/basic_node/extraction_operator.md - - ordered_map: - - ordered_map: api/ordered_map/index.md - - (constructor): api/ordered_map/constructor.md - - (destructor): api/ordered_map/destructor.md - - at: api/ordered_map/at.md - - emplace: api/ordered_map/emplace.md - - find: api/ordered_map/find.md - - operator[]: api/ordered_map/operator[].md - - yaml_version_type: api/yaml_version_type.md +- Home: + - Home: index.md + - License: home/license.md + - Releases: home/releases.md + - Supported Compilers: home/supported_compilers.md + - Community Support: home/community_support.md +- Tutorials: + - The First Steps: tutorials/index.md + - CMake Integration: tutorials/cmake_integration.md +- API References: + - API References: api/index.md + - basic_node: + - basic_node: api/basic_node/index.md + - member types: + - sequence_type: api/basic_node/sequence_type.md + - mapping_type: api/basic_node/mapping_type.md + - boolean_type: api/basic_node/boolean_type.md + - integer_type: api/basic_node/integer_type.md + - float_number_type: api/basic_node/float_number_type.md + - string_type: api/basic_node/string_type.md + - 'iterator, const_iterator': api/basic_node/iterator.md + - 'reverse_iterator, const_reverse_iterator': api/basic_node/reverse_iterator.md + - value_converter_type: api/basic_node/value_converter_type.md + - node_t: api/basic_node/node_t.md + - yaml_version_t: api/basic_node/yaml_version_t.md + - (constructor): api/basic_node/constructor.md + - (destructor): api/basic_node/destructor.md + - operators: + - operator=: api/basic_node/operator=.md + - 'operator[]': api/basic_node/operator[].md + - operator==: api/basic_node/operator_eq.md + - operator!=: api/basic_node/operator_ne.md + - operator<: api/basic_node/operator_lt.md + - operator<=: api/basic_node/operator_le.md + - operator>: api/basic_node/operator_gt.md + - operator>=: api/basic_node/operator_ge.md + - add_anchor_name: api/basic_node/add_anchor_name.md + - add_tag_name: api/basic_node/add_tag_name.md + - alias_of: api/basic_node/alias_of.md + - at: api/basic_node/at.md + - 'begin, cbegin': api/basic_node/begin.md + - contains: api/basic_node/contains.md + - deserialize: api/basic_node/deserialize.md + - deserialize_docs: api/basic_node/deserialize_docs.md + - empty: api/basic_node/empty.md + - 'end, cend': api/basic_node/end.md + - get_anchor_name: api/basic_node/get_anchor_name.md + - get_tag_name: api/basic_node/get_tag_name.md + - get_type: api/basic_node/get_type.md + - get_value: api/basic_node/get_value.md + - get_value_inplace: api/basic_node/get_value_inplace.md + - get_value_ref: api/basic_node/get_value_ref.md + - get_yaml_version: api/basic_node/get_yaml_version.md + - get_yaml_version_type: api/basic_node/get_yaml_version_type.md + - has_anchor_name: api/basic_node/has_anchor_name.md + - has_tag_name: api/basic_node/has_tag_name.md + - is_alias: api/basic_node/is_alias.md + - is_anchor: api/basic_node/is_anchor.md + - is_boolean: api/basic_node/is_boolean.md + - is_float_number: api/basic_node/is_float_number.md + - is_integer: api/basic_node/is_integer.md + - is_mapping: api/basic_node/is_mapping.md + - is_null: api/basic_node/is_null.md + - is_scalar: api/basic_node/is_scalar.md + - is_sequence: api/basic_node/is_sequence.md + - is_string: api/basic_node/is_string.md + - mapping: api/basic_node/mapping.md + - node: api/basic_node/node.md + - 'rbegin, crbegin': api/basic_node/rbegin.md + - 'rend, crend': api/basic_node/rend.md + - sequence: api/basic_node/sequence.md + - serialize: api/basic_node/serialize.md + - serialize_docs: api/basic_node/serialize_docs.md + - set_yaml_version: api/basic_node/set_yaml_version.md + - set_yaml_version_type: api/basic_node/set_yaml_version_type.md + - size: api/basic_node/size.md + - swap: api/basic_node/swap.md + - type: api/basic_node/type.md + - exception: + - exception: api/exception/index.md + - (constructor): api/exception/constructor.md + - (destructor): api/exception/destructor.md + - what: api/exception/what.md + - invalid_encoding: api/exception/invalid_encoding.md + - out_of_range: api/exception/out_of_range.md + - parse_error: api/exception/parse_error.md + - type_error: api/exception/type_error.md + - node_value_converter: + - node_value_converter: api/node_value_converter/index.md + - from_node: api/node_value_converter/from_node.md + - to_node: api/node_value_converter/to_node.md + - ordered_map: + - ordered_map: api/ordered_map/index.md + - (constructor): api/ordered_map/constructor.md + - (destructor): api/ordered_map/destructor.md + - at: api/ordered_map/at.md + - emplace: api/ordered_map/emplace.md + - find: api/ordered_map/find.md + - 'operator[]': api/ordered_map/operator[].md + - node_type: api/node_type.md + - yaml_version_type: api/yaml_version_type.md + - operator"" _yaml(): api/operator_literal_yaml.md + - operator<<(basic_node): api/basic_node/insertion_operator.md + - operator>>(basic_node): api/basic_node/extraction_operator.md + - macros: api/macros.md diff --git a/docs/mkdocs/requirements.txt b/docs/mkdocs/requirements.txt index 64272a10..9074e9f5 100644 --- a/docs/mkdocs/requirements.txt +++ b/docs/mkdocs/requirements.txt @@ -1,33 +1,34 @@ -Babel==2.14.0 -certifi==2024.2.2 -charset-normalizer==3.3.2 +babel==2.16.0 +certifi==2024.12.14 +charset-normalizer==3.4.0 click==8.1.7 colorama==0.4.6 ghp-import==2.1.0 gitdb==4.0.11 GitPython==3.1.43 -idna==3.7 -Jinja2==3.1.3 -Markdown==3.6 -MarkupSafe==2.1.5 +idna==3.10 +Jinja2==3.1.4 +Markdown==3.7 +MarkupSafe==3.0.2 mergedeep==1.3.4 -mkdocs==1.5.3 -mkdocs-git-revision-date-localized-plugin==1.2.4 -mkdocs-material==9.5.18 +mkdocs==1.6.1 +mkdocs-get-deps==0.2.0 +mkdocs-git-revision-date-localized-plugin==1.3.0 +mkdocs-material==9.5.49 mkdocs-material-extensions==1.3.1 -packaging==24.0 -paginate==0.5.6 +packaging==24.2 +paginate==0.5.7 pathspec==0.12.1 -platformdirs==4.2.0 -Pygments==2.17.2 -pymdown-extensions==10.7.1 +platformdirs==4.3.6 +Pygments==2.18.0 +pymdown-extensions==10.12 python-dateutil==2.9.0.post0 -pytz==2024.1 -PyYAML==6.0.1 +pytz==2024.2 +PyYAML==6.0.2 pyyaml_env_tag==0.1 -regex==2024.4.16 -requests==2.31.0 -six==1.16.0 +regex==2024.11.6 +requests==2.32.3 +six==1.17.0 smmap==5.0.1 -urllib3==2.2.1 -watchdog==4.0.0 +urllib3==2.2.3 +watchdog==6.0.0 diff --git a/include/fkYAML/exception.hpp b/include/fkYAML/exception.hpp index 1fa614be..f3b353a7 100644 --- a/include/fkYAML/exception.hpp +++ b/include/fkYAML/exception.hpp @@ -113,8 +113,13 @@ class invalid_encoding : public exception { }; /// @brief An exception class indicating an error in parsing. +/// @sa https://fktn-k.github.io/fkYAML/api/exception/parse_error/ class parse_error : public exception { public: + /// @brief Constructs a new parse_error object with an error message and counts of lines and colums at the error. + /// @param[in] msg An error message. + /// @param[in] lines Count of lines. + /// @param[in] cols_in_line Count of colums. explicit parse_error(const char* msg, uint32_t lines, uint32_t cols_in_line) noexcept : exception(generate_error_message(msg, lines, cols_in_line).c_str()) { } @@ -155,12 +160,18 @@ class type_error : public exception { } }; +/// @brief An exception class indicating an out-of-range error. +/// @sa https://fktn-k.github.io/fkYAML/api/exception/out_of_range/ class out_of_range : public exception { public: + /// @brief Construct a new out_of_range object with an invalid index value. + /// @param[in] index An invalid index value. explicit out_of_range(int index) noexcept : exception(generate_error_message(index).c_str()) { } + /// @brief Construct a new out_of_range object with invalid key contents. + /// @param[in] key Invalid key contents explicit out_of_range(const char* key) noexcept : exception(generate_error_message(key).c_str()) { } @@ -175,8 +186,13 @@ class out_of_range : public exception { } }; +/// @brief An exception class indicating an invalid tag. +/// @sa https://fktn-k.github.io/fkYAML/api/exception/invalid_tag/ class invalid_tag : public exception { public: + /// @brief Constructs a new invalid_tag object with an error message and invalid tag contents. + /// @param[in] msg An error message. + /// @param[in] tag Invalid tag contents. explicit invalid_tag(const char* msg, const char* tag) : exception(generate_error_message(msg, tag).c_str()) { } diff --git a/include/fkYAML/ordered_map.hpp b/include/fkYAML/ordered_map.hpp index 6051d07c..ccf1c936 100644 --- a/include/fkYAML/ordered_map.hpp +++ b/include/fkYAML/ordered_map.hpp @@ -32,21 +32,36 @@ template < typename Allocator = std::allocator>> class ordered_map : public std::vector, Allocator> { public: - /// A type for keys. + /// @brief A type for keys. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using key_type = Key; - /// A type for values. + + /// @brief A type for values. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using mapped_type = Value; - /// A type for internal key-value containers. + + /// @brief A type for internal key-value containers. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using Container = std::vector, Allocator>; - /// A type for key-value pairs. + + /// @brief A type for key-value pairs. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using value_type = typename Container::value_type; - /// A type for non-const iterators. + + /// @brief A type for non-const iterators. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using iterator = typename Container::iterator; - /// A type for const iterators. + + /// @brief A type for const iterators. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using const_iterator = typename Container::const_iterator; - /// A type for size parameters used in this class. + + /// @brief A type for size parameters used in this class. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using size_type = typename Container::size_type; - /// A type for comparison between keys. + + /// @brief A type for comparison between keys. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using key_compare = std::equal_to; public: diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 925b4138..3f38c26e 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -1692,8 +1692,13 @@ class invalid_encoding : public exception { }; /// @brief An exception class indicating an error in parsing. +/// @sa https://fktn-k.github.io/fkYAML/api/exception/parse_error/ class parse_error : public exception { public: + /// @brief Constructs a new parse_error object with an error message and counts of lines and colums at the error. + /// @param[in] msg An error message. + /// @param[in] lines Count of lines. + /// @param[in] cols_in_line Count of colums. explicit parse_error(const char* msg, uint32_t lines, uint32_t cols_in_line) noexcept : exception(generate_error_message(msg, lines, cols_in_line).c_str()) { } @@ -1734,12 +1739,18 @@ class type_error : public exception { } }; +/// @brief An exception class indicating an out-of-range error. +/// @sa https://fktn-k.github.io/fkYAML/api/exception/out_of_range/ class out_of_range : public exception { public: + /// @brief Construct a new out_of_range object with an invalid index value. + /// @param[in] index An invalid index value. explicit out_of_range(int index) noexcept : exception(generate_error_message(index).c_str()) { } + /// @brief Construct a new out_of_range object with invalid key contents. + /// @param[in] key Invalid key contents explicit out_of_range(const char* key) noexcept : exception(generate_error_message(key).c_str()) { } @@ -1754,8 +1765,13 @@ class out_of_range : public exception { } }; +/// @brief An exception class indicating an invalid tag. +/// @sa https://fktn-k.github.io/fkYAML/api/exception/invalid_tag/ class invalid_tag : public exception { public: + /// @brief Constructs a new invalid_tag object with an error message and invalid tag contents. + /// @param[in] msg An error message. + /// @param[in] tag Invalid tag contents. explicit invalid_tag(const char* msg, const char* tag) : exception(generate_error_message(msg, tag).c_str()) { } @@ -12095,21 +12111,36 @@ template < typename Allocator = std::allocator>> class ordered_map : public std::vector, Allocator> { public: - /// A type for keys. + /// @brief A type for keys. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using key_type = Key; - /// A type for values. + + /// @brief A type for values. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using mapped_type = Value; - /// A type for internal key-value containers. + + /// @brief A type for internal key-value containers. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using Container = std::vector, Allocator>; - /// A type for key-value pairs. + + /// @brief A type for key-value pairs. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using value_type = typename Container::value_type; - /// A type for non-const iterators. + + /// @brief A type for non-const iterators. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using iterator = typename Container::iterator; - /// A type for const iterators. + + /// @brief A type for const iterators. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using const_iterator = typename Container::const_iterator; - /// A type for size parameters used in this class. + + /// @brief A type for size parameters used in this class. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using size_type = typename Container::size_type; - /// A type for comparison between keys. + + /// @brief A type for comparison between keys. + /// @sa https://fktn-k.github.io/fkYAML/api/ordered_map/ using key_compare = std::equal_to; public: From b43c4cf9204a0c250211d2d2259a4f11ffb83a03 Mon Sep 17 00:00:00 2001 From: fktn Date: Thu, 19 Dec 2024 05:36:06 +0900 Subject: [PATCH 05/18] Update workflow jobs for release artifacts (#447) * update workflow jobs for release artifacts * change extension: tar.gz -> tgz --- .github/workflows/release_package.yml | 83 +++++++++++++++++---------- 1 file changed, 53 insertions(+), 30 deletions(-) diff --git a/.github/workflows/release_package.yml b/.github/workflows/release_package.yml index 73a3de5b..1e76b1b1 100644 --- a/.github/workflows/release_package.yml +++ b/.github/workflows/release_package.yml @@ -9,52 +9,75 @@ on: jobs: create_package: timeout-minutes: 10 - runs-on: ${{matrix.os}} + runs-on: ubuntu-latest # Since fkYAML is a header-only library, just using ubuntu-latest is enough for packaging. strategy: matrix: - os: [ubuntu-latest, windows-latest] single_header: ["ON", "OFF"] include: - - os: ubuntu-latest - artifact_name: fkYAML.tgz + - artifact_name: fkYAML single_header: "OFF" - - os: ubuntu-latest - artifact_name: fkYAML_single_header.tgz - single_header: "ON" - - os: windows-latest - artifact_name: fkYAML.zip - single_header: "OFF" - - os: windows-latest - artifact_name: fkYAML_single_header.zip + - artifact_name: fkYAML_single_header single_header: "ON" steps: - uses: actions/checkout@v4 - with: - submodules: recursive + + - name: install zip + run: sudo apt-get install zip - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/build/package" -DFK_YAML_USE_SINGLE_HEADER=${{matrix.single_header}} + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/build/${{matrix.artifact_name}}" -DFK_YAML_USE_SINGLE_HEADER=${{matrix.single_header}} - name: Install run: | cmake --build ${{github.workspace}}/build --config Release --target install - ls ${{github.workspace}}/build/package + ls -lAR ${{github.workspace}}/build/${{matrix.artifact_name}} - - name: Package - shell: bash + - name: Create tgz/zip archives of the install package run: | - ls '${{github.workspace}}/build' - if [[ "${{ matrix.os }}" == "windows-latest" ]] - then - 7z a ${{matrix.artifact_name}} '${{github.workspace}}/build/package' - else - tar czvf ${{matrix.artifact_name}} '${{github.workspace}}/build/package' - fi - ls - - - name: Upload Artifacts + cd ${{github.workspace}}/build + tar czvf '${{matrix.artifact_name}}.tgz' ./${{matrix.artifact_name}} + zip -r '${{matrix.artifact_name}}.zip' ./${{matrix.artifact_name}} + + - name: Upload Artifacts (tgz) + uses: actions/upload-artifact@v4 + with: + name: '${{matrix.artifact_name}}.tgz' + path: '${{github.workspace}}/build/${{matrix.artifact_name}}.tgz' + + - name: Upload Artifacts (zip) + uses: actions/upload-artifact@v4 + with: + name: '${{matrix.artifact_name}}.zip' + path: '${{github.workspace}}/build/${{matrix.artifact_name}}.zip' + + create_minimum_archive: + timeout-minutes: 10 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: install zip + run: sudo apt-get install zip + + - name: Create minimum tgz & zip archives + working-directory: ${{github.workspace}} + run: | # create a tgz archive which contains minimum required files to be used as a CMake project (e.g., using FetchContent). + mkdir fkYAML_min + cp -vr CMakeLists.txt fkYAML.natvis LICENSE.txt README.md include single_include ./fkYAML_min + tar czvf fkYAML_min.tgz ./fkYAML_min + zip -r fkYAML_min.zip ./fkYAML_min + rm -rf ./fkYAML_min + + - name: Upload the minimum archive (tgz) + uses: actions/upload-artifact@v4 + with: + name: fkYAML_min.tgz + path: '${{github.workspace}}/fkYAML_min.tgz' + + - name: Upload the minimum archive (zip) uses: actions/upload-artifact@v4 with: - name: ${{matrix.artifact_name}} - path: ${{matrix.artifact_name}} + name: fkYAML_min.zip + path: '${{github.workspace}}/fkYAML_min.zip' From 43a18846bbe10ea5c45a7fc8cd6ce323b51122dc Mon Sep 17 00:00:00 2001 From: fktn Date: Sun, 22 Dec 2024 02:33:22 +0900 Subject: [PATCH 06/18] Optimize lexer implementation (#448) * do not create a temporal, redundant lexical_token object * search plain scalar contents for flow indicators only within a flow context * modified validation of scalar contents * reduced redundant calls in lexer * updated benchmark results * fixed a clang-tidy error --- README.md | 36 +- .../fkYAML/detail/input/lexical_analyzer.hpp | 419 +++++++++--------- single_include/fkYAML/node.hpp | 419 +++++++++--------- .../result_debug_citm_catalog_json.txt | 14 +- .../results/result_debug_citm_catalog_yml.txt | 14 +- .../results/result_debug_ubuntu_yml.txt | 14 +- .../result_release_citm_catalog_json.txt | 14 +- .../result_release_citm_catalog_yml.txt | 14 +- .../results/result_release_ubuntu_yml.txt | 14 +- 9 files changed, 456 insertions(+), 502 deletions(-) diff --git a/README.md b/README.md index 028d2bf2..4804ee81 100644 --- a/README.md +++ b/README.md @@ -151,34 +151,34 @@ The following tables are created from the benchmarking results in the following | Benchmark | processed bytes per second (Release) | | ---------------------------------- | ------------------------------------ | -| fkYAML | 55.1393Mi/s | -| libfyaml | 34.7645Mi/s | -| rapidyaml
(with mutable buff) | 19.6806Gi/s | -| rapidyaml
(with immutable buff) | 140.24Mi/s | -| yaml-cpp | 8.75716Mi/s | +| fkYAML | 60.1886Mi/s | +| libfyaml | 34.9689Mi/s | +| rapidyaml
(with mutable buff) | 19.4415Gi/s | +| rapidyaml
(with immutable buff) | 139.381Mi/s | +| yaml-cpp | 8.8139Mi/s | ### Parsing [citm_catalog.json](https://github.com/fktn-k/fkYAML/blob/develop/tool/benchmark/cases/citm_catalog.json) | Benchmark | processed bytes per second (Release) | | ---------------------------------- | ------------------------------------ | -| fkYAML | 82.9931Mi/s | -| libfyaml | 52.4308Mi/s | -| rapidyaml
(with mutable buff) | 30.339Gi/s | -| rapidyaml
(with immutable buff) | 145.672Mi/s | -| yaml-cpp | 14.238Mi/s | +| fkYAML | 91.1523Mi/s | +| libfyaml | 51.8156Mi/s | +| rapidyaml
(with mutable buff) | 29.7284Gi/s | +| rapidyaml
(with immutable buff) | 140.764Mi/s | +| yaml-cpp | 14.8521Mi/s | ### Parsing [citm_catalog.yml](https://github.com/fktn-k/fkYAML/blob/develop/tool/benchmark/cases/citm_catalog.yml) | Benchmark | processed bytes per second (Release) | | ---------------------------------- | ------------------------------------ | -| fkYAML | 35.152Mi/s | -| libfyaml | 23.0845Mi/s | -| rapidyaml
(with mutable buff) | 31.117Gi/s | -| rapidyaml
(with immutable buff) | 66.3046Mi/s | -| yaml-cpp | 6.11709Mi/s | - -Although [rapidyaml](https://github.com/biojppm/rapidyaml) is about 2x faster with immutable buffer and far faster with mutable buff than fkYAML as it focuses on high performance, fkYAML is in general 50% faster than [libfyaml](https://github.com/pantoniou/libfyaml) and also about 6x faster than [yaml-cpp](https://github.com/jbeder/yaml-cpp). -Note that, since fkYAML deserializes scalars into native booleans or integers during the parsing, the performance could be more faster in some use cases since there is no need for string manipulations. +| fkYAML | 36.0492Mi/s | +| libfyaml | 21.547Mi/s | +| rapidyaml
(with mutable buff) | 22.6904Gi/s | +| rapidyaml
(with immutable buff) | 64.3972Mi/s | +| yaml-cpp | 6.2337Mi/s | + +Although [rapidyaml](https://github.com/biojppm/rapidyaml) is about 2x faster with immutable buffers and far faster with mutable buffers than fkYAML as it focuses on high performance, fkYAML is in general 70% faster than [libfyaml](https://github.com/pantoniou/libfyaml) and also about 6x faster than [yaml-cpp](https://github.com/jbeder/yaml-cpp). +Note that, since fkYAML deserializes scalars into native booleans or integers during the parsing, the performance could be more faster in some use cases since there is no need for string manipulations upon data queries. ## License diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index 5717ed70..20ea8949 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -28,6 +28,23 @@ FK_YAML_DETAIL_NAMESPACE_BEGIN /// @brief Lexical token information struct lexical_token { + lexical_token() = default; + + lexical_token(lexical_token_t t, str_view s) noexcept + : type(t), + str(s) { + } + + lexical_token(lexical_token_t t) noexcept + : type(t) { + } + + lexical_token(const lexical_token&) = default; + lexical_token& operator=(const lexical_token&) = default; + lexical_token(lexical_token&&) = default; + lexical_token& operator=(lexical_token&&) = default; + ~lexical_token() = default; + /// Lexical token type. lexical_token_t type {lexical_token_t::END_OF_BUFFER}; /// Lexical token contents. @@ -62,36 +79,29 @@ class lexical_analyzer { m_last_token_begin_line = m_pos_tracker.get_lines_read(); if (m_cur_itr == m_end_itr) { - return {}; + return {lexical_token_t::END_OF_BUFFER}; } - lexical_token token {}; - token.type = lexical_token_t::PLAIN_SCALAR; - switch (*m_cur_itr) { case '?': if (++m_cur_itr == m_end_itr) { - token.str = str_view {m_token_begin_itr, m_end_itr}; - return token; + return {lexical_token_t::PLAIN_SCALAR, {m_token_begin_itr, 1}}; } if (*m_cur_itr == ' ') { - token.type = lexical_token_t::EXPLICIT_KEY_PREFIX; - return token; + return {lexical_token_t::EXPLICIT_KEY_PREFIX}; } break; case ':': // key separator if (++m_cur_itr == m_end_itr) { - token.type = lexical_token_t::KEY_SEPARATOR; - return token; + return {lexical_token_t::KEY_SEPARATOR}; } switch (*m_cur_itr) { case ' ': case '\t': case '\n': - token.type = lexical_token_t::KEY_SEPARATOR; - return token; + return {lexical_token_t::KEY_SEPARATOR}; case ',': case '[': case ']': @@ -100,8 +110,7 @@ class lexical_analyzer { if (m_state & flow_context_bit) { // Flow indicators are not "safe" to be followed in a flow context. // See https://yaml.org/spec/1.2.2/#733-plain-style for more details. - token.type = lexical_token_t::KEY_SEPARATOR; - return token; + return {lexical_token_t::KEY_SEPARATOR}; } break; default: @@ -110,109 +119,72 @@ class lexical_analyzer { break; case ',': // value separator ++m_cur_itr; - token.type = lexical_token_t::VALUE_SEPARATOR; - return token; - case '&': { // anchor prefix - extract_anchor_name(token); - const bool is_empty = token.str.empty(); - if FK_YAML_UNLIKELY (is_empty) { - emit_error("anchor name must not be empty."); - } - - token.type = lexical_token_t::ANCHOR_PREFIX; - return token; - } - case '*': { // alias prefix - extract_anchor_name(token); - const bool is_empty = token.str.empty(); - if FK_YAML_UNLIKELY (is_empty) { - emit_error("anchor name must not be empty."); - } - - token.type = lexical_token_t::ALIAS_PREFIX; - return token; - } - case '!': - extract_tag_name(token); - token.type = lexical_token_t::TAG_PREFIX; - return token; + return {lexical_token_t::VALUE_SEPARATOR}; + case '&': // anchor prefix + return {lexical_token_t::ANCHOR_PREFIX, extract_anchor_name()}; + case '*': // alias prefix + return {lexical_token_t::ALIAS_PREFIX, extract_anchor_name()}; + case '!': // tag prefix + return {lexical_token_t::TAG_PREFIX, extract_tag_name()}; case '#': // comment prefix scan_comment(); return get_next_token(); case '%': // directive prefix if (m_state & document_directive_bit) { - token.type = scan_directive(); - return token; + return {scan_directive()}; } // The '%' character can be safely used as the first character in document contents. // See https://yaml.org/spec/1.2.2/#912-document-markers for more details. break; - case '-': { - const char next = *(m_cur_itr + 1); - switch (next) { + case '-': + switch (*(m_cur_itr + 1)) { case ' ': case '\t': case '\n': // Move a cursor to the beginning of the next token. m_cur_itr += 2; - token.type = lexical_token_t::SEQUENCE_BLOCK_PREFIX; - return token; + return {lexical_token_t::SEQUENCE_BLOCK_PREFIX}; default: break; } - const bool is_available = ((m_end_itr - m_cur_itr) > 2); - if (is_available) { + if ((m_end_itr - m_cur_itr) > 2) { const bool is_dir_end = std::equal(m_token_begin_itr, m_cur_itr + 3, "---"); if (is_dir_end) { m_cur_itr += 3; - token.type = lexical_token_t::END_OF_DIRECTIVES; - return token; + return {lexical_token_t::END_OF_DIRECTIVES}; } } break; - } case '[': // sequence flow begin ++m_cur_itr; - token.type = lexical_token_t::SEQUENCE_FLOW_BEGIN; - return token; + return {lexical_token_t::SEQUENCE_FLOW_BEGIN}; case ']': // sequence flow end ++m_cur_itr; - token.type = lexical_token_t::SEQUENCE_FLOW_END; - return token; + return {lexical_token_t::SEQUENCE_FLOW_END}; case '{': // mapping flow begin ++m_cur_itr; - token.type = lexical_token_t::MAPPING_FLOW_BEGIN; - return token; + return {lexical_token_t::MAPPING_FLOW_BEGIN}; case '}': // mapping flow end ++m_cur_itr; - token.type = lexical_token_t::MAPPING_FLOW_END; - return token; + return {lexical_token_t::MAPPING_FLOW_END}; case '@': emit_error("Any token cannot start with at(@). It is a reserved indicator for YAML."); case '`': emit_error("Any token cannot start with grave accent(`). It is a reserved indicator for YAML."); case '\"': ++m_token_begin_itr; - token.type = lexical_token_t::DOUBLE_QUOTED_SCALAR; - determine_double_quoted_scalar_range(token.str); - check_scalar_content(token.str); - return token; + return {lexical_token_t::DOUBLE_QUOTED_SCALAR, determine_double_quoted_scalar_range()}; case '\'': ++m_token_begin_itr; - token.type = lexical_token_t::SINGLE_QUOTED_SCALAR; - determine_single_quoted_scalar_range(token.str); - check_scalar_content(token.str); - return token; + return {lexical_token_t::SINGLE_QUOTED_SCALAR, determine_single_quoted_scalar_range()}; case '.': { - const bool is_available = ((m_end_itr - m_cur_itr) > 2); - if (is_available) { + if ((m_end_itr - m_cur_itr) > 2) { const bool is_doc_end = std::equal(m_cur_itr, m_cur_itr + 3, "..."); if (is_doc_end) { m_cur_itr += 3; - token.type = lexical_token_t::END_OF_DOCUMENT; - return token; + return {lexical_token_t::END_OF_DOCUMENT}; } } break; @@ -224,30 +196,23 @@ class lexical_analyzer { FK_YAML_ASSERT(header_end_pos != str_view::npos); const uint32_t base_indent = get_current_indent_level(&sv[header_end_pos]); - if (*m_token_begin_itr == '|') { - token.type = lexical_token_t::BLOCK_LITERAL_SCALAR; - } - else { - token.type = lexical_token_t::BLOCK_FOLDED_SCALAR; - } - + const lexical_token_t type = *m_token_begin_itr == '|' ? lexical_token_t::BLOCK_LITERAL_SCALAR + : lexical_token_t::BLOCK_FOLDED_SCALAR; const str_view header_line = sv.substr(1, header_end_pos - 1); m_block_scalar_header = convert_to_block_scalar_header(header_line); m_token_begin_itr = sv.begin() + (header_end_pos + 1); - m_block_scalar_header.indent = - determine_block_scalar_content_range(base_indent, m_block_scalar_header.indent, token.str); - return token; + return { + type, + determine_block_scalar_content_range( + base_indent, m_block_scalar_header.indent, m_block_scalar_header.indent)}; } default: break; } - token.type = lexical_token_t::PLAIN_SCALAR; - determine_plain_scalar_range(token.str); - check_scalar_content(token.str); - return token; + return {lexical_token_t::PLAIN_SCALAR, determine_plain_scalar_range()}; } /// @brief Get the beginning position of a last token. @@ -595,8 +560,8 @@ class lexical_analyzer { } /// @brief Extracts an anchor name from the input. - /// @param token The token into which the extraction result is written. - void extract_anchor_name(lexical_token& token) { + /// @return The extracted anchor name. + str_view extract_anchor_name() { FK_YAML_ASSERT(*m_cur_itr == '&' || *m_cur_itr == '*'); m_token_begin_itr = ++m_cur_itr; @@ -625,18 +590,21 @@ class lexical_analyzer { } } - token.str = str_view {m_token_begin_itr, m_cur_itr}; + if FK_YAML_UNLIKELY (m_token_begin_itr == m_cur_itr) { + emit_error("anchor name must not be empty."); + } + + return {m_token_begin_itr, m_cur_itr}; } /// @brief Extracts a tag name from the input. - /// @param token The token into which the extraction result is written. - void extract_tag_name(lexical_token& token) { + /// @return A tag name. + str_view extract_tag_name() { FK_YAML_ASSERT(*m_cur_itr == '!'); if (++m_cur_itr == m_end_itr) { // Just "!" is a non-specific tag. - token.str = str_view {m_token_begin_itr, m_end_itr}; - return; + return {m_token_begin_itr, m_end_itr}; } bool is_verbatim = false; @@ -646,8 +614,7 @@ class lexical_analyzer { case ' ': case '\n': // Just "!" is a non-specific tag. - token.str = str_view {m_token_begin_itr, m_cur_itr}; - return; + return {m_token_begin_itr, m_cur_itr}; case '!': // Secondary tag handles (!!suffix) break; @@ -690,16 +657,16 @@ class lexical_analyzer { } } while (!ends_loop); - token.str = str_view {m_token_begin_itr, m_cur_itr}; + str_view tag_name {m_token_begin_itr, m_cur_itr}; if (is_verbatim) { - const char last = token.str.back(); + const char last = tag_name.back(); if FK_YAML_UNLIKELY (last != '>') { emit_error("verbatim tag (!) must be ended with \'>\'."); } // only the `TAG` part of the `!` for URI validation. - const str_view tag_body = token.str.substr(2, token.str.size() - 3); + const str_view tag_body = tag_name.substr(2, tag_name.size() - 3); if FK_YAML_UNLIKELY (tag_body.empty()) { emit_error("verbatim tag(!) must not be empty."); } @@ -709,11 +676,11 @@ class lexical_analyzer { emit_error("invalid URI character is found in a verbatim tag."); } - return; + return tag_name; } if (is_named_handle) { - const char last = token.str.back(); + const char last = tag_name.back(); if FK_YAML_UNLIKELY (last == '!') { // Tag shorthand must be followed by a non-empty suffix. // See the "Tag Shorthands" section in https://yaml.org/spec/1.2.2/#691-node-tags. @@ -723,10 +690,10 @@ class lexical_analyzer { // get the position of last tag prefix character (!) to extract body of tag shorthands. // tag shorthand is either primary(!tag), secondary(!!tag) or named(!handle!tag). - const std::size_t last_tag_prefix_pos = token.str.find_last_of('!'); + const std::size_t last_tag_prefix_pos = tag_name.find_last_of('!'); FK_YAML_ASSERT(last_tag_prefix_pos != str_view::npos); - const str_view tag_uri = token.str.substr(last_tag_prefix_pos + 1); + const str_view tag_uri = tag_name.substr(last_tag_prefix_pos + 1); const bool is_valid_uri = uri_encoding::validate(tag_uri.begin(), tag_uri.end()); if FK_YAML_UNLIKELY (!is_valid_uri) { emit_error("Invalid URI character is found in a named tag handle."); @@ -738,11 +705,13 @@ class lexical_analyzer { if (invalid_char_pos != str_view::npos) { emit_error("Tag shorthand cannot contain flow indicators({}[],)."); } + + return tag_name; } /// @brief Determines the range of single quoted scalar by scanning remaining input buffer contents. - /// @param token Storage for the range of single quoted scalar. - void determine_single_quoted_scalar_range(str_view& token) { + /// @return A single quoted scalar. + str_view determine_single_quoted_scalar_range() { const str_view sv {m_token_begin_itr, m_end_itr}; std::size_t pos = sv.find('\''); @@ -750,9 +719,10 @@ class lexical_analyzer { FK_YAML_ASSERT(pos < sv.size()); if FK_YAML_LIKELY (pos == sv.size() - 1 || sv[pos + 1] != '\'') { // closing single quote is found. - token = {m_token_begin_itr, pos}; - m_cur_itr = sv.begin() + (pos + 1); - return; + m_cur_itr = m_token_begin_itr + (pos + 1); + str_view single_quoted_scalar {m_token_begin_itr, pos}; + check_scalar_content(single_quoted_scalar); + return single_quoted_scalar; } // If single quotation marks are repeated twice in a single quoted scalar, they are considered as an @@ -766,8 +736,8 @@ class lexical_analyzer { } /// @brief Determines the range of double quoted scalar by scanning remaining input buffer contents. - /// @param token Storage for the range of double quoted scalar. - void determine_double_quoted_scalar_range(str_view& token) { + /// @return A double quoted scalar. + str_view determine_double_quoted_scalar_range() { const str_view sv {m_token_begin_itr, m_end_itr}; std::size_t pos = sv.find('\"'); @@ -794,9 +764,10 @@ class lexical_analyzer { if (is_closed) { // closing double quote is found. - token = {m_token_begin_itr, pos}; - m_cur_itr = sv.begin() + (pos + 1); - return; + m_cur_itr = m_token_begin_itr + (pos + 1); + str_view double_quoted_salar {m_token_begin_itr, pos}; + check_scalar_content(double_quoted_salar); + return double_quoted_salar; } pos = sv.find('\"', pos + 1); @@ -807,16 +778,17 @@ class lexical_analyzer { } /// @brief Determines the range of plain scalar by scanning remaining input buffer contents. - /// @param token Storage for the range of plain scalar. - void determine_plain_scalar_range(str_view& token) { + /// @return A plain scalar. + str_view determine_plain_scalar_range() { const str_view sv {m_token_begin_itr, m_end_itr}; - constexpr str_view filter {"\n :{}[],"}; + // flow indicators are checked only within a flow context. + const str_view filter = (m_state & flow_context_bit) ? "\n :{}[]," : "\n :"; std::size_t pos = sv.find_first_of(filter); if FK_YAML_UNLIKELY (pos == str_view::npos) { - token = sv; + check_scalar_content(sv); m_cur_itr = m_end_itr; - return; + return sv; } bool ends_loop = false; @@ -894,7 +866,7 @@ class lexical_analyzer { case ']': case ',': // This check is enabled only in a flow context. - ends_loop = (m_state & flow_context_bit); + ends_loop = true; break; default: // LCOV_EXCL_LINE detail::unreachable(); // LCOV_EXCL_LINE @@ -907,8 +879,10 @@ class lexical_analyzer { pos = sv.find_first_of(filter, pos + 1); } while (pos != str_view::npos); - token = sv.substr(0, pos); - m_cur_itr = token.end(); + str_view plain_scalar = sv.substr(0, pos); + check_scalar_content(plain_scalar); + m_cur_itr = plain_scalar.end(); + return plain_scalar; } /// @brief Scan a block style string token either in the literal or folded style. @@ -916,32 +890,36 @@ class lexical_analyzer { /// @param indicated_indent The indicated indent level in the block scalar header. 0 means it's not indicated. /// @param token Storage for the scanned block scalar range. /// @return The content indentation level of the block scalar. - uint32_t determine_block_scalar_content_range(uint32_t base_indent, uint32_t indicated_indent, str_view& token) { + str_view determine_block_scalar_content_range( + uint32_t base_indent, uint32_t indicated_indent, uint32_t& content_indent) { const str_view sv {m_token_begin_itr, m_end_itr}; + const std::size_t remain_input_len = sv.size(); // Handle leading all-space lines. uint32_t cur_indent = 0; uint32_t max_leading_indent = 0; const char* cur_itr = m_token_begin_itr; - for (bool stop_increment = false; cur_itr != m_end_itr; ++cur_itr) { - const char c = *cur_itr; - if (c == ' ') { - if (!stop_increment) { + bool stop_increment = false; + + while (cur_itr != m_end_itr) { + switch (*cur_itr++) { + case ' ': + if FK_YAML_LIKELY (!stop_increment) { ++cur_indent; } continue; - } - if (c == '\n') { - max_leading_indent = std::max(cur_indent, max_leading_indent); - cur_indent = 0; - stop_increment = false; - continue; - } - if (c == '\t') { + case '\t': // Tabs are not counted as an indent character but still part of an empty line. // See https://yaml.org/spec/1.2.2/#rule-s-indent and https://yaml.org/spec/1.2.2/#64-empty-lines. stop_increment = true; continue; + case '\n': + max_leading_indent = std::max(cur_indent, max_leading_indent); + cur_indent = 0; + stop_increment = false; + continue; + default: + break; } break; } @@ -952,10 +930,11 @@ class lexical_analyzer { // loops from the next loop. (https://github.com/fktn-k/fkYAML/pull/410) m_cur_itr = m_end_itr; - token = sv; // If there's no non-empty line, the content indentation level is equal to the number of spaces on the // longest line. https://yaml.org/spec/1.2.2/#8111-block-indentation-indicator - return indicated_indent == 0 ? std::max(cur_indent, max_leading_indent) : base_indent + indicated_indent; + content_indent = + indicated_indent == 0 ? std::max(cur_indent, max_leading_indent) : base_indent + indicated_indent; + return sv; } // Any leading empty line must not contain more spaces than the first non-empty line. @@ -973,14 +952,14 @@ class lexical_analyzer { std::size_t last_newline_pos = sv.find('\n', cur_itr - m_token_begin_itr + 1); if (last_newline_pos == str_view::npos) { - last_newline_pos = sv.size(); + last_newline_pos = remain_input_len; } - const uint32_t content_indent = base_indent + indicated_indent; - while (last_newline_pos < sv.size()) { + content_indent = base_indent + indicated_indent; + while (last_newline_pos < remain_input_len) { std::size_t cur_line_end_pos = sv.find('\n', last_newline_pos + 1); if (cur_line_end_pos == str_view::npos) { - cur_line_end_pos = sv.size(); + cur_line_end_pos = remain_input_len; } const std::size_t cur_line_content_begin_pos = sv.find_first_not_of(' ', last_newline_pos + 1); @@ -1012,95 +991,93 @@ class lexical_analyzer { } // include last newline character if not all characters have been consumed yet. - if (last_newline_pos < sv.size()) { + if (last_newline_pos < remain_input_len) { ++last_newline_pos; } - token = sv.substr(0, last_newline_pos); - m_cur_itr = token.end(); - - return content_indent; - } - - /// @brief Handle unescaped control characters. - /// @param c A target character. - void handle_unescaped_control_char(char c) const { - FK_YAML_ASSERT(0x00 <= c && c <= 0x1F); - - switch (c) { - // 0x00(NULL) has already been handled above. - case 0x01: - emit_error("Control character U+0001 (SOH) must be escaped to \\u0001."); - case 0x02: - emit_error("Control character U+0002 (STX) must be escaped to \\u0002."); - case 0x03: - emit_error("Control character U+0003 (ETX) must be escaped to \\u0003."); - case 0x04: - emit_error("Control character U+0004 (EOT) must be escaped to \\u0004."); - case 0x05: - emit_error("Control character U+0005 (ENQ) must be escaped to \\u0005."); - case 0x06: - emit_error("Control character U+0006 (ACK) must be escaped to \\u0006."); - case 0x07: - emit_error("Control character U+0007 (BEL) must be escaped to \\a or \\u0007."); - case 0x08: - emit_error("Control character U+0008 (BS) must be escaped to \\b or \\u0008."); - case 0x09: // HT - // horizontal tabs (\t) are safe to use without escaping. - break; - // 0x0A(LF) has already been handled above. - case 0x0B: - emit_error("Control character U+000B (VT) must be escaped to \\v or \\u000B."); - case 0x0C: - emit_error("Control character U+000C (FF) must be escaped to \\f or \\u000C."); - // 0x0D(CR) has already been handled above. - case 0x0E: - emit_error("Control character U+000E (SO) must be escaped to \\u000E."); - case 0x0F: - emit_error("Control character U+000F (SI) must be escaped to \\u000F."); - case 0x10: - emit_error("Control character U+0010 (DLE) must be escaped to \\u0010."); - case 0x11: - emit_error("Control character U+0011 (DC1) must be escaped to \\u0011."); - case 0x12: - emit_error("Control character U+0012 (DC2) must be escaped to \\u0012."); - case 0x13: - emit_error("Control character U+0013 (DC3) must be escaped to \\u0013."); - case 0x14: - emit_error("Control character U+0014 (DC4) must be escaped to \\u0014."); - case 0x15: - emit_error("Control character U+0015 (NAK) must be escaped to \\u0015."); - case 0x16: - emit_error("Control character U+0016 (SYN) must be escaped to \\u0016."); - case 0x17: - emit_error("Control character U+0017 (ETB) must be escaped to \\u0017."); - case 0x18: - emit_error("Control character U+0018 (CAN) must be escaped to \\u0018."); - case 0x19: - emit_error("Control character U+0019 (EM) must be escaped to \\u0019."); - case 0x1A: - emit_error("Control character U+001A (SUB) must be escaped to \\u001A."); - case 0x1B: - emit_error("Control character U+001B (ESC) must be escaped to \\e or \\u001B."); - case 0x1C: - emit_error("Control character U+001C (FS) must be escaped to \\u001C."); - case 0x1D: - emit_error("Control character U+001D (GS) must be escaped to \\u001D."); - case 0x1E: - emit_error("Control character U+001E (RS) must be escaped to \\u001E."); - case 0x1F: - emit_error("Control character U+001F (US) must be escaped to \\u001F."); - default: - break; - } + m_cur_itr = m_token_begin_itr + last_newline_pos; + return sv.substr(0, last_newline_pos); } /// @brief Checks if the given scalar contains no unescaped control characters. /// @param scalar Scalar contents. - void check_scalar_content(str_view scalar) const { - for (auto c : scalar) { - if (0 <= c && c < 0x20) { - handle_unescaped_control_char(c); + void check_scalar_content(const str_view& scalar) const { + const char* p_current = scalar.begin(); + const char* p_end = scalar.end(); + + while (p_current != p_end) { + const uint32_t num_bytes = utf8::get_num_bytes(static_cast(*p_current)); + if (num_bytes > 1) { + // Multibyte characters are already checked in the input_adapter module. + p_current += num_bytes; + continue; + } + + switch (*p_current++) { + // 0x00(NULL) has already been handled above. + case 0x01: + emit_error("Control character U+0001 (SOH) must be escaped to \\u0001."); + case 0x02: + emit_error("Control character U+0002 (STX) must be escaped to \\u0002."); + case 0x03: + emit_error("Control character U+0003 (ETX) must be escaped to \\u0003."); + case 0x04: + emit_error("Control character U+0004 (EOT) must be escaped to \\u0004."); + case 0x05: + emit_error("Control character U+0005 (ENQ) must be escaped to \\u0005."); + case 0x06: + emit_error("Control character U+0006 (ACK) must be escaped to \\u0006."); + case 0x07: + emit_error("Control character U+0007 (BEL) must be escaped to \\a or \\u0007."); + case 0x08: + emit_error("Control character U+0008 (BS) must be escaped to \\b or \\u0008."); + case 0x09: // HT + // horizontal tabs (\t) are safe to use without escaping. + break; + // 0x0A(LF) has already been handled above. + case 0x0B: + emit_error("Control character U+000B (VT) must be escaped to \\v or \\u000B."); + case 0x0C: + emit_error("Control character U+000C (FF) must be escaped to \\f or \\u000C."); + // 0x0D(CR) has already been handled above. + case 0x0E: + emit_error("Control character U+000E (SO) must be escaped to \\u000E."); + case 0x0F: + emit_error("Control character U+000F (SI) must be escaped to \\u000F."); + case 0x10: + emit_error("Control character U+0010 (DLE) must be escaped to \\u0010."); + case 0x11: + emit_error("Control character U+0011 (DC1) must be escaped to \\u0011."); + case 0x12: + emit_error("Control character U+0012 (DC2) must be escaped to \\u0012."); + case 0x13: + emit_error("Control character U+0013 (DC3) must be escaped to \\u0013."); + case 0x14: + emit_error("Control character U+0014 (DC4) must be escaped to \\u0014."); + case 0x15: + emit_error("Control character U+0015 (NAK) must be escaped to \\u0015."); + case 0x16: + emit_error("Control character U+0016 (SYN) must be escaped to \\u0016."); + case 0x17: + emit_error("Control character U+0017 (ETB) must be escaped to \\u0017."); + case 0x18: + emit_error("Control character U+0018 (CAN) must be escaped to \\u0018."); + case 0x19: + emit_error("Control character U+0019 (EM) must be escaped to \\u0019."); + case 0x1A: + emit_error("Control character U+001A (SUB) must be escaped to \\u001A."); + case 0x1B: + emit_error("Control character U+001B (ESC) must be escaped to \\e or \\u001B."); + case 0x1C: + emit_error("Control character U+001C (FS) must be escaped to \\u001C."); + case 0x1D: + emit_error("Control character U+001D (GS) must be escaped to \\u001D."); + case 0x1E: + emit_error("Control character U+001E (RS) must be escaped to \\u001E."); + case 0x1F: + emit_error("Control character U+001F (US) must be escaped to \\u001F."); + default: + break; } } } diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 3f38c26e..f923607c 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -3227,6 +3227,23 @@ FK_YAML_DETAIL_NAMESPACE_BEGIN /// @brief Lexical token information struct lexical_token { + lexical_token() = default; + + lexical_token(lexical_token_t t, str_view s) noexcept + : type(t), + str(s) { + } + + lexical_token(lexical_token_t t) noexcept + : type(t) { + } + + lexical_token(const lexical_token&) = default; + lexical_token& operator=(const lexical_token&) = default; + lexical_token(lexical_token&&) = default; + lexical_token& operator=(lexical_token&&) = default; + ~lexical_token() = default; + /// Lexical token type. lexical_token_t type {lexical_token_t::END_OF_BUFFER}; /// Lexical token contents. @@ -3261,36 +3278,29 @@ class lexical_analyzer { m_last_token_begin_line = m_pos_tracker.get_lines_read(); if (m_cur_itr == m_end_itr) { - return {}; + return {lexical_token_t::END_OF_BUFFER}; } - lexical_token token {}; - token.type = lexical_token_t::PLAIN_SCALAR; - switch (*m_cur_itr) { case '?': if (++m_cur_itr == m_end_itr) { - token.str = str_view {m_token_begin_itr, m_end_itr}; - return token; + return {lexical_token_t::PLAIN_SCALAR, {m_token_begin_itr, 1}}; } if (*m_cur_itr == ' ') { - token.type = lexical_token_t::EXPLICIT_KEY_PREFIX; - return token; + return {lexical_token_t::EXPLICIT_KEY_PREFIX}; } break; case ':': // key separator if (++m_cur_itr == m_end_itr) { - token.type = lexical_token_t::KEY_SEPARATOR; - return token; + return {lexical_token_t::KEY_SEPARATOR}; } switch (*m_cur_itr) { case ' ': case '\t': case '\n': - token.type = lexical_token_t::KEY_SEPARATOR; - return token; + return {lexical_token_t::KEY_SEPARATOR}; case ',': case '[': case ']': @@ -3299,8 +3309,7 @@ class lexical_analyzer { if (m_state & flow_context_bit) { // Flow indicators are not "safe" to be followed in a flow context. // See https://yaml.org/spec/1.2.2/#733-plain-style for more details. - token.type = lexical_token_t::KEY_SEPARATOR; - return token; + return {lexical_token_t::KEY_SEPARATOR}; } break; default: @@ -3309,109 +3318,72 @@ class lexical_analyzer { break; case ',': // value separator ++m_cur_itr; - token.type = lexical_token_t::VALUE_SEPARATOR; - return token; - case '&': { // anchor prefix - extract_anchor_name(token); - const bool is_empty = token.str.empty(); - if FK_YAML_UNLIKELY (is_empty) { - emit_error("anchor name must not be empty."); - } - - token.type = lexical_token_t::ANCHOR_PREFIX; - return token; - } - case '*': { // alias prefix - extract_anchor_name(token); - const bool is_empty = token.str.empty(); - if FK_YAML_UNLIKELY (is_empty) { - emit_error("anchor name must not be empty."); - } - - token.type = lexical_token_t::ALIAS_PREFIX; - return token; - } - case '!': - extract_tag_name(token); - token.type = lexical_token_t::TAG_PREFIX; - return token; + return {lexical_token_t::VALUE_SEPARATOR}; + case '&': // anchor prefix + return {lexical_token_t::ANCHOR_PREFIX, extract_anchor_name()}; + case '*': // alias prefix + return {lexical_token_t::ALIAS_PREFIX, extract_anchor_name()}; + case '!': // tag prefix + return {lexical_token_t::TAG_PREFIX, extract_tag_name()}; case '#': // comment prefix scan_comment(); return get_next_token(); case '%': // directive prefix if (m_state & document_directive_bit) { - token.type = scan_directive(); - return token; + return {scan_directive()}; } // The '%' character can be safely used as the first character in document contents. // See https://yaml.org/spec/1.2.2/#912-document-markers for more details. break; - case '-': { - const char next = *(m_cur_itr + 1); - switch (next) { + case '-': + switch (*(m_cur_itr + 1)) { case ' ': case '\t': case '\n': // Move a cursor to the beginning of the next token. m_cur_itr += 2; - token.type = lexical_token_t::SEQUENCE_BLOCK_PREFIX; - return token; + return {lexical_token_t::SEQUENCE_BLOCK_PREFIX}; default: break; } - const bool is_available = ((m_end_itr - m_cur_itr) > 2); - if (is_available) { + if ((m_end_itr - m_cur_itr) > 2) { const bool is_dir_end = std::equal(m_token_begin_itr, m_cur_itr + 3, "---"); if (is_dir_end) { m_cur_itr += 3; - token.type = lexical_token_t::END_OF_DIRECTIVES; - return token; + return {lexical_token_t::END_OF_DIRECTIVES}; } } break; - } case '[': // sequence flow begin ++m_cur_itr; - token.type = lexical_token_t::SEQUENCE_FLOW_BEGIN; - return token; + return {lexical_token_t::SEQUENCE_FLOW_BEGIN}; case ']': // sequence flow end ++m_cur_itr; - token.type = lexical_token_t::SEQUENCE_FLOW_END; - return token; + return {lexical_token_t::SEQUENCE_FLOW_END}; case '{': // mapping flow begin ++m_cur_itr; - token.type = lexical_token_t::MAPPING_FLOW_BEGIN; - return token; + return {lexical_token_t::MAPPING_FLOW_BEGIN}; case '}': // mapping flow end ++m_cur_itr; - token.type = lexical_token_t::MAPPING_FLOW_END; - return token; + return {lexical_token_t::MAPPING_FLOW_END}; case '@': emit_error("Any token cannot start with at(@). It is a reserved indicator for YAML."); case '`': emit_error("Any token cannot start with grave accent(`). It is a reserved indicator for YAML."); case '\"': ++m_token_begin_itr; - token.type = lexical_token_t::DOUBLE_QUOTED_SCALAR; - determine_double_quoted_scalar_range(token.str); - check_scalar_content(token.str); - return token; + return {lexical_token_t::DOUBLE_QUOTED_SCALAR, determine_double_quoted_scalar_range()}; case '\'': ++m_token_begin_itr; - token.type = lexical_token_t::SINGLE_QUOTED_SCALAR; - determine_single_quoted_scalar_range(token.str); - check_scalar_content(token.str); - return token; + return {lexical_token_t::SINGLE_QUOTED_SCALAR, determine_single_quoted_scalar_range()}; case '.': { - const bool is_available = ((m_end_itr - m_cur_itr) > 2); - if (is_available) { + if ((m_end_itr - m_cur_itr) > 2) { const bool is_doc_end = std::equal(m_cur_itr, m_cur_itr + 3, "..."); if (is_doc_end) { m_cur_itr += 3; - token.type = lexical_token_t::END_OF_DOCUMENT; - return token; + return {lexical_token_t::END_OF_DOCUMENT}; } } break; @@ -3423,30 +3395,23 @@ class lexical_analyzer { FK_YAML_ASSERT(header_end_pos != str_view::npos); const uint32_t base_indent = get_current_indent_level(&sv[header_end_pos]); - if (*m_token_begin_itr == '|') { - token.type = lexical_token_t::BLOCK_LITERAL_SCALAR; - } - else { - token.type = lexical_token_t::BLOCK_FOLDED_SCALAR; - } - + const lexical_token_t type = *m_token_begin_itr == '|' ? lexical_token_t::BLOCK_LITERAL_SCALAR + : lexical_token_t::BLOCK_FOLDED_SCALAR; const str_view header_line = sv.substr(1, header_end_pos - 1); m_block_scalar_header = convert_to_block_scalar_header(header_line); m_token_begin_itr = sv.begin() + (header_end_pos + 1); - m_block_scalar_header.indent = - determine_block_scalar_content_range(base_indent, m_block_scalar_header.indent, token.str); - return token; + return { + type, + determine_block_scalar_content_range( + base_indent, m_block_scalar_header.indent, m_block_scalar_header.indent)}; } default: break; } - token.type = lexical_token_t::PLAIN_SCALAR; - determine_plain_scalar_range(token.str); - check_scalar_content(token.str); - return token; + return {lexical_token_t::PLAIN_SCALAR, determine_plain_scalar_range()}; } /// @brief Get the beginning position of a last token. @@ -3794,8 +3759,8 @@ class lexical_analyzer { } /// @brief Extracts an anchor name from the input. - /// @param token The token into which the extraction result is written. - void extract_anchor_name(lexical_token& token) { + /// @return The extracted anchor name. + str_view extract_anchor_name() { FK_YAML_ASSERT(*m_cur_itr == '&' || *m_cur_itr == '*'); m_token_begin_itr = ++m_cur_itr; @@ -3824,18 +3789,21 @@ class lexical_analyzer { } } - token.str = str_view {m_token_begin_itr, m_cur_itr}; + if FK_YAML_UNLIKELY (m_token_begin_itr == m_cur_itr) { + emit_error("anchor name must not be empty."); + } + + return {m_token_begin_itr, m_cur_itr}; } /// @brief Extracts a tag name from the input. - /// @param token The token into which the extraction result is written. - void extract_tag_name(lexical_token& token) { + /// @return A tag name. + str_view extract_tag_name() { FK_YAML_ASSERT(*m_cur_itr == '!'); if (++m_cur_itr == m_end_itr) { // Just "!" is a non-specific tag. - token.str = str_view {m_token_begin_itr, m_end_itr}; - return; + return {m_token_begin_itr, m_end_itr}; } bool is_verbatim = false; @@ -3845,8 +3813,7 @@ class lexical_analyzer { case ' ': case '\n': // Just "!" is a non-specific tag. - token.str = str_view {m_token_begin_itr, m_cur_itr}; - return; + return {m_token_begin_itr, m_cur_itr}; case '!': // Secondary tag handles (!!suffix) break; @@ -3889,16 +3856,16 @@ class lexical_analyzer { } } while (!ends_loop); - token.str = str_view {m_token_begin_itr, m_cur_itr}; + str_view tag_name {m_token_begin_itr, m_cur_itr}; if (is_verbatim) { - const char last = token.str.back(); + const char last = tag_name.back(); if FK_YAML_UNLIKELY (last != '>') { emit_error("verbatim tag (!) must be ended with \'>\'."); } // only the `TAG` part of the `!` for URI validation. - const str_view tag_body = token.str.substr(2, token.str.size() - 3); + const str_view tag_body = tag_name.substr(2, tag_name.size() - 3); if FK_YAML_UNLIKELY (tag_body.empty()) { emit_error("verbatim tag(!) must not be empty."); } @@ -3908,11 +3875,11 @@ class lexical_analyzer { emit_error("invalid URI character is found in a verbatim tag."); } - return; + return tag_name; } if (is_named_handle) { - const char last = token.str.back(); + const char last = tag_name.back(); if FK_YAML_UNLIKELY (last == '!') { // Tag shorthand must be followed by a non-empty suffix. // See the "Tag Shorthands" section in https://yaml.org/spec/1.2.2/#691-node-tags. @@ -3922,10 +3889,10 @@ class lexical_analyzer { // get the position of last tag prefix character (!) to extract body of tag shorthands. // tag shorthand is either primary(!tag), secondary(!!tag) or named(!handle!tag). - const std::size_t last_tag_prefix_pos = token.str.find_last_of('!'); + const std::size_t last_tag_prefix_pos = tag_name.find_last_of('!'); FK_YAML_ASSERT(last_tag_prefix_pos != str_view::npos); - const str_view tag_uri = token.str.substr(last_tag_prefix_pos + 1); + const str_view tag_uri = tag_name.substr(last_tag_prefix_pos + 1); const bool is_valid_uri = uri_encoding::validate(tag_uri.begin(), tag_uri.end()); if FK_YAML_UNLIKELY (!is_valid_uri) { emit_error("Invalid URI character is found in a named tag handle."); @@ -3937,11 +3904,13 @@ class lexical_analyzer { if (invalid_char_pos != str_view::npos) { emit_error("Tag shorthand cannot contain flow indicators({}[],)."); } + + return tag_name; } /// @brief Determines the range of single quoted scalar by scanning remaining input buffer contents. - /// @param token Storage for the range of single quoted scalar. - void determine_single_quoted_scalar_range(str_view& token) { + /// @return A single quoted scalar. + str_view determine_single_quoted_scalar_range() { const str_view sv {m_token_begin_itr, m_end_itr}; std::size_t pos = sv.find('\''); @@ -3949,9 +3918,10 @@ class lexical_analyzer { FK_YAML_ASSERT(pos < sv.size()); if FK_YAML_LIKELY (pos == sv.size() - 1 || sv[pos + 1] != '\'') { // closing single quote is found. - token = {m_token_begin_itr, pos}; - m_cur_itr = sv.begin() + (pos + 1); - return; + m_cur_itr = m_token_begin_itr + (pos + 1); + str_view single_quoted_scalar {m_token_begin_itr, pos}; + check_scalar_content(single_quoted_scalar); + return single_quoted_scalar; } // If single quotation marks are repeated twice in a single quoted scalar, they are considered as an @@ -3965,8 +3935,8 @@ class lexical_analyzer { } /// @brief Determines the range of double quoted scalar by scanning remaining input buffer contents. - /// @param token Storage for the range of double quoted scalar. - void determine_double_quoted_scalar_range(str_view& token) { + /// @return A double quoted scalar. + str_view determine_double_quoted_scalar_range() { const str_view sv {m_token_begin_itr, m_end_itr}; std::size_t pos = sv.find('\"'); @@ -3993,9 +3963,10 @@ class lexical_analyzer { if (is_closed) { // closing double quote is found. - token = {m_token_begin_itr, pos}; - m_cur_itr = sv.begin() + (pos + 1); - return; + m_cur_itr = m_token_begin_itr + (pos + 1); + str_view double_quoted_salar {m_token_begin_itr, pos}; + check_scalar_content(double_quoted_salar); + return double_quoted_salar; } pos = sv.find('\"', pos + 1); @@ -4006,16 +3977,17 @@ class lexical_analyzer { } /// @brief Determines the range of plain scalar by scanning remaining input buffer contents. - /// @param token Storage for the range of plain scalar. - void determine_plain_scalar_range(str_view& token) { + /// @return A plain scalar. + str_view determine_plain_scalar_range() { const str_view sv {m_token_begin_itr, m_end_itr}; - constexpr str_view filter {"\n :{}[],"}; + // flow indicators are checked only within a flow context. + const str_view filter = (m_state & flow_context_bit) ? "\n :{}[]," : "\n :"; std::size_t pos = sv.find_first_of(filter); if FK_YAML_UNLIKELY (pos == str_view::npos) { - token = sv; + check_scalar_content(sv); m_cur_itr = m_end_itr; - return; + return sv; } bool ends_loop = false; @@ -4093,7 +4065,7 @@ class lexical_analyzer { case ']': case ',': // This check is enabled only in a flow context. - ends_loop = (m_state & flow_context_bit); + ends_loop = true; break; default: // LCOV_EXCL_LINE detail::unreachable(); // LCOV_EXCL_LINE @@ -4106,8 +4078,10 @@ class lexical_analyzer { pos = sv.find_first_of(filter, pos + 1); } while (pos != str_view::npos); - token = sv.substr(0, pos); - m_cur_itr = token.end(); + str_view plain_scalar = sv.substr(0, pos); + check_scalar_content(plain_scalar); + m_cur_itr = plain_scalar.end(); + return plain_scalar; } /// @brief Scan a block style string token either in the literal or folded style. @@ -4115,32 +4089,36 @@ class lexical_analyzer { /// @param indicated_indent The indicated indent level in the block scalar header. 0 means it's not indicated. /// @param token Storage for the scanned block scalar range. /// @return The content indentation level of the block scalar. - uint32_t determine_block_scalar_content_range(uint32_t base_indent, uint32_t indicated_indent, str_view& token) { + str_view determine_block_scalar_content_range( + uint32_t base_indent, uint32_t indicated_indent, uint32_t& content_indent) { const str_view sv {m_token_begin_itr, m_end_itr}; + const std::size_t remain_input_len = sv.size(); // Handle leading all-space lines. uint32_t cur_indent = 0; uint32_t max_leading_indent = 0; const char* cur_itr = m_token_begin_itr; - for (bool stop_increment = false; cur_itr != m_end_itr; ++cur_itr) { - const char c = *cur_itr; - if (c == ' ') { - if (!stop_increment) { + bool stop_increment = false; + + while (cur_itr != m_end_itr) { + switch (*cur_itr++) { + case ' ': + if FK_YAML_LIKELY (!stop_increment) { ++cur_indent; } continue; - } - if (c == '\n') { - max_leading_indent = std::max(cur_indent, max_leading_indent); - cur_indent = 0; - stop_increment = false; - continue; - } - if (c == '\t') { + case '\t': // Tabs are not counted as an indent character but still part of an empty line. // See https://yaml.org/spec/1.2.2/#rule-s-indent and https://yaml.org/spec/1.2.2/#64-empty-lines. stop_increment = true; continue; + case '\n': + max_leading_indent = std::max(cur_indent, max_leading_indent); + cur_indent = 0; + stop_increment = false; + continue; + default: + break; } break; } @@ -4151,10 +4129,11 @@ class lexical_analyzer { // loops from the next loop. (https://github.com/fktn-k/fkYAML/pull/410) m_cur_itr = m_end_itr; - token = sv; // If there's no non-empty line, the content indentation level is equal to the number of spaces on the // longest line. https://yaml.org/spec/1.2.2/#8111-block-indentation-indicator - return indicated_indent == 0 ? std::max(cur_indent, max_leading_indent) : base_indent + indicated_indent; + content_indent = + indicated_indent == 0 ? std::max(cur_indent, max_leading_indent) : base_indent + indicated_indent; + return sv; } // Any leading empty line must not contain more spaces than the first non-empty line. @@ -4172,14 +4151,14 @@ class lexical_analyzer { std::size_t last_newline_pos = sv.find('\n', cur_itr - m_token_begin_itr + 1); if (last_newline_pos == str_view::npos) { - last_newline_pos = sv.size(); + last_newline_pos = remain_input_len; } - const uint32_t content_indent = base_indent + indicated_indent; - while (last_newline_pos < sv.size()) { + content_indent = base_indent + indicated_indent; + while (last_newline_pos < remain_input_len) { std::size_t cur_line_end_pos = sv.find('\n', last_newline_pos + 1); if (cur_line_end_pos == str_view::npos) { - cur_line_end_pos = sv.size(); + cur_line_end_pos = remain_input_len; } const std::size_t cur_line_content_begin_pos = sv.find_first_not_of(' ', last_newline_pos + 1); @@ -4211,95 +4190,93 @@ class lexical_analyzer { } // include last newline character if not all characters have been consumed yet. - if (last_newline_pos < sv.size()) { + if (last_newline_pos < remain_input_len) { ++last_newline_pos; } - token = sv.substr(0, last_newline_pos); - m_cur_itr = token.end(); - - return content_indent; - } - - /// @brief Handle unescaped control characters. - /// @param c A target character. - void handle_unescaped_control_char(char c) const { - FK_YAML_ASSERT(0x00 <= c && c <= 0x1F); - - switch (c) { - // 0x00(NULL) has already been handled above. - case 0x01: - emit_error("Control character U+0001 (SOH) must be escaped to \\u0001."); - case 0x02: - emit_error("Control character U+0002 (STX) must be escaped to \\u0002."); - case 0x03: - emit_error("Control character U+0003 (ETX) must be escaped to \\u0003."); - case 0x04: - emit_error("Control character U+0004 (EOT) must be escaped to \\u0004."); - case 0x05: - emit_error("Control character U+0005 (ENQ) must be escaped to \\u0005."); - case 0x06: - emit_error("Control character U+0006 (ACK) must be escaped to \\u0006."); - case 0x07: - emit_error("Control character U+0007 (BEL) must be escaped to \\a or \\u0007."); - case 0x08: - emit_error("Control character U+0008 (BS) must be escaped to \\b or \\u0008."); - case 0x09: // HT - // horizontal tabs (\t) are safe to use without escaping. - break; - // 0x0A(LF) has already been handled above. - case 0x0B: - emit_error("Control character U+000B (VT) must be escaped to \\v or \\u000B."); - case 0x0C: - emit_error("Control character U+000C (FF) must be escaped to \\f or \\u000C."); - // 0x0D(CR) has already been handled above. - case 0x0E: - emit_error("Control character U+000E (SO) must be escaped to \\u000E."); - case 0x0F: - emit_error("Control character U+000F (SI) must be escaped to \\u000F."); - case 0x10: - emit_error("Control character U+0010 (DLE) must be escaped to \\u0010."); - case 0x11: - emit_error("Control character U+0011 (DC1) must be escaped to \\u0011."); - case 0x12: - emit_error("Control character U+0012 (DC2) must be escaped to \\u0012."); - case 0x13: - emit_error("Control character U+0013 (DC3) must be escaped to \\u0013."); - case 0x14: - emit_error("Control character U+0014 (DC4) must be escaped to \\u0014."); - case 0x15: - emit_error("Control character U+0015 (NAK) must be escaped to \\u0015."); - case 0x16: - emit_error("Control character U+0016 (SYN) must be escaped to \\u0016."); - case 0x17: - emit_error("Control character U+0017 (ETB) must be escaped to \\u0017."); - case 0x18: - emit_error("Control character U+0018 (CAN) must be escaped to \\u0018."); - case 0x19: - emit_error("Control character U+0019 (EM) must be escaped to \\u0019."); - case 0x1A: - emit_error("Control character U+001A (SUB) must be escaped to \\u001A."); - case 0x1B: - emit_error("Control character U+001B (ESC) must be escaped to \\e or \\u001B."); - case 0x1C: - emit_error("Control character U+001C (FS) must be escaped to \\u001C."); - case 0x1D: - emit_error("Control character U+001D (GS) must be escaped to \\u001D."); - case 0x1E: - emit_error("Control character U+001E (RS) must be escaped to \\u001E."); - case 0x1F: - emit_error("Control character U+001F (US) must be escaped to \\u001F."); - default: - break; - } + m_cur_itr = m_token_begin_itr + last_newline_pos; + return sv.substr(0, last_newline_pos); } /// @brief Checks if the given scalar contains no unescaped control characters. /// @param scalar Scalar contents. - void check_scalar_content(str_view scalar) const { - for (auto c : scalar) { - if (0 <= c && c < 0x20) { - handle_unescaped_control_char(c); + void check_scalar_content(const str_view& scalar) const { + const char* p_current = scalar.begin(); + const char* p_end = scalar.end(); + + while (p_current != p_end) { + const uint32_t num_bytes = utf8::get_num_bytes(static_cast(*p_current)); + if (num_bytes > 1) { + // Multibyte characters are already checked in the input_adapter module. + p_current += num_bytes; + continue; + } + + switch (*p_current++) { + // 0x00(NULL) has already been handled above. + case 0x01: + emit_error("Control character U+0001 (SOH) must be escaped to \\u0001."); + case 0x02: + emit_error("Control character U+0002 (STX) must be escaped to \\u0002."); + case 0x03: + emit_error("Control character U+0003 (ETX) must be escaped to \\u0003."); + case 0x04: + emit_error("Control character U+0004 (EOT) must be escaped to \\u0004."); + case 0x05: + emit_error("Control character U+0005 (ENQ) must be escaped to \\u0005."); + case 0x06: + emit_error("Control character U+0006 (ACK) must be escaped to \\u0006."); + case 0x07: + emit_error("Control character U+0007 (BEL) must be escaped to \\a or \\u0007."); + case 0x08: + emit_error("Control character U+0008 (BS) must be escaped to \\b or \\u0008."); + case 0x09: // HT + // horizontal tabs (\t) are safe to use without escaping. + break; + // 0x0A(LF) has already been handled above. + case 0x0B: + emit_error("Control character U+000B (VT) must be escaped to \\v or \\u000B."); + case 0x0C: + emit_error("Control character U+000C (FF) must be escaped to \\f or \\u000C."); + // 0x0D(CR) has already been handled above. + case 0x0E: + emit_error("Control character U+000E (SO) must be escaped to \\u000E."); + case 0x0F: + emit_error("Control character U+000F (SI) must be escaped to \\u000F."); + case 0x10: + emit_error("Control character U+0010 (DLE) must be escaped to \\u0010."); + case 0x11: + emit_error("Control character U+0011 (DC1) must be escaped to \\u0011."); + case 0x12: + emit_error("Control character U+0012 (DC2) must be escaped to \\u0012."); + case 0x13: + emit_error("Control character U+0013 (DC3) must be escaped to \\u0013."); + case 0x14: + emit_error("Control character U+0014 (DC4) must be escaped to \\u0014."); + case 0x15: + emit_error("Control character U+0015 (NAK) must be escaped to \\u0015."); + case 0x16: + emit_error("Control character U+0016 (SYN) must be escaped to \\u0016."); + case 0x17: + emit_error("Control character U+0017 (ETB) must be escaped to \\u0017."); + case 0x18: + emit_error("Control character U+0018 (CAN) must be escaped to \\u0018."); + case 0x19: + emit_error("Control character U+0019 (EM) must be escaped to \\u0019."); + case 0x1A: + emit_error("Control character U+001A (SUB) must be escaped to \\u001A."); + case 0x1B: + emit_error("Control character U+001B (ESC) must be escaped to \\e or \\u001B."); + case 0x1C: + emit_error("Control character U+001C (FS) must be escaped to \\u001C."); + case 0x1D: + emit_error("Control character U+001D (GS) must be escaped to \\u001D."); + case 0x1E: + emit_error("Control character U+001E (RS) must be escaped to \\u001E."); + case 0x1F: + emit_error("Control character U+001F (US) must be escaped to \\u001F."); + default: + break; } } } diff --git a/tool/benchmark/results/result_debug_citm_catalog_json.txt b/tool/benchmark/results/result_debug_citm_catalog_json.txt index 6f6f7341..d04b8699 100644 --- a/tool/benchmark/results/result_debug_citm_catalog_json.txt +++ b/tool/benchmark/results/result_debug_citm_catalog_json.txt @@ -1,4 +1,4 @@ -2024-10-13T02:04:56+09:00 +2024-12-22T01:28:01+09:00 Running ./build_bm_debug/tool/benchmark/benchmarker Run on (16 X 3193.88 MHz CPU s) CPU Caches: @@ -6,13 +6,13 @@ CPU Caches: L1 Instruction 32 KiB (x8) L2 Unified 512 KiB (x8) L3 Unified 16384 KiB (x1) -Load Average: 0.16, 0.30, 0.40 +Load Average: 1.00, 0.39, 0.14 ***WARNING*** Library was built as DEBUG. Timings may be affected. ------------------------------------------------------------------------------------- Benchmark Time CPU Iterations UserCounters... ------------------------------------------------------------------------------------- -bm_fkyaml_parse 23349021 ns 23347957 ns 30 bytes_per_second=70.5496Mi/s items_per_second=42.8303/s -bm_yamlcpp_parse 831355289 ns 831372800 ns 1 bytes_per_second=1.98129Mi/s items_per_second=1.20283/s -bm_libfyaml_parse 119048859 ns 119053880 ns 5 bytes_per_second=13.8357Mi/s items_per_second=8.39956/s -bm_rapidyaml_parse_inplace 65126 ns 65125 ns 8378 bytes_per_second=24.7001Gi/s items_per_second=15.3552k/s -bm_rapidyaml_parse_arena 44036503 ns 44038113 ns 16 bytes_per_second=37.4037Mi/s items_per_second=22.7076/s +bm_fkyaml_parse 20140087 ns 20219603 ns 36 bytes_per_second=81.465Mi/s items_per_second=49.457/s +bm_yamlcpp_parse 824976395 ns 827427500 ns 1 bytes_per_second=1.99074Mi/s items_per_second=1.20857/s +bm_libfyaml_parse 119860560 ns 120087717 ns 6 bytes_per_second=13.7166Mi/s items_per_second=8.32725/s +bm_rapidyaml_parse_inplace 52605 ns 52662 ns 13548 bytes_per_second=30.5454Gi/s items_per_second=18.989k/s +bm_rapidyaml_parse_arena 41897531 ns 41887041 ns 17 bytes_per_second=39.3246Mi/s items_per_second=23.8737/s diff --git a/tool/benchmark/results/result_debug_citm_catalog_yml.txt b/tool/benchmark/results/result_debug_citm_catalog_yml.txt index 759f795e..281ed073 100644 --- a/tool/benchmark/results/result_debug_citm_catalog_yml.txt +++ b/tool/benchmark/results/result_debug_citm_catalog_yml.txt @@ -1,4 +1,4 @@ -2024-10-13T02:05:01+09:00 +2024-12-22T01:28:06+09:00 Running ./build_bm_debug/tool/benchmark/benchmarker Run on (16 X 3193.88 MHz CPU s) CPU Caches: @@ -6,13 +6,13 @@ CPU Caches: L1 Instruction 32 KiB (x8) L2 Unified 512 KiB (x8) L3 Unified 16384 KiB (x1) -Load Average: 0.23, 0.31, 0.40 +Load Average: 1.00, 0.40, 0.14 ***WARNING*** Library was built as DEBUG. Timings may be affected. ------------------------------------------------------------------------------------- Benchmark Time CPU Iterations UserCounters... ------------------------------------------------------------------------------------- -bm_fkyaml_parse 22455707 ns 22457000 ns 30 bytes_per_second=30.4668Mi/s items_per_second=44.5295/s -bm_yamlcpp_parse 848988826 ns 848900400 ns 1 bytes_per_second=825.32Ki/s items_per_second=1.17799/s -bm_libfyaml_parse 112468150 ns 112466929 ns 7 bytes_per_second=6.08351Mi/s items_per_second=8.8915/s -bm_rapidyaml_parse_inplace 20576 ns 20574 ns 34118 bytes_per_second=32.4757Gi/s items_per_second=48.6049k/s -bm_rapidyaml_parse_arena 35946283 ns 35944910 ns 20 bytes_per_second=19.0345Mi/s items_per_second=27.8204/s +bm_fkyaml_parse 20816812 ns 20751359 ns 34 bytes_per_second=32.971Mi/s items_per_second=48.1896/s +bm_yamlcpp_parse 849217073 ns 847757700 ns 1 bytes_per_second=826.432Ki/s items_per_second=1.17958/s +bm_libfyaml_parse 112104197 ns 111836333 ns 6 bytes_per_second=6.11781Mi/s items_per_second=8.94164/s +bm_rapidyaml_parse_inplace 21570 ns 21506 ns 33456 bytes_per_second=31.0691Gi/s items_per_second=46.4996k/s +bm_rapidyaml_parse_arena 37021323 ns 36891053 ns 19 bytes_per_second=18.5463Mi/s items_per_second=27.1068/s diff --git a/tool/benchmark/results/result_debug_ubuntu_yml.txt b/tool/benchmark/results/result_debug_ubuntu_yml.txt index edf8686e..8ac3cd2a 100644 --- a/tool/benchmark/results/result_debug_ubuntu_yml.txt +++ b/tool/benchmark/results/result_debug_ubuntu_yml.txt @@ -1,4 +1,4 @@ -2024-10-13T02:04:52+09:00 +2024-12-22T01:27:57+09:00 Running ./build_bm_debug/tool/benchmark/benchmarker Run on (16 X 3193.88 MHz CPU s) CPU Caches: @@ -6,13 +6,13 @@ CPU Caches: L1 Instruction 32 KiB (x8) L2 Unified 512 KiB (x8) L3 Unified 16384 KiB (x1) -Load Average: 0.09, 0.28, 0.40 +Load Average: 1.00, 0.38, 0.13 ***WARNING*** Library was built as DEBUG. Timings may be affected. ------------------------------------------------------------------------------------- Benchmark Time CPU Iterations UserCounters... ------------------------------------------------------------------------------------- -bm_fkyaml_parse 165697 ns 165705 ns 4219 bytes_per_second=50.744Mi/s items_per_second=6.03481k/s -bm_yamlcpp_parse 7938718 ns 7939041 ns 88 bytes_per_second=1.05914Mi/s items_per_second=125.96/s -bm_libfyaml_parse 1025815 ns 1025825 ns 680 bytes_per_second=8.19686Mi/s items_per_second=974.825/s -bm_rapidyaml_parse_inplace 959 ns 959 ns 717671 bytes_per_second=8.56577Gi/s items_per_second=1.04315M/s -bm_rapidyaml_parse_arena 289903 ns 289915 ns 2444 bytes_per_second=29.0035Mi/s items_per_second=3.44929k/s +bm_fkyaml_parse 153251 ns 154543 ns 4429 bytes_per_second=54.4092Mi/s items_per_second=6.4707k/s +bm_yamlcpp_parse 8297369 ns 8354844 ns 84 bytes_per_second=1.00643Mi/s items_per_second=119.691/s +bm_libfyaml_parse 1056772 ns 1065795 ns 661 bytes_per_second=7.88946Mi/s items_per_second=938.266/s +bm_rapidyaml_parse_inplace 975 ns 982 ns 706183 bytes_per_second=8.36368Gi/s items_per_second=1.01854M/s +bm_rapidyaml_parse_arena 293219 ns 294795 ns 2331 bytes_per_second=28.5234Mi/s items_per_second=3.39219k/s diff --git a/tool/benchmark/results/result_release_citm_catalog_json.txt b/tool/benchmark/results/result_release_citm_catalog_json.txt index ae7ed38c..89f532b6 100644 --- a/tool/benchmark/results/result_release_citm_catalog_json.txt +++ b/tool/benchmark/results/result_release_citm_catalog_json.txt @@ -1,4 +1,4 @@ -2024-10-13T01:55:12+09:00 +2024-12-22T01:25:42+09:00 Running ./build_bm_release/tool/benchmark/benchmarker Run on (16 X 3193.88 MHz CPU s) CPU Caches: @@ -6,12 +6,12 @@ CPU Caches: L1 Instruction 32 KiB (x8) L2 Unified 512 KiB (x8) L3 Unified 16384 KiB (x1) -Load Average: 0.38, 0.40, 0.44 +Load Average: 0.14, 0.06, 0.01 ------------------------------------------------------------------------------------- Benchmark Time CPU Iterations UserCounters... ------------------------------------------------------------------------------------- -bm_fkyaml_parse 19846319 ns 19847303 ns 35 bytes_per_second=82.9931Mi/s items_per_second=50.3847/s -bm_yamlcpp_parse 115684121 ns 115689950 ns 6 bytes_per_second=14.238Mi/s items_per_second=8.64379/s -bm_libfyaml_parse 31415418 ns 31416483 ns 24 bytes_per_second=52.4308Mi/s items_per_second=31.8304/s -bm_rapidyaml_parse_inplace 53018 ns 53020 ns 12756 bytes_per_second=30.339Gi/s items_per_second=18.8607k/s -bm_rapidyaml_parse_arena 11307118 ns 11307543 ns 61 bytes_per_second=145.672Mi/s items_per_second=88.4365/s +bm_fkyaml_parse 18183785 ns 18070739 ns 38 bytes_per_second=91.1523Mi/s items_per_second=55.3381/s +bm_yamlcpp_parse 111608816 ns 110906333 ns 6 bytes_per_second=14.8521Mi/s items_per_second=9.01662/s +bm_libfyaml_parse 31745123 ns 31789463 ns 24 bytes_per_second=51.8156Mi/s items_per_second=31.457/s +bm_rapidyaml_parse_inplace 53190 ns 54109 ns 12182 bytes_per_second=29.7284Gi/s items_per_second=18.4811k/s +bm_rapidyaml_parse_arena 11537854 ns 11701766 ns 59 bytes_per_second=140.764Mi/s items_per_second=85.4572/s diff --git a/tool/benchmark/results/result_release_citm_catalog_yml.txt b/tool/benchmark/results/result_release_citm_catalog_yml.txt index 9cacdb5f..9a168163 100644 --- a/tool/benchmark/results/result_release_citm_catalog_yml.txt +++ b/tool/benchmark/results/result_release_citm_catalog_yml.txt @@ -1,4 +1,4 @@ -2024-10-13T01:55:16+09:00 +2024-12-22T01:35:07+09:00 Running ./build_bm_release/tool/benchmark/benchmarker Run on (16 X 3193.88 MHz CPU s) CPU Caches: @@ -6,12 +6,12 @@ CPU Caches: L1 Instruction 32 KiB (x8) L2 Unified 512 KiB (x8) L3 Unified 16384 KiB (x1) -Load Average: 0.43, 0.41, 0.44 +Load Average: 0.20, 0.21, 0.14 ------------------------------------------------------------------------------------- Benchmark Time CPU Iterations UserCounters... ------------------------------------------------------------------------------------- -bm_fkyaml_parse 19463284 ns 19463849 ns 37 bytes_per_second=35.152Mi/s items_per_second=51.3773/s -bm_yamlcpp_parse 111843539 ns 111849533 ns 6 bytes_per_second=6.11709Mi/s items_per_second=8.94058/s -bm_libfyaml_parse 29637484 ns 29638652 ns 25 bytes_per_second=23.0845Mi/s items_per_second=33.7397/s -bm_rapidyaml_parse_inplace 21471 ns 21472 ns 29716 bytes_per_second=31.117Gi/s items_per_second=46.5713k/s -bm_rapidyaml_parse_arena 10318869 ns 10318941 ns 66 bytes_per_second=66.3046Mi/s items_per_second=96.9092/s +bm_fkyaml_parse 19005246 ns 18979447 ns 36 bytes_per_second=36.0492Mi/s items_per_second=52.6886/s +bm_yamlcpp_parse 109966009 ns 109757200 ns 6 bytes_per_second=6.2337Mi/s items_per_second=9.11102/s +bm_libfyaml_parse 31836258 ns 31753588 ns 24 bytes_per_second=21.547Mi/s items_per_second=31.4925/s +bm_rapidyaml_parse_inplace 29559 ns 29447 ns 24350 bytes_per_second=22.6904Gi/s items_per_second=33.9597k/s +bm_rapidyaml_parse_arena 10671326 ns 10624578 ns 64 bytes_per_second=64.3972Mi/s items_per_second=94.1214/s diff --git a/tool/benchmark/results/result_release_ubuntu_yml.txt b/tool/benchmark/results/result_release_ubuntu_yml.txt index 8ee920d5..040ff895 100644 --- a/tool/benchmark/results/result_release_ubuntu_yml.txt +++ b/tool/benchmark/results/result_release_ubuntu_yml.txt @@ -1,4 +1,4 @@ -2024-10-13T01:55:07+09:00 +2024-12-22T01:25:37+09:00 Running ./build_bm_release/tool/benchmark/benchmarker Run on (16 X 3193.88 MHz CPU s) CPU Caches: @@ -6,12 +6,12 @@ CPU Caches: L1 Instruction 32 KiB (x8) L2 Unified 512 KiB (x8) L3 Unified 16384 KiB (x1) -Load Average: 0.32, 0.38, 0.44 +Load Average: 0.06, 0.04, 0.01 ------------------------------------------------------------------------------------- Benchmark Time CPU Iterations UserCounters... ------------------------------------------------------------------------------------- -bm_fkyaml_parse 152489 ns 152496 ns 4506 bytes_per_second=55.1393Mi/s items_per_second=6.55753k/s -bm_yamlcpp_parse 960175 ns 960191 ns 732 bytes_per_second=8.75716Mi/s items_per_second=1.04146k/s -bm_libfyaml_parse 241862 ns 241871 ns 3140 bytes_per_second=34.7645Mi/s items_per_second=4.13443k/s -bm_rapidyaml_parse_inplace 417 ns 417 ns 1656253 bytes_per_second=19.6806Gi/s items_per_second=2.39672M/s -bm_rapidyaml_parse_arena 59956 ns 59958 ns 11651 bytes_per_second=140.24Mi/s items_per_second=16.6783k/s +bm_fkyaml_parse 140515 ns 139703 ns 4969 bytes_per_second=60.1886Mi/s items_per_second=7.15803k/s +bm_yamlcpp_parse 959662 ns 954009 ns 727 bytes_per_second=8.8139Mi/s items_per_second=1.04821k/s +bm_libfyaml_parse 241916 ns 240458 ns 2733 bytes_per_second=34.9689Mi/s items_per_second=4.15873k/s +bm_rapidyaml_parse_inplace 425 ns 422 ns 1672964 bytes_per_second=19.4415Gi/s items_per_second=2.3676M/s +bm_rapidyaml_parse_arena 60700 ns 60328 ns 11452 bytes_per_second=139.381Mi/s items_per_second=16.5761k/s From 7d9e702a4a8f42078d37923ad7feb98ca10fb432 Mon Sep 17 00:00:00 2001 From: fktn Date: Mon, 23 Dec 2024 11:31:26 +0900 Subject: [PATCH 07/18] Emit an error if ":" is missing after a mapping key (#450) * emit errors if ":" is missing after a mapping key * generalized codes to move back to a parent node with target indentation * disable clang-tidy check (bugprone-easily-swappable-parameters) * added test cases & addressed coverage loss --- .clang-tidy | 1 + .../fkYAML/detail/encodings/utf_encodings.hpp | 2 +- include/fkYAML/detail/input/deserializer.hpp | 252 ++++++++--------- include/fkYAML/detail/input/scalar_parser.hpp | 2 +- include/fkYAML/detail/str_view.hpp | 5 - single_include/fkYAML/node.hpp | 261 ++++++++---------- test/unit_test/test_deserializer_class.cpp | 42 +++ 7 files changed, 273 insertions(+), 292 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index aa9f337e..42be3580 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,6 +3,7 @@ Checks: '*, -altera-id-dependent-backward-branch, -altera-struct-pack-align, -altera-unroll-loops, + -bugprone-easily-swappable-parameters, -cert-dcl21-cpp, -cppcoreguidelines-avoid-c-arrays, -cppcoreguidelines-avoid-do-while, diff --git a/include/fkYAML/detail/encodings/utf_encodings.hpp b/include/fkYAML/detail/encodings/utf_encodings.hpp index 12b8e52c..ee33944f 100644 --- a/include/fkYAML/detail/encodings/utf_encodings.hpp +++ b/include/fkYAML/detail/encodings/utf_encodings.hpp @@ -190,7 +190,7 @@ inline bool validate(const std::initializer_list& byte_array) noexcept /// @param[out] utf8 UTF-8 encoded bytes. /// @param[out] consumed_size The number of UTF-16 encoded characters used for the conversion. /// @param[out] encoded_size The size of UTF-encoded bytes. -inline void from_utf16( // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) +inline void from_utf16( std::array utf16, std::array& utf8, uint32_t& consumed_size, uint32_t& encoded_size) { if (utf16[0] < 0x80u) { utf8[0] = static_cast(utf16[0] & 0x7Fu); diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index 36c84fb7..6294a536 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -72,7 +72,6 @@ class basic_deserializer { /// @param indent The indentation width in the current line. (count from zero) /// @param state The parse context type. /// @param p_node The underlying node associated to this context. - // // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) parse_context(uint32_t line, uint32_t indent, context_state_t state, basic_node_type* p_node) noexcept : line(line), indent(indent), @@ -188,6 +187,8 @@ class basic_deserializer { lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_SEQUENCE, &root); m_context_stack.emplace_back(std::move(context)); token = lexer.get_next_token(); + line = lexer.get_lines_processed(); + indent = lexer.get_last_token_begin_pos(); break; } case lexical_token_t::SEQUENCE_FLOW_BEGIN: @@ -199,6 +200,8 @@ class basic_deserializer { m_context_stack.emplace_back( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::FLOW_SEQUENCE, &root); token = lexer.get_next_token(); + line = lexer.get_lines_processed(); + indent = lexer.get_last_token_begin_pos(); break; case lexical_token_t::MAPPING_FLOW_BEGIN: ++m_flow_context_depth; @@ -209,6 +212,8 @@ class basic_deserializer { m_context_stack.emplace_back( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::FLOW_MAPPING, &root); token = lexer.get_next_token(); + line = lexer.get_lines_processed(); + indent = lexer.get_last_token_begin_pos(); break; case lexical_token_t::EXPLICIT_KEY_PREFIX: { // If the explicit key prefix (? ) is detected here, the root node of current document must be a mapping. @@ -220,6 +225,8 @@ class basic_deserializer { parse_context context( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_MAPPING, &root); m_context_stack.emplace_back(std::move(context)); + line = lexer.get_lines_processed(); + indent = lexer.get_last_token_begin_pos(); break; } case lexical_token_t::BLOCK_LITERAL_SCALAR: @@ -247,6 +254,9 @@ class basic_deserializer { m_needs_tag_impl = false; m_tag_name.clear(); } + + line = lexer.get_lines_processed(); + indent = lexer.get_last_token_begin_pos(); } break; default: @@ -257,7 +267,7 @@ class basic_deserializer { mp_current_node = &root; // parse YAML nodes recursively - deserialize_node(lexer, token, last_type); + deserialize_node(lexer, token, line, indent, last_type); FK_YAML_ASSERT( last_type == lexical_token_t::END_OF_BUFFER || last_type == lexical_token_t::END_OF_DIRECTIVES || last_type == lexical_token_t::END_OF_DOCUMENT); @@ -369,34 +379,19 @@ class basic_deserializer { /// @param lexer The lexical analyzer to be used. /// @param first_type The first lexical token. /// @param last_type Storage for last lexical token type. - void deserialize_node(lexer_type& lexer, const lexical_token& first_token, lexical_token_t& last_type) { + void deserialize_node( + lexer_type& lexer, const lexical_token& first_token, uint32_t first_line, uint32_t first_indent, + lexical_token_t& last_type) { lexical_token token = first_token; - uint32_t line = lexer.get_lines_processed(); - uint32_t indent = lexer.get_last_token_begin_pos(); + uint32_t line = first_line; + uint32_t indent = first_indent; do { switch (token.type) { case lexical_token_t::EXPLICIT_KEY_PREFIX: { - uint32_t pop_num = 0; - if (indent == 0) { - pop_num = static_cast(m_context_stack.size() - 1); - } - else { - const bool needs_to_move_back = indent < m_context_stack.back().indent; - if (needs_to_move_back) { - auto target_itr = std::find_if( // LCOV_EXCL_LINE - m_context_stack.rbegin(), - m_context_stack.rend(), - [indent](const parse_context& c) { return indent > c.indent; }); - pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); - } - } - if (pop_num > 0) { - for (uint32_t i = 0; i < pop_num; i++) { - // move back to the previous container node. - m_context_stack.pop_back(); - } - mp_current_node = m_context_stack.back().p_node; + const bool needs_to_move_back = indent == 0 || indent < m_context_stack.back().indent; + if (needs_to_move_back) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { return indent > c.indent; }); } if FK_YAML_UNLIKELY (mp_current_node->is_null()) { @@ -449,6 +444,10 @@ class basic_deserializer { throw parse_error("sequence key should not be empty.", line, indent); } + if (m_flow_context_depth > 0) { + break; + } + // hold the line count of the key separator for later use. const uint32_t old_indent = indent; const uint32_t old_line = line; @@ -466,10 +465,6 @@ class basic_deserializer { line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); - if (m_flow_context_depth > 0) { - continue; - } - const bool is_implicit_same_line = (line == old_line) && (m_context_stack.empty() || old_indent > m_context_stack.back().indent); if (is_implicit_same_line) { @@ -543,6 +538,22 @@ class basic_deserializer { continue; } + if (indent <= m_context_stack.back().indent) { + FK_YAML_ASSERT(m_context_stack.back().state == context_state_t::MAPPING_VALUE); + + // Mapping values can be omitted and are considered to be null. + // ```yaml + // foo: + // bar: + // baz: + // qux: + // # -> {foo: null, bar: {baz: null}, qux: null} + // ``` + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return (c.state == context_state_t::BLOCK_MAPPING) && (indent == c.indent); + }); + } + // defer checking the existence of a key separator after the following scalar until the next // deserialize_scalar() call. continue; @@ -608,40 +619,16 @@ class basic_deserializer { if (m_flow_context_depth == 0) { lexer.set_context_state(true); - uint32_t pop_num = 0; - if (indent == 0) { - pop_num = static_cast(m_context_stack.size() - 1); - } - else if (indent <= m_context_stack.back().indent) { - auto target_itr = std::find_if( // LCOV_EXCL_LINE - m_context_stack.rbegin(), - m_context_stack.rend(), - [indent](const parse_context& c) { - if (indent != c.indent) { - return false; - } - - switch (c.state) { - case context_state_t::BLOCK_MAPPING: - case context_state_t::MAPPING_VALUE: - return true; - default: - return false; - } - }); - const bool is_indent_valid = (target_itr != m_context_stack.rend()); - if FK_YAML_UNLIKELY (!is_indent_valid) { - throw parse_error("Detected invalid indentation.", line, indent); - } - - pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); - } - if (pop_num > 0) { - for (uint32_t i = 0; i < pop_num; i++) { - // move back to the previous container node. - m_context_stack.pop_back(); - } - mp_current_node = m_context_stack.back().p_node; + if (indent <= m_context_stack.back().indent) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + switch (c.state) { + case context_state_t::BLOCK_MAPPING: + case context_state_t::MAPPING_VALUE: + return indent == c.indent; + default: + return false; + } + }); } } else if FK_YAML_UNLIKELY (m_flow_token_state == flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX) { @@ -755,40 +742,16 @@ class basic_deserializer { if (m_flow_context_depth == 0) { lexer.set_context_state(true); - uint32_t pop_num = 0; - if (indent == 0) { - pop_num = static_cast(m_context_stack.size() - 1); - } - else if (indent <= m_context_stack.back().indent) { - auto target_itr = std::find_if( // LCOV_EXCL_LINE - m_context_stack.rbegin(), - m_context_stack.rend(), - [indent](const parse_context& c) { - if (indent != c.indent) { - return false; - } - - switch (c.state) { - case context_state_t::BLOCK_MAPPING: - case context_state_t::MAPPING_VALUE: - return true; - default: - return false; - } - }); - const bool is_indent_valid = (target_itr != m_context_stack.rend()); - if FK_YAML_UNLIKELY (!is_indent_valid) { - throw parse_error("Detected invalid indentation.", line, indent); - } - - pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); - } - if (pop_num > 0) { - for (uint32_t i = 0; i < pop_num; i++) { - // move back to the previous container node. - m_context_stack.pop_back(); - } - mp_current_node = m_context_stack.back().p_node; + if (indent <= m_context_stack.back().indent) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + switch (c.state) { + case context_state_t::BLOCK_MAPPING: + case context_state_t::MAPPING_VALUE: + return indent == c.indent; + default: + return false; + } + }); } } else if FK_YAML_UNLIKELY (m_flow_token_state == flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX) { @@ -933,11 +896,8 @@ class basic_deserializer { apply_directive_set(node); apply_node_properties(node); - const bool should_continue = deserialize_scalar(lexer, std::move(node), indent, line, token); - if (should_continue) { - continue; - } - break; + deserialize_scalar(lexer, std::move(node), indent, line, token); + continue; } case lexical_token_t::PLAIN_SCALAR: case lexical_token_t::SINGLE_QUOTED_SCALAR: @@ -951,11 +911,8 @@ class basic_deserializer { apply_directive_set(node); apply_node_properties(node); - const bool do_continue = deserialize_scalar(lexer, std::move(node), indent, line, token); - if (do_continue) { - continue; - } - break; + deserialize_scalar(lexer, std::move(node), indent, line, token); + continue; } case lexical_token_t::BLOCK_LITERAL_SCALAR: case lexical_token_t::BLOCK_FOLDED_SCALAR: { @@ -1000,7 +957,6 @@ class basic_deserializer { /// @param line The variable to store the line of either the first property or the last non-property token. /// @param indent The variable to store the indent of either the first property or the last non-property token. /// @return true if any property is found, false otherwise. - // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) bool deserialize_node_properties(lexer_type& lexer, lexical_token& last_token, uint32_t& line, uint32_t& indent) { m_needs_anchor_impl = m_needs_tag_impl = false; @@ -1071,29 +1027,10 @@ class basic_deserializer { /// @param indent The indentation width in the current line where the key is found. void add_new_key(basic_node_type&& key, const uint32_t line, const uint32_t indent) { if (m_flow_context_depth == 0) { - uint32_t pop_num = 0; - if (indent == 0) { - pop_num = static_cast(m_context_stack.size() - 1); - } - else if (indent <= m_context_stack.back().indent) { - auto target_itr = - std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), [indent](const parse_context& c) { - // the target node is a block mapping key node with the same indentation. - return (indent == c.indent) && (c.state == context_state_t::BLOCK_MAPPING); - }); - const bool is_indent_valid = (target_itr != m_context_stack.rend()); - if FK_YAML_UNLIKELY (!is_indent_valid) { - throw parse_error("Detected invalid indentation.", line, indent); - } - - pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); - } - if (pop_num > 0) { - for (uint32_t i = 0; i < pop_num; i++) { - // move back to the previous container node. - m_context_stack.pop_back(); - } - mp_current_node = m_context_stack.back().p_node; + if (indent <= m_context_stack.back().indent) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return (c.state == context_state_t::BLOCK_MAPPING) && (indent == c.indent); + }); } } else if FK_YAML_UNLIKELY (m_flow_token_state != flow_token_state_t::NEEDS_VALUE_OR_SUFFIX) { @@ -1158,16 +1095,22 @@ class basic_deserializer { /// @param line The number of processed lines. Can be updated in this function. /// @param token The storage for last lexical token. /// @return true if next token has already been got, false otherwise. - bool deserialize_scalar( + void deserialize_scalar( lexer_type& lexer, basic_node_type&& node, uint32_t& indent, uint32_t& line, lexical_token& token) { + token = lexer.get_next_token(); if (mp_current_node->is_mapping()) { + const bool is_key_sep_followed = + (token.type == lexical_token_t::KEY_SEPARATOR) && (line == lexer.get_lines_processed()); + if FK_YAML_UNLIKELY (!is_key_sep_followed) { + throw parse_error( + "The \":\" mapping value indicator must be followed after a mapping key.", + lexer.get_lines_processed(), + lexer.get_last_token_begin_pos()); + } add_new_key(std::move(node), line, indent); - return false; } - - token = lexer.get_next_token(); - if (token.type == lexical_token_t::KEY_SEPARATOR) { - if (line != lexer.get_lines_processed()) { + else if (token.type == lexical_token_t::KEY_SEPARATOR) { + if FK_YAML_UNLIKELY (line != lexer.get_lines_processed()) { // This path is for explicit mapping key separator like: // // ```yaml @@ -1182,7 +1125,7 @@ class basic_deserializer { } indent = lexer.get_last_token_begin_pos(); line = lexer.get_lines_processed(); - return true; + return; } if (mp_current_node->is_scalar()) { @@ -1229,9 +1172,40 @@ class basic_deserializer { else { assign_node_value(std::move(node), line, indent); } + indent = lexer.get_last_token_begin_pos(); line = lexer.get_lines_processed(); - return true; + } + + /// @brief Pops parent contexts to a block mapping with the given indentation. + /// @tparam Pred Functor type to test parent contexts. + /// @param line The current line count. + /// @param indent The indentation level of the target parent block mapping. + template + void pop_to_parent_node(uint32_t line, uint32_t indent, Pred&& pred) { + FK_YAML_ASSERT(!m_context_stack.empty()); + + uint32_t pop_num = 0; + if (indent == 0) { + pop_num = static_cast(m_context_stack.size() - 1); + } + else { + // LCOV_EXCL_START + auto itr = std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), std::forward(pred)); + // LCOV_EXCL_STOP + const bool is_indent_valid = (itr != m_context_stack.rend()); + if FK_YAML_UNLIKELY (!is_indent_valid) { + throw parse_error("Detected invalid indentation.", line, indent); + } + + pop_num = static_cast(std::distance(m_context_stack.rbegin(), itr)); + } + + // move back to the parent block mapping. + for (uint32_t i = 0; i < pop_num; i++) { + m_context_stack.pop_back(); + } + mp_current_node = m_context_stack.back().p_node; } /// @brief Set YAML directive properties to the given node. diff --git a/include/fkYAML/detail/input/scalar_parser.hpp b/include/fkYAML/detail/input/scalar_parser.hpp index 495faa7e..92cb905b 100644 --- a/include/fkYAML/detail/input/scalar_parser.hpp +++ b/include/fkYAML/detail/input/scalar_parser.hpp @@ -47,7 +47,7 @@ class scalar_parser { /// @brief Constructs a new scalar_parser object. /// @param line Current line. /// @param indent Current indentation. - scalar_parser(uint32_t line, uint32_t indent) noexcept // NOLINT(bugprone-easily-swappable-parameters) + scalar_parser(uint32_t line, uint32_t indent) noexcept : m_line(line), m_indent(indent) { } diff --git a/include/fkYAML/detail/str_view.hpp b/include/fkYAML/detail/str_view.hpp index ee0afbd5..41bd8455 100644 --- a/include/fkYAML/detail/str_view.hpp +++ b/include/fkYAML/detail/str_view.hpp @@ -451,8 +451,6 @@ class basic_str_view { return find(s) != npos; } - // NOLINTBEGIN(bugprone-easily-swappable-parameters) - /// @brief Finds the beginning position of `sv` characters in this referenced character sequence. /// @param sv The character sequence to compare with. /// @param pos The offset of the search beginning position in this referenced character sequence. @@ -525,8 +523,6 @@ class basic_str_view { return find(basic_str_view(s), pos); } - // NOLINTEND(bugprone-easily-swappable-parameters) - /// @brief Retrospectively finds the beginning position of `sv` characters in this referenced character sequence. /// @param sv The character sequence to compare with. /// @param pos The offset of the search beginning position in this referenced character sequence. @@ -606,7 +602,6 @@ class basic_str_view { /// @param pos The offset of the search beginning position in this referenced character sequence. /// @param n The length of `s` character sequence used for comparison. /// @return The beginning position of `s` characters, `npos` otherwise. - // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) size_type find_first_of(const CharT* s, size_type pos, size_type n) const noexcept { if FK_YAML_UNLIKELY (n == 0) { return npos; diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index f923607c..40091bb2 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -1962,7 +1962,7 @@ inline bool validate(const std::initializer_list& byte_array) noexcept /// @param[out] utf8 UTF-8 encoded bytes. /// @param[out] consumed_size The number of UTF-16 encoded characters used for the conversion. /// @param[out] encoded_size The size of UTF-encoded bytes. -inline void from_utf16( // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) +inline void from_utf16( std::array utf16, std::array& utf8, uint32_t& consumed_size, uint32_t& encoded_size) { if (utf16[0] < 0x80u) { utf8[0] = static_cast(utf16[0] & 0x7Fu); @@ -2559,8 +2559,6 @@ class basic_str_view { return find(s) != npos; } - // NOLINTBEGIN(bugprone-easily-swappable-parameters) - /// @brief Finds the beginning position of `sv` characters in this referenced character sequence. /// @param sv The character sequence to compare with. /// @param pos The offset of the search beginning position in this referenced character sequence. @@ -2633,8 +2631,6 @@ class basic_str_view { return find(basic_str_view(s), pos); } - // NOLINTEND(bugprone-easily-swappable-parameters) - /// @brief Retrospectively finds the beginning position of `sv` characters in this referenced character sequence. /// @param sv The character sequence to compare with. /// @param pos The offset of the search beginning position in this referenced character sequence. @@ -2714,7 +2710,6 @@ class basic_str_view { /// @param pos The offset of the search beginning position in this referenced character sequence. /// @param n The length of `s` character sequence used for comparison. /// @return The beginning position of `s` characters, `npos` otherwise. - // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) size_type find_first_of(const CharT* s, size_type pos, size_type n) const noexcept { if FK_YAML_UNLIKELY (n == 0) { return npos; @@ -6030,7 +6025,7 @@ class scalar_parser { /// @brief Constructs a new scalar_parser object. /// @param line Current line. /// @param indent Current indentation. - scalar_parser(uint32_t line, uint32_t indent) noexcept // NOLINT(bugprone-easily-swappable-parameters) + scalar_parser(uint32_t line, uint32_t indent) noexcept : m_line(line), m_indent(indent) { } @@ -7084,7 +7079,6 @@ class basic_deserializer { /// @param indent The indentation width in the current line. (count from zero) /// @param state The parse context type. /// @param p_node The underlying node associated to this context. - // // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) parse_context(uint32_t line, uint32_t indent, context_state_t state, basic_node_type* p_node) noexcept : line(line), indent(indent), @@ -7200,6 +7194,8 @@ class basic_deserializer { lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_SEQUENCE, &root); m_context_stack.emplace_back(std::move(context)); token = lexer.get_next_token(); + line = lexer.get_lines_processed(); + indent = lexer.get_last_token_begin_pos(); break; } case lexical_token_t::SEQUENCE_FLOW_BEGIN: @@ -7211,6 +7207,8 @@ class basic_deserializer { m_context_stack.emplace_back( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::FLOW_SEQUENCE, &root); token = lexer.get_next_token(); + line = lexer.get_lines_processed(); + indent = lexer.get_last_token_begin_pos(); break; case lexical_token_t::MAPPING_FLOW_BEGIN: ++m_flow_context_depth; @@ -7221,6 +7219,8 @@ class basic_deserializer { m_context_stack.emplace_back( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::FLOW_MAPPING, &root); token = lexer.get_next_token(); + line = lexer.get_lines_processed(); + indent = lexer.get_last_token_begin_pos(); break; case lexical_token_t::EXPLICIT_KEY_PREFIX: { // If the explicit key prefix (? ) is detected here, the root node of current document must be a mapping. @@ -7232,6 +7232,8 @@ class basic_deserializer { parse_context context( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_MAPPING, &root); m_context_stack.emplace_back(std::move(context)); + line = lexer.get_lines_processed(); + indent = lexer.get_last_token_begin_pos(); break; } case lexical_token_t::BLOCK_LITERAL_SCALAR: @@ -7259,6 +7261,9 @@ class basic_deserializer { m_needs_tag_impl = false; m_tag_name.clear(); } + + line = lexer.get_lines_processed(); + indent = lexer.get_last_token_begin_pos(); } break; default: @@ -7269,7 +7274,7 @@ class basic_deserializer { mp_current_node = &root; // parse YAML nodes recursively - deserialize_node(lexer, token, last_type); + deserialize_node(lexer, token, line, indent, last_type); FK_YAML_ASSERT( last_type == lexical_token_t::END_OF_BUFFER || last_type == lexical_token_t::END_OF_DIRECTIVES || last_type == lexical_token_t::END_OF_DOCUMENT); @@ -7381,34 +7386,19 @@ class basic_deserializer { /// @param lexer The lexical analyzer to be used. /// @param first_type The first lexical token. /// @param last_type Storage for last lexical token type. - void deserialize_node(lexer_type& lexer, const lexical_token& first_token, lexical_token_t& last_type) { + void deserialize_node( + lexer_type& lexer, const lexical_token& first_token, uint32_t first_line, uint32_t first_indent, + lexical_token_t& last_type) { lexical_token token = first_token; - uint32_t line = lexer.get_lines_processed(); - uint32_t indent = lexer.get_last_token_begin_pos(); + uint32_t line = first_line; + uint32_t indent = first_indent; do { switch (token.type) { case lexical_token_t::EXPLICIT_KEY_PREFIX: { - uint32_t pop_num = 0; - if (indent == 0) { - pop_num = static_cast(m_context_stack.size() - 1); - } - else { - const bool needs_to_move_back = indent < m_context_stack.back().indent; - if (needs_to_move_back) { - auto target_itr = std::find_if( // LCOV_EXCL_LINE - m_context_stack.rbegin(), - m_context_stack.rend(), - [indent](const parse_context& c) { return indent > c.indent; }); - pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); - } - } - if (pop_num > 0) { - for (uint32_t i = 0; i < pop_num; i++) { - // move back to the previous container node. - m_context_stack.pop_back(); - } - mp_current_node = m_context_stack.back().p_node; + const bool needs_to_move_back = indent == 0 || indent < m_context_stack.back().indent; + if (needs_to_move_back) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { return indent > c.indent; }); } if FK_YAML_UNLIKELY (mp_current_node->is_null()) { @@ -7461,6 +7451,10 @@ class basic_deserializer { throw parse_error("sequence key should not be empty.", line, indent); } + if (m_flow_context_depth > 0) { + break; + } + // hold the line count of the key separator for later use. const uint32_t old_indent = indent; const uint32_t old_line = line; @@ -7478,10 +7472,6 @@ class basic_deserializer { line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); - if (m_flow_context_depth > 0) { - continue; - } - const bool is_implicit_same_line = (line == old_line) && (m_context_stack.empty() || old_indent > m_context_stack.back().indent); if (is_implicit_same_line) { @@ -7555,6 +7545,22 @@ class basic_deserializer { continue; } + if (indent <= m_context_stack.back().indent) { + FK_YAML_ASSERT(m_context_stack.back().state == context_state_t::MAPPING_VALUE); + + // Mapping values can be omitted and are considered to be null. + // ```yaml + // foo: + // bar: + // baz: + // qux: + // # -> {foo: null, bar: {baz: null}, qux: null} + // ``` + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return (c.state == context_state_t::BLOCK_MAPPING) && (indent == c.indent); + }); + } + // defer checking the existence of a key separator after the following scalar until the next // deserialize_scalar() call. continue; @@ -7620,40 +7626,16 @@ class basic_deserializer { if (m_flow_context_depth == 0) { lexer.set_context_state(true); - uint32_t pop_num = 0; - if (indent == 0) { - pop_num = static_cast(m_context_stack.size() - 1); - } - else if (indent <= m_context_stack.back().indent) { - auto target_itr = std::find_if( // LCOV_EXCL_LINE - m_context_stack.rbegin(), - m_context_stack.rend(), - [indent](const parse_context& c) { - if (indent != c.indent) { - return false; - } - - switch (c.state) { - case context_state_t::BLOCK_MAPPING: - case context_state_t::MAPPING_VALUE: - return true; - default: - return false; - } - }); - const bool is_indent_valid = (target_itr != m_context_stack.rend()); - if FK_YAML_UNLIKELY (!is_indent_valid) { - throw parse_error("Detected invalid indentation.", line, indent); - } - - pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); - } - if (pop_num > 0) { - for (uint32_t i = 0; i < pop_num; i++) { - // move back to the previous container node. - m_context_stack.pop_back(); - } - mp_current_node = m_context_stack.back().p_node; + if (indent <= m_context_stack.back().indent) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + switch (c.state) { + case context_state_t::BLOCK_MAPPING: + case context_state_t::MAPPING_VALUE: + return indent == c.indent; + default: + return false; + } + }); } } else if FK_YAML_UNLIKELY (m_flow_token_state == flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX) { @@ -7767,40 +7749,16 @@ class basic_deserializer { if (m_flow_context_depth == 0) { lexer.set_context_state(true); - uint32_t pop_num = 0; - if (indent == 0) { - pop_num = static_cast(m_context_stack.size() - 1); - } - else if (indent <= m_context_stack.back().indent) { - auto target_itr = std::find_if( // LCOV_EXCL_LINE - m_context_stack.rbegin(), - m_context_stack.rend(), - [indent](const parse_context& c) { - if (indent != c.indent) { - return false; - } - - switch (c.state) { - case context_state_t::BLOCK_MAPPING: - case context_state_t::MAPPING_VALUE: - return true; - default: - return false; - } - }); - const bool is_indent_valid = (target_itr != m_context_stack.rend()); - if FK_YAML_UNLIKELY (!is_indent_valid) { - throw parse_error("Detected invalid indentation.", line, indent); - } - - pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); - } - if (pop_num > 0) { - for (uint32_t i = 0; i < pop_num; i++) { - // move back to the previous container node. - m_context_stack.pop_back(); - } - mp_current_node = m_context_stack.back().p_node; + if (indent <= m_context_stack.back().indent) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + switch (c.state) { + case context_state_t::BLOCK_MAPPING: + case context_state_t::MAPPING_VALUE: + return indent == c.indent; + default: + return false; + } + }); } } else if FK_YAML_UNLIKELY (m_flow_token_state == flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX) { @@ -7945,11 +7903,8 @@ class basic_deserializer { apply_directive_set(node); apply_node_properties(node); - const bool should_continue = deserialize_scalar(lexer, std::move(node), indent, line, token); - if (should_continue) { - continue; - } - break; + deserialize_scalar(lexer, std::move(node), indent, line, token); + continue; } case lexical_token_t::PLAIN_SCALAR: case lexical_token_t::SINGLE_QUOTED_SCALAR: @@ -7963,11 +7918,8 @@ class basic_deserializer { apply_directive_set(node); apply_node_properties(node); - const bool do_continue = deserialize_scalar(lexer, std::move(node), indent, line, token); - if (do_continue) { - continue; - } - break; + deserialize_scalar(lexer, std::move(node), indent, line, token); + continue; } case lexical_token_t::BLOCK_LITERAL_SCALAR: case lexical_token_t::BLOCK_FOLDED_SCALAR: { @@ -8012,7 +7964,6 @@ class basic_deserializer { /// @param line The variable to store the line of either the first property or the last non-property token. /// @param indent The variable to store the indent of either the first property or the last non-property token. /// @return true if any property is found, false otherwise. - // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) bool deserialize_node_properties(lexer_type& lexer, lexical_token& last_token, uint32_t& line, uint32_t& indent) { m_needs_anchor_impl = m_needs_tag_impl = false; @@ -8083,29 +8034,10 @@ class basic_deserializer { /// @param indent The indentation width in the current line where the key is found. void add_new_key(basic_node_type&& key, const uint32_t line, const uint32_t indent) { if (m_flow_context_depth == 0) { - uint32_t pop_num = 0; - if (indent == 0) { - pop_num = static_cast(m_context_stack.size() - 1); - } - else if (indent <= m_context_stack.back().indent) { - auto target_itr = - std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), [indent](const parse_context& c) { - // the target node is a block mapping key node with the same indentation. - return (indent == c.indent) && (c.state == context_state_t::BLOCK_MAPPING); - }); - const bool is_indent_valid = (target_itr != m_context_stack.rend()); - if FK_YAML_UNLIKELY (!is_indent_valid) { - throw parse_error("Detected invalid indentation.", line, indent); - } - - pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); - } - if (pop_num > 0) { - for (uint32_t i = 0; i < pop_num; i++) { - // move back to the previous container node. - m_context_stack.pop_back(); - } - mp_current_node = m_context_stack.back().p_node; + if (indent <= m_context_stack.back().indent) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return (c.state == context_state_t::BLOCK_MAPPING) && (indent == c.indent); + }); } } else if FK_YAML_UNLIKELY (m_flow_token_state != flow_token_state_t::NEEDS_VALUE_OR_SUFFIX) { @@ -8170,16 +8102,22 @@ class basic_deserializer { /// @param line The number of processed lines. Can be updated in this function. /// @param token The storage for last lexical token. /// @return true if next token has already been got, false otherwise. - bool deserialize_scalar( + void deserialize_scalar( lexer_type& lexer, basic_node_type&& node, uint32_t& indent, uint32_t& line, lexical_token& token) { + token = lexer.get_next_token(); if (mp_current_node->is_mapping()) { + const bool is_key_sep_followed = + (token.type == lexical_token_t::KEY_SEPARATOR) && (line == lexer.get_lines_processed()); + if FK_YAML_UNLIKELY (!is_key_sep_followed) { + throw parse_error( + "The \":\" mapping value indicator must be followed after a mapping key.", + lexer.get_lines_processed(), + lexer.get_last_token_begin_pos()); + } add_new_key(std::move(node), line, indent); - return false; } - - token = lexer.get_next_token(); - if (token.type == lexical_token_t::KEY_SEPARATOR) { - if (line != lexer.get_lines_processed()) { + else if (token.type == lexical_token_t::KEY_SEPARATOR) { + if FK_YAML_UNLIKELY (line != lexer.get_lines_processed()) { // This path is for explicit mapping key separator like: // // ```yaml @@ -8194,7 +8132,7 @@ class basic_deserializer { } indent = lexer.get_last_token_begin_pos(); line = lexer.get_lines_processed(); - return true; + return; } if (mp_current_node->is_scalar()) { @@ -8241,9 +8179,40 @@ class basic_deserializer { else { assign_node_value(std::move(node), line, indent); } + indent = lexer.get_last_token_begin_pos(); line = lexer.get_lines_processed(); - return true; + } + + /// @brief Pops parent contexts to a block mapping with the given indentation. + /// @tparam Pred Functor type to test parent contexts. + /// @param line The current line count. + /// @param indent The indentation level of the target parent block mapping. + template + void pop_to_parent_node(uint32_t line, uint32_t indent, Pred&& pred) { + FK_YAML_ASSERT(!m_context_stack.empty()); + + uint32_t pop_num = 0; + if (indent == 0) { + pop_num = static_cast(m_context_stack.size() - 1); + } + else { + // LCOV_EXCL_START + auto itr = std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), std::forward(pred)); + // LCOV_EXCL_STOP + const bool is_indent_valid = (itr != m_context_stack.rend()); + if FK_YAML_UNLIKELY (!is_indent_valid) { + throw parse_error("Detected invalid indentation.", line, indent); + } + + pop_num = static_cast(std::distance(m_context_stack.rbegin(), itr)); + } + + // move back to the parent block mapping. + for (uint32_t i = 0; i < pop_num; i++) { + m_context_stack.pop_back(); + } + mp_current_node = m_context_stack.back().p_node; } /// @brief Set YAML directive properties to the given node. diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 373119b7..3e0ff56e 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -1061,6 +1061,48 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(qux_2_node.is_string()); REQUIRE(qux_2_node.get_value_ref() == "b"); } + + // // regression test for https://github.com/fktn-k/fkYAML/issues/449 + SECTION("missing the \":\" mapping value indicator after key (root)") { + std::string input = "1:\n" + "1"; + + REQUIRE_THROWS_AS(root = deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); + } + + // regression test for https://github.com/fktn-k/fkYAML/issues/449 + SECTION("missing the \":\" mapping value indicator after key (nested)") { + std::string input = "abc:\n" + " def: ghi\n" + " jkl mno"; + + REQUIRE_THROWS_AS(root = deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); + } + + SECTION("block mapping which contains empty mapping values") { + std::string input = "foo:\n" + "bar:\n" + " foo:\n" + " bar:\n" + "baz:\n"; + + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 3); + REQUIRE(root.contains("foo")); + REQUIRE(root.contains("bar")); + REQUIRE(root.contains("baz")); + + REQUIRE(root["foo"].is_null()); + REQUIRE(root["bar"].is_mapping()); + REQUIRE(root["bar"].size() == 2); + REQUIRE(root["bar"].contains("foo")); + REQUIRE(root["bar"].contains("bar")); + REQUIRE(root["bar"]["foo"].is_null()); + REQUIRE(root["bar"]["bar"].is_null()); + REQUIRE(root["baz"].is_null()); + } } TEST_CASE("Deserializer_FlowContainerKey") { From 08462e2015d9627e7937f29e225723d2454cceff Mon Sep 17 00:00:00 2001 From: fktn Date: Mon, 30 Dec 2024 02:30:49 +0900 Subject: [PATCH 08/18] Fix bad indentation detection for block collection entries (#451) * detect bad indentation at block mapping entries * improved parse context management * detect error on too much indented block sequence entries * added test cases * fixed clang-tidy error * addressed coverage loss * run amalgamation * deleted unused lambda capture in the deserializer --- Makefile | 2 +- include/fkYAML/detail/input/deserializer.hpp | 245 ++++++++++++------- single_include/fkYAML/node.hpp | 245 ++++++++++++------- test/unit_test/test_deserializer_class.cpp | 125 +++++++++- 4 files changed, 431 insertions(+), 186 deletions(-) diff --git a/Makefile b/Makefile index f5c18590..57a33166 100644 --- a/Makefile +++ b/Makefile @@ -161,7 +161,7 @@ update-version: fkYAML.natvis update-project-version update-sources update-git-t # pre-requisites: lcov lcov-coverage: cmake -B build_coverage -S . -DCMAKE_BUILD_TYPE=Debug -DFK_YAML_CODE_COVERAGE=ON - cmake --build build_coverage --config Debug --target generate_test_coverage -j $(JOBS) + cmake --build build_coverage --config Debug --target generate_test_coverage # pre-requisites: genhtml lcov html-coverage: lcov-coverage diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index 6294a536..4b0aea13 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -56,6 +56,7 @@ class basic_deserializer { BLOCK_MAPPING_EXPLICIT_VALUE, //!< The underlying node is an explicit block mapping value. MAPPING_VALUE, //!< The underlying node is a block mapping value. BLOCK_SEQUENCE, //!< The underlying node is a block sequence. + BLOCK_SEQUENCE_ENTRY, //!< The underlying node is a block sequence entry. FLOW_SEQUENCE, //!< The underlying node is a flow sequence. FLOW_SEQUENCE_KEY, //!< The underlying node is a flow sequence as a key. FLOW_MAPPING, //!< The underlying node is a flow mapping. @@ -164,6 +165,7 @@ class basic_deserializer { lexical_token token {}; basic_node_type root; + mp_current_node = &root; mp_meta = root.mp_meta; // parse directives first. @@ -176,16 +178,24 @@ class basic_deserializer { switch (token.type) { case lexical_token_t::SEQUENCE_BLOCK_PREFIX: { - root = basic_node_type::sequence(); + root = basic_node_type::sequence({basic_node_type()}); apply_directive_set(root); if (found_props) { // If node properties are found before the block sequence entry prefix, the properties belong to the // root sequence node. apply_node_properties(root); } + parse_context context( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_SEQUENCE, &root); + m_context_stack.emplace_back(context); + + mp_current_node = &(root.template get_value_ref().back()); + apply_directive_set(*mp_current_node); + context.state = context_state_t::BLOCK_SEQUENCE_ENTRY; + context.p_node = mp_current_node; m_context_stack.emplace_back(std::move(context)); + token = lexer.get_next_token(); line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); @@ -264,8 +274,6 @@ class basic_deserializer { break; } - mp_current_node = &root; - // parse YAML nodes recursively deserialize_node(lexer, token, line, indent, last_type); FK_YAML_ASSERT( @@ -391,25 +399,31 @@ class basic_deserializer { case lexical_token_t::EXPLICIT_KEY_PREFIX: { const bool needs_to_move_back = indent == 0 || indent < m_context_stack.back().indent; if (needs_to_move_back) { - pop_to_parent_node(line, indent, [indent](const parse_context& c) { return indent > c.indent; }); + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return c.state == context_state_t::BLOCK_MAPPING && indent == c.indent; + }); } - if FK_YAML_UNLIKELY (mp_current_node->is_null()) { - // This path is needed in case the input contains nested explicit keys like the following YAML - // snippet: + switch (m_context_stack.back().state) { + case context_state_t::MAPPING_VALUE: + case context_state_t::BLOCK_MAPPING_EXPLICIT_KEY: + case context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE: + case context_state_t::BLOCK_SEQUENCE_ENTRY: + // This path is needed in case the input contains nested explicit keys. // ```yaml - // ? ? foo - // : bar - // : baz + // foo: + // ? ? foo + // : bar + // : ? baz + // : - ? qux + // : 123 // ``` *mp_current_node = basic_node_type::mapping(); apply_directive_set(*mp_current_node); - } - - if (m_context_stack.back().state == context_state_t::BLOCK_SEQUENCE) { - auto& seq = mp_current_node->template get_value_ref(); - seq.emplace_back(basic_node_type::mapping()); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, &(seq.back())); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); + break; + default: + break; } token = lexer.get_next_token(); @@ -417,14 +431,22 @@ class basic_deserializer { // heap-allocated node will be freed in handling the corresponding KEY_SEPARATOR event auto* p_node = new basic_node_type(node_type::SEQUENCE); m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING_EXPLICIT_KEY, p_node); - mp_current_node = m_context_stack.back().p_node; - apply_directive_set(*mp_current_node); + + apply_directive_set(*p_node); parse_context context( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_SEQUENCE, - mp_current_node); + p_node); + m_context_stack.emplace_back(context); + + p_node->template get_value_ref().emplace_back(basic_node_type()); + mp_current_node = &(p_node->template get_value_ref().back()); + apply_directive_set(*mp_current_node); + context.state = context_state_t::BLOCK_SEQUENCE_ENTRY; + context.p_node = mp_current_node; m_context_stack.emplace_back(std::move(context)); + break; } @@ -439,8 +461,12 @@ class basic_deserializer { continue; } case lexical_token_t::KEY_SEPARATOR: { - const bool is_empty_seq = mp_current_node->is_sequence() && mp_current_node->empty(); - if FK_YAML_UNLIKELY (is_empty_seq) { + FK_YAML_ASSERT(!m_context_stack.empty()); + if FK_YAML_UNLIKELY (m_context_stack.back().state == context_state_t::BLOCK_SEQUENCE_ENTRY) { + // empty mapping keys are not supported. + // ```yaml + // - : foo + // ``` throw parse_error("sequence key should not be empty.", line, indent); } @@ -495,7 +521,7 @@ class basic_deserializer { if (token.type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { // a key separator preceding block sequence entries - *mp_current_node = basic_node_type::sequence(); + *mp_current_node = basic_node_type::sequence({basic_node_type()}); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); auto& cur_context = m_context_stack.back(); @@ -503,6 +529,13 @@ class basic_deserializer { cur_context.indent = indent; cur_context.state = context_state_t::BLOCK_SEQUENCE; + mp_current_node = &(mp_current_node->template get_value_ref().back()); + apply_directive_set(*mp_current_node); + parse_context entry_context = cur_context; + entry_context.state = context_state_t::BLOCK_SEQUENCE_ENTRY; + entry_context.p_node = mp_current_node; + m_context_stack.emplace_back(std::move(entry_context)); + token = lexer.get_next_token(); line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); @@ -527,11 +560,10 @@ class basic_deserializer { // https://github.com/fktn-k/fkYAML/issues/368 for more details. line = line_after_props; indent = lexer.get_last_token_begin_pos(); - mp_current_node->template get_value_ref().emplace_back( - basic_node_type::mapping()); - mp_current_node = &mp_current_node->template get_value_ref().back(); + *mp_current_node = basic_node_type::mapping(); m_context_stack.emplace_back( line_after_props, indent, context_state_t::BLOCK_MAPPING, mp_current_node); + apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); } @@ -560,10 +592,7 @@ class basic_deserializer { } // handle explicit mapping key separators. - - while (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { - m_context_stack.pop_back(); - } + FK_YAML_ASSERT(m_context_stack.back().state == context_state_t::BLOCK_MAPPING_EXPLICIT_KEY); basic_node_type key_node = std::move(*m_context_stack.back().p_node); m_context_stack.pop_back(); @@ -571,13 +600,19 @@ class basic_deserializer { key_node, basic_node_type()); mp_current_node = &(m_context_stack.back().p_node->operator[](std::move(key_node))); m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE, mp_current_node); + old_line, old_indent, context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE, mp_current_node); if (token.type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { - *mp_current_node = basic_node_type::sequence(); + *mp_current_node = basic_node_type::sequence({basic_node_type()}); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE, mp_current_node); + + mp_current_node = &(mp_current_node->template get_value_ref().back()); + parse_context entry_context = m_context_stack.back(); + entry_context.state = context_state_t::BLOCK_SEQUENCE_ENTRY; + entry_context.p_node = mp_current_node; + m_context_stack.emplace_back(std::move(entry_context)); break; } @@ -597,22 +632,48 @@ class basic_deserializer { // ``` continue; case lexical_token_t::SEQUENCE_BLOCK_PREFIX: { - const bool is_further_nested = m_context_stack.back().indent < indent; - if (is_further_nested) { - mp_current_node->template get_value_ref().emplace_back(basic_node_type::sequence()); - mp_current_node = &(mp_current_node->template get_value_ref().back()); + FK_YAML_ASSERT(!m_context_stack.empty()); + const uint32_t parent_indent = m_context_stack.back().indent; + if (indent == parent_indent) { + // If the previous block sequence entry is empty, just move to the parent context. + // ```yaml + // foo: + // - + // - bar + // # ^ (here) + // # -> {foo: [null, bar]} + // ``` + pop_to_parent_node(line, indent, [](const parse_context& c) { + return c.state == context_state_t::BLOCK_SEQUENCE; + }); + } + else if (indent < parent_indent) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return c.state == context_state_t::BLOCK_SEQUENCE && indent == c.indent; + }); + } + else /*parent_indent < indent*/ { + if FK_YAML_UNLIKELY (m_context_stack.back().state == context_state_t::BLOCK_SEQUENCE) { + // bad indentation like the following YAML: + // ```yaml + // - "foo" + // - bar + // # ^ + // ``` + throw parse_error("bad indentation of a mapping entry.", line, indent); + } + + *mp_current_node = basic_node_type::sequence(); m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE, mp_current_node); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); - break; } - // move back to the previous sequence if necessary. - while (m_context_stack.back().state != context_state_t::BLOCK_SEQUENCE || - indent != m_context_stack.back().indent) { - m_context_stack.pop_back(); - } - mp_current_node = m_context_stack.back().p_node; + auto& seq = mp_current_node->template get_value_ref(); + seq.emplace_back(basic_node_type()); + mp_current_node = &(seq.back()); + apply_directive_set(*mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); break; } case lexical_token_t::SEQUENCE_FLOW_BEGIN: @@ -1027,20 +1088,30 @@ class basic_deserializer { /// @param indent The indentation width in the current line where the key is found. void add_new_key(basic_node_type&& key, const uint32_t line, const uint32_t indent) { if (m_flow_context_depth == 0) { - if (indent <= m_context_stack.back().indent) { - pop_to_parent_node(line, indent, [indent](const parse_context& c) { - return (c.state == context_state_t::BLOCK_MAPPING) && (indent == c.indent); - }); + if FK_YAML_UNLIKELY (m_context_stack.back().indent < indent) { + // bad indentation like the following YAML: + // ```yaml + // foo: true + // baz: 123 + // # ^ + // ``` + throw parse_error("bad indentation of a mapping entry.", line, indent); } + + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return (c.state == context_state_t::BLOCK_MAPPING) && (indent == c.indent); + }); } - else if FK_YAML_UNLIKELY (m_flow_token_state != flow_token_state_t::NEEDS_VALUE_OR_SUFFIX) { - throw parse_error("Flow mapping entry is found without separated with a comma.", line, indent); - } + else { + if FK_YAML_UNLIKELY (m_flow_token_state != flow_token_state_t::NEEDS_VALUE_OR_SUFFIX) { + throw parse_error("Flow mapping entry is found without separated with a comma.", line, indent); + } - if (mp_current_node->is_sequence()) { - mp_current_node->template get_value_ref().emplace_back(basic_node_type::mapping()); - mp_current_node = &(mp_current_node->operator[](mp_current_node->size() - 1)); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); + if (mp_current_node->is_sequence()) { + mp_current_node->template get_value_ref().emplace_back(basic_node_type::mapping()); + mp_current_node = &(mp_current_node->operator[](mp_current_node->size() - 1)); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); + } } auto itr = mp_current_node->template get_value_ref().emplace(std::move(key), basic_node_type()); @@ -1058,34 +1129,36 @@ class basic_deserializer { /// @param node_value A rvalue basic_node_type object to be assigned to the current node. void assign_node_value(basic_node_type&& node_value, const uint32_t line, const uint32_t indent) { if (mp_current_node->is_sequence()) { - if (m_flow_context_depth > 0) { - if FK_YAML_UNLIKELY (m_flow_token_state != flow_token_state_t::NEEDS_VALUE_OR_SUFFIX) { - throw parse_error("flow sequence entry is found without separated with a comma.", line, indent); - } - m_flow_token_state = flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX; + FK_YAML_ASSERT(m_flow_context_depth > 0); + + if FK_YAML_UNLIKELY (m_flow_token_state != flow_token_state_t::NEEDS_VALUE_OR_SUFFIX) { + // Flow sequence entries are not allowed to be empty. + // ```yaml + // [foo,,bar] + // ``` + throw parse_error("flow sequence entry is found without separated with a comma.", line, indent); } mp_current_node->template get_value_ref().emplace_back(std::move(node_value)); + m_flow_token_state = flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX; return; } // a scalar node *mp_current_node = std::move(node_value); - if FK_YAML_LIKELY (!m_context_stack.empty()) { - if (m_flow_context_depth > 0 || - m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { - m_context_stack.pop_back(); - mp_current_node = m_context_stack.back().p_node; - - if (m_flow_context_depth > 0) { - m_flow_token_state = flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX; - } - } - } - else { + if FK_YAML_UNLIKELY (m_context_stack.empty()) { // single scalar document. return; } + + if FK_YAML_LIKELY (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { + m_context_stack.pop_back(); + mp_current_node = m_context_stack.back().p_node; + + if (m_flow_context_depth > 0) { + m_flow_token_state = flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX; + } + } } /// @brief Deserialize a detected scalar node. @@ -1112,19 +1185,20 @@ class basic_deserializer { else if (token.type == lexical_token_t::KEY_SEPARATOR) { if FK_YAML_UNLIKELY (line != lexer.get_lines_processed()) { // This path is for explicit mapping key separator like: - // // ```yaml // ? foo // : bar // # ^ this separator // ``` assign_node_value(std::move(node), line, indent); - if (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { - mp_current_node = m_context_stack.back().p_node; - m_context_stack.pop_back(); - } indent = lexer.get_last_token_begin_pos(); line = lexer.get_lines_processed(); + + if (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return c.state == context_state_t::BLOCK_MAPPING_EXPLICIT_KEY && indent == c.indent; + }); + } return; } @@ -1134,6 +1208,7 @@ class basic_deserializer { switch (cur_context.state) { case context_state_t::BLOCK_MAPPING_EXPLICIT_KEY: case context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE: + case context_state_t::BLOCK_SEQUENCE_ENTRY: m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); break; default: @@ -1185,21 +1260,15 @@ class basic_deserializer { void pop_to_parent_node(uint32_t line, uint32_t indent, Pred&& pred) { FK_YAML_ASSERT(!m_context_stack.empty()); - uint32_t pop_num = 0; - if (indent == 0) { - pop_num = static_cast(m_context_stack.size() - 1); + // LCOV_EXCL_START + auto itr = std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), std::forward(pred)); + // LCOV_EXCL_STOP + const bool is_indent_valid = (itr != m_context_stack.rend()); + if FK_YAML_UNLIKELY (!is_indent_valid) { + throw parse_error("Detected invalid indentation.", line, indent); } - else { - // LCOV_EXCL_START - auto itr = std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), std::forward(pred)); - // LCOV_EXCL_STOP - const bool is_indent_valid = (itr != m_context_stack.rend()); - if FK_YAML_UNLIKELY (!is_indent_valid) { - throw parse_error("Detected invalid indentation.", line, indent); - } - pop_num = static_cast(std::distance(m_context_stack.rbegin(), itr)); - } + const auto pop_num = static_cast(std::distance(m_context_stack.rbegin(), itr)); // move back to the parent block mapping. for (uint32_t i = 0; i < pop_num; i++) { diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 40091bb2..58506df1 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -7063,6 +7063,7 @@ class basic_deserializer { BLOCK_MAPPING_EXPLICIT_VALUE, //!< The underlying node is an explicit block mapping value. MAPPING_VALUE, //!< The underlying node is a block mapping value. BLOCK_SEQUENCE, //!< The underlying node is a block sequence. + BLOCK_SEQUENCE_ENTRY, //!< The underlying node is a block sequence entry. FLOW_SEQUENCE, //!< The underlying node is a flow sequence. FLOW_SEQUENCE_KEY, //!< The underlying node is a flow sequence as a key. FLOW_MAPPING, //!< The underlying node is a flow mapping. @@ -7171,6 +7172,7 @@ class basic_deserializer { lexical_token token {}; basic_node_type root; + mp_current_node = &root; mp_meta = root.mp_meta; // parse directives first. @@ -7183,16 +7185,24 @@ class basic_deserializer { switch (token.type) { case lexical_token_t::SEQUENCE_BLOCK_PREFIX: { - root = basic_node_type::sequence(); + root = basic_node_type::sequence({basic_node_type()}); apply_directive_set(root); if (found_props) { // If node properties are found before the block sequence entry prefix, the properties belong to the // root sequence node. apply_node_properties(root); } + parse_context context( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_SEQUENCE, &root); + m_context_stack.emplace_back(context); + + mp_current_node = &(root.template get_value_ref().back()); + apply_directive_set(*mp_current_node); + context.state = context_state_t::BLOCK_SEQUENCE_ENTRY; + context.p_node = mp_current_node; m_context_stack.emplace_back(std::move(context)); + token = lexer.get_next_token(); line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); @@ -7271,8 +7281,6 @@ class basic_deserializer { break; } - mp_current_node = &root; - // parse YAML nodes recursively deserialize_node(lexer, token, line, indent, last_type); FK_YAML_ASSERT( @@ -7398,25 +7406,31 @@ class basic_deserializer { case lexical_token_t::EXPLICIT_KEY_PREFIX: { const bool needs_to_move_back = indent == 0 || indent < m_context_stack.back().indent; if (needs_to_move_back) { - pop_to_parent_node(line, indent, [indent](const parse_context& c) { return indent > c.indent; }); + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return c.state == context_state_t::BLOCK_MAPPING && indent == c.indent; + }); } - if FK_YAML_UNLIKELY (mp_current_node->is_null()) { - // This path is needed in case the input contains nested explicit keys like the following YAML - // snippet: + switch (m_context_stack.back().state) { + case context_state_t::MAPPING_VALUE: + case context_state_t::BLOCK_MAPPING_EXPLICIT_KEY: + case context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE: + case context_state_t::BLOCK_SEQUENCE_ENTRY: + // This path is needed in case the input contains nested explicit keys. // ```yaml - // ? ? foo - // : bar - // : baz + // foo: + // ? ? foo + // : bar + // : ? baz + // : - ? qux + // : 123 // ``` *mp_current_node = basic_node_type::mapping(); apply_directive_set(*mp_current_node); - } - - if (m_context_stack.back().state == context_state_t::BLOCK_SEQUENCE) { - auto& seq = mp_current_node->template get_value_ref(); - seq.emplace_back(basic_node_type::mapping()); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, &(seq.back())); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); + break; + default: + break; } token = lexer.get_next_token(); @@ -7424,14 +7438,22 @@ class basic_deserializer { // heap-allocated node will be freed in handling the corresponding KEY_SEPARATOR event auto* p_node = new basic_node_type(node_type::SEQUENCE); m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING_EXPLICIT_KEY, p_node); - mp_current_node = m_context_stack.back().p_node; - apply_directive_set(*mp_current_node); + + apply_directive_set(*p_node); parse_context context( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_SEQUENCE, - mp_current_node); + p_node); + m_context_stack.emplace_back(context); + + p_node->template get_value_ref().emplace_back(basic_node_type()); + mp_current_node = &(p_node->template get_value_ref().back()); + apply_directive_set(*mp_current_node); + context.state = context_state_t::BLOCK_SEQUENCE_ENTRY; + context.p_node = mp_current_node; m_context_stack.emplace_back(std::move(context)); + break; } @@ -7446,8 +7468,12 @@ class basic_deserializer { continue; } case lexical_token_t::KEY_SEPARATOR: { - const bool is_empty_seq = mp_current_node->is_sequence() && mp_current_node->empty(); - if FK_YAML_UNLIKELY (is_empty_seq) { + FK_YAML_ASSERT(!m_context_stack.empty()); + if FK_YAML_UNLIKELY (m_context_stack.back().state == context_state_t::BLOCK_SEQUENCE_ENTRY) { + // empty mapping keys are not supported. + // ```yaml + // - : foo + // ``` throw parse_error("sequence key should not be empty.", line, indent); } @@ -7502,7 +7528,7 @@ class basic_deserializer { if (token.type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { // a key separator preceding block sequence entries - *mp_current_node = basic_node_type::sequence(); + *mp_current_node = basic_node_type::sequence({basic_node_type()}); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); auto& cur_context = m_context_stack.back(); @@ -7510,6 +7536,13 @@ class basic_deserializer { cur_context.indent = indent; cur_context.state = context_state_t::BLOCK_SEQUENCE; + mp_current_node = &(mp_current_node->template get_value_ref().back()); + apply_directive_set(*mp_current_node); + parse_context entry_context = cur_context; + entry_context.state = context_state_t::BLOCK_SEQUENCE_ENTRY; + entry_context.p_node = mp_current_node; + m_context_stack.emplace_back(std::move(entry_context)); + token = lexer.get_next_token(); line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); @@ -7534,11 +7567,10 @@ class basic_deserializer { // https://github.com/fktn-k/fkYAML/issues/368 for more details. line = line_after_props; indent = lexer.get_last_token_begin_pos(); - mp_current_node->template get_value_ref().emplace_back( - basic_node_type::mapping()); - mp_current_node = &mp_current_node->template get_value_ref().back(); + *mp_current_node = basic_node_type::mapping(); m_context_stack.emplace_back( line_after_props, indent, context_state_t::BLOCK_MAPPING, mp_current_node); + apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); } @@ -7567,10 +7599,7 @@ class basic_deserializer { } // handle explicit mapping key separators. - - while (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { - m_context_stack.pop_back(); - } + FK_YAML_ASSERT(m_context_stack.back().state == context_state_t::BLOCK_MAPPING_EXPLICIT_KEY); basic_node_type key_node = std::move(*m_context_stack.back().p_node); m_context_stack.pop_back(); @@ -7578,13 +7607,19 @@ class basic_deserializer { key_node, basic_node_type()); mp_current_node = &(m_context_stack.back().p_node->operator[](std::move(key_node))); m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE, mp_current_node); + old_line, old_indent, context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE, mp_current_node); if (token.type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { - *mp_current_node = basic_node_type::sequence(); + *mp_current_node = basic_node_type::sequence({basic_node_type()}); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE, mp_current_node); + + mp_current_node = &(mp_current_node->template get_value_ref().back()); + parse_context entry_context = m_context_stack.back(); + entry_context.state = context_state_t::BLOCK_SEQUENCE_ENTRY; + entry_context.p_node = mp_current_node; + m_context_stack.emplace_back(std::move(entry_context)); break; } @@ -7604,22 +7639,48 @@ class basic_deserializer { // ``` continue; case lexical_token_t::SEQUENCE_BLOCK_PREFIX: { - const bool is_further_nested = m_context_stack.back().indent < indent; - if (is_further_nested) { - mp_current_node->template get_value_ref().emplace_back(basic_node_type::sequence()); - mp_current_node = &(mp_current_node->template get_value_ref().back()); + FK_YAML_ASSERT(!m_context_stack.empty()); + const uint32_t parent_indent = m_context_stack.back().indent; + if (indent == parent_indent) { + // If the previous block sequence entry is empty, just move to the parent context. + // ```yaml + // foo: + // - + // - bar + // # ^ (here) + // # -> {foo: [null, bar]} + // ``` + pop_to_parent_node(line, indent, [](const parse_context& c) { + return c.state == context_state_t::BLOCK_SEQUENCE; + }); + } + else if (indent < parent_indent) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return c.state == context_state_t::BLOCK_SEQUENCE && indent == c.indent; + }); + } + else /*parent_indent < indent*/ { + if FK_YAML_UNLIKELY (m_context_stack.back().state == context_state_t::BLOCK_SEQUENCE) { + // bad indentation like the following YAML: + // ```yaml + // - "foo" + // - bar + // # ^ + // ``` + throw parse_error("bad indentation of a mapping entry.", line, indent); + } + + *mp_current_node = basic_node_type::sequence(); m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE, mp_current_node); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); - break; } - // move back to the previous sequence if necessary. - while (m_context_stack.back().state != context_state_t::BLOCK_SEQUENCE || - indent != m_context_stack.back().indent) { - m_context_stack.pop_back(); - } - mp_current_node = m_context_stack.back().p_node; + auto& seq = mp_current_node->template get_value_ref(); + seq.emplace_back(basic_node_type()); + mp_current_node = &(seq.back()); + apply_directive_set(*mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); break; } case lexical_token_t::SEQUENCE_FLOW_BEGIN: @@ -8034,20 +8095,30 @@ class basic_deserializer { /// @param indent The indentation width in the current line where the key is found. void add_new_key(basic_node_type&& key, const uint32_t line, const uint32_t indent) { if (m_flow_context_depth == 0) { - if (indent <= m_context_stack.back().indent) { - pop_to_parent_node(line, indent, [indent](const parse_context& c) { - return (c.state == context_state_t::BLOCK_MAPPING) && (indent == c.indent); - }); + if FK_YAML_UNLIKELY (m_context_stack.back().indent < indent) { + // bad indentation like the following YAML: + // ```yaml + // foo: true + // baz: 123 + // # ^ + // ``` + throw parse_error("bad indentation of a mapping entry.", line, indent); } + + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return (c.state == context_state_t::BLOCK_MAPPING) && (indent == c.indent); + }); } - else if FK_YAML_UNLIKELY (m_flow_token_state != flow_token_state_t::NEEDS_VALUE_OR_SUFFIX) { - throw parse_error("Flow mapping entry is found without separated with a comma.", line, indent); - } + else { + if FK_YAML_UNLIKELY (m_flow_token_state != flow_token_state_t::NEEDS_VALUE_OR_SUFFIX) { + throw parse_error("Flow mapping entry is found without separated with a comma.", line, indent); + } - if (mp_current_node->is_sequence()) { - mp_current_node->template get_value_ref().emplace_back(basic_node_type::mapping()); - mp_current_node = &(mp_current_node->operator[](mp_current_node->size() - 1)); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); + if (mp_current_node->is_sequence()) { + mp_current_node->template get_value_ref().emplace_back(basic_node_type::mapping()); + mp_current_node = &(mp_current_node->operator[](mp_current_node->size() - 1)); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); + } } auto itr = mp_current_node->template get_value_ref().emplace(std::move(key), basic_node_type()); @@ -8065,34 +8136,36 @@ class basic_deserializer { /// @param node_value A rvalue basic_node_type object to be assigned to the current node. void assign_node_value(basic_node_type&& node_value, const uint32_t line, const uint32_t indent) { if (mp_current_node->is_sequence()) { - if (m_flow_context_depth > 0) { - if FK_YAML_UNLIKELY (m_flow_token_state != flow_token_state_t::NEEDS_VALUE_OR_SUFFIX) { - throw parse_error("flow sequence entry is found without separated with a comma.", line, indent); - } - m_flow_token_state = flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX; + FK_YAML_ASSERT(m_flow_context_depth > 0); + + if FK_YAML_UNLIKELY (m_flow_token_state != flow_token_state_t::NEEDS_VALUE_OR_SUFFIX) { + // Flow sequence entries are not allowed to be empty. + // ```yaml + // [foo,,bar] + // ``` + throw parse_error("flow sequence entry is found without separated with a comma.", line, indent); } mp_current_node->template get_value_ref().emplace_back(std::move(node_value)); + m_flow_token_state = flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX; return; } // a scalar node *mp_current_node = std::move(node_value); - if FK_YAML_LIKELY (!m_context_stack.empty()) { - if (m_flow_context_depth > 0 || - m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { - m_context_stack.pop_back(); - mp_current_node = m_context_stack.back().p_node; - - if (m_flow_context_depth > 0) { - m_flow_token_state = flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX; - } - } - } - else { + if FK_YAML_UNLIKELY (m_context_stack.empty()) { // single scalar document. return; } + + if FK_YAML_LIKELY (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { + m_context_stack.pop_back(); + mp_current_node = m_context_stack.back().p_node; + + if (m_flow_context_depth > 0) { + m_flow_token_state = flow_token_state_t::NEEDS_SEPARATOR_OR_SUFFIX; + } + } } /// @brief Deserialize a detected scalar node. @@ -8119,19 +8192,20 @@ class basic_deserializer { else if (token.type == lexical_token_t::KEY_SEPARATOR) { if FK_YAML_UNLIKELY (line != lexer.get_lines_processed()) { // This path is for explicit mapping key separator like: - // // ```yaml // ? foo // : bar // # ^ this separator // ``` assign_node_value(std::move(node), line, indent); - if (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { - mp_current_node = m_context_stack.back().p_node; - m_context_stack.pop_back(); - } indent = lexer.get_last_token_begin_pos(); line = lexer.get_lines_processed(); + + if (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { + pop_to_parent_node(line, indent, [indent](const parse_context& c) { + return c.state == context_state_t::BLOCK_MAPPING_EXPLICIT_KEY && indent == c.indent; + }); + } return; } @@ -8141,6 +8215,7 @@ class basic_deserializer { switch (cur_context.state) { case context_state_t::BLOCK_MAPPING_EXPLICIT_KEY: case context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE: + case context_state_t::BLOCK_SEQUENCE_ENTRY: m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); break; default: @@ -8192,21 +8267,15 @@ class basic_deserializer { void pop_to_parent_node(uint32_t line, uint32_t indent, Pred&& pred) { FK_YAML_ASSERT(!m_context_stack.empty()); - uint32_t pop_num = 0; - if (indent == 0) { - pop_num = static_cast(m_context_stack.size() - 1); + // LCOV_EXCL_START + auto itr = std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), std::forward(pred)); + // LCOV_EXCL_STOP + const bool is_indent_valid = (itr != m_context_stack.rend()); + if FK_YAML_UNLIKELY (!is_indent_valid) { + throw parse_error("Detected invalid indentation.", line, indent); } - else { - // LCOV_EXCL_START - auto itr = std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), std::forward(pred)); - // LCOV_EXCL_STOP - const bool is_indent_valid = (itr != m_context_stack.rend()); - if FK_YAML_UNLIKELY (!is_indent_valid) { - throw parse_error("Detected invalid indentation.", line, indent); - } - pop_num = static_cast(std::distance(m_context_stack.rbegin(), itr)); - } + const auto pop_num = static_cast(std::distance(m_context_stack.rbegin(), itr)); // move back to the parent block mapping. for (uint32_t i = 0; i < pop_num; i++) { diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 3e0ff56e..88d565c5 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -315,15 +315,6 @@ TEST_CASE("Deserializer_ScalarConversionErrorHandling") { REQUIRE_THROWS_AS(root = deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); } -TEST_CASE("Deserializer_InvalidIndentation") { - fkyaml::detail::basic_deserializer deserializer; - fkyaml::node root; - - REQUIRE_THROWS_AS( - root = deserializer.deserialize(fkyaml::detail::input_adapter("foo:\n bar: baz\n qux: true")), - fkyaml::parse_error); -} - TEST_CASE("Deserializer_DuplicateKeys") { fkyaml::detail::basic_deserializer deserializer; fkyaml::node root; @@ -703,6 +694,27 @@ TEST_CASE("Deserializer_BlockSequence") { REQUIRE(foo_baz_node.is_boolean()); REQUIRE(foo_baz_node.get_value() == true); } + + SECTION("empty block sequence entries") { + std::string input = "- -\n" + " - 123\n" + " -\n" + "-\n"; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_sequence()); + REQUIRE(root.size() == 2); + + fkyaml::node& root_0 = root[0]; + REQUIRE(root_0.is_sequence()); + REQUIRE(root_0.size() == 3); + REQUIRE(root_0[0].is_null()); + REQUIRE(root_0[1].is_integer()); + REQUIRE(root_0[1].get_value() == 123); + REQUIRE(root_0[2].is_null()); + + REQUIRE(root[1].is_null()); + } } TEST_CASE("Deserializer_BlockMapping") { @@ -1622,6 +1634,42 @@ TEST_CASE("Deserializer_ExplicitBlockMapping") { REQUIRE(root_2_bazfalse_456_seqmapkey_0_qux789_mapkey_node.is_float_number()); REQUIRE(root_2_bazfalse_456_seqmapkey_0_qux789_mapkey_node.get_value() == 1.41); } + + SECTION("nested explicit mapping keys in various ways") { + std::string input = "foo:\n" + " ? ? foo\n" + " : bar\n" + " : ? baz\n" + " : - ? qux\n" + " : 123\n"; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("foo")); + + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_mapping()); + REQUIRE(foo_node.size() == 1); + fkyaml::node map_key = {{"foo", "bar"}}; + REQUIRE(foo_node.contains(map_key)); + + fkyaml::node& foo_inner_node = foo_node[map_key]; + REQUIRE(foo_inner_node.is_mapping()); + REQUIRE(foo_inner_node.size() == 1); + REQUIRE(foo_inner_node.contains("baz")); + + fkyaml::node& foo_inner_baz_node = foo_inner_node["baz"]; + REQUIRE(foo_inner_baz_node.is_sequence()); + REQUIRE(foo_inner_baz_node.size() == 1); + + fkyaml::node& foo_inner_baz_0_node = foo_inner_baz_node[0]; + REQUIRE(foo_inner_baz_0_node.is_mapping()); + REQUIRE(foo_inner_baz_0_node.size() == 1); + REQUIRE(foo_inner_baz_0_node.contains("qux")); + REQUIRE(foo_inner_baz_0_node["qux"].is_integer()); + REQUIRE(foo_inner_baz_0_node["qux"].get_value() == 123); + } } TEST_CASE("Deserializer_FlowSequence") { @@ -2104,6 +2152,65 @@ TEST_CASE("Deserializer_FlowMapping") { } } +TEST_CASE("Deserializer_BadIndentation") { + fkyaml::detail::basic_deserializer deserializer; + fkyaml::node root; + + SECTION("implicit mapping entries") { + std::string input = "abc: def ghi\n" + " jkl: mno"; + + REQUIRE_THROWS_AS(root = deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); + } + + SECTION("nested implicit mapping entry with too much indentation") { + std::string input = "abc:\n" + " def: ghi\n" + " jkl: mno"; + + REQUIRE_THROWS_AS(root = deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); + } + + SECTION("nested implicit mapping entry with less indentation") { + std::string input = "foo:\n" + " bar: baz\n" + " qux: true"; + + REQUIRE_THROWS_AS(root = deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); + } + + // regression test for https://github.com/fktn-k/fkYAML/issues/449 + SECTION("implicit mapping entries with a value on a separate line") { + std::string input = "abc:\n" + " def ghi\n" + " jkl: mno"; + + REQUIRE_THROWS_AS(root = deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); + } + + SECTION("explicit mapping entry with an implicit mapping as its key") { + std::string input = "? abc: def\n" + " def: ghi\n" + ": jkl: mno"; + + REQUIRE_THROWS_AS(root = deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); + } + + SECTION("block sequence entries") { + std::string input = "- \"abc\"\n" + " - def"; + + REQUIRE_THROWS_AS(root = deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); + } + + SECTION("nested block sequence entries") { + std::string input = "- - \"abc\"\n" + " - def\n"; + + REQUIRE_THROWS_AS(root = deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); + } +} + TEST_CASE("Deserializer_InputWithComment") { fkyaml::detail::basic_deserializer deserializer; fkyaml::node root; From 8633c19deb1e1a7f256fe24e7d1b8e5b631246e8 Mon Sep 17 00:00:00 2001 From: fktn Date: Thu, 2 Jan 2025 23:51:55 +0900 Subject: [PATCH 09/18] Update copyright year and directory structure (#452) * updated copyright year * rename: test -> tests, tool -> tools * moved files for documentation * moved project documentation files to the .github directory * fixed path for coverage * fixed paths in the script files --- CODEOWNERS => .github/CODEOWNERS | 0 .../CODE_OF_CONDUCT.md | 0 CONTRIBUTING.md => .github/CONTRIBUTING.md | 0 SECURITY.md => .github/SECURITY.md | 0 .gitignore | 6 +- CMakeLists.txt | 10 +- LICENSE.txt | 2 +- Makefile | 24 ++--- README.md | 2 +- REUSE.toml | 2 +- docs/{mkdocs => }/Makefile | 0 .../docs/api/basic_node/add_anchor_name.md | 4 +- .../docs/api/basic_node/add_tag_name.md | 4 +- .../docs/api/basic_node/alias_of.md | 4 +- docs/{mkdocs => }/docs/api/basic_node/at.md | 8 +- .../{mkdocs => }/docs/api/basic_node/begin.md | 4 +- .../docs/api/basic_node/boolean_type.md | 4 +- .../docs/api/basic_node/constructor.md | 28 +++--- .../docs/api/basic_node/contains.md | 4 +- .../docs/api/basic_node/deserialize.md | 18 ++-- .../docs/api/basic_node/deserialize_docs.md | 18 ++-- .../docs/api/basic_node/destructor.md | 0 .../{mkdocs => }/docs/api/basic_node/empty.md | 4 +- docs/{mkdocs => }/docs/api/basic_node/end.md | 4 +- .../api/basic_node/extraction_operator.md | 6 +- .../docs/api/basic_node/float_number_type.md | 4 +- .../docs/api/basic_node/get_anchor_name.md | 4 +- .../docs/api/basic_node/get_tag_name.md | 4 +- .../docs/api/basic_node/get_type.md | 4 +- .../docs/api/basic_node/get_value.md | 4 +- .../docs/api/basic_node/get_value_inplace.md | 4 +- .../docs/api/basic_node/get_value_ref.md | 4 +- .../docs/api/basic_node/get_yaml_version.md | 4 +- .../api/basic_node/get_yaml_version_type.md | 4 +- .../docs/api/basic_node/has_anchor_name.md | 4 +- .../docs/api/basic_node/has_tag_name.md | 4 +- .../{mkdocs => }/docs/api/basic_node/index.md | 0 .../docs/api/basic_node/insertion_operator.md | 4 +- .../docs/api/basic_node/integer_type.md | 4 +- .../docs/api/basic_node/is_alias.md | 4 +- .../docs/api/basic_node/is_anchor.md | 4 +- .../docs/api/basic_node/is_boolean.md | 4 +- .../docs/api/basic_node/is_float_number.md | 4 +- .../docs/api/basic_node/is_integer.md | 4 +- .../docs/api/basic_node/is_mapping.md | 4 +- .../docs/api/basic_node/is_null.md | 4 +- .../docs/api/basic_node/is_scalar.md | 4 +- .../docs/api/basic_node/is_sequence.md | 4 +- .../docs/api/basic_node/is_string.md | 4 +- .../docs/api/basic_node/iterator.md | 4 +- .../docs/api/basic_node/mapping.md | 4 +- .../docs/api/basic_node/mapping_type.md | 4 +- docs/{mkdocs => }/docs/api/basic_node/node.md | 4 +- .../docs/api/basic_node/node_t.md | 4 +- .../docs/api/basic_node/operator=.md | 8 +- .../docs/api/basic_node/operator[].md | 8 +- .../docs/api/basic_node/operator_eq.md | 4 +- .../docs/api/basic_node/operator_ge.md | 4 +- .../docs/api/basic_node/operator_gt.md | 4 +- .../docs/api/basic_node/operator_le.md | 4 +- .../docs/api/basic_node/operator_lt.md | 4 +- .../docs/api/basic_node/operator_ne.md | 4 +- .../docs/api/basic_node/rbegin.md | 4 +- docs/{mkdocs => }/docs/api/basic_node/rend.md | 4 +- .../docs/api/basic_node/reverse_iterator.md | 4 +- .../docs/api/basic_node/sequence.md | 4 +- .../docs/api/basic_node/sequence_type.md | 4 +- .../docs/api/basic_node/serialize.md | 4 +- .../docs/api/basic_node/serialize_docs.md | 4 +- .../docs/api/basic_node/set_yaml_version.md | 4 +- .../api/basic_node/set_yaml_version_type.md | 4 +- docs/{mkdocs => }/docs/api/basic_node/size.md | 4 +- .../docs/api/basic_node/string_type.md | 4 +- docs/{mkdocs => }/docs/api/basic_node/swap.md | 8 +- docs/{mkdocs => }/docs/api/basic_node/type.md | 4 +- .../api/basic_node/value_converter_type.md | 4 +- .../docs/api/basic_node/yaml_version_t.md | 4 +- .../docs/api/exception/constructor.md | 8 +- .../docs/api/exception/destructor.md | 0 docs/{mkdocs => }/docs/api/exception/index.md | 0 .../docs/api/exception/invalid_encoding.md | 0 .../docs/api/exception/invalid_tag.md | 0 .../docs/api/exception/out_of_range.md | 0 .../docs/api/exception/parse_error.md | 0 .../docs/api/exception/type_error.md | 0 docs/{mkdocs => }/docs/api/exception/what.md | 4 +- docs/{mkdocs => }/docs/api/index.md | 0 docs/{mkdocs => }/docs/api/macros.md | 4 +- docs/{mkdocs => }/docs/api/node_type.md | 4 +- .../api/node_value_converter/from_node.md | 4 +- .../docs/api/node_value_converter/index.md | 0 .../docs/api/node_value_converter/to_node.md | 4 +- .../docs/api/operator_literal_yaml.md | 4 +- docs/{mkdocs => }/docs/api/ordered_map/at.md | 4 +- .../docs/api/ordered_map/constructor.md | 8 +- .../docs/api/ordered_map/destructor.md | 0 .../docs/api/ordered_map/emplace.md | 4 +- .../{mkdocs => }/docs/api/ordered_map/find.md | 4 +- .../docs/api/ordered_map/index.md | 0 .../docs/api/ordered_map/operator[].md | 4 +- .../docs/api/yaml_version_type.md | 4 +- .../docs/home/community_support.md | 0 docs/{mkdocs => }/docs/home/license.md | 2 +- docs/{mkdocs => }/docs/home/releases.md | 0 .../docs/home/supported_compilers.md | 0 .../{mkdocs => }/docs/img/range-begin-end.svg | 0 .../docs/img/range-rbegin-rend.svg | 0 docs/{mkdocs => }/docs/index.md | 0 docs/{mkdocs => }/docs/javascripts/config.js | 0 .../docs/tutorials/cmake_integration.md | 0 docs/{mkdocs => }/docs/tutorials/index.md | 18 ++-- docs/examples/CMakeLists.txt | 69 ------------- docs/{mkdocs => }/mkdocs.yml | 4 +- docs/{mkdocs => }/requirements.txt | 0 examples/CMakeLists.txt | 40 ++++++++ examples/apis/CMakeLists.txt | 10 ++ examples/apis/basic_node/CMakeLists.txt | 16 +++ .../apis/basic_node/add_anchor_name.cpp | 2 +- .../apis/basic_node/add_anchor_name.output | 0 .../apis/basic_node/add_tag_name.cpp | 2 +- .../apis/basic_node/add_tag_name.output | 0 .../apis/basic_node/alias_of.cpp | 2 +- .../apis/basic_node/alias_of.output | 0 .../apis/basic_node/at_basic_node.cpp | 2 +- .../apis/basic_node/at_basic_node.output | 0 .../apis/basic_node/at_compatible_type.cpp | 2 +- .../apis/basic_node/at_compatible_type.output | 0 .../apis/basic_node/begin.cpp | 2 +- .../apis/basic_node/begin.output | 0 .../apis/basic_node/boolean_type.cpp | 2 +- .../apis/basic_node/boolean_type.output | 0 .../apis/basic_node/constructor_1.cpp | 2 +- .../apis/basic_node/constructor_1.output | 0 .../apis/basic_node/constructor_2.cpp | 2 +- .../apis/basic_node/constructor_2.output | 0 .../apis/basic_node/constructor_3.cpp | 2 +- .../apis/basic_node/constructor_3.output | 0 .../apis/basic_node/constructor_4.cpp | 2 +- .../apis/basic_node/constructor_4.output | 0 .../apis/basic_node/constructor_5.cpp | 2 +- .../apis/basic_node/constructor_5.output | 0 .../apis/basic_node/constructor_6.cpp | 2 +- .../apis/basic_node/constructor_6.output | 0 .../apis/basic_node/constructor_7.cpp | 2 +- .../apis/basic_node/constructor_7.output | 0 .../apis/basic_node/contains.cpp | 2 +- .../apis/basic_node/contains.output | 0 .../basic_node/copy_assignment_operator.cpp | 2 +- .../copy_assignment_operator.output | 0 .../basic_node/deserialize_char_array.cpp | 2 +- .../basic_node/deserialize_char_array.output | 0 .../deserialize_docs_char_array.cpp | 2 +- .../deserialize_docs_char_array.output | 0 .../deserialize_docs_file_pointer.cpp | 2 +- .../deserialize_docs_file_pointer.output | 0 .../basic_node/deserialize_docs_iterators.cpp | 2 +- .../deserialize_docs_iterators.output | 0 .../basic_node/deserialize_docs_string.cpp | 2 +- .../basic_node/deserialize_docs_string.output | 0 .../basic_node/deserialize_file_pointer.cpp | 2 +- .../deserialize_file_pointer.output | 0 .../apis/basic_node/deserialize_iterators.cpp | 2 +- .../basic_node/deserialize_iterators.output | 0 .../apis/basic_node/deserialize_string.cpp | 2 +- .../apis/basic_node/deserialize_string.output | 0 .../apis/basic_node/empty.cpp | 2 +- .../apis/basic_node/empty.output | 0 .../apis/basic_node/end.cpp | 2 +- .../apis/basic_node/end.output | 0 .../apis/basic_node/extraction_operator.cpp | 2 +- .../basic_node/extraction_operator.output | 0 .../apis/basic_node/float_number_type.cpp | 2 +- .../apis/basic_node/float_number_type.output | 0 .../apis/basic_node/get_anchor_name.cpp | 2 +- .../apis/basic_node/get_anchor_name.output | 0 .../apis/basic_node/get_tag_name.cpp | 2 +- .../apis/basic_node/get_tag_name.output | 0 .../apis/basic_node/get_type.cpp | 2 +- .../apis/basic_node/get_type.output | 0 .../apis/basic_node/get_value.cpp | 2 +- .../apis/basic_node/get_value.output | 0 .../apis/basic_node/get_value_inplace.cpp | 2 +- .../apis/basic_node/get_value_inplace.output | 0 .../apis/basic_node/get_value_ref.cpp | 2 +- .../apis/basic_node/get_value_ref.output | 0 .../apis/basic_node/get_yaml_version.cpp | 2 +- .../apis/basic_node/get_yaml_version.output | 0 .../apis/basic_node/get_yaml_version_type.cpp | 2 +- .../basic_node/get_yaml_version_type.output | 0 .../apis/basic_node/has_anchor_name.cpp | 2 +- .../apis/basic_node/has_anchor_name.output | 0 .../apis/basic_node/has_tag_name.cpp | 2 +- .../apis/basic_node/has_tag_name.output | 0 .../apis/basic_node/insertion_operator.cpp | 2 +- .../apis/basic_node/insertion_operator.output | 0 .../apis/basic_node/integer_type.cpp | 2 +- .../apis/basic_node/integer_type.output | 0 .../apis/basic_node/is_alias.cpp | 2 +- .../apis/basic_node/is_alias.output | 0 .../apis/basic_node/is_anchor.cpp | 2 +- .../apis/basic_node/is_anchor.output | 0 .../apis/basic_node/is_boolean.cpp | 2 +- .../apis/basic_node/is_boolean.output | 0 .../apis/basic_node/is_float_number.cpp | 2 +- .../apis/basic_node/is_float_number.output | 0 .../apis/basic_node/is_integer.cpp | 2 +- .../apis/basic_node/is_integer.output | 0 .../apis/basic_node/is_mapping.cpp | 2 +- .../apis/basic_node/is_mapping.output | 0 .../apis/basic_node/is_null.cpp | 2 +- .../apis/basic_node/is_null.output | 0 .../apis/basic_node/is_scalar.cpp | 2 +- .../apis/basic_node/is_scalar.output | 0 .../apis/basic_node/is_sequence.cpp | 2 +- .../apis/basic_node/is_sequence.output | 0 .../apis/basic_node/is_string.cpp | 2 +- .../apis/basic_node/is_string.output | 0 .../apis/basic_node/iterator.cpp | 2 +- .../apis/basic_node/iterator.output | 0 .../apis/basic_node/mapping.cpp | 2 +- .../apis/basic_node/mapping.output | 0 .../apis/basic_node/mapping_type.cpp | 2 +- .../apis/basic_node/mapping_type.output | 0 .../basic_node/move_assignment_operator.cpp | 2 +- .../move_assignment_operator.output | 0 .../apis/basic_node/node.cpp | 2 +- .../apis/basic_node/node.output | 0 .../apis/basic_node/node_t.cpp | 2 +- .../apis/basic_node/node_t.output | 0 .../apis/basic_node/operator_eq.cpp | 2 +- .../apis/basic_node/operator_eq.output | 0 .../apis/basic_node/operator_ge.cpp | 2 +- .../apis/basic_node/operator_ge.output | 0 .../apis/basic_node/operator_gt.cpp | 2 +- .../apis/basic_node/operator_gt.output | 0 .../apis/basic_node/operator_le.cpp | 2 +- .../apis/basic_node/operator_le.output | 0 .../apis/basic_node/operator_lt.cpp | 2 +- .../apis/basic_node/operator_lt.output | 0 .../apis/basic_node/operator_ne.cpp | 2 +- .../apis/basic_node/operator_ne.output | 0 .../apis/basic_node/rbegin.cpp | 2 +- .../apis/basic_node/rbegin.output | 0 .../apis/basic_node/rend.cpp | 2 +- .../apis/basic_node/rend.output | 0 .../apis/basic_node/reverse_iterator.cpp | 2 +- .../apis/basic_node/reverse_iterator.output | 0 .../apis/basic_node/sequence.cpp | 2 +- .../apis/basic_node/sequence.output | 0 .../apis/basic_node/sequence_type.cpp | 2 +- .../apis/basic_node/sequence_type.output | 0 .../apis/basic_node/serialize.cpp | 2 +- .../apis/basic_node/serialize.output | 0 .../apis/basic_node/serialize_docs.cpp | 2 +- .../apis/basic_node/serialize_docs.output | 0 .../apis/basic_node/set_yaml_version.cpp | 2 +- .../apis/basic_node/set_yaml_version.output | 0 .../apis/basic_node/set_yaml_version_type.cpp | 2 +- .../basic_node/set_yaml_version_type.output | 0 .../apis/basic_node/size.cpp | 2 +- .../apis/basic_node/size.output | 0 .../apis/basic_node/string_type.cpp | 2 +- .../apis/basic_node/string_type.output | 0 .../subscript_operator_basic_node.cpp | 2 +- .../subscript_operator_basic_node.output | 0 .../subscript_operator_compatible_type.cpp | 2 +- .../subscript_operator_compatible_type.output | 0 .../apis/basic_node/swap_member.cpp | 2 +- .../apis/basic_node/swap_member.output | 0 .../apis/basic_node/swap_std.cpp | 2 +- .../apis/basic_node/swap_std.output | 0 .../apis/basic_node/type.cpp | 2 +- .../apis/basic_node/type.output | 0 .../apis/basic_node/value_converter_type.cpp | 2 +- .../basic_node/value_converter_type.output | 0 .../apis/basic_node/yaml_version_t.cpp | 2 +- .../apis/basic_node/yaml_version_t.output | 0 examples/apis/exception/CMakeLists.txt | 16 +++ .../apis/exception/constructor_msg.cpp | 2 +- .../apis/exception/constructor_msg.output | 0 .../apis/exception/constructor_noarg.cpp | 2 +- .../apis/exception/constructor_noarg.output | 0 .../apis/exception/what.cpp | 2 +- .../apis/exception/what.output | 0 {docs/examples => examples/apis}/input.yaml | 0 .../apis}/input_multi.yaml | 0 examples/apis/macros/CMakeLists.txt | 16 +++ .../apis/macros/versions.cpp | 2 +- .../apis/macros/versions.output | 0 examples/apis/node_type/CMakeLists.txt | 16 +++ .../apis/node_type/node_type.cpp | 2 +- .../apis/node_type/node_type.output | 0 .../apis/node_value_converter/CMakeLists.txt | 16 +++ .../apis/node_value_converter/from_node.cpp | 2 +- .../node_value_converter/from_node.output | 0 .../apis/node_value_converter/to_node.cpp | 2 +- .../apis/node_value_converter/to_node.output | 0 .../apis/operator_literal_yaml/CMakeLists.txt | 16 +++ .../operator_literal_yaml.cpp | 2 +- .../operator_literal_yaml.output | 0 examples/apis/ordered_map/CMakeLists.txt | 16 +++ .../apis/ordered_map/at.cpp | 2 +- .../apis/ordered_map/at.output | 0 .../constructor_initializer_list.cpp | 2 +- .../constructor_initializer_list.output | 0 .../apis/ordered_map/constructor_noarg.cpp | 2 +- .../apis/ordered_map/constructor_noarg.output | 0 .../apis/ordered_map/emplace.cpp | 2 +- .../apis/ordered_map/emplace.output | 0 .../apis/ordered_map/find.cpp | 2 +- .../apis/ordered_map/find.output | 0 .../apis/ordered_map/subscript_operator.cpp | 2 +- .../ordered_map/subscript_operator.output | 0 .../apis/yaml_version_type/CMakeLists.txt | 16 +++ .../yaml_version_type/yaml_version_type.cpp | 2 +- .../yaml_version_type.output | 0 examples/tutorials/CMakeLists.txt | 15 +++ .../tutorials}/example.yaml | 0 .../tutorials}/tutorial_1.cpp | 2 +- .../tutorials}/tutorial_1.output | 0 .../tutorials}/tutorial_2.cpp | 2 +- .../tutorials}/tutorial_2.output | 0 .../tutorials}/tutorial_3.cpp | 2 +- .../tutorials}/tutorial_3.output | 0 .../tutorials}/tutorial_4.cpp | 2 +- .../tutorials}/tutorial_4.output | 0 include/fkYAML/detail/assert.hpp | 2 +- .../fkYAML/detail/conversions/from_node.hpp | 2 +- .../fkYAML/detail/conversions/scalar_conv.hpp | 2 +- include/fkYAML/detail/conversions/to_node.hpp | 2 +- .../fkYAML/detail/conversions/to_string.hpp | 2 +- include/fkYAML/detail/document_metainfo.hpp | 2 +- .../fkYAML/detail/encodings/uri_encoding.hpp | 2 +- .../detail/encodings/utf_encode_detector.hpp | 2 +- .../fkYAML/detail/encodings/utf_encode_t.hpp | 2 +- .../fkYAML/detail/encodings/utf_encodings.hpp | 2 +- .../fkYAML/detail/encodings/yaml_escaper.hpp | 2 +- .../detail/input/block_scalar_header.hpp | 2 +- include/fkYAML/detail/input/deserializer.hpp | 2 +- include/fkYAML/detail/input/input_adapter.hpp | 2 +- .../fkYAML/detail/input/lexical_analyzer.hpp | 2 +- .../fkYAML/detail/input/position_tracker.hpp | 2 +- include/fkYAML/detail/input/scalar_parser.hpp | 2 +- .../fkYAML/detail/input/scalar_scanner.hpp | 2 +- include/fkYAML/detail/input/tag_resolver.hpp | 2 +- include/fkYAML/detail/input/tag_t.hpp | 2 +- include/fkYAML/detail/iterator.hpp | 2 +- .../detail/macros/cpp_config_macros.hpp | 2 +- .../fkYAML/detail/macros/define_macros.hpp | 2 +- .../fkYAML/detail/macros/version_macros.hpp | 2 +- include/fkYAML/detail/meta/detect.hpp | 2 +- .../detail/meta/input_adapter_traits.hpp | 2 +- include/fkYAML/detail/meta/node_traits.hpp | 2 +- include/fkYAML/detail/meta/stl_supplement.hpp | 2 +- include/fkYAML/detail/meta/type_traits.hpp | 2 +- include/fkYAML/detail/node_attrs.hpp | 2 +- include/fkYAML/detail/node_property.hpp | 2 +- include/fkYAML/detail/node_ref_storage.hpp | 2 +- include/fkYAML/detail/output/serializer.hpp | 2 +- include/fkYAML/detail/reverse_iterator.hpp | 2 +- include/fkYAML/detail/str_view.hpp | 2 +- include/fkYAML/detail/string_formatter.hpp | 2 +- .../fkYAML/detail/types/lexical_token_t.hpp | 2 +- include/fkYAML/detail/types/node_t.hpp | 2 +- .../fkYAML/detail/types/yaml_version_t.hpp | 2 +- include/fkYAML/exception.hpp | 2 +- include/fkYAML/fkyaml_fwd.hpp | 2 +- include/fkYAML/node.hpp | 2 +- include/fkYAML/node_type.hpp | 2 +- include/fkYAML/node_value_converter.hpp | 2 +- include/fkYAML/ordered_map.hpp | 2 +- include/fkYAML/yaml_version_type.hpp | 2 +- scripts/run_amalgamation.bat | 6 +- scripts/run_amalgamation.sh | 6 +- scripts/run_clang_format.bat | 6 +- scripts/run_clang_format.sh | 2 +- single_include/fkYAML/fkyaml_fwd.hpp | 4 +- single_include/fkYAML/node.hpp | 92 +++++++++--------- {test => tests}/CMakeLists.txt | 0 .../CMakeLists.txt | 0 .../project/CMakeLists.txt | 0 .../project/main.cpp | 2 +- .../cmake_fetch_content_test/CMakeLists.txt | 0 .../project/CMakeLists.txt | 0 .../project/main.cpp | 2 +- .../cmake_find_package_test/CMakeLists.txt | 0 .../project/CMakeLists.txt | 0 .../cmake_find_package_test}/project/main.cpp | 2 +- .../CMakeLists.txt | 0 .../project/CMakeLists.txt | 0 .../project/main.cpp | 2 +- {test => tests}/unit_test/CMakeLists.txt | 2 +- {test => tests}/unit_test/main.cpp | 2 +- .../unit_test/test_custom_from_node.cpp | 2 +- .../extraction_operator_test_data.yml | 0 .../test_data/input_adapter_test_data.txt | 0 .../input_adapter_test_data_utf16be_crlf.txt | Bin .../input_adapter_test_data_utf16bebom.txt | Bin .../input_adapter_test_data_utf16ben.txt | Bin .../input_adapter_test_data_utf16lebom.txt | Bin .../input_adapter_test_data_utf16len.txt | Bin .../input_adapter_test_data_utf32be_crlf.txt | Bin .../input_adapter_test_data_utf32bebom.txt | Bin .../input_adapter_test_data_utf32ben.txt | Bin .../input_adapter_test_data_utf32lebom.txt | Bin .../input_adapter_test_data_utf32len.txt | Bin .../input_adapter_test_data_utf8_crlf.txt | 0 .../input_adapter_test_data_utf8bom.txt | 0 .../input_adapter_test_data_utf8n.txt | 0 ...ter_test_data_utf8n_invalid_1byte_char.txt | 0 ...ter_test_data_utf8n_invalid_2byte_char.txt | 0 ...ter_test_data_utf8n_invalid_3byte_char.txt | 0 ...ter_test_data_utf8n_invalid_4byte_char.txt | 0 ...apter_test_data_utf8n_valid_1byte_char.txt | 0 ...apter_test_data_utf8n_valid_2byte_char.txt | 0 ...apter_test_data_utf8n_valid_3byte_char.txt | 0 ...apter_test_data_utf8n_valid_4byte_char.txt | 0 .../test_data/single_char_byte_input.txt | 0 .../unit_test/test_deserializer_class.cpp | 2 +- .../unit_test/test_exception_class.cpp | 2 +- .../unit_test/test_input_adapter.cpp | 2 +- .../unit_test/test_iterator_class.cpp | 2 +- .../unit_test/test_lexical_analyzer_class.cpp | 2 +- {test => tests}/unit_test/test_node_attrs.cpp | 2 +- {test => tests}/unit_test/test_node_class.cpp | 2 +- .../unit_test/test_node_ref_storage_class.cpp | 2 +- {test => tests}/unit_test/test_node_type.cpp | 2 +- .../unit_test/test_ordered_map_class.cpp | 2 +- .../unit_test/test_position_tracker_class.cpp | 2 +- .../unit_test/test_reverse_iterator_class.cpp | 2 +- .../unit_test/test_scalar_conv.cpp | 2 +- .../unit_test/test_scalar_parser_class.cpp | 2 +- .../unit_test/test_scalar_scanner_class.cpp | 2 +- .../unit_test/test_serializer_class.cpp | 2 +- .../unit_test/test_str_view_class.cpp | 2 +- .../unit_test/test_string_formatter.cpp | 2 +- .../unit_test/test_tag_resolver_class.cpp | 2 +- .../unit_test/test_uri_encoding_class.cpp | 2 +- .../unit_test/test_utf_encode_detector.cpp | 2 +- .../unit_test/test_utf_encodings.cpp | 2 +- .../unit_test/test_yaml_escaper_class.cpp | 2 +- .../unit_test/test_yaml_version_type.cpp | 2 +- {tool => tools}/amalgamation/CHANGES.md | 0 {tool => tools}/amalgamation/README.md | 0 {tool => tools}/amalgamation/amalgamate.py | 0 .../amalgamation/fkyaml_fwd_hpp.json | 0 {tool => tools}/amalgamation/node_hpp.json | 0 {tool => tools}/benchmark/CMakeLists.txt | 0 {tool => tools}/benchmark/README.md | 0 .../benchmark/cases/citm_catalog.json | 0 .../benchmark/cases/citm_catalog.yml | 0 {tool => tools}/benchmark/cases/ubuntu.yml | 0 {tool => tools}/benchmark/main.cpp | 2 +- .../result_debug_citm_catalog_json.txt | 0 .../results/result_debug_citm_catalog_yml.txt | 0 .../results/result_debug_ubuntu_yml.txt | 0 .../result_release_citm_catalog_json.txt | 0 .../result_release_citm_catalog_yml.txt | 0 .../results/result_release_ubuntu_yml.txt | 0 {tool => tools}/clang_tidy/CMakeLists.txt | 0 {tool => tools}/iwyu/CMakeLists.txt | 0 {tool => tools}/natvis_generator/Makefile | 0 {tool => tools}/natvis_generator/README.md | 0 .../natvis_generator/fkYAML.natvis.j2 | 0 .../natvis_generator/natvis_generator.py | 0 {tool => tools}/natvis_generator/params.json | 0 .../natvis_generator/requirements.txt | 0 467 files changed, 656 insertions(+), 532 deletions(-) rename CODEOWNERS => .github/CODEOWNERS (100%) rename CODE_OF_CONDUCT.md => .github/CODE_OF_CONDUCT.md (100%) rename CONTRIBUTING.md => .github/CONTRIBUTING.md (100%) rename SECURITY.md => .github/SECURITY.md (100%) rename docs/{mkdocs => }/Makefile (100%) rename docs/{mkdocs => }/docs/api/basic_node/add_anchor_name.md (85%) rename docs/{mkdocs => }/docs/api/basic_node/add_tag_name.md (85%) rename docs/{mkdocs => }/docs/api/basic_node/alias_of.md (89%) rename docs/{mkdocs => }/docs/api/basic_node/at.md (91%) rename docs/{mkdocs => }/docs/api/basic_node/begin.md (90%) rename docs/{mkdocs => }/docs/api/basic_node/boolean_type.md (87%) rename docs/{mkdocs => }/docs/api/basic_node/constructor.md (88%) rename docs/{mkdocs => }/docs/api/basic_node/contains.md (93%) rename docs/{mkdocs => }/docs/api/basic_node/deserialize.md (88%) rename docs/{mkdocs => }/docs/api/basic_node/deserialize_docs.md (82%) rename docs/{mkdocs => }/docs/api/basic_node/destructor.md (100%) rename docs/{mkdocs => }/docs/api/basic_node/empty.md (85%) rename docs/{mkdocs => }/docs/api/basic_node/end.md (90%) rename docs/{mkdocs => }/docs/api/basic_node/extraction_operator.md (87%) rename docs/{mkdocs => }/docs/api/basic_node/float_number_type.md (88%) rename docs/{mkdocs => }/docs/api/basic_node/get_anchor_name.md (86%) rename docs/{mkdocs => }/docs/api/basic_node/get_tag_name.md (86%) rename docs/{mkdocs => }/docs/api/basic_node/get_type.md (89%) rename docs/{mkdocs => }/docs/api/basic_node/get_value.md (98%) rename docs/{mkdocs => }/docs/api/basic_node/get_value_inplace.md (96%) rename docs/{mkdocs => }/docs/api/basic_node/get_value_ref.md (91%) rename docs/{mkdocs => }/docs/api/basic_node/get_yaml_version.md (91%) rename docs/{mkdocs => }/docs/api/basic_node/get_yaml_version_type.md (86%) rename docs/{mkdocs => }/docs/api/basic_node/has_anchor_name.md (81%) rename docs/{mkdocs => }/docs/api/basic_node/has_tag_name.md (81%) rename docs/{mkdocs => }/docs/api/basic_node/index.md (100%) rename docs/{mkdocs => }/docs/api/basic_node/insertion_operator.md (91%) rename docs/{mkdocs => }/docs/api/basic_node/integer_type.md (85%) rename docs/{mkdocs => }/docs/api/basic_node/is_alias.md (83%) rename docs/{mkdocs => }/docs/api/basic_node/is_anchor.md (82%) rename docs/{mkdocs => }/docs/api/basic_node/is_boolean.md (81%) rename docs/{mkdocs => }/docs/api/basic_node/is_float_number.md (81%) rename docs/{mkdocs => }/docs/api/basic_node/is_integer.md (81%) rename docs/{mkdocs => }/docs/api/basic_node/is_mapping.md (81%) rename docs/{mkdocs => }/docs/api/basic_node/is_null.md (82%) rename docs/{mkdocs => }/docs/api/basic_node/is_scalar.md (83%) rename docs/{mkdocs => }/docs/api/basic_node/is_sequence.md (81%) rename docs/{mkdocs => }/docs/api/basic_node/is_string.md (81%) rename docs/{mkdocs => }/docs/api/basic_node/iterator.md (96%) rename docs/{mkdocs => }/docs/api/basic_node/mapping.md (88%) rename docs/{mkdocs => }/docs/api/basic_node/mapping_type.md (94%) rename docs/{mkdocs => }/docs/api/basic_node/node.md (83%) rename docs/{mkdocs => }/docs/api/basic_node/node_t.md (94%) rename docs/{mkdocs => }/docs/api/basic_node/operator=.md (76%) rename docs/{mkdocs => }/docs/api/basic_node/operator[].md (90%) rename docs/{mkdocs => }/docs/api/basic_node/operator_eq.md (89%) rename docs/{mkdocs => }/docs/api/basic_node/operator_ge.md (85%) rename docs/{mkdocs => }/docs/api/basic_node/operator_gt.md (84%) rename docs/{mkdocs => }/docs/api/basic_node/operator_le.md (85%) rename docs/{mkdocs => }/docs/api/basic_node/operator_lt.md (92%) rename docs/{mkdocs => }/docs/api/basic_node/operator_ne.md (85%) rename docs/{mkdocs => }/docs/api/basic_node/rbegin.md (90%) rename docs/{mkdocs => }/docs/api/basic_node/rend.md (91%) rename docs/{mkdocs => }/docs/api/basic_node/reverse_iterator.md (96%) rename docs/{mkdocs => }/docs/api/basic_node/sequence.md (88%) rename docs/{mkdocs => }/docs/api/basic_node/sequence_type.md (89%) rename docs/{mkdocs => }/docs/api/basic_node/serialize.md (95%) rename docs/{mkdocs => }/docs/api/basic_node/serialize_docs.md (92%) rename docs/{mkdocs => }/docs/api/basic_node/set_yaml_version.md (90%) rename docs/{mkdocs => }/docs/api/basic_node/set_yaml_version_type.md (83%) rename docs/{mkdocs => }/docs/api/basic_node/size.md (84%) rename docs/{mkdocs => }/docs/api/basic_node/string_type.md (88%) rename docs/{mkdocs => }/docs/api/basic_node/swap.md (87%) rename docs/{mkdocs => }/docs/api/basic_node/type.md (93%) rename docs/{mkdocs => }/docs/api/basic_node/value_converter_type.md (91%) rename docs/{mkdocs => }/docs/api/basic_node/yaml_version_t.md (90%) rename docs/{mkdocs => }/docs/api/exception/constructor.md (78%) rename docs/{mkdocs => }/docs/api/exception/destructor.md (100%) rename docs/{mkdocs => }/docs/api/exception/index.md (100%) rename docs/{mkdocs => }/docs/api/exception/invalid_encoding.md (100%) rename docs/{mkdocs => }/docs/api/exception/invalid_tag.md (100%) rename docs/{mkdocs => }/docs/api/exception/out_of_range.md (100%) rename docs/{mkdocs => }/docs/api/exception/parse_error.md (100%) rename docs/{mkdocs => }/docs/api/exception/type_error.md (100%) rename docs/{mkdocs => }/docs/api/exception/what.md (86%) rename docs/{mkdocs => }/docs/api/index.md (100%) rename docs/{mkdocs => }/docs/api/macros.md (97%) rename docs/{mkdocs => }/docs/api/node_type.md (95%) rename docs/{mkdocs => }/docs/api/node_value_converter/from_node.md (94%) rename docs/{mkdocs => }/docs/api/node_value_converter/index.md (100%) rename docs/{mkdocs => }/docs/api/node_value_converter/to_node.md (94%) rename docs/{mkdocs => }/docs/api/operator_literal_yaml.md (93%) rename docs/{mkdocs => }/docs/api/ordered_map/at.md (92%) rename docs/{mkdocs => }/docs/api/ordered_map/constructor.md (79%) rename docs/{mkdocs => }/docs/api/ordered_map/destructor.md (100%) rename docs/{mkdocs => }/docs/api/ordered_map/emplace.md (87%) rename docs/{mkdocs => }/docs/api/ordered_map/find.md (89%) rename docs/{mkdocs => }/docs/api/ordered_map/index.md (100%) rename docs/{mkdocs => }/docs/api/ordered_map/operator[].md (91%) rename docs/{mkdocs => }/docs/api/yaml_version_type.md (87%) rename docs/{mkdocs => }/docs/home/community_support.md (100%) rename docs/{mkdocs => }/docs/home/license.md (96%) rename docs/{mkdocs => }/docs/home/releases.md (100%) rename docs/{mkdocs => }/docs/home/supported_compilers.md (100%) rename docs/{mkdocs => }/docs/img/range-begin-end.svg (100%) rename docs/{mkdocs => }/docs/img/range-rbegin-rend.svg (100%) rename docs/{mkdocs => }/docs/index.md (100%) rename docs/{mkdocs => }/docs/javascripts/config.js (100%) rename docs/{mkdocs => }/docs/tutorials/cmake_integration.md (100%) rename docs/{mkdocs => }/docs/tutorials/index.md (95%) delete mode 100644 docs/examples/CMakeLists.txt rename docs/{mkdocs => }/mkdocs.yml (98%) rename docs/{mkdocs => }/requirements.txt (100%) create mode 100644 examples/CMakeLists.txt create mode 100644 examples/apis/CMakeLists.txt create mode 100644 examples/apis/basic_node/CMakeLists.txt rename docs/examples/ex_basic_node_add_anchor_name.cpp => examples/apis/basic_node/add_anchor_name.cpp (91%) rename docs/examples/ex_basic_node_add_anchor_name.output => examples/apis/basic_node/add_anchor_name.output (100%) rename docs/examples/ex_basic_node_add_tag_name.cpp => examples/apis/basic_node/add_tag_name.cpp (91%) rename docs/examples/ex_basic_node_add_tag_name.output => examples/apis/basic_node/add_tag_name.output (100%) rename docs/examples/ex_basic_node_alias_of.cpp => examples/apis/basic_node/alias_of.cpp (92%) rename docs/examples/ex_basic_node_alias_of.output => examples/apis/basic_node/alias_of.output (100%) rename docs/examples/ex_basic_node_at_basic_node.cpp => examples/apis/basic_node/at_basic_node.cpp (96%) rename docs/examples/ex_basic_node_at_basic_node.output => examples/apis/basic_node/at_basic_node.output (100%) rename docs/examples/ex_basic_node_at_compatible_type.cpp => examples/apis/basic_node/at_compatible_type.cpp (95%) rename docs/examples/ex_basic_node_at_compatible_type.output => examples/apis/basic_node/at_compatible_type.output (100%) rename docs/examples/ex_basic_node_begin.cpp => examples/apis/basic_node/begin.cpp (90%) rename docs/examples/ex_basic_node_begin.output => examples/apis/basic_node/begin.output (100%) rename docs/examples/ex_basic_node_boolean_type.cpp => examples/apis/basic_node/boolean_type.cpp (89%) rename docs/examples/ex_basic_node_boolean_type.output => examples/apis/basic_node/boolean_type.output (100%) rename docs/examples/ex_basic_node_constructor_1.cpp => examples/apis/basic_node/constructor_1.cpp (88%) rename docs/examples/ex_basic_node_constructor_1.output => examples/apis/basic_node/constructor_1.output (100%) rename docs/examples/ex_basic_node_constructor_2.cpp => examples/apis/basic_node/constructor_2.cpp (88%) rename docs/examples/ex_basic_node_constructor_2.output => examples/apis/basic_node/constructor_2.output (100%) rename docs/examples/ex_basic_node_constructor_3.cpp => examples/apis/basic_node/constructor_3.cpp (88%) rename docs/examples/ex_basic_node_constructor_3.output => examples/apis/basic_node/constructor_3.output (100%) rename docs/examples/ex_basic_node_constructor_4.cpp => examples/apis/basic_node/constructor_4.cpp (89%) rename docs/examples/ex_basic_node_constructor_4.output => examples/apis/basic_node/constructor_4.output (100%) rename docs/examples/ex_basic_node_constructor_5.cpp => examples/apis/basic_node/constructor_5.cpp (89%) rename docs/examples/ex_basic_node_constructor_5.output => examples/apis/basic_node/constructor_5.output (100%) rename docs/examples/ex_basic_node_constructor_6.cpp => examples/apis/basic_node/constructor_6.cpp (88%) rename docs/examples/ex_basic_node_constructor_6.output => examples/apis/basic_node/constructor_6.output (100%) rename docs/examples/ex_basic_node_constructor_7.cpp => examples/apis/basic_node/constructor_7.cpp (90%) rename docs/examples/ex_basic_node_constructor_7.output => examples/apis/basic_node/constructor_7.output (100%) rename docs/examples/ex_basic_node_contains.cpp => examples/apis/basic_node/contains.cpp (93%) rename docs/examples/ex_basic_node_contains.output => examples/apis/basic_node/contains.output (100%) rename docs/examples/ex_basic_node_copy_assignment_operator.cpp => examples/apis/basic_node/copy_assignment_operator.cpp (90%) rename docs/examples/ex_basic_node_copy_assignment_operator.output => examples/apis/basic_node/copy_assignment_operator.output (100%) rename docs/examples/ex_basic_node_deserialize_char_array.cpp => examples/apis/basic_node/deserialize_char_array.cpp (93%) rename docs/examples/ex_basic_node_deserialize_char_array.output => examples/apis/basic_node/deserialize_char_array.output (100%) rename docs/examples/ex_basic_node_deserialize_docs_char_array.cpp => examples/apis/basic_node/deserialize_docs_char_array.cpp (95%) rename docs/examples/ex_basic_node_deserialize_docs_char_array.output => examples/apis/basic_node/deserialize_docs_char_array.output (100%) rename docs/examples/ex_basic_node_deserialize_docs_file_pointer.cpp => examples/apis/basic_node/deserialize_docs_file_pointer.cpp (95%) rename docs/examples/ex_basic_node_deserialize_docs_file_pointer.output => examples/apis/basic_node/deserialize_docs_file_pointer.output (100%) rename docs/examples/ex_basic_node_deserialize_docs_iterators.cpp => examples/apis/basic_node/deserialize_docs_iterators.cpp (95%) rename docs/examples/ex_basic_node_deserialize_docs_iterators.output => examples/apis/basic_node/deserialize_docs_iterators.output (100%) rename docs/examples/ex_basic_node_deserialize_docs_string.cpp => examples/apis/basic_node/deserialize_docs_string.cpp (95%) rename docs/examples/ex_basic_node_deserialize_docs_string.output => examples/apis/basic_node/deserialize_docs_string.output (100%) rename docs/examples/ex_basic_node_deserialize_file_pointer.cpp => examples/apis/basic_node/deserialize_file_pointer.cpp (93%) rename docs/examples/ex_basic_node_deserialize_file_pointer.output => examples/apis/basic_node/deserialize_file_pointer.output (100%) rename docs/examples/ex_basic_node_deserialize_iterators.cpp => examples/apis/basic_node/deserialize_iterators.cpp (92%) rename docs/examples/ex_basic_node_deserialize_iterators.output => examples/apis/basic_node/deserialize_iterators.output (100%) rename docs/examples/ex_basic_node_deserialize_string.cpp => examples/apis/basic_node/deserialize_string.cpp (93%) rename docs/examples/ex_basic_node_deserialize_string.output => examples/apis/basic_node/deserialize_string.output (100%) rename docs/examples/ex_basic_node_empty.cpp => examples/apis/basic_node/empty.cpp (93%) rename docs/examples/ex_basic_node_empty.output => examples/apis/basic_node/empty.output (100%) rename docs/examples/ex_basic_node_end.cpp => examples/apis/basic_node/end.cpp (91%) rename docs/examples/ex_basic_node_end.output => examples/apis/basic_node/end.output (100%) rename docs/examples/ex_basic_node_extraction_operator.cpp => examples/apis/basic_node/extraction_operator.cpp (90%) rename docs/examples/ex_basic_node_extraction_operator.output => examples/apis/basic_node/extraction_operator.output (100%) rename docs/examples/ex_basic_node_float_number_type.cpp => examples/apis/basic_node/float_number_type.cpp (89%) rename docs/examples/ex_basic_node_float_number_type.output => examples/apis/basic_node/float_number_type.output (100%) rename docs/examples/ex_basic_node_get_anchor_name.cpp => examples/apis/basic_node/get_anchor_name.cpp (92%) rename docs/examples/ex_basic_node_get_anchor_name.output => examples/apis/basic_node/get_anchor_name.output (100%) rename docs/examples/ex_basic_node_get_tag_name.cpp => examples/apis/basic_node/get_tag_name.cpp (92%) rename docs/examples/ex_basic_node_get_tag_name.output => examples/apis/basic_node/get_tag_name.output (100%) rename docs/examples/ex_basic_node_get_type.cpp => examples/apis/basic_node/get_type.cpp (95%) rename docs/examples/ex_basic_node_get_type.output => examples/apis/basic_node/get_type.output (100%) rename docs/examples/ex_basic_node_get_value.cpp => examples/apis/basic_node/get_value.cpp (97%) rename docs/examples/ex_basic_node_get_value.output => examples/apis/basic_node/get_value.output (100%) rename docs/examples/ex_basic_node_get_value_inplace.cpp => examples/apis/basic_node/get_value_inplace.cpp (96%) rename docs/examples/ex_basic_node_get_value_inplace.output => examples/apis/basic_node/get_value_inplace.output (100%) rename docs/examples/ex_basic_node_get_value_ref.cpp => examples/apis/basic_node/get_value_ref.cpp (93%) rename docs/examples/ex_basic_node_get_value_ref.output => examples/apis/basic_node/get_value_ref.output (100%) rename docs/examples/ex_basic_node_get_yaml_version.cpp => examples/apis/basic_node/get_yaml_version.cpp (91%) rename docs/examples/ex_basic_node_get_yaml_version.output => examples/apis/basic_node/get_yaml_version.output (100%) rename docs/examples/ex_basic_node_get_yaml_version_type.cpp => examples/apis/basic_node/get_yaml_version_type.cpp (91%) rename docs/examples/ex_basic_node_get_yaml_version_type.output => examples/apis/basic_node/get_yaml_version_type.output (100%) rename docs/examples/ex_basic_node_has_anchor_name.cpp => examples/apis/basic_node/has_anchor_name.cpp (92%) rename docs/examples/ex_basic_node_has_anchor_name.output => examples/apis/basic_node/has_anchor_name.output (100%) rename docs/examples/ex_basic_node_has_tag_name.cpp => examples/apis/basic_node/has_tag_name.cpp (92%) rename docs/examples/ex_basic_node_has_tag_name.output => examples/apis/basic_node/has_tag_name.output (100%) rename docs/examples/ex_basic_node_insertion_operator.cpp => examples/apis/basic_node/insertion_operator.cpp (92%) rename docs/examples/ex_basic_node_insertion_operator.output => examples/apis/basic_node/insertion_operator.output (100%) rename docs/examples/ex_basic_node_integer_type.cpp => examples/apis/basic_node/integer_type.cpp (90%) rename docs/examples/ex_basic_node_integer_type.output => examples/apis/basic_node/integer_type.output (100%) rename docs/examples/ex_basic_node_is_alias.cpp => examples/apis/basic_node/is_alias.cpp (93%) rename docs/examples/ex_basic_node_is_alias.output => examples/apis/basic_node/is_alias.output (100%) rename docs/examples/ex_basic_node_is_anchor.cpp => examples/apis/basic_node/is_anchor.cpp (92%) rename docs/examples/ex_basic_node_is_anchor.output => examples/apis/basic_node/is_anchor.output (100%) rename docs/examples/ex_basic_node_is_boolean.cpp => examples/apis/basic_node/is_boolean.cpp (89%) rename docs/examples/ex_basic_node_is_boolean.output => examples/apis/basic_node/is_boolean.output (100%) rename docs/examples/ex_basic_node_is_float_number.cpp => examples/apis/basic_node/is_float_number.cpp (89%) rename docs/examples/ex_basic_node_is_float_number.output => examples/apis/basic_node/is_float_number.output (100%) rename docs/examples/ex_basic_node_is_integer.cpp => examples/apis/basic_node/is_integer.cpp (89%) rename docs/examples/ex_basic_node_is_integer.output => examples/apis/basic_node/is_integer.output (100%) rename docs/examples/ex_basic_node_is_mapping.cpp => examples/apis/basic_node/is_mapping.cpp (89%) rename docs/examples/ex_basic_node_is_mapping.output => examples/apis/basic_node/is_mapping.output (100%) rename docs/examples/ex_basic_node_is_null.cpp => examples/apis/basic_node/is_null.cpp (89%) rename docs/examples/ex_basic_node_is_null.output => examples/apis/basic_node/is_null.output (100%) rename docs/examples/ex_basic_node_is_scalar.cpp => examples/apis/basic_node/is_scalar.cpp (94%) rename docs/examples/ex_basic_node_is_scalar.output => examples/apis/basic_node/is_scalar.output (100%) rename docs/examples/ex_basic_node_is_sequence.cpp => examples/apis/basic_node/is_sequence.cpp (89%) rename docs/examples/ex_basic_node_is_sequence.output => examples/apis/basic_node/is_sequence.output (100%) rename docs/examples/ex_basic_node_is_string.cpp => examples/apis/basic_node/is_string.cpp (89%) rename docs/examples/ex_basic_node_is_string.output => examples/apis/basic_node/is_string.output (100%) rename docs/examples/ex_basic_node_iterator.cpp => examples/apis/basic_node/iterator.cpp (94%) rename docs/examples/ex_basic_node_iterator.output => examples/apis/basic_node/iterator.output (100%) rename docs/examples/ex_basic_node_mapping.cpp => examples/apis/basic_node/mapping.cpp (89%) rename docs/examples/ex_basic_node_mapping.output => examples/apis/basic_node/mapping.output (100%) rename docs/examples/ex_basic_node_mapping_type.cpp => examples/apis/basic_node/mapping_type.cpp (90%) rename docs/examples/ex_basic_node_mapping_type.output => examples/apis/basic_node/mapping_type.output (100%) rename docs/examples/ex_basic_node_move_assignment_operator.cpp => examples/apis/basic_node/move_assignment_operator.cpp (90%) rename docs/examples/ex_basic_node_move_assignment_operator.output => examples/apis/basic_node/move_assignment_operator.output (100%) rename docs/examples/ex_basic_node_node.cpp => examples/apis/basic_node/node.cpp (91%) rename docs/examples/ex_basic_node_node.output => examples/apis/basic_node/node.output (100%) rename docs/examples/ex_basic_node_node_t.cpp => examples/apis/basic_node/node_t.cpp (95%) rename docs/examples/ex_basic_node_node_t.output => examples/apis/basic_node/node_t.output (100%) rename docs/examples/ex_basic_node_operator_eq.cpp => examples/apis/basic_node/operator_eq.cpp (95%) rename docs/examples/ex_basic_node_operator_eq.output => examples/apis/basic_node/operator_eq.output (100%) rename docs/examples/ex_basic_node_operator_ge.cpp => examples/apis/basic_node/operator_ge.cpp (95%) rename docs/examples/ex_basic_node_operator_ge.output => examples/apis/basic_node/operator_ge.output (100%) rename docs/examples/ex_basic_node_operator_gt.cpp => examples/apis/basic_node/operator_gt.cpp (95%) rename docs/examples/ex_basic_node_operator_gt.output => examples/apis/basic_node/operator_gt.output (100%) rename docs/examples/ex_basic_node_operator_le.cpp => examples/apis/basic_node/operator_le.cpp (95%) rename docs/examples/ex_basic_node_operator_le.output => examples/apis/basic_node/operator_le.output (100%) rename docs/examples/ex_basic_node_operator_lt.cpp => examples/apis/basic_node/operator_lt.cpp (95%) rename docs/examples/ex_basic_node_operator_lt.output => examples/apis/basic_node/operator_lt.output (100%) rename docs/examples/ex_basic_node_operator_ne.cpp => examples/apis/basic_node/operator_ne.cpp (95%) rename docs/examples/ex_basic_node_operator_ne.output => examples/apis/basic_node/operator_ne.output (100%) rename docs/examples/ex_basic_node_rbegin.cpp => examples/apis/basic_node/rbegin.cpp (90%) rename docs/examples/ex_basic_node_rbegin.output => examples/apis/basic_node/rbegin.output (100%) rename docs/examples/ex_basic_node_rend.cpp => examples/apis/basic_node/rend.cpp (91%) rename docs/examples/ex_basic_node_rend.output => examples/apis/basic_node/rend.output (100%) rename docs/examples/ex_basic_node_reverse_iterator.cpp => examples/apis/basic_node/reverse_iterator.cpp (94%) rename docs/examples/ex_basic_node_reverse_iterator.output => examples/apis/basic_node/reverse_iterator.output (100%) rename docs/examples/ex_basic_node_sequence.cpp => examples/apis/basic_node/sequence.cpp (90%) rename docs/examples/ex_basic_node_sequence.output => examples/apis/basic_node/sequence.output (100%) rename docs/examples/ex_basic_node_sequence_type.cpp => examples/apis/basic_node/sequence_type.cpp (90%) rename docs/examples/ex_basic_node_sequence_type.output => examples/apis/basic_node/sequence_type.output (100%) rename docs/examples/ex_basic_node_serialize.cpp => examples/apis/basic_node/serialize.cpp (93%) rename docs/examples/ex_basic_node_serialize.output => examples/apis/basic_node/serialize.output (100%) rename docs/examples/ex_basic_node_serialize_docs.cpp => examples/apis/basic_node/serialize_docs.cpp (94%) rename docs/examples/ex_basic_node_serialize_docs.output => examples/apis/basic_node/serialize_docs.output (100%) rename docs/examples/ex_basic_node_set_yaml_version.cpp => examples/apis/basic_node/set_yaml_version.cpp (92%) rename docs/examples/ex_basic_node_set_yaml_version.output => examples/apis/basic_node/set_yaml_version.output (100%) rename docs/examples/ex_basic_node_set_yaml_version_type.cpp => examples/apis/basic_node/set_yaml_version_type.cpp (93%) rename docs/examples/ex_basic_node_set_yaml_version_type.output => examples/apis/basic_node/set_yaml_version_type.output (100%) rename docs/examples/ex_basic_node_size.cpp => examples/apis/basic_node/size.cpp (93%) rename docs/examples/ex_basic_node_size.output => examples/apis/basic_node/size.output (100%) rename docs/examples/ex_basic_node_string_type.cpp => examples/apis/basic_node/string_type.cpp (90%) rename docs/examples/ex_basic_node_string_type.output => examples/apis/basic_node/string_type.output (100%) rename docs/examples/ex_basic_node_subscript_operator_basic_node.cpp => examples/apis/basic_node/subscript_operator_basic_node.cpp (95%) rename docs/examples/ex_basic_node_subscript_operator_basic_node.output => examples/apis/basic_node/subscript_operator_basic_node.output (100%) rename docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp => examples/apis/basic_node/subscript_operator_compatible_type.cpp (94%) rename docs/examples/ex_basic_node_subscript_operator_compatible_type.output => examples/apis/basic_node/subscript_operator_compatible_type.output (100%) rename docs/examples/ex_basic_node_swap_member.cpp => examples/apis/basic_node/swap_member.cpp (92%) rename docs/examples/ex_basic_node_swap_member.output => examples/apis/basic_node/swap_member.output (100%) rename docs/examples/ex_basic_node_swap_std.cpp => examples/apis/basic_node/swap_std.cpp (92%) rename docs/examples/ex_basic_node_swap_std.output => examples/apis/basic_node/swap_std.output (100%) rename docs/examples/ex_basic_node_type.cpp => examples/apis/basic_node/type.cpp (95%) rename docs/examples/ex_basic_node_type.output => examples/apis/basic_node/type.output (100%) rename docs/examples/ex_basic_node_value_converter_type.cpp => examples/apis/basic_node/value_converter_type.cpp (93%) rename docs/examples/ex_basic_node_value_converter_type.output => examples/apis/basic_node/value_converter_type.output (100%) rename docs/examples/ex_basic_node_yaml_version_t.cpp => examples/apis/basic_node/yaml_version_t.cpp (94%) rename docs/examples/ex_basic_node_yaml_version_t.output => examples/apis/basic_node/yaml_version_t.output (100%) create mode 100644 examples/apis/exception/CMakeLists.txt rename docs/examples/ex_exception_constructor_msg.cpp => examples/apis/exception/constructor_msg.cpp (90%) rename docs/examples/ex_exception_constructor_msg.output => examples/apis/exception/constructor_msg.output (100%) rename docs/examples/ex_exception_constructor_noarg.cpp => examples/apis/exception/constructor_noarg.cpp (89%) rename docs/examples/ex_exception_constructor_noarg.output => examples/apis/exception/constructor_noarg.output (100%) rename docs/examples/ex_exception_what.cpp => examples/apis/exception/what.cpp (90%) rename docs/examples/ex_exception_what.output => examples/apis/exception/what.output (100%) rename {docs/examples => examples/apis}/input.yaml (100%) rename {docs/examples => examples/apis}/input_multi.yaml (100%) create mode 100644 examples/apis/macros/CMakeLists.txt rename docs/examples/ex_macros_versions.cpp => examples/apis/macros/versions.cpp (89%) rename docs/examples/ex_macros_versions.output => examples/apis/macros/versions.output (100%) create mode 100644 examples/apis/node_type/CMakeLists.txt rename docs/examples/ex_node_type.cpp => examples/apis/node_type/node_type.cpp (95%) rename docs/examples/ex_node_type.output => examples/apis/node_type/node_type.output (100%) create mode 100644 examples/apis/node_value_converter/CMakeLists.txt rename docs/examples/ex_node_value_converter_from_node.cpp => examples/apis/node_value_converter/from_node.cpp (94%) rename docs/examples/ex_node_value_converter_from_node.output => examples/apis/node_value_converter/from_node.output (100%) rename docs/examples/ex_node_value_converter_to_node.cpp => examples/apis/node_value_converter/to_node.cpp (92%) rename docs/examples/ex_node_value_converter_to_node.output => examples/apis/node_value_converter/to_node.output (100%) create mode 100644 examples/apis/operator_literal_yaml/CMakeLists.txt rename docs/examples/ex_operator_literal_yaml.cpp => examples/apis/operator_literal_yaml/operator_literal_yaml.cpp (93%) rename docs/examples/ex_operator_literal_yaml.output => examples/apis/operator_literal_yaml/operator_literal_yaml.output (100%) create mode 100644 examples/apis/ordered_map/CMakeLists.txt rename docs/examples/ex_ordered_map_at.cpp => examples/apis/ordered_map/at.cpp (92%) rename docs/examples/ex_ordered_map_at.output => examples/apis/ordered_map/at.output (100%) rename docs/examples/ex_ordered_map_constructor_initializer_list.cpp => examples/apis/ordered_map/constructor_initializer_list.cpp (90%) rename docs/examples/ex_ordered_map_constructor_initializer_list.output => examples/apis/ordered_map/constructor_initializer_list.output (100%) rename docs/examples/ex_ordered_map_constructor_noarg.cpp => examples/apis/ordered_map/constructor_noarg.cpp (89%) rename docs/examples/ex_ordered_map_constructor_noarg.output => examples/apis/ordered_map/constructor_noarg.output (100%) rename docs/examples/ex_ordered_map_emplace.cpp => examples/apis/ordered_map/emplace.cpp (93%) rename docs/examples/ex_ordered_map_emplace.output => examples/apis/ordered_map/emplace.output (100%) rename docs/examples/ex_ordered_map_find.cpp => examples/apis/ordered_map/find.cpp (93%) rename docs/examples/ex_ordered_map_find.output => examples/apis/ordered_map/find.output (100%) rename docs/examples/ex_ordered_map_subscript_operator.cpp => examples/apis/ordered_map/subscript_operator.cpp (92%) rename docs/examples/ex_ordered_map_subscript_operator.output => examples/apis/ordered_map/subscript_operator.output (100%) create mode 100644 examples/apis/yaml_version_type/CMakeLists.txt rename docs/examples/ex_yaml_version_type.cpp => examples/apis/yaml_version_type/yaml_version_type.cpp (94%) rename docs/examples/ex_yaml_version_type.output => examples/apis/yaml_version_type/yaml_version_type.output (100%) create mode 100644 examples/tutorials/CMakeLists.txt rename {docs/examples => examples/tutorials}/example.yaml (100%) rename {docs/examples => examples/tutorials}/tutorial_1.cpp (92%) rename {docs/examples => examples/tutorials}/tutorial_1.output (100%) rename {docs/examples => examples/tutorials}/tutorial_2.cpp (93%) rename {docs/examples => examples/tutorials}/tutorial_2.output (100%) rename {docs/examples => examples/tutorials}/tutorial_3.cpp (95%) rename {docs/examples => examples/tutorials}/tutorial_3.output (100%) rename {docs/examples => examples/tutorials}/tutorial_4.cpp (97%) rename {docs/examples => examples/tutorials}/tutorial_4.output (100%) rename {test => tests}/CMakeLists.txt (100%) rename {test => tests}/cmake_add_subdirectory_test/CMakeLists.txt (100%) rename {test => tests}/cmake_add_subdirectory_test/project/CMakeLists.txt (100%) rename {test/cmake_fetch_content_test => tests/cmake_add_subdirectory_test}/project/main.cpp (90%) rename {test => tests}/cmake_fetch_content_test/CMakeLists.txt (100%) rename {test => tests}/cmake_fetch_content_test/project/CMakeLists.txt (100%) rename {test/cmake_find_package_test => tests/cmake_fetch_content_test}/project/main.cpp (90%) rename {test => tests}/cmake_find_package_test/CMakeLists.txt (100%) rename {test => tests}/cmake_find_package_test/project/CMakeLists.txt (100%) rename {test/cmake_target_include_directories_test => tests/cmake_find_package_test}/project/main.cpp (90%) rename {test => tests}/cmake_target_include_directories_test/CMakeLists.txt (100%) rename {test => tests}/cmake_target_include_directories_test/project/CMakeLists.txt (100%) rename {test/cmake_add_subdirectory_test => tests/cmake_target_include_directories_test}/project/main.cpp (90%) rename {test => tests}/unit_test/CMakeLists.txt (99%) rename {test => tests}/unit_test/main.cpp (86%) rename {test => tests}/unit_test/test_custom_from_node.cpp (98%) rename {test => tests}/unit_test/test_data/extraction_operator_test_data.yml (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf16be_crlf.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf16bebom.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf16ben.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf16lebom.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf16len.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf32be_crlf.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf32bebom.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf32ben.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf32lebom.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf32len.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8_crlf.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8bom.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8n.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8n_invalid_1byte_char.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8n_invalid_2byte_char.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8n_invalid_3byte_char.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8n_invalid_4byte_char.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8n_valid_1byte_char.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8n_valid_2byte_char.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8n_valid_3byte_char.txt (100%) rename {test => tests}/unit_test/test_data/input_adapter_test_data_utf8n_valid_4byte_char.txt (100%) rename {test => tests}/unit_test/test_data/single_char_byte_input.txt (100%) rename {test => tests}/unit_test/test_deserializer_class.cpp (99%) rename {test => tests}/unit_test/test_exception_class.cpp (93%) rename {test => tests}/unit_test/test_input_adapter.cpp (99%) rename {test => tests}/unit_test/test_iterator_class.cpp (99%) rename {test => tests}/unit_test/test_lexical_analyzer_class.cpp (99%) rename {test => tests}/unit_test/test_node_attrs.cpp (97%) rename {test => tests}/unit_test/test_node_class.cpp (99%) rename {test => tests}/unit_test/test_node_ref_storage_class.cpp (97%) rename {test => tests}/unit_test/test_node_type.cpp (94%) rename {test => tests}/unit_test/test_ordered_map_class.cpp (98%) rename {test => tests}/unit_test/test_position_tracker_class.cpp (98%) rename {test => tests}/unit_test/test_reverse_iterator_class.cpp (99%) rename {test => tests}/unit_test/test_scalar_conv.cpp (99%) rename {test => tests}/unit_test/test_scalar_parser_class.cpp (99%) rename {test => tests}/unit_test/test_scalar_scanner_class.cpp (98%) rename {test => tests}/unit_test/test_serializer_class.cpp (99%) rename {test => tests}/unit_test/test_str_view_class.cpp (99%) rename {test => tests}/unit_test/test_string_formatter.cpp (90%) rename {test => tests}/unit_test/test_tag_resolver_class.cpp (98%) rename {test => tests}/unit_test/test_uri_encoding_class.cpp (97%) rename {test => tests}/unit_test/test_utf_encode_detector.cpp (99%) rename {test => tests}/unit_test/test_utf_encodings.cpp (99%) rename {test => tests}/unit_test/test_yaml_escaper_class.cpp (98%) rename {test => tests}/unit_test/test_yaml_version_type.cpp (92%) rename {tool => tools}/amalgamation/CHANGES.md (100%) rename {tool => tools}/amalgamation/README.md (100%) rename {tool => tools}/amalgamation/amalgamate.py (100%) rename {tool => tools}/amalgamation/fkyaml_fwd_hpp.json (100%) rename {tool => tools}/amalgamation/node_hpp.json (100%) rename {tool => tools}/benchmark/CMakeLists.txt (100%) rename {tool => tools}/benchmark/README.md (100%) rename {tool => tools}/benchmark/cases/citm_catalog.json (100%) rename {tool => tools}/benchmark/cases/citm_catalog.yml (100%) rename {tool => tools}/benchmark/cases/ubuntu.yml (100%) rename {tool => tools}/benchmark/main.cpp (98%) rename {tool => tools}/benchmark/results/result_debug_citm_catalog_json.txt (100%) rename {tool => tools}/benchmark/results/result_debug_citm_catalog_yml.txt (100%) rename {tool => tools}/benchmark/results/result_debug_ubuntu_yml.txt (100%) rename {tool => tools}/benchmark/results/result_release_citm_catalog_json.txt (100%) rename {tool => tools}/benchmark/results/result_release_citm_catalog_yml.txt (100%) rename {tool => tools}/benchmark/results/result_release_ubuntu_yml.txt (100%) rename {tool => tools}/clang_tidy/CMakeLists.txt (100%) rename {tool => tools}/iwyu/CMakeLists.txt (100%) rename {tool => tools}/natvis_generator/Makefile (100%) rename {tool => tools}/natvis_generator/README.md (100%) rename {tool => tools}/natvis_generator/fkYAML.natvis.j2 (100%) rename {tool => tools}/natvis_generator/natvis_generator.py (100%) rename {tool => tools}/natvis_generator/params.json (100%) rename {tool => tools}/natvis_generator/requirements.txt (100%) diff --git a/CODEOWNERS b/.github/CODEOWNERS similarity index 100% rename from CODEOWNERS rename to .github/CODEOWNERS diff --git a/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md similarity index 100% rename from CODE_OF_CONDUCT.md rename to .github/CODE_OF_CONDUCT.md diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md diff --git a/SECURITY.md b/.github/SECURITY.md similarity index 100% rename from SECURITY.md rename to .github/SECURITY.md diff --git a/.gitignore b/.gitignore index 6160d917..1ae40e09 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ /.vs/ # documentation -/docs/mkdocs/site/ -/docs/mkdocs/venv/ +/docs/site/ +/docs/venv/ # natvis generator -/tool/natvis_generator/venv/ +/tools/natvis_generator/venv/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 4577d3e7..6744faeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,7 @@ endif() ########################### if(FK_YAML_BUILD_EXAMPLES) - add_subdirectory(docs/examples) + add_subdirectory(examples) endif() ############################ @@ -119,16 +119,16 @@ endif() # Configure clang-tidy if enabled. if(FK_YAML_RUN_CLANG_TIDY) - add_subdirectory(tool/clang_tidy) + add_subdirectory(tools/clang_tidy) endif() # Configure include-what-you-use if enabled. if(FK_YAML_RUN_IWYU) - add_subdirectory(tool/iwyu) + add_subdirectory(tools/iwyu) endif() if(FK_YAML_RUN_BENCHMARK) - add_subdirectory(tool/benchmark) + add_subdirectory(tools/benchmark) endif() ################################# @@ -143,7 +143,7 @@ if(FK_YAML_BUILD_TEST OR FK_YAML_BUILD_ALL_TEST) add_subdirectory(${CATCH2_ROOT_DIR}) include(CTest) enable_testing() - add_subdirectory(test) + add_subdirectory(tests) # Set the unit test app project as the Visual Studio startup project # if the target compiler is some version of Microsoft Visual C++ and diff --git a/LICENSE.txt b/LICENSE.txt index 50eaec62..e0f75b3f 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023-2024 Kensuke Fukutani +Copyright (c) 2023-2025 Kensuke Fukutani Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Makefile b/Makefile index 57a33166..62d1edc6 100644 --- a/Makefile +++ b/Makefile @@ -88,10 +88,10 @@ check-amalgamate: ########################################## update-params-for-natvis: - echo { \"version\": \"$(TARGET_VERSION_FULL)\" } > ./tool/natvis_generator/params.json + echo { \"version\": \"$(TARGET_VERSION_FULL)\" } > ./tools/natvis_generator/params.json fkYAML.natvis: update-params-for-natvis - @$(MAKE) -C ./tool/natvis_generator generate + @$(MAKE) -C ./tools/natvis_generator generate ##################### # Documentation # @@ -102,10 +102,10 @@ examples: cmake --build build_examples --config Debug build-docs: examples - @$(MAKE) -C ./docs/mkdocs build + @$(MAKE) -C ./docs build serve-docs: examples - @$(MAKE) -C ./docs/mkdocs serve + @$(MAKE) -C ./docs serve ############### # Version # @@ -130,10 +130,10 @@ update-project-version: reuse: update-reuse-templates pipx run reuse annotate $(SRCS) --template fkYAML \ --copyright "Kensuke Fukutani " --copyright-style spdx \ - --license MIT --year "2023-2024" --style cppsingle + --license MIT --year "2023-2025" --style cppsingle pipx run reuse annotate $(TEST_SRCS) $(EXAMPLE_SRCS) $(TOOL_SRCS) --template fkYAML_support \ --copyright "Kensuke Fukutani " --copyright-style spdx \ - --license MIT --year "2023-2024" --style cppsingle + --license MIT --year "2023-2025" --style cppsingle pipx run reuse lint update-sources: reuse update-version-macros @@ -178,18 +178,18 @@ build-bm-debug: cmake --build build_bm_debug --config Debug bm-debug: - BENCHMARK_OUT=./tool/benchmark/results/result_debug_ubuntu_yml.txt BENCHMARK_OUT_FORMAT=console ./build_bm_debug/tool/benchmark/benchmarker ./tool/benchmark/cases/ubuntu.yml - BENCHMARK_OUT=./tool/benchmark/results/result_debug_citm_catalog_json.txt BENCHMARK_OUT_FORMAT=console ./build_bm_debug/tool/benchmark/benchmarker ./tool/benchmark/cases/citm_catalog.json - BENCHMARK_OUT=./tool/benchmark/results/result_debug_citm_catalog_yml.txt BENCHMARK_OUT_FORMAT=console ./build_bm_debug/tool/benchmark/benchmarker ./tool/benchmark/cases/citm_catalog.yml + BENCHMARK_OUT=./tools/benchmark/results/result_debug_ubuntu_yml.txt BENCHMARK_OUT_FORMAT=console ./build_bm_debug/tools/benchmark/benchmarker ./tools/benchmark/cases/ubuntu.yml + BENCHMARK_OUT=./tools/benchmark/results/result_debug_citm_catalog_json.txt BENCHMARK_OUT_FORMAT=console ./build_bm_debug/tools/benchmark/benchmarker ./tools/benchmark/cases/citm_catalog.json + BENCHMARK_OUT=./tools/benchmark/results/result_debug_citm_catalog_yml.txt BENCHMARK_OUT_FORMAT=console ./build_bm_debug/tools/benchmark/benchmarker ./tools/benchmark/cases/citm_catalog.yml build-bm-release: cmake -B build_bm_release -S . -DCMAKE_BUILD_TYPE=Release -DFK_YAML_RUN_BENCHMARK=ON cmake --build build_bm_release --config Release bm-release: - BENCHMARK_OUT=./tool/benchmark/results/result_release_ubuntu_yml.txt BENCHMARK_OUT_FORMAT=console ./build_bm_release/tool/benchmark/benchmarker ./tool/benchmark/cases/ubuntu.yml - BENCHMARK_OUT=./tool/benchmark/results/result_release_citm_catalog_json.txt BENCHMARK_OUT_FORMAT=console ./build_bm_release/tool/benchmark/benchmarker ./tool/benchmark/cases/citm_catalog.json - BENCHMARK_OUT=./tool/benchmark/results/result_release_citm_catalog_yml.txt BENCHMARK_OUT_FORMAT=console ./build_bm_release/tool/benchmark/benchmarker ./tool/benchmark/cases/citm_catalog.yml + BENCHMARK_OUT=./tools/benchmark/results/result_release_ubuntu_yml.txt BENCHMARK_OUT_FORMAT=console ./build_bm_release/tools/benchmark/benchmarker ./tools/benchmark/cases/ubuntu.yml + BENCHMARK_OUT=./tools/benchmark/results/result_release_citm_catalog_json.txt BENCHMARK_OUT_FORMAT=console ./build_bm_release/tools/benchmark/benchmarker ./tools/benchmark/cases/citm_catalog.json + BENCHMARK_OUT=./tools/benchmark/results/result_release_citm_catalog_yml.txt BENCHMARK_OUT_FORMAT=console ./build_bm_release/tools/benchmark/benchmarker ./tools/benchmark/cases/citm_catalog.yml ################### # Maintenance # diff --git a/README.md b/README.md index 4804ee81..6f41cf6d 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ Note that, since fkYAML deserializes scalars into native booleans or integers du This project is distributed under the [MIT License](https://opensource.org/license/mit/): -Copyright (c) 2023-2024 Kensuke Fukutani +Copyright (c) 2023-2025 Kensuke Fukutani Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/REUSE.toml b/REUSE.toml index d988fa29..64e97b91 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -6,7 +6,7 @@ SPDX-PackageDownloadLocation = "https://github.com/fktn-k/fkYAML" [[annotations]] path = "**" precedence = "aggregate" -SPDX-FileCopyrightText = "2023-2024 Kensuke Fukutani " +SPDX-FileCopyrightText = "2023-2025 Kensuke Fukutani " SPDX-License-Identifier = "MIT" [[annotations]] diff --git a/docs/mkdocs/Makefile b/docs/Makefile similarity index 100% rename from docs/mkdocs/Makefile rename to docs/Makefile diff --git a/docs/mkdocs/docs/api/basic_node/add_anchor_name.md b/docs/docs/api/basic_node/add_anchor_name.md similarity index 85% rename from docs/mkdocs/docs/api/basic_node/add_anchor_name.md rename to docs/docs/api/basic_node/add_anchor_name.md index b0784638..35a11178 100644 --- a/docs/mkdocs/docs/api/basic_node/add_anchor_name.md +++ b/docs/docs/api/basic_node/add_anchor_name.md @@ -20,12 +20,12 @@ If the basic_node has already had any anchor name, the new anchor name overwrite ??? Example ```cpp - --8<-- "examples/ex_basic_node_add_anchor_name.cpp:9" + --8<-- "apis/basic_node/add_anchor_name.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_add_anchor_name.output" + --8<-- "apis/basic_node/add_anchor_name.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/add_tag_name.md b/docs/docs/api/basic_node/add_tag_name.md similarity index 85% rename from docs/mkdocs/docs/api/basic_node/add_tag_name.md rename to docs/docs/api/basic_node/add_tag_name.md index e865e951..75861232 100644 --- a/docs/mkdocs/docs/api/basic_node/add_tag_name.md +++ b/docs/docs/api/basic_node/add_tag_name.md @@ -20,12 +20,12 @@ If the basic_node has already had any tag name, the new tag name overwrites the ??? Example ```cpp - --8<-- "examples/ex_basic_node_add_tag_name.cpp:9" + --8<-- "apis/basic_node/add_tag_name.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_add_tag_name.output" + --8<-- "apis/basic_node/add_tag_name.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/alias_of.md b/docs/docs/api/basic_node/alias_of.md similarity index 89% rename from docs/mkdocs/docs/api/basic_node/alias_of.md rename to docs/docs/api/basic_node/alias_of.md index e0db2d26..104fe590 100644 --- a/docs/mkdocs/docs/api/basic_node/alias_of.md +++ b/docs/docs/api/basic_node/alias_of.md @@ -28,12 +28,12 @@ An alias node which refers to the given anchor node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_alias_of.cpp:9" + --8<-- "apis/basic_node/alias_of.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_alias_of.output" + --8<-- "apis/basic_node/alias_of.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/at.md b/docs/docs/api/basic_node/at.md similarity index 91% rename from docs/mkdocs/docs/api/basic_node/at.md rename to docs/docs/api/basic_node/at.md index c63d30ff..71ba06d1 100644 --- a/docs/mkdocs/docs/api/basic_node/at.md +++ b/docs/docs/api/basic_node/at.md @@ -60,23 +60,23 @@ This function therefore costs a bit more than [`operator[]`](operator[].md) due ??? Example "Access an element with compatible keys" ```cpp - --8<-- "examples/ex_basic_node_at_compatible_type.cpp:9" + --8<-- "apis/basic_node/at_compatible_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_at_compatible_type.output" + --8<-- "apis/basic_node/at_compatible_type.output" ``` ??? Example "Access an element with `basic_node` keys" ```cpp - --8<-- "examples/ex_basic_node_at_basic_node.cpp:9" + --8<-- "apis/basic_node/at_basic_node.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_at_basic_node.output" + --8<-- "apis/basic_node/at_basic_node.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/begin.md b/docs/docs/api/basic_node/begin.md similarity index 90% rename from docs/mkdocs/docs/api/basic_node/begin.md rename to docs/docs/api/basic_node/begin.md index 376aac37..63b3734e 100644 --- a/docs/mkdocs/docs/api/basic_node/begin.md +++ b/docs/docs/api/basic_node/begin.md @@ -22,12 +22,12 @@ A (constant) iterator to the first element of a container node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_begin.cpp:9" + --8<-- "apis/basic_node/begin.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_begin.output" + --8<-- "apis/basic_node/begin.output" ``` ### **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/boolean_type.md b/docs/docs/api/basic_node/boolean_type.md similarity index 87% rename from docs/mkdocs/docs/api/basic_node/boolean_type.md rename to docs/docs/api/basic_node/boolean_type.md index dd38164b..256c38e5 100644 --- a/docs/mkdocs/docs/api/basic_node/boolean_type.md +++ b/docs/docs/api/basic_node/boolean_type.md @@ -21,12 +21,12 @@ With the decided type, boolean values are stored directly inside a [`basic_node` ??? Example ```cpp - --8<-- "examples/ex_basic_node_boolean_type.cpp:9" + --8<-- "apis/basic_node/boolean_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_boolean_type.output" + --8<-- "apis/basic_node/boolean_type.output" ``` ### **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/constructor.md b/docs/docs/api/basic_node/constructor.md similarity index 88% rename from docs/mkdocs/docs/api/basic_node/constructor.md rename to docs/docs/api/basic_node/constructor.md index bc2ca0e7..0d25876f 100644 --- a/docs/mkdocs/docs/api/basic_node/constructor.md +++ b/docs/docs/api/basic_node/constructor.md @@ -117,78 +117,78 @@ Available overloads are: ??? Example "Overload(1): create a default value" ```cpp - --8<-- "examples/ex_basic_node_constructor_1.cpp:9" + --8<-- "apis/basic_node/constructor_1.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_constructor_1.output" + --8<-- "apis/basic_node/constructor_1.output" ``` ??? Example "Overload(2): create an empty value with a given type" ```cpp - --8<-- "examples/ex_basic_node_constructor_2.cpp:9" + --8<-- "apis/basic_node/constructor_2.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_constructor_2.output" + --8<-- "apis/basic_node/constructor_2.output" ``` ??? Example "Overload(3): create an empty value with a given type (deprecated)" ```cpp - --8<-- "examples/ex_basic_node_constructor_3.cpp:9" + --8<-- "apis/basic_node/constructor_3.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_constructor_3.output" + --8<-- "apis/basic_node/constructor_3.output" ``` ??? Example "Overload(4): copy construct a basic_node object" ```cpp - --8<-- "examples/ex_basic_node_constructor_4.cpp:9" + --8<-- "apis/basic_node/constructor_4.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_constructor_4.output" + --8<-- "apis/basic_node/constructor_4.output" ``` ??? Example "Overload(5): move construct a basic_node object" ```cpp - --8<-- "examples/ex_basic_node_constructor_5.cpp:9" + --8<-- "apis/basic_node/constructor_5.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_constructor_5.output" + --8<-- "apis/basic_node/constructor_5.output" ``` ??? Example "Overload(6): create a basic_node object with compatible types" ```cpp - --8<-- "examples/ex_basic_node_constructor_6.cpp:9" + --8<-- "apis/basic_node/constructor_6.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_constructor_6.output" + --8<-- "apis/basic_node/constructor_6.output" ``` ??? Example "Overload(7): create a basic_node object from an initializer list" ```cpp - --8<-- "examples/ex_basic_node_constructor_7.cpp:9" + --8<-- "apis/basic_node/constructor_7.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_constructor_7.output" + --8<-- "apis/basic_node/constructor_7.output" ``` --- diff --git a/docs/mkdocs/docs/api/basic_node/contains.md b/docs/docs/api/basic_node/contains.md similarity index 93% rename from docs/mkdocs/docs/api/basic_node/contains.md rename to docs/docs/api/basic_node/contains.md index 1f04a430..ed570ad4 100644 --- a/docs/mkdocs/docs/api/basic_node/contains.md +++ b/docs/docs/api/basic_node/contains.md @@ -37,12 +37,12 @@ So, if you use the same key multiple times, for example, in a for loop, consider ??? Example ```cpp - --8<-- "examples/ex_basic_node_contains.cpp:9" + --8<-- "apis/basic_node/contains.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_contains.output" + --8<-- "apis/basic_node/contains.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/deserialize.md b/docs/docs/api/basic_node/deserialize.md similarity index 88% rename from docs/mkdocs/docs/api/basic_node/deserialize.md rename to docs/docs/api/basic_node/deserialize.md index c81cea62..f9eb6988 100644 --- a/docs/mkdocs/docs/api/basic_node/deserialize.md +++ b/docs/docs/api/basic_node/deserialize.md @@ -75,49 +75,49 @@ The resulting `basic_node` object of deserialization. ??? Example "Example (a character array)" ```cpp - --8<-- "examples/ex_basic_node_deserialize_char_array.cpp:9" + --8<-- "apis/basic_node/deserialize_char_array.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_deserialize_char_array.output" + --8<-- "apis/basic_node/deserialize_char_array.output" ``` ??? Example "Example (a std::string object)" ```cpp - --8<-- "examples/ex_basic_node_deserialize_string.cpp:9" + --8<-- "apis/basic_node/deserialize_string.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_deserialize_string.output" + --8<-- "apis/basic_node/deserialize_string.output" ``` ??? Example "Example (a FILE pointer)" ```yaml title="input.yaml" - --8<-- "examples/input.yaml" + --8<-- "apis/input.yaml" ``` ```cpp - --8<-- "examples/ex_basic_node_deserialize_file_pointer.cpp:9" + --8<-- "apis/basic_node/deserialize_file_pointer.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_deserialize_file_pointer.output" + --8<-- "apis/basic_node/deserialize_file_pointer.output" ``` ??? Example "Example (a pair of iterators)" ```cpp - --8<-- "examples/ex_basic_node_deserialize_iterators.cpp:9" + --8<-- "apis/basic_node/deserialize_iterators.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_deserialize_iterators.output" + --8<-- "apis/basic_node/deserialize_iterators.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/deserialize_docs.md b/docs/docs/api/basic_node/deserialize_docs.md similarity index 82% rename from docs/mkdocs/docs/api/basic_node/deserialize_docs.md rename to docs/docs/api/basic_node/deserialize_docs.md index 2e654c1b..36e9b520 100644 --- a/docs/mkdocs/docs/api/basic_node/deserialize_docs.md +++ b/docs/docs/api/basic_node/deserialize_docs.md @@ -57,49 +57,49 @@ The resulting `basic_node` objects of deserialization. ??? Example "Example (a character array)" ```cpp - --8<-- "examples/ex_basic_node_deserialize_docs_char_array.cpp:9" + --8<-- "apis/basic_node/deserialize_docs_char_array.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_deserialize_docs_char_array.output" + --8<-- "apis/basic_node/deserialize_docs_char_array.output" ``` ??? Example "Example (a std::string object)" ```cpp - --8<-- "examples/ex_basic_node_deserialize_docs_string.cpp:9" + --8<-- "apis/basic_node/deserialize_docs_string.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_deserialize_docs_string.output" + --8<-- "apis/basic_node/deserialize_docs_string.output" ``` ??? Example "Example (a FILE pointer)" ```yaml title="input_multi.yaml" - --8<-- "examples/input_multi.yaml" + --8<-- "apis/input_multi.yaml" ``` ```cpp - --8<-- "examples/ex_basic_node_deserialize_docs_file_pointer.cpp:9" + --8<-- "apis/basic_node/deserialize_docs_file_pointer.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_deserialize_docs_file_pointer.output" + --8<-- "apis/basic_node/deserialize_docs_file_pointer.output" ``` ??? Example "Example (a pair of iterators)" ```cpp - --8<-- "examples/ex_basic_node_deserialize_docs_iterators.cpp:9" + --8<-- "apis/basic_node/deserialize_docs_iterators.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_deserialize_docs_iterators.output" + --8<-- "apis/basic_node/deserialize_docs_iterators.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/destructor.md b/docs/docs/api/basic_node/destructor.md similarity index 100% rename from docs/mkdocs/docs/api/basic_node/destructor.md rename to docs/docs/api/basic_node/destructor.md diff --git a/docs/mkdocs/docs/api/basic_node/empty.md b/docs/docs/api/basic_node/empty.md similarity index 85% rename from docs/mkdocs/docs/api/basic_node/empty.md rename to docs/docs/api/basic_node/empty.md index 0b87f302..48c85b54 100644 --- a/docs/mkdocs/docs/api/basic_node/empty.md +++ b/docs/docs/api/basic_node/empty.md @@ -18,12 +18,12 @@ If a basic_node is neither a sequence, mapping nor string, a [`fkyaml::type_erro ??? Example ```cpp - --8<-- "examples/ex_basic_node_empty.cpp:9" + --8<-- "apis/basic_node/empty.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_empty.output" + --8<-- "apis/basic_node/empty.output" ``` ### **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/end.md b/docs/docs/api/basic_node/end.md similarity index 90% rename from docs/mkdocs/docs/api/basic_node/end.md rename to docs/docs/api/basic_node/end.md index c5a6996f..1e458a2e 100644 --- a/docs/mkdocs/docs/api/basic_node/end.md +++ b/docs/docs/api/basic_node/end.md @@ -22,12 +22,12 @@ A (constant) iterator to the past-the-last element of a container node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_end.cpp:9" + --8<-- "apis/basic_node/end.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_end.output" + --8<-- "apis/basic_node/end.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/extraction_operator.md b/docs/docs/api/basic_node/extraction_operator.md similarity index 87% rename from docs/mkdocs/docs/api/basic_node/extraction_operator.md rename to docs/docs/api/basic_node/extraction_operator.md index ef0a57e3..27836890 100644 --- a/docs/mkdocs/docs/api/basic_node/extraction_operator.md +++ b/docs/docs/api/basic_node/extraction_operator.md @@ -28,16 +28,16 @@ Reference to the input stream object `is`. ??? Example ```yaml - --8<-- "examples/input.yaml" + --8<-- "apis/input.yaml" ``` ```cpp - --8<-- "examples/ex_basic_node_extraction_operator.cpp:9" + --8<-- "apis/basic_node/extraction_operator.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_extraction_operator.output" + --8<-- "apis/basic_node/extraction_operator.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/float_number_type.md b/docs/docs/api/basic_node/float_number_type.md similarity index 88% rename from docs/mkdocs/docs/api/basic_node/float_number_type.md rename to docs/docs/api/basic_node/float_number_type.md index f3b17221..70d4eaac 100644 --- a/docs/mkdocs/docs/api/basic_node/float_number_type.md +++ b/docs/docs/api/basic_node/float_number_type.md @@ -22,12 +22,12 @@ With the decided type, floating point values are stored directly inside a [`basi ??? Example ```cpp - --8<-- "examples/ex_basic_node_float_number_type.cpp:9" + --8<-- "apis/basic_node/float_number_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_float_number_type.output" + --8<-- "apis/basic_node/float_number_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/get_anchor_name.md b/docs/docs/api/basic_node/get_anchor_name.md similarity index 86% rename from docs/mkdocs/docs/api/basic_node/get_anchor_name.md rename to docs/docs/api/basic_node/get_anchor_name.md index ed8f5e04..9f691019 100644 --- a/docs/mkdocs/docs/api/basic_node/get_anchor_name.md +++ b/docs/docs/api/basic_node/get_anchor_name.md @@ -20,12 +20,12 @@ The anchor name associated to the node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_get_anchor_name.cpp:9" + --8<-- "apis/basic_node/get_anchor_name.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_get_anchor_name.output" + --8<-- "apis/basic_node/get_anchor_name.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/get_tag_name.md b/docs/docs/api/basic_node/get_tag_name.md similarity index 86% rename from docs/mkdocs/docs/api/basic_node/get_tag_name.md rename to docs/docs/api/basic_node/get_tag_name.md index 0a50e048..76509631 100644 --- a/docs/mkdocs/docs/api/basic_node/get_tag_name.md +++ b/docs/docs/api/basic_node/get_tag_name.md @@ -20,12 +20,12 @@ The tag name associated to the node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_get_tag_name.cpp:9" + --8<-- "apis/basic_node/get_tag_name.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_get_tag_name.output" + --8<-- "apis/basic_node/get_tag_name.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/get_type.md b/docs/docs/api/basic_node/get_type.md similarity index 89% rename from docs/mkdocs/docs/api/basic_node/get_type.md rename to docs/docs/api/basic_node/get_type.md index 8f092523..cc7134ac 100644 --- a/docs/mkdocs/docs/api/basic_node/get_type.md +++ b/docs/docs/api/basic_node/get_type.md @@ -27,12 +27,12 @@ The type of the YAML node value. ??? Example ```cpp - --8<-- "examples/ex_basic_node_get_type.cpp:9" + --8<-- "apis/basic_node/get_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_get_type.output" + --8<-- "apis/basic_node/get_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/get_value.md b/docs/docs/api/basic_node/get_value.md similarity index 98% rename from docs/mkdocs/docs/api/basic_node/get_value.md rename to docs/docs/api/basic_node/get_value.md index 2cf9930c..9f806a1c 100644 --- a/docs/mkdocs/docs/api/basic_node/get_value.md +++ b/docs/docs/api/basic_node/get_value.md @@ -123,12 +123,12 @@ A compatible native data value converted from the [basic_node](./index.md) objec ??? Example ```cpp - --8<-- "examples/ex_basic_node_get_value.cpp:9" + --8<-- "apis/basic_node/get_value.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_get_value.output" + --8<-- "apis/basic_node/get_value.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/get_value_inplace.md b/docs/docs/api/basic_node/get_value_inplace.md similarity index 96% rename from docs/mkdocs/docs/api/basic_node/get_value_inplace.md rename to docs/docs/api/basic_node/get_value_inplace.md index 9d010f2c..9b107011 100644 --- a/docs/mkdocs/docs/api/basic_node/get_value_inplace.md +++ b/docs/docs/api/basic_node/get_value_inplace.md @@ -55,12 +55,12 @@ See the notes there for details. ??? Example ```cpp - --8<-- "examples/ex_basic_node_get_value_inplace.cpp:9" + --8<-- "apis/basic_node/get_value_inplace.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_get_value_inplace.output" + --8<-- "apis/basic_node/get_value_inplace.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/get_value_ref.md b/docs/docs/api/basic_node/get_value_ref.md similarity index 91% rename from docs/mkdocs/docs/api/basic_node/get_value_ref.md rename to docs/docs/api/basic_node/get_value_ref.md index 76ec2cc5..8f371316 100644 --- a/docs/mkdocs/docs/api/basic_node/get_value_ref.md +++ b/docs/docs/api/basic_node/get_value_ref.md @@ -39,12 +39,12 @@ Reference to the internally stored YAML node value. ??? Example ```cpp - --8<-- "examples/ex_basic_node_get_value_ref.cpp:9" + --8<-- "apis/basic_node/get_value_ref.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_get_value_ref.output" + --8<-- "apis/basic_node/get_value_ref.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/get_yaml_version.md b/docs/docs/api/basic_node/get_yaml_version.md similarity index 91% rename from docs/mkdocs/docs/api/basic_node/get_yaml_version.md rename to docs/docs/api/basic_node/get_yaml_version.md index b54c0a04..65097748 100644 --- a/docs/mkdocs/docs/api/basic_node/get_yaml_version.md +++ b/docs/docs/api/basic_node/get_yaml_version.md @@ -35,12 +35,12 @@ The YAML specification version applied to a basic_node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_get_yaml_version.cpp:9" + --8<-- "apis/basic_node/get_yaml_version.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_get_yaml_version.output" + --8<-- "apis/basic_node/get_yaml_version.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/get_yaml_version_type.md b/docs/docs/api/basic_node/get_yaml_version_type.md similarity index 86% rename from docs/mkdocs/docs/api/basic_node/get_yaml_version_type.md rename to docs/docs/api/basic_node/get_yaml_version_type.md index 595b72af..21513379 100644 --- a/docs/mkdocs/docs/api/basic_node/get_yaml_version_type.md +++ b/docs/docs/api/basic_node/get_yaml_version_type.md @@ -22,12 +22,12 @@ The YAML specification version applied to a basic_node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_get_yaml_version_type.cpp:9" + --8<-- "apis/basic_node/get_yaml_version_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_get_yaml_version_type.output" + --8<-- "apis/basic_node/get_yaml_version_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/has_anchor_name.md b/docs/docs/api/basic_node/has_anchor_name.md similarity index 81% rename from docs/mkdocs/docs/api/basic_node/has_anchor_name.md rename to docs/docs/api/basic_node/has_anchor_name.md index 71821ed4..88ffe617 100644 --- a/docs/mkdocs/docs/api/basic_node/has_anchor_name.md +++ b/docs/docs/api/basic_node/has_anchor_name.md @@ -17,12 +17,12 @@ Check if the node has an anchor name. ??? Example ```cpp - --8<-- "examples/ex_basic_node_has_anchor_name.cpp:9" + --8<-- "apis/basic_node/has_anchor_name.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_has_anchor_name.output" + --8<-- "apis/basic_node/has_anchor_name.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/has_tag_name.md b/docs/docs/api/basic_node/has_tag_name.md similarity index 81% rename from docs/mkdocs/docs/api/basic_node/has_tag_name.md rename to docs/docs/api/basic_node/has_tag_name.md index b91c32f8..ba49bad2 100644 --- a/docs/mkdocs/docs/api/basic_node/has_tag_name.md +++ b/docs/docs/api/basic_node/has_tag_name.md @@ -17,12 +17,12 @@ Check if the node has a tag name. ??? Example ```cpp - --8<-- "examples/ex_basic_node_has_tag_name.cpp:9" + --8<-- "apis/basic_node/has_tag_name.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_has_tag_name.output" + --8<-- "apis/basic_node/has_tag_name.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/index.md b/docs/docs/api/basic_node/index.md similarity index 100% rename from docs/mkdocs/docs/api/basic_node/index.md rename to docs/docs/api/basic_node/index.md diff --git a/docs/mkdocs/docs/api/basic_node/insertion_operator.md b/docs/docs/api/basic_node/insertion_operator.md similarity index 91% rename from docs/mkdocs/docs/api/basic_node/insertion_operator.md rename to docs/docs/api/basic_node/insertion_operator.md index 104973c5..1934370f 100644 --- a/docs/mkdocs/docs/api/basic_node/insertion_operator.md +++ b/docs/docs/api/basic_node/insertion_operator.md @@ -50,12 +50,12 @@ Reference to the output stream object `os`. ??? Example ```cpp - --8<-- "examples/ex_basic_node_insertion_operator.cpp:9" + --8<-- "apis/basic_node/insertion_operator.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_insertion_operator.output" + --8<-- "apis/basic_node/insertion_operator.output" ``` ### **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/integer_type.md b/docs/docs/api/basic_node/integer_type.md similarity index 85% rename from docs/mkdocs/docs/api/basic_node/integer_type.md rename to docs/docs/api/basic_node/integer_type.md index 1e37d4a9..a699f66f 100644 --- a/docs/mkdocs/docs/api/basic_node/integer_type.md +++ b/docs/docs/api/basic_node/integer_type.md @@ -17,12 +17,12 @@ With the decided type, integer values are stored directly inside a [`basic_node` ??? Example ```cpp - --8<-- "examples/ex_basic_node_integer_type.cpp:9" + --8<-- "apis/basic_node/integer_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_integer_type.output" + --8<-- "apis/basic_node/integer_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/is_alias.md b/docs/docs/api/basic_node/is_alias.md similarity index 83% rename from docs/mkdocs/docs/api/basic_node/is_alias.md rename to docs/docs/api/basic_node/is_alias.md index 6575654b..3ac7ea2b 100644 --- a/docs/mkdocs/docs/api/basic_node/is_alias.md +++ b/docs/docs/api/basic_node/is_alias.md @@ -17,12 +17,12 @@ Tests whether the node is an alias node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_is_alias.cpp:9" + --8<-- "apis/basic_node/is_alias.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_is_alias.output" + --8<-- "apis/basic_node/is_alias.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/is_anchor.md b/docs/docs/api/basic_node/is_anchor.md similarity index 82% rename from docs/mkdocs/docs/api/basic_node/is_anchor.md rename to docs/docs/api/basic_node/is_anchor.md index c7bd8a43..1b0f2bc5 100644 --- a/docs/mkdocs/docs/api/basic_node/is_anchor.md +++ b/docs/docs/api/basic_node/is_anchor.md @@ -17,12 +17,12 @@ Tests whether the node is an anchor node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_is_anchor.cpp:9" + --8<-- "apis/basic_node/is_anchor.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_is_anchor.output" + --8<-- "apis/basic_node/is_anchor.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/is_boolean.md b/docs/docs/api/basic_node/is_boolean.md similarity index 81% rename from docs/mkdocs/docs/api/basic_node/is_boolean.md rename to docs/docs/api/basic_node/is_boolean.md index afb130ae..ce0bdcec 100644 --- a/docs/mkdocs/docs/api/basic_node/is_boolean.md +++ b/docs/docs/api/basic_node/is_boolean.md @@ -17,12 +17,12 @@ Tests whether the node is a boolean node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_is_boolean.cpp:9" + --8<-- "apis/basic_node/is_boolean.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_is_boolean.output" + --8<-- "apis/basic_node/is_boolean.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/is_float_number.md b/docs/docs/api/basic_node/is_float_number.md similarity index 81% rename from docs/mkdocs/docs/api/basic_node/is_float_number.md rename to docs/docs/api/basic_node/is_float_number.md index c22493a5..57bccf65 100644 --- a/docs/mkdocs/docs/api/basic_node/is_float_number.md +++ b/docs/docs/api/basic_node/is_float_number.md @@ -17,12 +17,12 @@ Tests whether the node is a floating point value node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_is_float_number.cpp:9" + --8<-- "apis/basic_node/is_float_number.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_is_float_number.output" + --8<-- "apis/basic_node/is_float_number.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/is_integer.md b/docs/docs/api/basic_node/is_integer.md similarity index 81% rename from docs/mkdocs/docs/api/basic_node/is_integer.md rename to docs/docs/api/basic_node/is_integer.md index c223376f..89113d82 100644 --- a/docs/mkdocs/docs/api/basic_node/is_integer.md +++ b/docs/docs/api/basic_node/is_integer.md @@ -17,12 +17,12 @@ Tests whether the node is an integer node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_is_integer.cpp:9" + --8<-- "apis/basic_node/is_integer.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_is_integer.output" + --8<-- "apis/basic_node/is_integer.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/is_mapping.md b/docs/docs/api/basic_node/is_mapping.md similarity index 81% rename from docs/mkdocs/docs/api/basic_node/is_mapping.md rename to docs/docs/api/basic_node/is_mapping.md index 9658dd6b..2539e909 100644 --- a/docs/mkdocs/docs/api/basic_node/is_mapping.md +++ b/docs/docs/api/basic_node/is_mapping.md @@ -17,12 +17,12 @@ Tests whether the node is a mapping node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_is_mapping.cpp:9" + --8<-- "apis/basic_node/is_mapping.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_is_mapping.output" + --8<-- "apis/basic_node/is_mapping.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/is_null.md b/docs/docs/api/basic_node/is_null.md similarity index 82% rename from docs/mkdocs/docs/api/basic_node/is_null.md rename to docs/docs/api/basic_node/is_null.md index e09fd182..12b7c2c7 100644 --- a/docs/mkdocs/docs/api/basic_node/is_null.md +++ b/docs/docs/api/basic_node/is_null.md @@ -17,12 +17,12 @@ Tests whether the node is a null node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_is_null.cpp:9" + --8<-- "apis/basic_node/is_null.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_is_null.output" + --8<-- "apis/basic_node/is_null.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/is_scalar.md b/docs/docs/api/basic_node/is_scalar.md similarity index 83% rename from docs/mkdocs/docs/api/basic_node/is_scalar.md rename to docs/docs/api/basic_node/is_scalar.md index 88932f40..e6c9f824 100644 --- a/docs/mkdocs/docs/api/basic_node/is_scalar.md +++ b/docs/docs/api/basic_node/is_scalar.md @@ -17,12 +17,12 @@ Tests whether the node is a scalar node: either a null, boolean, integer, floati ??? Example ```cpp - --8<-- "examples/ex_basic_node_is_scalar.cpp:9" + --8<-- "apis/basic_node/is_scalar.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_is_scalar.output" + --8<-- "apis/basic_node/is_scalar.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/is_sequence.md b/docs/docs/api/basic_node/is_sequence.md similarity index 81% rename from docs/mkdocs/docs/api/basic_node/is_sequence.md rename to docs/docs/api/basic_node/is_sequence.md index 79765c95..77de9143 100644 --- a/docs/mkdocs/docs/api/basic_node/is_sequence.md +++ b/docs/docs/api/basic_node/is_sequence.md @@ -17,12 +17,12 @@ Tests whether the node is a sequence node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_is_sequence.cpp:9" + --8<-- "apis/basic_node/is_sequence.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_is_sequence.output" + --8<-- "apis/basic_node/is_sequence.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/is_string.md b/docs/docs/api/basic_node/is_string.md similarity index 81% rename from docs/mkdocs/docs/api/basic_node/is_string.md rename to docs/docs/api/basic_node/is_string.md index 3b0b3ebe..c2803057 100644 --- a/docs/mkdocs/docs/api/basic_node/is_string.md +++ b/docs/docs/api/basic_node/is_string.md @@ -17,12 +17,12 @@ Tests whether the node is a string node. ??? Example ```cpp - --8<-- "examples/ex_basic_node_is_string.cpp:9" + --8<-- "apis/basic_node/is_string.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_is_string.output" + --8<-- "apis/basic_node/is_string.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/iterator.md b/docs/docs/api/basic_node/iterator.md similarity index 96% rename from docs/mkdocs/docs/api/basic_node/iterator.md rename to docs/docs/api/basic_node/iterator.md index acee0644..9e45ecb6 100644 --- a/docs/mkdocs/docs/api/basic_node/iterator.md +++ b/docs/docs/api/basic_node/iterator.md @@ -41,12 +41,12 @@ They satisfies [LegacyBidirectionalIterator](https://en.cppreference.com/w/cpp/n ??? Example ```cpp - --8<-- "examples/ex_basic_node_iterator.cpp:9" + --8<-- "apis/basic_node/iterator.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_iterator.output" + --8<-- "apis/basic_node/iterator.output" ``` ### **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/mapping.md b/docs/docs/api/basic_node/mapping.md similarity index 88% rename from docs/mkdocs/docs/api/basic_node/mapping.md rename to docs/docs/api/basic_node/mapping.md index 5750d564..53b81bab 100644 --- a/docs/mkdocs/docs/api/basic_node/mapping.md +++ b/docs/docs/api/basic_node/mapping.md @@ -17,12 +17,12 @@ The resulting basic_node has the [`node_type::MAPPING`](../node_type.md) type. ??? Example ```cpp - --8<-- "examples/ex_basic_node_mapping.cpp:9" + --8<-- "apis/basic_node/mapping.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_mapping.output" + --8<-- "apis/basic_node/mapping.output" ``` diff --git a/docs/mkdocs/docs/api/basic_node/mapping_type.md b/docs/docs/api/basic_node/mapping_type.md similarity index 94% rename from docs/mkdocs/docs/api/basic_node/mapping_type.md rename to docs/docs/api/basic_node/mapping_type.md index 6e3db014..36cd6006 100644 --- a/docs/mkdocs/docs/api/basic_node/mapping_type.md +++ b/docs/docs/api/basic_node/mapping_type.md @@ -31,12 +31,12 @@ Note that mapping values are stored as a pointer to an allocated memory area on ??? Example ```cpp - --8<-- "examples/ex_basic_node_mapping_type.cpp:9" + --8<-- "apis/basic_node/mapping_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_mapping_type.output" + --8<-- "apis/basic_node/mapping_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/node.md b/docs/docs/api/basic_node/node.md similarity index 83% rename from docs/mkdocs/docs/api/basic_node/node.md rename to docs/docs/api/basic_node/node.md index 32236087..e5a787b7 100644 --- a/docs/mkdocs/docs/api/basic_node/node.md +++ b/docs/docs/api/basic_node/node.md @@ -13,12 +13,12 @@ This type is a specialization of the [basic_node](index.md) template class and u ??? Example ```cpp - --8<-- "examples/ex_basic_node_node.cpp:9" + --8<-- "apis/basic_node/node.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_node.output" + --8<-- "apis/basic_node/node.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/node_t.md b/docs/docs/api/basic_node/node_t.md similarity index 94% rename from docs/mkdocs/docs/api/basic_node/node_t.md rename to docs/docs/api/basic_node/node_t.md index cf3ec9fb..c0e2ddbd 100644 --- a/docs/mkdocs/docs/api/basic_node/node_t.md +++ b/docs/docs/api/basic_node/node_t.md @@ -45,12 +45,12 @@ This enumeration collects the different YAML value types. ??? Example ```cpp - --8<-- "examples/ex_basic_node_node_t.cpp:9" + --8<-- "apis/basic_node/node_t.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_node_t.output" + --8<-- "apis/basic_node/node_t.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/operator=.md b/docs/docs/api/basic_node/operator=.md similarity index 76% rename from docs/mkdocs/docs/api/basic_node/operator=.md rename to docs/docs/api/basic_node/operator=.md index 1766fde2..9d9b1e1a 100644 --- a/docs/mkdocs/docs/api/basic_node/operator=.md +++ b/docs/docs/api/basic_node/operator=.md @@ -23,12 +23,12 @@ Reference to `this` basic_node object. ??? Example "Overload(1): copy assignments a basic_node" ```cpp - --8<-- "examples/ex_basic_node_copy_assignment_operator.cpp:9" + --8<-- "apis/basic_node/copy_assignment_operator.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_copy_assignment_operator.output" + --8<-- "apis/basic_node/copy_assignment_operator.output" ``` ## **Examples** @@ -36,12 +36,12 @@ Reference to `this` basic_node object. ??? Example "Overload(2): move assignments a basic_node" ```cpp - --8<-- "examples/ex_basic_node_move_assignment_operator.cpp:9" + --8<-- "apis/basic_node/move_assignment_operator.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_move_assignment_operator.output" + --8<-- "apis/basic_node/move_assignment_operator.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/operator[].md b/docs/docs/api/basic_node/operator[].md similarity index 90% rename from docs/mkdocs/docs/api/basic_node/operator[].md rename to docs/docs/api/basic_node/operator[].md index 17dd6cbb..d8da8162 100644 --- a/docs/mkdocs/docs/api/basic_node/operator[].md +++ b/docs/docs/api/basic_node/operator[].md @@ -62,23 +62,23 @@ So, if you use the same key multiple times, for example, in a for loop, consider ??? Example "Overload(1): access an element with compatible keys" ```cpp - --8<-- "examples/ex_basic_node_subscript_operator_compatible_type.cpp:9" + --8<-- "apis/basic_node/subscript_operator_compatible_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_subscript_operator_compatible_type.output" + --8<-- "apis/basic_node/subscript_operator_compatible_type.output" ``` ??? Example "Overload(2): access an element with `basic_node` keys" ```cpp - --8<-- "examples/ex_basic_node_subscript_operator_basic_node.cpp:9" + --8<-- "apis/basic_node/subscript_operator_basic_node.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_subscript_operator_basic_node.output" + --8<-- "apis/basic_node/subscript_operator_basic_node.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/operator_eq.md b/docs/docs/api/basic_node/operator_eq.md similarity index 89% rename from docs/mkdocs/docs/api/basic_node/operator_eq.md rename to docs/docs/api/basic_node/operator_eq.md index b5d09dd5..d43ceb56 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_eq.md +++ b/docs/docs/api/basic_node/operator_eq.md @@ -25,12 +25,12 @@ Compares two `basic_node` objects for equality according to the following rules: ??? Example ```cpp - --8<-- "examples/ex_basic_node_operator_eq.cpp:9" + --8<-- "apis/basic_node/operator_eq.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_operator_eq.output" + --8<-- "apis/basic_node/operator_eq.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/operator_ge.md b/docs/docs/api/basic_node/operator_ge.md similarity index 85% rename from docs/mkdocs/docs/api/basic_node/operator_ge.md rename to docs/docs/api/basic_node/operator_ge.md index a2c97943..7b51019b 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_ge.md +++ b/docs/docs/api/basic_node/operator_ge.md @@ -22,12 +22,12 @@ Check if `this` object is greater than or equal to `rhs`. ??? Example ```cpp - --8<-- "examples/ex_basic_node_operator_ge.cpp:9" + --8<-- "apis/basic_node/operator_ge.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_operator_ge.output" + --8<-- "apis/basic_node/operator_ge.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/operator_gt.md b/docs/docs/api/basic_node/operator_gt.md similarity index 84% rename from docs/mkdocs/docs/api/basic_node/operator_gt.md rename to docs/docs/api/basic_node/operator_gt.md index c95ac0e5..fba0f421 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_gt.md +++ b/docs/docs/api/basic_node/operator_gt.md @@ -22,12 +22,12 @@ Check if `this` object is greater than `rhs`. ??? Example ```cpp - --8<-- "examples/ex_basic_node_operator_gt.cpp:9" + --8<-- "apis/basic_node/operator_gt.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_operator_gt.output" + --8<-- "apis/basic_node/operator_gt.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/operator_le.md b/docs/docs/api/basic_node/operator_le.md similarity index 85% rename from docs/mkdocs/docs/api/basic_node/operator_le.md rename to docs/docs/api/basic_node/operator_le.md index 9fb6396c..34703952 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_le.md +++ b/docs/docs/api/basic_node/operator_le.md @@ -22,12 +22,12 @@ Check if `this` object is less than or equal to `rhs`. ??? Example ```cpp - --8<-- "examples/ex_basic_node_operator_le.cpp:9" + --8<-- "apis/basic_node/operator_le.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_operator_le.output" + --8<-- "apis/basic_node/operator_le.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/operator_lt.md b/docs/docs/api/basic_node/operator_lt.md similarity index 92% rename from docs/mkdocs/docs/api/basic_node/operator_lt.md rename to docs/docs/api/basic_node/operator_lt.md index 46d75cba..8c7eaf37 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_lt.md +++ b/docs/docs/api/basic_node/operator_lt.md @@ -34,12 +34,12 @@ Check if `this` object is less than `rhs` according to the following rules: ??? Example ```cpp - --8<-- "examples/ex_basic_node_operator_lt.cpp:9" + --8<-- "apis/basic_node/operator_lt.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_operator_lt.output" + --8<-- "apis/basic_node/operator_lt.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/operator_ne.md b/docs/docs/api/basic_node/operator_ne.md similarity index 85% rename from docs/mkdocs/docs/api/basic_node/operator_ne.md rename to docs/docs/api/basic_node/operator_ne.md index 2f7ab060..7d83f95f 100644 --- a/docs/mkdocs/docs/api/basic_node/operator_ne.md +++ b/docs/docs/api/basic_node/operator_ne.md @@ -22,12 +22,12 @@ Compares two `basic_node` objects for inequality. ??? Example ```cpp - --8<-- "examples/ex_basic_node_operator_ne.cpp:9" + --8<-- "apis/basic_node/operator_ne.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_operator_ne.output" + --8<-- "apis/basic_node/operator_ne.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/rbegin.md b/docs/docs/api/basic_node/rbegin.md similarity index 90% rename from docs/mkdocs/docs/api/basic_node/rbegin.md rename to docs/docs/api/basic_node/rbegin.md index 33d0e662..81c56b78 100644 --- a/docs/mkdocs/docs/api/basic_node/rbegin.md +++ b/docs/docs/api/basic_node/rbegin.md @@ -22,12 +22,12 @@ A (constant) iterator to the reverse-beginning (= last) element of a container n ??? Example ```cpp - --8<-- "examples/ex_basic_node_rbegin.cpp:9" + --8<-- "apis/basic_node/rbegin.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_rbegin.output" + --8<-- "apis/basic_node/rbegin.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/rend.md b/docs/docs/api/basic_node/rend.md similarity index 91% rename from docs/mkdocs/docs/api/basic_node/rend.md rename to docs/docs/api/basic_node/rend.md index e73788c0..84caacfe 100644 --- a/docs/mkdocs/docs/api/basic_node/rend.md +++ b/docs/docs/api/basic_node/rend.md @@ -22,12 +22,12 @@ A (constant) iterator to the reverse-end (= one before the first) element of a c ??? Example ```cpp - --8<-- "examples/ex_basic_node_rend.cpp:9" + --8<-- "apis/basic_node/rend.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_rend.output" + --8<-- "apis/basic_node/rend.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/reverse_iterator.md b/docs/docs/api/basic_node/reverse_iterator.md similarity index 96% rename from docs/mkdocs/docs/api/basic_node/reverse_iterator.md rename to docs/docs/api/basic_node/reverse_iterator.md index 4efe66ae..2b394220 100644 --- a/docs/mkdocs/docs/api/basic_node/reverse_iterator.md +++ b/docs/docs/api/basic_node/reverse_iterator.md @@ -44,12 +44,12 @@ They satisfies [LegacyBidirectionalIterator](https://en.cppreference.com/w/cpp/n ??? Example ```cpp - --8<-- "examples/ex_basic_node_reverse_iterator.cpp:9" + --8<-- "apis/basic_node/reverse_iterator.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_reverse_iterator.output" + --8<-- "apis/basic_node/reverse_iterator.output" ``` ### **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/sequence.md b/docs/docs/api/basic_node/sequence.md similarity index 88% rename from docs/mkdocs/docs/api/basic_node/sequence.md rename to docs/docs/api/basic_node/sequence.md index ba7abedf..b5e40d15 100644 --- a/docs/mkdocs/docs/api/basic_node/sequence.md +++ b/docs/docs/api/basic_node/sequence.md @@ -17,12 +17,12 @@ The resulting basic_node has the [`node_type::SEQUENCE`](../node_type.md) type. ??? Example ```cpp - --8<-- "examples/ex_basic_node_sequence.cpp:9" + --8<-- "apis/basic_node/sequence.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_sequence.output" + --8<-- "apis/basic_node/sequence.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/sequence_type.md b/docs/docs/api/basic_node/sequence_type.md similarity index 89% rename from docs/mkdocs/docs/api/basic_node/sequence_type.md rename to docs/docs/api/basic_node/sequence_type.md index edabaa72..324663ce 100644 --- a/docs/mkdocs/docs/api/basic_node/sequence_type.md +++ b/docs/docs/api/basic_node/sequence_type.md @@ -19,12 +19,12 @@ Note that sequence objects are stored as a pointer to an allocated memory area o ??? Example ```cpp - --8<-- "examples/ex_basic_node_sequence_type.cpp:9" + --8<-- "apis/basic_node/sequence_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_sequence_type.output" + --8<-- "apis/basic_node/sequence_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/serialize.md b/docs/docs/api/basic_node/serialize.md similarity index 95% rename from docs/mkdocs/docs/api/basic_node/serialize.md rename to docs/docs/api/basic_node/serialize.md index 17370f54..53888f6b 100644 --- a/docs/mkdocs/docs/api/basic_node/serialize.md +++ b/docs/docs/api/basic_node/serialize.md @@ -61,12 +61,12 @@ The resulting string object of the serialization. ??? Example ```cpp - --8<-- "examples/ex_basic_node_serialize.cpp:9" + --8<-- "apis/basic_node/serialize.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_serialize.output" + --8<-- "apis/basic_node/serialize.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/serialize_docs.md b/docs/docs/api/basic_node/serialize_docs.md similarity index 92% rename from docs/mkdocs/docs/api/basic_node/serialize_docs.md rename to docs/docs/api/basic_node/serialize_docs.md index 444dd70c..a54c32b4 100644 --- a/docs/mkdocs/docs/api/basic_node/serialize_docs.md +++ b/docs/docs/api/basic_node/serialize_docs.md @@ -32,12 +32,12 @@ The resulting string object of the serialization. ??? Example ```cpp - --8<-- "examples/ex_basic_node_serialize_docs.cpp:9" + --8<-- "apis/basic_node/serialize_docs.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_serialize_docs.output" + --8<-- "apis/basic_node/serialize_docs.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/set_yaml_version.md b/docs/docs/api/basic_node/set_yaml_version.md similarity index 90% rename from docs/mkdocs/docs/api/basic_node/set_yaml_version.md rename to docs/docs/api/basic_node/set_yaml_version.md index 2234e391..e3ee106f 100644 --- a/docs/mkdocs/docs/api/basic_node/set_yaml_version.md +++ b/docs/docs/api/basic_node/set_yaml_version.md @@ -32,12 +32,12 @@ Sets a target YAML specification version to the `basic_node` object. ??? Example ```cpp - --8<-- "examples/ex_basic_node_set_yaml_version.cpp:9" + --8<-- "apis/basic_node/set_yaml_version.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_set_yaml_version.output" + --8<-- "apis/basic_node/set_yaml_version.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/set_yaml_version_type.md b/docs/docs/api/basic_node/set_yaml_version_type.md similarity index 83% rename from docs/mkdocs/docs/api/basic_node/set_yaml_version_type.md rename to docs/docs/api/basic_node/set_yaml_version_type.md index f933c16c..1d8a84b8 100644 --- a/docs/mkdocs/docs/api/basic_node/set_yaml_version_type.md +++ b/docs/docs/api/basic_node/set_yaml_version_type.md @@ -18,12 +18,12 @@ Sets a target YAML specification version to the `basic_node` object. ??? Example ```cpp - --8<-- "examples/ex_basic_node_set_yaml_version_type.cpp:9" + --8<-- "apis/basic_node/set_yaml_version_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_set_yaml_version_type.output" + --8<-- "apis/basic_node/set_yaml_version_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/size.md b/docs/docs/api/basic_node/size.md similarity index 84% rename from docs/mkdocs/docs/api/basic_node/size.md rename to docs/docs/api/basic_node/size.md index 71ccce08..98dac605 100644 --- a/docs/mkdocs/docs/api/basic_node/size.md +++ b/docs/docs/api/basic_node/size.md @@ -18,12 +18,12 @@ The size of a node value. ??? Example ```cpp - --8<-- "examples/ex_basic_node_size.cpp:9" + --8<-- "apis/basic_node/size.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_size.output" + --8<-- "apis/basic_node/size.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/string_type.md b/docs/docs/api/basic_node/string_type.md similarity index 88% rename from docs/mkdocs/docs/api/basic_node/string_type.md rename to docs/docs/api/basic_node/string_type.md index b07fe8d9..7fab8d58 100644 --- a/docs/mkdocs/docs/api/basic_node/string_type.md +++ b/docs/docs/api/basic_node/string_type.md @@ -19,12 +19,12 @@ Note that string objects are stored as a pointer to an allocated memory area on ??? Example ```cpp - --8<-- "examples/ex_basic_node_string_type.cpp:9" + --8<-- "apis/basic_node/string_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_string_type.output" + --8<-- "apis/basic_node/string_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/swap.md b/docs/docs/api/basic_node/swap.md similarity index 87% rename from docs/mkdocs/docs/api/basic_node/swap.md rename to docs/docs/api/basic_node/swap.md index bc2401c3..ac2e098e 100644 --- a/docs/mkdocs/docs/api/basic_node/swap.md +++ b/docs/docs/api/basic_node/swap.md @@ -27,12 +27,12 @@ Swaps the internally stored data with the given basic_node object. ??? Example "member function: Swap the contents with another basic_node" ```cpp - --8<-- "examples/ex_basic_node_swap_member.cpp:9" + --8<-- "apis/basic_node/swap_member.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_swap_member.output" + --8<-- "apis/basic_node/swap_member.output" ``` ## **Examples** @@ -40,12 +40,12 @@ Swaps the internally stored data with the given basic_node object. ??? Example "non-member function: Swap the contents between basic_node objects" ```cpp - --8<-- "examples/ex_basic_node_swap_std.cpp:9" + --8<-- "apis/basic_node/swap_std.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_swap_std.output" + --8<-- "apis/basic_node/swap_std.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/type.md b/docs/docs/api/basic_node/type.md similarity index 93% rename from docs/mkdocs/docs/api/basic_node/type.md rename to docs/docs/api/basic_node/type.md index 51e1bc8c..6db4e8db 100644 --- a/docs/mkdocs/docs/api/basic_node/type.md +++ b/docs/docs/api/basic_node/type.md @@ -41,12 +41,12 @@ The type of the YAML node value. ??? Example ```cpp - --8<-- "examples/ex_basic_node_type.cpp:9" + --8<-- "apis/basic_node/type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_type.output" + --8<-- "apis/basic_node/type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/value_converter_type.md b/docs/docs/api/basic_node/value_converter_type.md similarity index 91% rename from docs/mkdocs/docs/api/basic_node/value_converter_type.md rename to docs/docs/api/basic_node/value_converter_type.md index c67c5553..d3defdc1 100644 --- a/docs/mkdocs/docs/api/basic_node/value_converter_type.md +++ b/docs/docs/api/basic_node/value_converter_type.md @@ -26,12 +26,12 @@ If you want to convert some type from/to `basic_node`, however, it is recommende ??? Example ```cpp - --8<-- "examples/ex_basic_node_value_converter_type.cpp:9" + --8<-- "apis/basic_node/value_converter_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_value_converter_type.output" + --8<-- "apis/basic_node/value_converter_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/basic_node/yaml_version_t.md b/docs/docs/api/basic_node/yaml_version_t.md similarity index 90% rename from docs/mkdocs/docs/api/basic_node/yaml_version_t.md rename to docs/docs/api/basic_node/yaml_version_t.md index a9029901..39e47d14 100644 --- a/docs/mkdocs/docs/api/basic_node/yaml_version_t.md +++ b/docs/docs/api/basic_node/yaml_version_t.md @@ -31,12 +31,12 @@ This enumeration collects the YAML specification versions. It is used as meta da ??? Example ```cpp - --8<-- "examples/ex_basic_node_yaml_version_t.cpp:9" + --8<-- "apis/basic_node/yaml_version_t.cpp:9" ``` output: ```bash - --8<-- "examples/ex_basic_node_yaml_version_t.output" + --8<-- "apis/basic_node/yaml_version_t.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/exception/constructor.md b/docs/docs/api/exception/constructor.md similarity index 78% rename from docs/mkdocs/docs/api/exception/constructor.md rename to docs/docs/api/exception/constructor.md index 1efb6233..c6b43194 100644 --- a/docs/mkdocs/docs/api/exception/constructor.md +++ b/docs/docs/api/exception/constructor.md @@ -19,12 +19,12 @@ You can specify an error message on constructing an object with an overloaded co ??? Example "Overload(1): create a default value" ```cpp - --8<-- "examples/ex_exception_constructor_noarg.cpp:9" + --8<-- "apis/exception/constructor_noarg.cpp:9" ``` output: ```bash - --8<-- "examples/ex_exception_constructor_noarg.output" + --8<-- "apis/exception/constructor_noarg.output" ``` ## **Examples** @@ -32,12 +32,12 @@ You can specify an error message on constructing an object with an overloaded co ??? Example "Overload(2): create an object with an error message" ```cpp - --8<-- "examples/ex_exception_constructor_msg.cpp:9" + --8<-- "apis/exception/constructor_msg.cpp:9" ``` output: ```bash - --8<-- "examples/ex_exception_constructor_msg.output" + --8<-- "apis/exception/constructor_msg.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/exception/destructor.md b/docs/docs/api/exception/destructor.md similarity index 100% rename from docs/mkdocs/docs/api/exception/destructor.md rename to docs/docs/api/exception/destructor.md diff --git a/docs/mkdocs/docs/api/exception/index.md b/docs/docs/api/exception/index.md similarity index 100% rename from docs/mkdocs/docs/api/exception/index.md rename to docs/docs/api/exception/index.md diff --git a/docs/mkdocs/docs/api/exception/invalid_encoding.md b/docs/docs/api/exception/invalid_encoding.md similarity index 100% rename from docs/mkdocs/docs/api/exception/invalid_encoding.md rename to docs/docs/api/exception/invalid_encoding.md diff --git a/docs/mkdocs/docs/api/exception/invalid_tag.md b/docs/docs/api/exception/invalid_tag.md similarity index 100% rename from docs/mkdocs/docs/api/exception/invalid_tag.md rename to docs/docs/api/exception/invalid_tag.md diff --git a/docs/mkdocs/docs/api/exception/out_of_range.md b/docs/docs/api/exception/out_of_range.md similarity index 100% rename from docs/mkdocs/docs/api/exception/out_of_range.md rename to docs/docs/api/exception/out_of_range.md diff --git a/docs/mkdocs/docs/api/exception/parse_error.md b/docs/docs/api/exception/parse_error.md similarity index 100% rename from docs/mkdocs/docs/api/exception/parse_error.md rename to docs/docs/api/exception/parse_error.md diff --git a/docs/mkdocs/docs/api/exception/type_error.md b/docs/docs/api/exception/type_error.md similarity index 100% rename from docs/mkdocs/docs/api/exception/type_error.md rename to docs/docs/api/exception/type_error.md diff --git a/docs/mkdocs/docs/api/exception/what.md b/docs/docs/api/exception/what.md similarity index 86% rename from docs/mkdocs/docs/api/exception/what.md rename to docs/docs/api/exception/what.md index c20fe981..19826b6f 100644 --- a/docs/mkdocs/docs/api/exception/what.md +++ b/docs/docs/api/exception/what.md @@ -17,12 +17,12 @@ An error message for an exception or a non-null pointer to an empty string. ??? Example ```cpp - --8<-- "examples/ex_exception_what.cpp:9" + --8<-- "apis/exception/what.cpp:9" ``` output: ```bash - --8<-- "examples/ex_exception_what.output" + --8<-- "apis/exception/what.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/index.md b/docs/docs/api/index.md similarity index 100% rename from docs/mkdocs/docs/api/index.md rename to docs/docs/api/index.md diff --git a/docs/mkdocs/docs/api/macros.md b/docs/docs/api/macros.md similarity index 97% rename from docs/mkdocs/docs/api/macros.md rename to docs/docs/api/macros.md index 30ba0b6e..1a759b8a 100644 --- a/docs/mkdocs/docs/api/macros.md +++ b/docs/docs/api/macros.md @@ -17,12 +17,12 @@ These macros are available for client applications as the metadata of this libra ??? Example "print the library version" ```cpp - --8<-- "examples/ex_macros_versions.cpp:9" + --8<-- "apis/macros/versions.cpp:9" ``` output: ```bash - --8<-- "examples/ex_macros_versions.output" + --8<-- "apis/macros/versions.output" ``` ## Library Namespaces diff --git a/docs/mkdocs/docs/api/node_type.md b/docs/docs/api/node_type.md similarity index 95% rename from docs/mkdocs/docs/api/node_type.md rename to docs/docs/api/node_type.md index b72a6b9f..516c4bed 100644 --- a/docs/mkdocs/docs/api/node_type.md +++ b/docs/docs/api/node_type.md @@ -41,12 +41,12 @@ This enumeration collects the different YAML value types. They are internally us ??? Example ```cpp - --8<-- "examples/ex_node_type.cpp:9" + --8<-- "apis/node_type/node_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_node_type.output" + --8<-- "apis/node_type/node_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/node_value_converter/from_node.md b/docs/docs/api/node_value_converter/from_node.md similarity index 94% rename from docs/mkdocs/docs/api/node_value_converter/from_node.md rename to docs/docs/api/node_value_converter/from_node.md index 19500c90..6caa7ed2 100644 --- a/docs/mkdocs/docs/api/node_value_converter/from_node.md +++ b/docs/docs/api/node_value_converter/from_node.md @@ -45,12 +45,12 @@ A value of a compatible type converted from a basic_node. ??? Example ```cpp - --8<-- "examples/ex_node_value_converter_from_node.cpp:9" + --8<-- "apis/node_value_converter/from_node.cpp:9" ``` output: ```bash - --8<-- "examples/ex_node_value_converter_from_node.output" + --8<-- "apis/node_value_converter/from_node.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/node_value_converter/index.md b/docs/docs/api/node_value_converter/index.md similarity index 100% rename from docs/mkdocs/docs/api/node_value_converter/index.md rename to docs/docs/api/node_value_converter/index.md diff --git a/docs/mkdocs/docs/api/node_value_converter/to_node.md b/docs/docs/api/node_value_converter/to_node.md similarity index 94% rename from docs/mkdocs/docs/api/node_value_converter/to_node.md rename to docs/docs/api/node_value_converter/to_node.md index 91466409..4a25a70f 100644 --- a/docs/mkdocs/docs/api/node_value_converter/to_node.md +++ b/docs/docs/api/node_value_converter/to_node.md @@ -43,12 +43,12 @@ A basic_node object converted from a value of a compatible type. ??? Example ```cpp - --8<-- "examples/ex_node_value_converter_to_node.cpp:9" + --8<-- "apis/node_value_converter/to_node.cpp:9" ``` output: ```bash - --8<-- "examples/ex_node_value_converter_to_node.output" + --8<-- "apis/node_value_converter/to_node.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/operator_literal_yaml.md b/docs/docs/api/operator_literal_yaml.md similarity index 93% rename from docs/mkdocs/docs/api/operator_literal_yaml.md rename to docs/docs/api/operator_literal_yaml.md index da0f36d0..afa349a3 100644 --- a/docs/mkdocs/docs/api/operator_literal_yaml.md +++ b/docs/docs/api/operator_literal_yaml.md @@ -38,12 +38,12 @@ The resulting basic_node object deserialized from the input string `s`. ??? Example ```cpp - --8<-- "examples/ex_operator_literal_yaml.cpp:9" + --8<-- "apis/operator_literal_yaml/operator_literal_yaml.cpp:9" ``` output: ```bash - --8<-- "examples/ex_operator_literal_yaml.output" + --8<-- "apis/operator_literal_yaml/operator_literal_yaml.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/ordered_map/at.md b/docs/docs/api/ordered_map/at.md similarity index 92% rename from docs/mkdocs/docs/api/ordered_map/at.md rename to docs/docs/api/ordered_map/at.md index 3b659dee..a43ac60b 100644 --- a/docs/mkdocs/docs/api/ordered_map/at.md +++ b/docs/docs/api/ordered_map/at.md @@ -32,12 +32,12 @@ This function throws a [`fkyaml::exception`] if the given key does not exist in ??? Example ```cpp - --8<-- "examples/ex_ordered_map_at.cpp:9" + --8<-- "apis/ordered_map/at.cpp:9" ``` output: ```bash - --8<-- "examples/ex_ordered_map_at.output" + --8<-- "apis/ordered_map/at.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/ordered_map/constructor.md b/docs/docs/api/ordered_map/constructor.md similarity index 79% rename from docs/mkdocs/docs/api/ordered_map/constructor.md rename to docs/docs/api/ordered_map/constructor.md index 9517a9c1..59c11a42 100644 --- a/docs/mkdocs/docs/api/ordered_map/constructor.md +++ b/docs/docs/api/ordered_map/constructor.md @@ -21,23 +21,23 @@ You can specify the initial value on constructing an ordered_map with an overloa ??? Example "Overload(1): create a default value." ```cpp - --8<-- "examples/ex_ordered_map_constructor_noarg.cpp:9" + --8<-- "apis/ordered_map/constructor_noarg.cpp:9" ``` output: ```bash - --8<-- "examples/ex_ordered_map_constructor_noarg.output" + --8<-- "apis/ordered_map/constructor_noarg.output" ``` ??? Example "Overload(2): create an ordered_map object with an initializer list" ```cpp - --8<-- "examples/ex_ordered_map_constructor_initializer_list.cpp:9" + --8<-- "apis/ordered_map/constructor_initializer_list.cpp:9" ``` output: ```bash - --8<-- "examples/ex_ordered_map_constructor_initializer_list.output" + --8<-- "apis/ordered_map/constructor_initializer_list.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/ordered_map/destructor.md b/docs/docs/api/ordered_map/destructor.md similarity index 100% rename from docs/mkdocs/docs/api/ordered_map/destructor.md rename to docs/docs/api/ordered_map/destructor.md diff --git a/docs/mkdocs/docs/api/ordered_map/emplace.md b/docs/docs/api/ordered_map/emplace.md similarity index 87% rename from docs/mkdocs/docs/api/ordered_map/emplace.md rename to docs/docs/api/ordered_map/emplace.md index 1e5616a6..31c29b6d 100644 --- a/docs/mkdocs/docs/api/ordered_map/emplace.md +++ b/docs/docs/api/ordered_map/emplace.md @@ -29,12 +29,12 @@ A pair consisting of an iterator to the inserted element or the already-existing ??? Example ```cpp - --8<-- "examples/ex_ordered_map_constructor_initializer_list.cpp:9" + --8<-- "apis/ordered_map/constructor_initializer_list.cpp:9" ``` output: ```bash - --8<-- "examples/ex_ordered_map_constructor_initializer_list.output" + --8<-- "apis/ordered_map/constructor_initializer_list.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/ordered_map/find.md b/docs/docs/api/ordered_map/find.md similarity index 89% rename from docs/mkdocs/docs/api/ordered_map/find.md rename to docs/docs/api/ordered_map/find.md index c183c893..eda68710 100644 --- a/docs/mkdocs/docs/api/ordered_map/find.md +++ b/docs/docs/api/ordered_map/find.md @@ -31,12 +31,12 @@ A (constant) iterator to the target value if found, the result of end() otherwis ??? Example ```cpp - --8<-- "examples/ex_ordered_map_emplace.cpp:9" + --8<-- "apis/ordered_map/emplace.cpp:9" ``` output: ```bash - --8<-- "examples/ex_ordered_map_emplace.output" + --8<-- "apis/ordered_map/emplace.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/ordered_map/index.md b/docs/docs/api/ordered_map/index.md similarity index 100% rename from docs/mkdocs/docs/api/ordered_map/index.md rename to docs/docs/api/ordered_map/index.md diff --git a/docs/mkdocs/docs/api/ordered_map/operator[].md b/docs/docs/api/ordered_map/operator[].md similarity index 91% rename from docs/mkdocs/docs/api/ordered_map/operator[].md rename to docs/docs/api/ordered_map/operator[].md index 5b21b36b..818601fe 100644 --- a/docs/mkdocs/docs/api/ordered_map/operator[].md +++ b/docs/docs/api/ordered_map/operator[].md @@ -35,12 +35,12 @@ Possibly a default value of the `mapped_type` if the ordered_map does not contai ??? Example ```cpp - --8<-- "examples/ex_ordered_map_subscript_operator.cpp:9" + --8<-- "apis/ordered_map/subscript_operator.cpp:9" ``` output: ```bash - --8<-- "examples/ex_ordered_map_subscript_operator.output" + --8<-- "apis/ordered_map/subscript_operator.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/api/yaml_version_type.md b/docs/docs/api/yaml_version_type.md similarity index 87% rename from docs/mkdocs/docs/api/yaml_version_type.md rename to docs/docs/api/yaml_version_type.md index b0069023..191423d8 100644 --- a/docs/mkdocs/docs/api/yaml_version_type.md +++ b/docs/docs/api/yaml_version_type.md @@ -20,12 +20,12 @@ This enumeration collects the used versions of YAML specification. It is used as ??? Example ```cpp - --8<-- "examples/ex_yaml_version_type.cpp:9" + --8<-- "apis/yaml_version_type/yaml_version_type.cpp:9" ``` output: ```bash - --8<-- "examples/ex_yaml_version_type.output" + --8<-- "apis/yaml_version_type/yaml_version_type.output" ``` ## **See Also** diff --git a/docs/mkdocs/docs/home/community_support.md b/docs/docs/home/community_support.md similarity index 100% rename from docs/mkdocs/docs/home/community_support.md rename to docs/docs/home/community_support.md diff --git a/docs/mkdocs/docs/home/license.md b/docs/docs/home/license.md similarity index 96% rename from docs/mkdocs/docs/home/license.md rename to docs/docs/home/license.md index 50eaec62..e0f75b3f 100644 --- a/docs/mkdocs/docs/home/license.md +++ b/docs/docs/home/license.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023-2024 Kensuke Fukutani +Copyright (c) 2023-2025 Kensuke Fukutani Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/mkdocs/docs/home/releases.md b/docs/docs/home/releases.md similarity index 100% rename from docs/mkdocs/docs/home/releases.md rename to docs/docs/home/releases.md diff --git a/docs/mkdocs/docs/home/supported_compilers.md b/docs/docs/home/supported_compilers.md similarity index 100% rename from docs/mkdocs/docs/home/supported_compilers.md rename to docs/docs/home/supported_compilers.md diff --git a/docs/mkdocs/docs/img/range-begin-end.svg b/docs/docs/img/range-begin-end.svg similarity index 100% rename from docs/mkdocs/docs/img/range-begin-end.svg rename to docs/docs/img/range-begin-end.svg diff --git a/docs/mkdocs/docs/img/range-rbegin-rend.svg b/docs/docs/img/range-rbegin-rend.svg similarity index 100% rename from docs/mkdocs/docs/img/range-rbegin-rend.svg rename to docs/docs/img/range-rbegin-rend.svg diff --git a/docs/mkdocs/docs/index.md b/docs/docs/index.md similarity index 100% rename from docs/mkdocs/docs/index.md rename to docs/docs/index.md diff --git a/docs/mkdocs/docs/javascripts/config.js b/docs/docs/javascripts/config.js similarity index 100% rename from docs/mkdocs/docs/javascripts/config.js rename to docs/docs/javascripts/config.js diff --git a/docs/mkdocs/docs/tutorials/cmake_integration.md b/docs/docs/tutorials/cmake_integration.md similarity index 100% rename from docs/mkdocs/docs/tutorials/cmake_integration.md rename to docs/docs/tutorials/cmake_integration.md diff --git a/docs/mkdocs/docs/tutorials/index.md b/docs/docs/tutorials/index.md similarity index 95% rename from docs/mkdocs/docs/tutorials/index.md rename to docs/docs/tutorials/index.md index 8518c79f..d40067ab 100644 --- a/docs/mkdocs/docs/tutorials/index.md +++ b/docs/docs/tutorials/index.md @@ -71,12 +71,12 @@ Also, make sure the example.yaml file is encoded in either the UTF-8, UTF-16BE/L === "example.yaml" ```yaml - --8<-- "examples/example.yaml" + --8<-- "tutorials/example.yaml" ``` === "tutorial.cpp" ```cpp - --8<-- "examples/tutorial_1.cpp:9" + --8<-- "tutorials/tutorial_1.cpp:9" ``` === "CMakeLists.txt" @@ -105,7 +105,7 @@ Congratulation! You've got an application which loads a YAML file and then outpu If you run the tutorial executable file, you will see the output like: ```bash ---8<-- "examples/tutorial_1.output" +--8<-- "tutorials/tutorial_1.output" ``` ### :mag: Access individual YAML nodes @@ -114,13 +114,13 @@ Say you just want to care about values associated with the `title` key and ignor You can do it by modifying the tutorial.cpp file as follows: ```cpp title="tutorial.cpp" hl_lines="12-16" ---8<-- "examples/tutorial_2.cpp:9" +--8<-- "tutorials/tutorial_2.cpp:9" ``` Rebuild and run the application, and you'll see the output like: ```bash ---8<-- "examples/tutorial_2.output" +--8<-- "tutorials/tutorial_2.output" ``` ### :hammer: Generate YAML nodes from code @@ -131,13 +131,13 @@ The fkYAML library also provides a feature to realize such a need. You can achieve that by changing the highlighted part of the code snippet: ```cpp title="tutorial.cpp" hl_lines="13-15 17 19-21 24-25" ---8<-- "examples/tutorial_3.cpp:9" +--8<-- "tutorials/tutorial_3.cpp:9" ``` Rebuild and run the application, and you'll see the output like: ```bash ---8<-- "examples/tutorial_3.output" +--8<-- "tutorials/tutorial_3.output" ``` ### :pill: Integrate with user-defined types @@ -148,13 +148,13 @@ Note that you don't need to implement specializations for STL types (such as std The updated code snippet down below shows how the specializations for user-defined types can reduce boilerplate code. ```cpp title="tutorial.cpp" hl_lines="6-31 44-45 48-51" ---8<-- "examples/tutorial_4.cpp:9" +--8<-- "tutorials/tutorial_4.cpp:9" ``` Rebuild and run the application, and you'll see the same output as before: ```bash ---8<-- "examples/tutorial_4.output" +--8<-- "tutorials/tutorial_4.output" ``` The specializations highlighted above do not change the output, but they allow us to focus more on what the code is to achive. diff --git a/docs/examples/CMakeLists.txt b/docs/examples/CMakeLists.txt deleted file mode 100644 index e10b028f..00000000 --- a/docs/examples/CMakeLists.txt +++ /dev/null @@ -1,69 +0,0 @@ -############################# -# Common configurations # -############################# - -add_library(example_common_config INTERFACE) -target_link_libraries( - example_common_config - INTERFACE - ${FK_YAML_TARGET_NAME} -) -target_compile_options( - example_common_config - INTERFACE - # MSVC - $<$: - /wd4996 # examples contain deprecated APIs. - > - # GNU - $<$: - -Wno-deprecated-declarations # examples contain deprecated APIs. - > - # Clang - $<$: - -Wno-deprecated-declarations #examples contain deprecated APIs. - > -) - -############################### -# Build tutorial projects # -############################### - -file(GLOB_RECURSE TUT_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tutorial_*.cpp) -foreach(TUT_SRC_FILE ${TUT_SRC_FILES}) - file(RELATIVE_PATH REL_TUT_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${TUT_SRC_FILE}) - string(REPLACE ".cpp" "" TUT_SRC_FILE_BASE ${REL_TUT_SRC_FILE}) - add_executable(${TUT_SRC_FILE_BASE} ${TUT_SRC_FILE}) - target_link_libraries(${TUT_SRC_FILE_BASE} example_common_config) - - add_custom_command( - TARGET ${TUT_SRC_FILE_BASE} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/example.yaml $ - COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${TUT_SRC_FILE_BASE}.output - WORKING_DIRECTORY $ - ) -endforeach() - -########################### -# Build example codes # -########################### - -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/input.yaml) - -file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/ex_*.cpp) -foreach(EX_SRC_FILE ${EX_SRC_FILES}) - file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) - string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) - add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) - target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) - - add_custom_command( - TARGET ${EX_SRC_FILE_BASE} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/input.yaml $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/input_multi.yaml $ - COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output - WORKING_DIRECTORY $ - ) -endforeach() diff --git a/docs/mkdocs/mkdocs.yml b/docs/mkdocs.yml similarity index 98% rename from docs/mkdocs/mkdocs.yml rename to docs/mkdocs.yml index df61fe58..1026f454 100644 --- a/docs/mkdocs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -5,7 +5,7 @@ site_url: https://fktn-k.github.io/fkYAML/ repo_name: fktn-k/fkYAML repo_url: https://github.com/fktn-k/fkYAML -copyright: Copyright © 2023-2024 Kensuke Fukutani +copyright: Copyright © 2023-2025 Kensuke Fukutani theme: name: material @@ -60,7 +60,7 @@ markdown_extensions: alternate_style: true - pymdownx.tilde - pymdownx.snippets: - base_path: .. + base_path: ../examples check_paths: true - toc: permalink: true diff --git a/docs/mkdocs/requirements.txt b/docs/requirements.txt similarity index 100% rename from docs/mkdocs/requirements.txt rename to docs/requirements.txt diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 00000000..85806f4b --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,40 @@ +############################# +# Common configurations # +############################# + +add_library(example_common_config INTERFACE) +target_link_libraries( + example_common_config + INTERFACE + ${FK_YAML_TARGET_NAME} +) +target_compile_options( + example_common_config + INTERFACE + # MSVC + $<$: + /wd4996 # examples contain deprecated APIs. + > + # GNU + $<$: + -Wno-deprecated-declarations # examples contain deprecated APIs. + > + # Clang + $<$: + -Wno-deprecated-declarations #examples contain deprecated APIs. + > +) + +# FIXME: change build instructions according to the changes in their paths. + +############################### +# Build tutorial projects # +############################### + +add_subdirectory(tutorials) + +########################### +# Build example codes # +########################### + + diff --git a/examples/apis/CMakeLists.txt b/examples/apis/CMakeLists.txt new file mode 100644 index 00000000..148a8151 --- /dev/null +++ b/examples/apis/CMakeLists.txt @@ -0,0 +1,10 @@ +set(INPUT_YAML_PATH ${CMAKE_CURRENT_SOURCE_DIR}/input.yaml) +set(INPUT_MULTI_YAML_PATH ${CMAKE_CURRENT_SOURCE_DIR}/input_multi.yaml) + +add_subdirectory(basic_node) +add_subdirectory(exception) +add_subdirectory(node_type) +add_subdirectory(node_value_converter) +add_subdirectory(operator_literal_yaml) +add_subdirectory(ordered_map) +add_subdirectory(yaml_version_type) diff --git a/examples/apis/basic_node/CMakeLists.txt b/examples/apis/basic_node/CMakeLists.txt new file mode 100644 index 00000000..e7176246 --- /dev/null +++ b/examples/apis/basic_node/CMakeLists.txt @@ -0,0 +1,16 @@ +file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +foreach(EX_SRC_FILE ${EX_SRC_FILES}) + file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) + string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) + add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) + target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + + add_custom_command( + TARGET ${EX_SRC_FILE_BASE} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ + ) +endforeach() diff --git a/docs/examples/ex_basic_node_add_anchor_name.cpp b/examples/apis/basic_node/add_anchor_name.cpp similarity index 91% rename from docs/examples/ex_basic_node_add_anchor_name.cpp rename to examples/apis/basic_node/add_anchor_name.cpp index 7b350804..e353c658 100644 --- a/docs/examples/ex_basic_node_add_anchor_name.cpp +++ b/examples/apis/basic_node/add_anchor_name.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_add_anchor_name.output b/examples/apis/basic_node/add_anchor_name.output similarity index 100% rename from docs/examples/ex_basic_node_add_anchor_name.output rename to examples/apis/basic_node/add_anchor_name.output diff --git a/docs/examples/ex_basic_node_add_tag_name.cpp b/examples/apis/basic_node/add_tag_name.cpp similarity index 91% rename from docs/examples/ex_basic_node_add_tag_name.cpp rename to examples/apis/basic_node/add_tag_name.cpp index 6fbee168..62be059a 100644 --- a/docs/examples/ex_basic_node_add_tag_name.cpp +++ b/examples/apis/basic_node/add_tag_name.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_add_tag_name.output b/examples/apis/basic_node/add_tag_name.output similarity index 100% rename from docs/examples/ex_basic_node_add_tag_name.output rename to examples/apis/basic_node/add_tag_name.output diff --git a/docs/examples/ex_basic_node_alias_of.cpp b/examples/apis/basic_node/alias_of.cpp similarity index 92% rename from docs/examples/ex_basic_node_alias_of.cpp rename to examples/apis/basic_node/alias_of.cpp index ccc12dde..5d29d2f1 100644 --- a/docs/examples/ex_basic_node_alias_of.cpp +++ b/examples/apis/basic_node/alias_of.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_alias_of.output b/examples/apis/basic_node/alias_of.output similarity index 100% rename from docs/examples/ex_basic_node_alias_of.output rename to examples/apis/basic_node/alias_of.output diff --git a/docs/examples/ex_basic_node_at_basic_node.cpp b/examples/apis/basic_node/at_basic_node.cpp similarity index 96% rename from docs/examples/ex_basic_node_at_basic_node.cpp rename to examples/apis/basic_node/at_basic_node.cpp index 43307dc5..74b2203c 100644 --- a/docs/examples/ex_basic_node_at_basic_node.cpp +++ b/examples/apis/basic_node/at_basic_node.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_at_basic_node.output b/examples/apis/basic_node/at_basic_node.output similarity index 100% rename from docs/examples/ex_basic_node_at_basic_node.output rename to examples/apis/basic_node/at_basic_node.output diff --git a/docs/examples/ex_basic_node_at_compatible_type.cpp b/examples/apis/basic_node/at_compatible_type.cpp similarity index 95% rename from docs/examples/ex_basic_node_at_compatible_type.cpp rename to examples/apis/basic_node/at_compatible_type.cpp index 02210d6e..632939f6 100644 --- a/docs/examples/ex_basic_node_at_compatible_type.cpp +++ b/examples/apis/basic_node/at_compatible_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_at_compatible_type.output b/examples/apis/basic_node/at_compatible_type.output similarity index 100% rename from docs/examples/ex_basic_node_at_compatible_type.output rename to examples/apis/basic_node/at_compatible_type.output diff --git a/docs/examples/ex_basic_node_begin.cpp b/examples/apis/basic_node/begin.cpp similarity index 90% rename from docs/examples/ex_basic_node_begin.cpp rename to examples/apis/basic_node/begin.cpp index 2bb05c3a..ef7ec801 100644 --- a/docs/examples/ex_basic_node_begin.cpp +++ b/examples/apis/basic_node/begin.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_begin.output b/examples/apis/basic_node/begin.output similarity index 100% rename from docs/examples/ex_basic_node_begin.output rename to examples/apis/basic_node/begin.output diff --git a/docs/examples/ex_basic_node_boolean_type.cpp b/examples/apis/basic_node/boolean_type.cpp similarity index 89% rename from docs/examples/ex_basic_node_boolean_type.cpp rename to examples/apis/basic_node/boolean_type.cpp index 3f05fdd8..55bcecec 100644 --- a/docs/examples/ex_basic_node_boolean_type.cpp +++ b/examples/apis/basic_node/boolean_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_boolean_type.output b/examples/apis/basic_node/boolean_type.output similarity index 100% rename from docs/examples/ex_basic_node_boolean_type.output rename to examples/apis/basic_node/boolean_type.output diff --git a/docs/examples/ex_basic_node_constructor_1.cpp b/examples/apis/basic_node/constructor_1.cpp similarity index 88% rename from docs/examples/ex_basic_node_constructor_1.cpp rename to examples/apis/basic_node/constructor_1.cpp index 306584be..c54ae24e 100644 --- a/docs/examples/ex_basic_node_constructor_1.cpp +++ b/examples/apis/basic_node/constructor_1.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_constructor_1.output b/examples/apis/basic_node/constructor_1.output similarity index 100% rename from docs/examples/ex_basic_node_constructor_1.output rename to examples/apis/basic_node/constructor_1.output diff --git a/docs/examples/ex_basic_node_constructor_2.cpp b/examples/apis/basic_node/constructor_2.cpp similarity index 88% rename from docs/examples/ex_basic_node_constructor_2.cpp rename to examples/apis/basic_node/constructor_2.cpp index 4969c04a..4b9ab934 100644 --- a/docs/examples/ex_basic_node_constructor_2.cpp +++ b/examples/apis/basic_node/constructor_2.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_constructor_2.output b/examples/apis/basic_node/constructor_2.output similarity index 100% rename from docs/examples/ex_basic_node_constructor_2.output rename to examples/apis/basic_node/constructor_2.output diff --git a/docs/examples/ex_basic_node_constructor_3.cpp b/examples/apis/basic_node/constructor_3.cpp similarity index 88% rename from docs/examples/ex_basic_node_constructor_3.cpp rename to examples/apis/basic_node/constructor_3.cpp index 5d541e8c..b7183c29 100644 --- a/docs/examples/ex_basic_node_constructor_3.cpp +++ b/examples/apis/basic_node/constructor_3.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_constructor_3.output b/examples/apis/basic_node/constructor_3.output similarity index 100% rename from docs/examples/ex_basic_node_constructor_3.output rename to examples/apis/basic_node/constructor_3.output diff --git a/docs/examples/ex_basic_node_constructor_4.cpp b/examples/apis/basic_node/constructor_4.cpp similarity index 89% rename from docs/examples/ex_basic_node_constructor_4.cpp rename to examples/apis/basic_node/constructor_4.cpp index 8f1f1fc7..54959958 100644 --- a/docs/examples/ex_basic_node_constructor_4.cpp +++ b/examples/apis/basic_node/constructor_4.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_constructor_4.output b/examples/apis/basic_node/constructor_4.output similarity index 100% rename from docs/examples/ex_basic_node_constructor_4.output rename to examples/apis/basic_node/constructor_4.output diff --git a/docs/examples/ex_basic_node_constructor_5.cpp b/examples/apis/basic_node/constructor_5.cpp similarity index 89% rename from docs/examples/ex_basic_node_constructor_5.cpp rename to examples/apis/basic_node/constructor_5.cpp index c3276dbf..2fcf71f3 100644 --- a/docs/examples/ex_basic_node_constructor_5.cpp +++ b/examples/apis/basic_node/constructor_5.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_constructor_5.output b/examples/apis/basic_node/constructor_5.output similarity index 100% rename from docs/examples/ex_basic_node_constructor_5.output rename to examples/apis/basic_node/constructor_5.output diff --git a/docs/examples/ex_basic_node_constructor_6.cpp b/examples/apis/basic_node/constructor_6.cpp similarity index 88% rename from docs/examples/ex_basic_node_constructor_6.cpp rename to examples/apis/basic_node/constructor_6.cpp index 8f07fc48..321ad527 100644 --- a/docs/examples/ex_basic_node_constructor_6.cpp +++ b/examples/apis/basic_node/constructor_6.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_constructor_6.output b/examples/apis/basic_node/constructor_6.output similarity index 100% rename from docs/examples/ex_basic_node_constructor_6.output rename to examples/apis/basic_node/constructor_6.output diff --git a/docs/examples/ex_basic_node_constructor_7.cpp b/examples/apis/basic_node/constructor_7.cpp similarity index 90% rename from docs/examples/ex_basic_node_constructor_7.cpp rename to examples/apis/basic_node/constructor_7.cpp index fe6b141a..f1c614f0 100644 --- a/docs/examples/ex_basic_node_constructor_7.cpp +++ b/examples/apis/basic_node/constructor_7.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_constructor_7.output b/examples/apis/basic_node/constructor_7.output similarity index 100% rename from docs/examples/ex_basic_node_constructor_7.output rename to examples/apis/basic_node/constructor_7.output diff --git a/docs/examples/ex_basic_node_contains.cpp b/examples/apis/basic_node/contains.cpp similarity index 93% rename from docs/examples/ex_basic_node_contains.cpp rename to examples/apis/basic_node/contains.cpp index 67d6c337..6ec791a8 100644 --- a/docs/examples/ex_basic_node_contains.cpp +++ b/examples/apis/basic_node/contains.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_contains.output b/examples/apis/basic_node/contains.output similarity index 100% rename from docs/examples/ex_basic_node_contains.output rename to examples/apis/basic_node/contains.output diff --git a/docs/examples/ex_basic_node_copy_assignment_operator.cpp b/examples/apis/basic_node/copy_assignment_operator.cpp similarity index 90% rename from docs/examples/ex_basic_node_copy_assignment_operator.cpp rename to examples/apis/basic_node/copy_assignment_operator.cpp index 885fd49a..864052fd 100644 --- a/docs/examples/ex_basic_node_copy_assignment_operator.cpp +++ b/examples/apis/basic_node/copy_assignment_operator.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_copy_assignment_operator.output b/examples/apis/basic_node/copy_assignment_operator.output similarity index 100% rename from docs/examples/ex_basic_node_copy_assignment_operator.output rename to examples/apis/basic_node/copy_assignment_operator.output diff --git a/docs/examples/ex_basic_node_deserialize_char_array.cpp b/examples/apis/basic_node/deserialize_char_array.cpp similarity index 93% rename from docs/examples/ex_basic_node_deserialize_char_array.cpp rename to examples/apis/basic_node/deserialize_char_array.cpp index 27600611..866f6492 100644 --- a/docs/examples/ex_basic_node_deserialize_char_array.cpp +++ b/examples/apis/basic_node/deserialize_char_array.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_deserialize_char_array.output b/examples/apis/basic_node/deserialize_char_array.output similarity index 100% rename from docs/examples/ex_basic_node_deserialize_char_array.output rename to examples/apis/basic_node/deserialize_char_array.output diff --git a/docs/examples/ex_basic_node_deserialize_docs_char_array.cpp b/examples/apis/basic_node/deserialize_docs_char_array.cpp similarity index 95% rename from docs/examples/ex_basic_node_deserialize_docs_char_array.cpp rename to examples/apis/basic_node/deserialize_docs_char_array.cpp index 65201dd1..fca9a819 100644 --- a/docs/examples/ex_basic_node_deserialize_docs_char_array.cpp +++ b/examples/apis/basic_node/deserialize_docs_char_array.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_deserialize_docs_char_array.output b/examples/apis/basic_node/deserialize_docs_char_array.output similarity index 100% rename from docs/examples/ex_basic_node_deserialize_docs_char_array.output rename to examples/apis/basic_node/deserialize_docs_char_array.output diff --git a/docs/examples/ex_basic_node_deserialize_docs_file_pointer.cpp b/examples/apis/basic_node/deserialize_docs_file_pointer.cpp similarity index 95% rename from docs/examples/ex_basic_node_deserialize_docs_file_pointer.cpp rename to examples/apis/basic_node/deserialize_docs_file_pointer.cpp index 8d71408e..3ad59f0f 100644 --- a/docs/examples/ex_basic_node_deserialize_docs_file_pointer.cpp +++ b/examples/apis/basic_node/deserialize_docs_file_pointer.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_deserialize_docs_file_pointer.output b/examples/apis/basic_node/deserialize_docs_file_pointer.output similarity index 100% rename from docs/examples/ex_basic_node_deserialize_docs_file_pointer.output rename to examples/apis/basic_node/deserialize_docs_file_pointer.output diff --git a/docs/examples/ex_basic_node_deserialize_docs_iterators.cpp b/examples/apis/basic_node/deserialize_docs_iterators.cpp similarity index 95% rename from docs/examples/ex_basic_node_deserialize_docs_iterators.cpp rename to examples/apis/basic_node/deserialize_docs_iterators.cpp index b530ecd7..fd3b41a7 100644 --- a/docs/examples/ex_basic_node_deserialize_docs_iterators.cpp +++ b/examples/apis/basic_node/deserialize_docs_iterators.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_deserialize_docs_iterators.output b/examples/apis/basic_node/deserialize_docs_iterators.output similarity index 100% rename from docs/examples/ex_basic_node_deserialize_docs_iterators.output rename to examples/apis/basic_node/deserialize_docs_iterators.output diff --git a/docs/examples/ex_basic_node_deserialize_docs_string.cpp b/examples/apis/basic_node/deserialize_docs_string.cpp similarity index 95% rename from docs/examples/ex_basic_node_deserialize_docs_string.cpp rename to examples/apis/basic_node/deserialize_docs_string.cpp index 897f69b7..f8dd6e88 100644 --- a/docs/examples/ex_basic_node_deserialize_docs_string.cpp +++ b/examples/apis/basic_node/deserialize_docs_string.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_deserialize_docs_string.output b/examples/apis/basic_node/deserialize_docs_string.output similarity index 100% rename from docs/examples/ex_basic_node_deserialize_docs_string.output rename to examples/apis/basic_node/deserialize_docs_string.output diff --git a/docs/examples/ex_basic_node_deserialize_file_pointer.cpp b/examples/apis/basic_node/deserialize_file_pointer.cpp similarity index 93% rename from docs/examples/ex_basic_node_deserialize_file_pointer.cpp rename to examples/apis/basic_node/deserialize_file_pointer.cpp index 6e436eb8..6e909840 100644 --- a/docs/examples/ex_basic_node_deserialize_file_pointer.cpp +++ b/examples/apis/basic_node/deserialize_file_pointer.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_deserialize_file_pointer.output b/examples/apis/basic_node/deserialize_file_pointer.output similarity index 100% rename from docs/examples/ex_basic_node_deserialize_file_pointer.output rename to examples/apis/basic_node/deserialize_file_pointer.output diff --git a/docs/examples/ex_basic_node_deserialize_iterators.cpp b/examples/apis/basic_node/deserialize_iterators.cpp similarity index 92% rename from docs/examples/ex_basic_node_deserialize_iterators.cpp rename to examples/apis/basic_node/deserialize_iterators.cpp index 705a3586..b7dc83a5 100644 --- a/docs/examples/ex_basic_node_deserialize_iterators.cpp +++ b/examples/apis/basic_node/deserialize_iterators.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_deserialize_iterators.output b/examples/apis/basic_node/deserialize_iterators.output similarity index 100% rename from docs/examples/ex_basic_node_deserialize_iterators.output rename to examples/apis/basic_node/deserialize_iterators.output diff --git a/docs/examples/ex_basic_node_deserialize_string.cpp b/examples/apis/basic_node/deserialize_string.cpp similarity index 93% rename from docs/examples/ex_basic_node_deserialize_string.cpp rename to examples/apis/basic_node/deserialize_string.cpp index 570b5d82..a7b27e7a 100644 --- a/docs/examples/ex_basic_node_deserialize_string.cpp +++ b/examples/apis/basic_node/deserialize_string.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_deserialize_string.output b/examples/apis/basic_node/deserialize_string.output similarity index 100% rename from docs/examples/ex_basic_node_deserialize_string.output rename to examples/apis/basic_node/deserialize_string.output diff --git a/docs/examples/ex_basic_node_empty.cpp b/examples/apis/basic_node/empty.cpp similarity index 93% rename from docs/examples/ex_basic_node_empty.cpp rename to examples/apis/basic_node/empty.cpp index 1adb7e61..20354b26 100644 --- a/docs/examples/ex_basic_node_empty.cpp +++ b/examples/apis/basic_node/empty.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_empty.output b/examples/apis/basic_node/empty.output similarity index 100% rename from docs/examples/ex_basic_node_empty.output rename to examples/apis/basic_node/empty.output diff --git a/docs/examples/ex_basic_node_end.cpp b/examples/apis/basic_node/end.cpp similarity index 91% rename from docs/examples/ex_basic_node_end.cpp rename to examples/apis/basic_node/end.cpp index 14f1c062..22a1f1d4 100644 --- a/docs/examples/ex_basic_node_end.cpp +++ b/examples/apis/basic_node/end.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_end.output b/examples/apis/basic_node/end.output similarity index 100% rename from docs/examples/ex_basic_node_end.output rename to examples/apis/basic_node/end.output diff --git a/docs/examples/ex_basic_node_extraction_operator.cpp b/examples/apis/basic_node/extraction_operator.cpp similarity index 90% rename from docs/examples/ex_basic_node_extraction_operator.cpp rename to examples/apis/basic_node/extraction_operator.cpp index d622b586..271eb849 100644 --- a/docs/examples/ex_basic_node_extraction_operator.cpp +++ b/examples/apis/basic_node/extraction_operator.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_extraction_operator.output b/examples/apis/basic_node/extraction_operator.output similarity index 100% rename from docs/examples/ex_basic_node_extraction_operator.output rename to examples/apis/basic_node/extraction_operator.output diff --git a/docs/examples/ex_basic_node_float_number_type.cpp b/examples/apis/basic_node/float_number_type.cpp similarity index 89% rename from docs/examples/ex_basic_node_float_number_type.cpp rename to examples/apis/basic_node/float_number_type.cpp index 89da57ce..bd98d1a8 100644 --- a/docs/examples/ex_basic_node_float_number_type.cpp +++ b/examples/apis/basic_node/float_number_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_float_number_type.output b/examples/apis/basic_node/float_number_type.output similarity index 100% rename from docs/examples/ex_basic_node_float_number_type.output rename to examples/apis/basic_node/float_number_type.output diff --git a/docs/examples/ex_basic_node_get_anchor_name.cpp b/examples/apis/basic_node/get_anchor_name.cpp similarity index 92% rename from docs/examples/ex_basic_node_get_anchor_name.cpp rename to examples/apis/basic_node/get_anchor_name.cpp index 1a9e765f..1bc62086 100644 --- a/docs/examples/ex_basic_node_get_anchor_name.cpp +++ b/examples/apis/basic_node/get_anchor_name.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_get_anchor_name.output b/examples/apis/basic_node/get_anchor_name.output similarity index 100% rename from docs/examples/ex_basic_node_get_anchor_name.output rename to examples/apis/basic_node/get_anchor_name.output diff --git a/docs/examples/ex_basic_node_get_tag_name.cpp b/examples/apis/basic_node/get_tag_name.cpp similarity index 92% rename from docs/examples/ex_basic_node_get_tag_name.cpp rename to examples/apis/basic_node/get_tag_name.cpp index 5312a93b..056a7138 100644 --- a/docs/examples/ex_basic_node_get_tag_name.cpp +++ b/examples/apis/basic_node/get_tag_name.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_get_tag_name.output b/examples/apis/basic_node/get_tag_name.output similarity index 100% rename from docs/examples/ex_basic_node_get_tag_name.output rename to examples/apis/basic_node/get_tag_name.output diff --git a/docs/examples/ex_basic_node_get_type.cpp b/examples/apis/basic_node/get_type.cpp similarity index 95% rename from docs/examples/ex_basic_node_get_type.cpp rename to examples/apis/basic_node/get_type.cpp index 65a59076..02e8a82f 100644 --- a/docs/examples/ex_basic_node_get_type.cpp +++ b/examples/apis/basic_node/get_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_get_type.output b/examples/apis/basic_node/get_type.output similarity index 100% rename from docs/examples/ex_basic_node_get_type.output rename to examples/apis/basic_node/get_type.output diff --git a/docs/examples/ex_basic_node_get_value.cpp b/examples/apis/basic_node/get_value.cpp similarity index 97% rename from docs/examples/ex_basic_node_get_value.cpp rename to examples/apis/basic_node/get_value.cpp index bbedb18e..8392c82f 100644 --- a/docs/examples/ex_basic_node_get_value.cpp +++ b/examples/apis/basic_node/get_value.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_get_value.output b/examples/apis/basic_node/get_value.output similarity index 100% rename from docs/examples/ex_basic_node_get_value.output rename to examples/apis/basic_node/get_value.output diff --git a/docs/examples/ex_basic_node_get_value_inplace.cpp b/examples/apis/basic_node/get_value_inplace.cpp similarity index 96% rename from docs/examples/ex_basic_node_get_value_inplace.cpp rename to examples/apis/basic_node/get_value_inplace.cpp index 3aa4cc47..1f6bdb5f 100644 --- a/docs/examples/ex_basic_node_get_value_inplace.cpp +++ b/examples/apis/basic_node/get_value_inplace.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_get_value_inplace.output b/examples/apis/basic_node/get_value_inplace.output similarity index 100% rename from docs/examples/ex_basic_node_get_value_inplace.output rename to examples/apis/basic_node/get_value_inplace.output diff --git a/docs/examples/ex_basic_node_get_value_ref.cpp b/examples/apis/basic_node/get_value_ref.cpp similarity index 93% rename from docs/examples/ex_basic_node_get_value_ref.cpp rename to examples/apis/basic_node/get_value_ref.cpp index 2265017f..ea3c175d 100644 --- a/docs/examples/ex_basic_node_get_value_ref.cpp +++ b/examples/apis/basic_node/get_value_ref.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_get_value_ref.output b/examples/apis/basic_node/get_value_ref.output similarity index 100% rename from docs/examples/ex_basic_node_get_value_ref.output rename to examples/apis/basic_node/get_value_ref.output diff --git a/docs/examples/ex_basic_node_get_yaml_version.cpp b/examples/apis/basic_node/get_yaml_version.cpp similarity index 91% rename from docs/examples/ex_basic_node_get_yaml_version.cpp rename to examples/apis/basic_node/get_yaml_version.cpp index 9e58267a..6881dbd1 100644 --- a/docs/examples/ex_basic_node_get_yaml_version.cpp +++ b/examples/apis/basic_node/get_yaml_version.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_get_yaml_version.output b/examples/apis/basic_node/get_yaml_version.output similarity index 100% rename from docs/examples/ex_basic_node_get_yaml_version.output rename to examples/apis/basic_node/get_yaml_version.output diff --git a/docs/examples/ex_basic_node_get_yaml_version_type.cpp b/examples/apis/basic_node/get_yaml_version_type.cpp similarity index 91% rename from docs/examples/ex_basic_node_get_yaml_version_type.cpp rename to examples/apis/basic_node/get_yaml_version_type.cpp index d3c416a9..00de944b 100644 --- a/docs/examples/ex_basic_node_get_yaml_version_type.cpp +++ b/examples/apis/basic_node/get_yaml_version_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_get_yaml_version_type.output b/examples/apis/basic_node/get_yaml_version_type.output similarity index 100% rename from docs/examples/ex_basic_node_get_yaml_version_type.output rename to examples/apis/basic_node/get_yaml_version_type.output diff --git a/docs/examples/ex_basic_node_has_anchor_name.cpp b/examples/apis/basic_node/has_anchor_name.cpp similarity index 92% rename from docs/examples/ex_basic_node_has_anchor_name.cpp rename to examples/apis/basic_node/has_anchor_name.cpp index b970e30b..5e82bb01 100644 --- a/docs/examples/ex_basic_node_has_anchor_name.cpp +++ b/examples/apis/basic_node/has_anchor_name.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_has_anchor_name.output b/examples/apis/basic_node/has_anchor_name.output similarity index 100% rename from docs/examples/ex_basic_node_has_anchor_name.output rename to examples/apis/basic_node/has_anchor_name.output diff --git a/docs/examples/ex_basic_node_has_tag_name.cpp b/examples/apis/basic_node/has_tag_name.cpp similarity index 92% rename from docs/examples/ex_basic_node_has_tag_name.cpp rename to examples/apis/basic_node/has_tag_name.cpp index 57f99af2..2d73edce 100644 --- a/docs/examples/ex_basic_node_has_tag_name.cpp +++ b/examples/apis/basic_node/has_tag_name.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_has_tag_name.output b/examples/apis/basic_node/has_tag_name.output similarity index 100% rename from docs/examples/ex_basic_node_has_tag_name.output rename to examples/apis/basic_node/has_tag_name.output diff --git a/docs/examples/ex_basic_node_insertion_operator.cpp b/examples/apis/basic_node/insertion_operator.cpp similarity index 92% rename from docs/examples/ex_basic_node_insertion_operator.cpp rename to examples/apis/basic_node/insertion_operator.cpp index 6b2c889b..2342e8ca 100644 --- a/docs/examples/ex_basic_node_insertion_operator.cpp +++ b/examples/apis/basic_node/insertion_operator.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_insertion_operator.output b/examples/apis/basic_node/insertion_operator.output similarity index 100% rename from docs/examples/ex_basic_node_insertion_operator.output rename to examples/apis/basic_node/insertion_operator.output diff --git a/docs/examples/ex_basic_node_integer_type.cpp b/examples/apis/basic_node/integer_type.cpp similarity index 90% rename from docs/examples/ex_basic_node_integer_type.cpp rename to examples/apis/basic_node/integer_type.cpp index 797dc5e4..c0ea4127 100644 --- a/docs/examples/ex_basic_node_integer_type.cpp +++ b/examples/apis/basic_node/integer_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_integer_type.output b/examples/apis/basic_node/integer_type.output similarity index 100% rename from docs/examples/ex_basic_node_integer_type.output rename to examples/apis/basic_node/integer_type.output diff --git a/docs/examples/ex_basic_node_is_alias.cpp b/examples/apis/basic_node/is_alias.cpp similarity index 93% rename from docs/examples/ex_basic_node_is_alias.cpp rename to examples/apis/basic_node/is_alias.cpp index 5a9bf39f..18fddd91 100644 --- a/docs/examples/ex_basic_node_is_alias.cpp +++ b/examples/apis/basic_node/is_alias.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_is_alias.output b/examples/apis/basic_node/is_alias.output similarity index 100% rename from docs/examples/ex_basic_node_is_alias.output rename to examples/apis/basic_node/is_alias.output diff --git a/docs/examples/ex_basic_node_is_anchor.cpp b/examples/apis/basic_node/is_anchor.cpp similarity index 92% rename from docs/examples/ex_basic_node_is_anchor.cpp rename to examples/apis/basic_node/is_anchor.cpp index a4a3fa3e..b6abbe2e 100644 --- a/docs/examples/ex_basic_node_is_anchor.cpp +++ b/examples/apis/basic_node/is_anchor.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_is_anchor.output b/examples/apis/basic_node/is_anchor.output similarity index 100% rename from docs/examples/ex_basic_node_is_anchor.output rename to examples/apis/basic_node/is_anchor.output diff --git a/docs/examples/ex_basic_node_is_boolean.cpp b/examples/apis/basic_node/is_boolean.cpp similarity index 89% rename from docs/examples/ex_basic_node_is_boolean.cpp rename to examples/apis/basic_node/is_boolean.cpp index 805656b4..8a83b3c7 100644 --- a/docs/examples/ex_basic_node_is_boolean.cpp +++ b/examples/apis/basic_node/is_boolean.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_is_boolean.output b/examples/apis/basic_node/is_boolean.output similarity index 100% rename from docs/examples/ex_basic_node_is_boolean.output rename to examples/apis/basic_node/is_boolean.output diff --git a/docs/examples/ex_basic_node_is_float_number.cpp b/examples/apis/basic_node/is_float_number.cpp similarity index 89% rename from docs/examples/ex_basic_node_is_float_number.cpp rename to examples/apis/basic_node/is_float_number.cpp index 0ec5c4c5..e0aaf624 100644 --- a/docs/examples/ex_basic_node_is_float_number.cpp +++ b/examples/apis/basic_node/is_float_number.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_is_float_number.output b/examples/apis/basic_node/is_float_number.output similarity index 100% rename from docs/examples/ex_basic_node_is_float_number.output rename to examples/apis/basic_node/is_float_number.output diff --git a/docs/examples/ex_basic_node_is_integer.cpp b/examples/apis/basic_node/is_integer.cpp similarity index 89% rename from docs/examples/ex_basic_node_is_integer.cpp rename to examples/apis/basic_node/is_integer.cpp index f8bb0f28..0d3b9639 100644 --- a/docs/examples/ex_basic_node_is_integer.cpp +++ b/examples/apis/basic_node/is_integer.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_is_integer.output b/examples/apis/basic_node/is_integer.output similarity index 100% rename from docs/examples/ex_basic_node_is_integer.output rename to examples/apis/basic_node/is_integer.output diff --git a/docs/examples/ex_basic_node_is_mapping.cpp b/examples/apis/basic_node/is_mapping.cpp similarity index 89% rename from docs/examples/ex_basic_node_is_mapping.cpp rename to examples/apis/basic_node/is_mapping.cpp index 31d20721..7ce8010a 100644 --- a/docs/examples/ex_basic_node_is_mapping.cpp +++ b/examples/apis/basic_node/is_mapping.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_is_mapping.output b/examples/apis/basic_node/is_mapping.output similarity index 100% rename from docs/examples/ex_basic_node_is_mapping.output rename to examples/apis/basic_node/is_mapping.output diff --git a/docs/examples/ex_basic_node_is_null.cpp b/examples/apis/basic_node/is_null.cpp similarity index 89% rename from docs/examples/ex_basic_node_is_null.cpp rename to examples/apis/basic_node/is_null.cpp index e743656a..fd7b0aba 100644 --- a/docs/examples/ex_basic_node_is_null.cpp +++ b/examples/apis/basic_node/is_null.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_is_null.output b/examples/apis/basic_node/is_null.output similarity index 100% rename from docs/examples/ex_basic_node_is_null.output rename to examples/apis/basic_node/is_null.output diff --git a/docs/examples/ex_basic_node_is_scalar.cpp b/examples/apis/basic_node/is_scalar.cpp similarity index 94% rename from docs/examples/ex_basic_node_is_scalar.cpp rename to examples/apis/basic_node/is_scalar.cpp index ce41409c..8abe9f31 100644 --- a/docs/examples/ex_basic_node_is_scalar.cpp +++ b/examples/apis/basic_node/is_scalar.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_is_scalar.output b/examples/apis/basic_node/is_scalar.output similarity index 100% rename from docs/examples/ex_basic_node_is_scalar.output rename to examples/apis/basic_node/is_scalar.output diff --git a/docs/examples/ex_basic_node_is_sequence.cpp b/examples/apis/basic_node/is_sequence.cpp similarity index 89% rename from docs/examples/ex_basic_node_is_sequence.cpp rename to examples/apis/basic_node/is_sequence.cpp index 76e3c2e8..0ed099e2 100644 --- a/docs/examples/ex_basic_node_is_sequence.cpp +++ b/examples/apis/basic_node/is_sequence.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_is_sequence.output b/examples/apis/basic_node/is_sequence.output similarity index 100% rename from docs/examples/ex_basic_node_is_sequence.output rename to examples/apis/basic_node/is_sequence.output diff --git a/docs/examples/ex_basic_node_is_string.cpp b/examples/apis/basic_node/is_string.cpp similarity index 89% rename from docs/examples/ex_basic_node_is_string.cpp rename to examples/apis/basic_node/is_string.cpp index ab97101a..7391cd64 100644 --- a/docs/examples/ex_basic_node_is_string.cpp +++ b/examples/apis/basic_node/is_string.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_is_string.output b/examples/apis/basic_node/is_string.output similarity index 100% rename from docs/examples/ex_basic_node_is_string.output rename to examples/apis/basic_node/is_string.output diff --git a/docs/examples/ex_basic_node_iterator.cpp b/examples/apis/basic_node/iterator.cpp similarity index 94% rename from docs/examples/ex_basic_node_iterator.cpp rename to examples/apis/basic_node/iterator.cpp index 3fff55f8..be57c2b3 100644 --- a/docs/examples/ex_basic_node_iterator.cpp +++ b/examples/apis/basic_node/iterator.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_iterator.output b/examples/apis/basic_node/iterator.output similarity index 100% rename from docs/examples/ex_basic_node_iterator.output rename to examples/apis/basic_node/iterator.output diff --git a/docs/examples/ex_basic_node_mapping.cpp b/examples/apis/basic_node/mapping.cpp similarity index 89% rename from docs/examples/ex_basic_node_mapping.cpp rename to examples/apis/basic_node/mapping.cpp index f38fc735..57e675cf 100644 --- a/docs/examples/ex_basic_node_mapping.cpp +++ b/examples/apis/basic_node/mapping.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_mapping.output b/examples/apis/basic_node/mapping.output similarity index 100% rename from docs/examples/ex_basic_node_mapping.output rename to examples/apis/basic_node/mapping.output diff --git a/docs/examples/ex_basic_node_mapping_type.cpp b/examples/apis/basic_node/mapping_type.cpp similarity index 90% rename from docs/examples/ex_basic_node_mapping_type.cpp rename to examples/apis/basic_node/mapping_type.cpp index 7f38ef7b..bd21bfdd 100644 --- a/docs/examples/ex_basic_node_mapping_type.cpp +++ b/examples/apis/basic_node/mapping_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_mapping_type.output b/examples/apis/basic_node/mapping_type.output similarity index 100% rename from docs/examples/ex_basic_node_mapping_type.output rename to examples/apis/basic_node/mapping_type.output diff --git a/docs/examples/ex_basic_node_move_assignment_operator.cpp b/examples/apis/basic_node/move_assignment_operator.cpp similarity index 90% rename from docs/examples/ex_basic_node_move_assignment_operator.cpp rename to examples/apis/basic_node/move_assignment_operator.cpp index b8d17c5b..5a25c3e8 100644 --- a/docs/examples/ex_basic_node_move_assignment_operator.cpp +++ b/examples/apis/basic_node/move_assignment_operator.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_move_assignment_operator.output b/examples/apis/basic_node/move_assignment_operator.output similarity index 100% rename from docs/examples/ex_basic_node_move_assignment_operator.output rename to examples/apis/basic_node/move_assignment_operator.output diff --git a/docs/examples/ex_basic_node_node.cpp b/examples/apis/basic_node/node.cpp similarity index 91% rename from docs/examples/ex_basic_node_node.cpp rename to examples/apis/basic_node/node.cpp index 526f12a0..13bd7df3 100644 --- a/docs/examples/ex_basic_node_node.cpp +++ b/examples/apis/basic_node/node.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_node.output b/examples/apis/basic_node/node.output similarity index 100% rename from docs/examples/ex_basic_node_node.output rename to examples/apis/basic_node/node.output diff --git a/docs/examples/ex_basic_node_node_t.cpp b/examples/apis/basic_node/node_t.cpp similarity index 95% rename from docs/examples/ex_basic_node_node_t.cpp rename to examples/apis/basic_node/node_t.cpp index 451ba827..4cadd58b 100644 --- a/docs/examples/ex_basic_node_node_t.cpp +++ b/examples/apis/basic_node/node_t.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_node_t.output b/examples/apis/basic_node/node_t.output similarity index 100% rename from docs/examples/ex_basic_node_node_t.output rename to examples/apis/basic_node/node_t.output diff --git a/docs/examples/ex_basic_node_operator_eq.cpp b/examples/apis/basic_node/operator_eq.cpp similarity index 95% rename from docs/examples/ex_basic_node_operator_eq.cpp rename to examples/apis/basic_node/operator_eq.cpp index fbee6424..f17a7664 100644 --- a/docs/examples/ex_basic_node_operator_eq.cpp +++ b/examples/apis/basic_node/operator_eq.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_operator_eq.output b/examples/apis/basic_node/operator_eq.output similarity index 100% rename from docs/examples/ex_basic_node_operator_eq.output rename to examples/apis/basic_node/operator_eq.output diff --git a/docs/examples/ex_basic_node_operator_ge.cpp b/examples/apis/basic_node/operator_ge.cpp similarity index 95% rename from docs/examples/ex_basic_node_operator_ge.cpp rename to examples/apis/basic_node/operator_ge.cpp index 9c5e554c..d5278d31 100644 --- a/docs/examples/ex_basic_node_operator_ge.cpp +++ b/examples/apis/basic_node/operator_ge.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_operator_ge.output b/examples/apis/basic_node/operator_ge.output similarity index 100% rename from docs/examples/ex_basic_node_operator_ge.output rename to examples/apis/basic_node/operator_ge.output diff --git a/docs/examples/ex_basic_node_operator_gt.cpp b/examples/apis/basic_node/operator_gt.cpp similarity index 95% rename from docs/examples/ex_basic_node_operator_gt.cpp rename to examples/apis/basic_node/operator_gt.cpp index b421d25d..c707c251 100644 --- a/docs/examples/ex_basic_node_operator_gt.cpp +++ b/examples/apis/basic_node/operator_gt.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_operator_gt.output b/examples/apis/basic_node/operator_gt.output similarity index 100% rename from docs/examples/ex_basic_node_operator_gt.output rename to examples/apis/basic_node/operator_gt.output diff --git a/docs/examples/ex_basic_node_operator_le.cpp b/examples/apis/basic_node/operator_le.cpp similarity index 95% rename from docs/examples/ex_basic_node_operator_le.cpp rename to examples/apis/basic_node/operator_le.cpp index 7de64ce9..16a241d6 100644 --- a/docs/examples/ex_basic_node_operator_le.cpp +++ b/examples/apis/basic_node/operator_le.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_operator_le.output b/examples/apis/basic_node/operator_le.output similarity index 100% rename from docs/examples/ex_basic_node_operator_le.output rename to examples/apis/basic_node/operator_le.output diff --git a/docs/examples/ex_basic_node_operator_lt.cpp b/examples/apis/basic_node/operator_lt.cpp similarity index 95% rename from docs/examples/ex_basic_node_operator_lt.cpp rename to examples/apis/basic_node/operator_lt.cpp index 4353348b..d44ad2e9 100644 --- a/docs/examples/ex_basic_node_operator_lt.cpp +++ b/examples/apis/basic_node/operator_lt.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_operator_lt.output b/examples/apis/basic_node/operator_lt.output similarity index 100% rename from docs/examples/ex_basic_node_operator_lt.output rename to examples/apis/basic_node/operator_lt.output diff --git a/docs/examples/ex_basic_node_operator_ne.cpp b/examples/apis/basic_node/operator_ne.cpp similarity index 95% rename from docs/examples/ex_basic_node_operator_ne.cpp rename to examples/apis/basic_node/operator_ne.cpp index 820a17ea..7badaeef 100644 --- a/docs/examples/ex_basic_node_operator_ne.cpp +++ b/examples/apis/basic_node/operator_ne.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_operator_ne.output b/examples/apis/basic_node/operator_ne.output similarity index 100% rename from docs/examples/ex_basic_node_operator_ne.output rename to examples/apis/basic_node/operator_ne.output diff --git a/docs/examples/ex_basic_node_rbegin.cpp b/examples/apis/basic_node/rbegin.cpp similarity index 90% rename from docs/examples/ex_basic_node_rbegin.cpp rename to examples/apis/basic_node/rbegin.cpp index a3d413e2..92765244 100644 --- a/docs/examples/ex_basic_node_rbegin.cpp +++ b/examples/apis/basic_node/rbegin.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_rbegin.output b/examples/apis/basic_node/rbegin.output similarity index 100% rename from docs/examples/ex_basic_node_rbegin.output rename to examples/apis/basic_node/rbegin.output diff --git a/docs/examples/ex_basic_node_rend.cpp b/examples/apis/basic_node/rend.cpp similarity index 91% rename from docs/examples/ex_basic_node_rend.cpp rename to examples/apis/basic_node/rend.cpp index e0f0b438..969eb4cb 100644 --- a/docs/examples/ex_basic_node_rend.cpp +++ b/examples/apis/basic_node/rend.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_rend.output b/examples/apis/basic_node/rend.output similarity index 100% rename from docs/examples/ex_basic_node_rend.output rename to examples/apis/basic_node/rend.output diff --git a/docs/examples/ex_basic_node_reverse_iterator.cpp b/examples/apis/basic_node/reverse_iterator.cpp similarity index 94% rename from docs/examples/ex_basic_node_reverse_iterator.cpp rename to examples/apis/basic_node/reverse_iterator.cpp index e8c1cbc6..a16d830c 100644 --- a/docs/examples/ex_basic_node_reverse_iterator.cpp +++ b/examples/apis/basic_node/reverse_iterator.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_reverse_iterator.output b/examples/apis/basic_node/reverse_iterator.output similarity index 100% rename from docs/examples/ex_basic_node_reverse_iterator.output rename to examples/apis/basic_node/reverse_iterator.output diff --git a/docs/examples/ex_basic_node_sequence.cpp b/examples/apis/basic_node/sequence.cpp similarity index 90% rename from docs/examples/ex_basic_node_sequence.cpp rename to examples/apis/basic_node/sequence.cpp index 1a25ee65..a3694ddd 100644 --- a/docs/examples/ex_basic_node_sequence.cpp +++ b/examples/apis/basic_node/sequence.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_sequence.output b/examples/apis/basic_node/sequence.output similarity index 100% rename from docs/examples/ex_basic_node_sequence.output rename to examples/apis/basic_node/sequence.output diff --git a/docs/examples/ex_basic_node_sequence_type.cpp b/examples/apis/basic_node/sequence_type.cpp similarity index 90% rename from docs/examples/ex_basic_node_sequence_type.cpp rename to examples/apis/basic_node/sequence_type.cpp index dcc50e26..57234783 100644 --- a/docs/examples/ex_basic_node_sequence_type.cpp +++ b/examples/apis/basic_node/sequence_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_sequence_type.output b/examples/apis/basic_node/sequence_type.output similarity index 100% rename from docs/examples/ex_basic_node_sequence_type.output rename to examples/apis/basic_node/sequence_type.output diff --git a/docs/examples/ex_basic_node_serialize.cpp b/examples/apis/basic_node/serialize.cpp similarity index 93% rename from docs/examples/ex_basic_node_serialize.cpp rename to examples/apis/basic_node/serialize.cpp index 1ef9dca7..af197535 100644 --- a/docs/examples/ex_basic_node_serialize.cpp +++ b/examples/apis/basic_node/serialize.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_serialize.output b/examples/apis/basic_node/serialize.output similarity index 100% rename from docs/examples/ex_basic_node_serialize.output rename to examples/apis/basic_node/serialize.output diff --git a/docs/examples/ex_basic_node_serialize_docs.cpp b/examples/apis/basic_node/serialize_docs.cpp similarity index 94% rename from docs/examples/ex_basic_node_serialize_docs.cpp rename to examples/apis/basic_node/serialize_docs.cpp index baea8d56..d17b1b8a 100644 --- a/docs/examples/ex_basic_node_serialize_docs.cpp +++ b/examples/apis/basic_node/serialize_docs.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_serialize_docs.output b/examples/apis/basic_node/serialize_docs.output similarity index 100% rename from docs/examples/ex_basic_node_serialize_docs.output rename to examples/apis/basic_node/serialize_docs.output diff --git a/docs/examples/ex_basic_node_set_yaml_version.cpp b/examples/apis/basic_node/set_yaml_version.cpp similarity index 92% rename from docs/examples/ex_basic_node_set_yaml_version.cpp rename to examples/apis/basic_node/set_yaml_version.cpp index 35a7ea78..eb8b37b5 100644 --- a/docs/examples/ex_basic_node_set_yaml_version.cpp +++ b/examples/apis/basic_node/set_yaml_version.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_set_yaml_version.output b/examples/apis/basic_node/set_yaml_version.output similarity index 100% rename from docs/examples/ex_basic_node_set_yaml_version.output rename to examples/apis/basic_node/set_yaml_version.output diff --git a/docs/examples/ex_basic_node_set_yaml_version_type.cpp b/examples/apis/basic_node/set_yaml_version_type.cpp similarity index 93% rename from docs/examples/ex_basic_node_set_yaml_version_type.cpp rename to examples/apis/basic_node/set_yaml_version_type.cpp index 9c89c966..0d1c3ec5 100644 --- a/docs/examples/ex_basic_node_set_yaml_version_type.cpp +++ b/examples/apis/basic_node/set_yaml_version_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_set_yaml_version_type.output b/examples/apis/basic_node/set_yaml_version_type.output similarity index 100% rename from docs/examples/ex_basic_node_set_yaml_version_type.output rename to examples/apis/basic_node/set_yaml_version_type.output diff --git a/docs/examples/ex_basic_node_size.cpp b/examples/apis/basic_node/size.cpp similarity index 93% rename from docs/examples/ex_basic_node_size.cpp rename to examples/apis/basic_node/size.cpp index 0231dcb0..ea7e0537 100644 --- a/docs/examples/ex_basic_node_size.cpp +++ b/examples/apis/basic_node/size.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_size.output b/examples/apis/basic_node/size.output similarity index 100% rename from docs/examples/ex_basic_node_size.output rename to examples/apis/basic_node/size.output diff --git a/docs/examples/ex_basic_node_string_type.cpp b/examples/apis/basic_node/string_type.cpp similarity index 90% rename from docs/examples/ex_basic_node_string_type.cpp rename to examples/apis/basic_node/string_type.cpp index c5a86a62..b597e73e 100644 --- a/docs/examples/ex_basic_node_string_type.cpp +++ b/examples/apis/basic_node/string_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_string_type.output b/examples/apis/basic_node/string_type.output similarity index 100% rename from docs/examples/ex_basic_node_string_type.output rename to examples/apis/basic_node/string_type.output diff --git a/docs/examples/ex_basic_node_subscript_operator_basic_node.cpp b/examples/apis/basic_node/subscript_operator_basic_node.cpp similarity index 95% rename from docs/examples/ex_basic_node_subscript_operator_basic_node.cpp rename to examples/apis/basic_node/subscript_operator_basic_node.cpp index ed562afd..5ed881e2 100644 --- a/docs/examples/ex_basic_node_subscript_operator_basic_node.cpp +++ b/examples/apis/basic_node/subscript_operator_basic_node.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_subscript_operator_basic_node.output b/examples/apis/basic_node/subscript_operator_basic_node.output similarity index 100% rename from docs/examples/ex_basic_node_subscript_operator_basic_node.output rename to examples/apis/basic_node/subscript_operator_basic_node.output diff --git a/docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp b/examples/apis/basic_node/subscript_operator_compatible_type.cpp similarity index 94% rename from docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp rename to examples/apis/basic_node/subscript_operator_compatible_type.cpp index 82020b21..e468f802 100644 --- a/docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp +++ b/examples/apis/basic_node/subscript_operator_compatible_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_subscript_operator_compatible_type.output b/examples/apis/basic_node/subscript_operator_compatible_type.output similarity index 100% rename from docs/examples/ex_basic_node_subscript_operator_compatible_type.output rename to examples/apis/basic_node/subscript_operator_compatible_type.output diff --git a/docs/examples/ex_basic_node_swap_member.cpp b/examples/apis/basic_node/swap_member.cpp similarity index 92% rename from docs/examples/ex_basic_node_swap_member.cpp rename to examples/apis/basic_node/swap_member.cpp index 7645026f..93bde4a5 100644 --- a/docs/examples/ex_basic_node_swap_member.cpp +++ b/examples/apis/basic_node/swap_member.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_swap_member.output b/examples/apis/basic_node/swap_member.output similarity index 100% rename from docs/examples/ex_basic_node_swap_member.output rename to examples/apis/basic_node/swap_member.output diff --git a/docs/examples/ex_basic_node_swap_std.cpp b/examples/apis/basic_node/swap_std.cpp similarity index 92% rename from docs/examples/ex_basic_node_swap_std.cpp rename to examples/apis/basic_node/swap_std.cpp index bec802da..91944003 100644 --- a/docs/examples/ex_basic_node_swap_std.cpp +++ b/examples/apis/basic_node/swap_std.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_swap_std.output b/examples/apis/basic_node/swap_std.output similarity index 100% rename from docs/examples/ex_basic_node_swap_std.output rename to examples/apis/basic_node/swap_std.output diff --git a/docs/examples/ex_basic_node_type.cpp b/examples/apis/basic_node/type.cpp similarity index 95% rename from docs/examples/ex_basic_node_type.cpp rename to examples/apis/basic_node/type.cpp index 451ba827..4cadd58b 100644 --- a/docs/examples/ex_basic_node_type.cpp +++ b/examples/apis/basic_node/type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_type.output b/examples/apis/basic_node/type.output similarity index 100% rename from docs/examples/ex_basic_node_type.output rename to examples/apis/basic_node/type.output diff --git a/docs/examples/ex_basic_node_value_converter_type.cpp b/examples/apis/basic_node/value_converter_type.cpp similarity index 93% rename from docs/examples/ex_basic_node_value_converter_type.cpp rename to examples/apis/basic_node/value_converter_type.cpp index 4c94c669..877168ca 100644 --- a/docs/examples/ex_basic_node_value_converter_type.cpp +++ b/examples/apis/basic_node/value_converter_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_value_converter_type.output b/examples/apis/basic_node/value_converter_type.output similarity index 100% rename from docs/examples/ex_basic_node_value_converter_type.output rename to examples/apis/basic_node/value_converter_type.output diff --git a/docs/examples/ex_basic_node_yaml_version_t.cpp b/examples/apis/basic_node/yaml_version_t.cpp similarity index 94% rename from docs/examples/ex_basic_node_yaml_version_t.cpp rename to examples/apis/basic_node/yaml_version_t.cpp index 7c59531d..80318528 100644 --- a/docs/examples/ex_basic_node_yaml_version_t.cpp +++ b/examples/apis/basic_node/yaml_version_t.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_basic_node_yaml_version_t.output b/examples/apis/basic_node/yaml_version_t.output similarity index 100% rename from docs/examples/ex_basic_node_yaml_version_t.output rename to examples/apis/basic_node/yaml_version_t.output diff --git a/examples/apis/exception/CMakeLists.txt b/examples/apis/exception/CMakeLists.txt new file mode 100644 index 00000000..e7176246 --- /dev/null +++ b/examples/apis/exception/CMakeLists.txt @@ -0,0 +1,16 @@ +file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +foreach(EX_SRC_FILE ${EX_SRC_FILES}) + file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) + string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) + add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) + target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + + add_custom_command( + TARGET ${EX_SRC_FILE_BASE} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ + ) +endforeach() diff --git a/docs/examples/ex_exception_constructor_msg.cpp b/examples/apis/exception/constructor_msg.cpp similarity index 90% rename from docs/examples/ex_exception_constructor_msg.cpp rename to examples/apis/exception/constructor_msg.cpp index d3369a99..a9f34e79 100644 --- a/docs/examples/ex_exception_constructor_msg.cpp +++ b/examples/apis/exception/constructor_msg.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_exception_constructor_msg.output b/examples/apis/exception/constructor_msg.output similarity index 100% rename from docs/examples/ex_exception_constructor_msg.output rename to examples/apis/exception/constructor_msg.output diff --git a/docs/examples/ex_exception_constructor_noarg.cpp b/examples/apis/exception/constructor_noarg.cpp similarity index 89% rename from docs/examples/ex_exception_constructor_noarg.cpp rename to examples/apis/exception/constructor_noarg.cpp index dce59ce9..706e6a9e 100644 --- a/docs/examples/ex_exception_constructor_noarg.cpp +++ b/examples/apis/exception/constructor_noarg.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_exception_constructor_noarg.output b/examples/apis/exception/constructor_noarg.output similarity index 100% rename from docs/examples/ex_exception_constructor_noarg.output rename to examples/apis/exception/constructor_noarg.output diff --git a/docs/examples/ex_exception_what.cpp b/examples/apis/exception/what.cpp similarity index 90% rename from docs/examples/ex_exception_what.cpp rename to examples/apis/exception/what.cpp index d398537c..740fab6a 100644 --- a/docs/examples/ex_exception_what.cpp +++ b/examples/apis/exception/what.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_exception_what.output b/examples/apis/exception/what.output similarity index 100% rename from docs/examples/ex_exception_what.output rename to examples/apis/exception/what.output diff --git a/docs/examples/input.yaml b/examples/apis/input.yaml similarity index 100% rename from docs/examples/input.yaml rename to examples/apis/input.yaml diff --git a/docs/examples/input_multi.yaml b/examples/apis/input_multi.yaml similarity index 100% rename from docs/examples/input_multi.yaml rename to examples/apis/input_multi.yaml diff --git a/examples/apis/macros/CMakeLists.txt b/examples/apis/macros/CMakeLists.txt new file mode 100644 index 00000000..e7176246 --- /dev/null +++ b/examples/apis/macros/CMakeLists.txt @@ -0,0 +1,16 @@ +file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +foreach(EX_SRC_FILE ${EX_SRC_FILES}) + file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) + string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) + add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) + target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + + add_custom_command( + TARGET ${EX_SRC_FILE_BASE} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ + ) +endforeach() diff --git a/docs/examples/ex_macros_versions.cpp b/examples/apis/macros/versions.cpp similarity index 89% rename from docs/examples/ex_macros_versions.cpp rename to examples/apis/macros/versions.cpp index 63ebe02c..a83946f4 100644 --- a/docs/examples/ex_macros_versions.cpp +++ b/examples/apis/macros/versions.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_macros_versions.output b/examples/apis/macros/versions.output similarity index 100% rename from docs/examples/ex_macros_versions.output rename to examples/apis/macros/versions.output diff --git a/examples/apis/node_type/CMakeLists.txt b/examples/apis/node_type/CMakeLists.txt new file mode 100644 index 00000000..e7176246 --- /dev/null +++ b/examples/apis/node_type/CMakeLists.txt @@ -0,0 +1,16 @@ +file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +foreach(EX_SRC_FILE ${EX_SRC_FILES}) + file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) + string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) + add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) + target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + + add_custom_command( + TARGET ${EX_SRC_FILE_BASE} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ + ) +endforeach() diff --git a/docs/examples/ex_node_type.cpp b/examples/apis/node_type/node_type.cpp similarity index 95% rename from docs/examples/ex_node_type.cpp rename to examples/apis/node_type/node_type.cpp index 286ea4d7..3b6dbff5 100644 --- a/docs/examples/ex_node_type.cpp +++ b/examples/apis/node_type/node_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_node_type.output b/examples/apis/node_type/node_type.output similarity index 100% rename from docs/examples/ex_node_type.output rename to examples/apis/node_type/node_type.output diff --git a/examples/apis/node_value_converter/CMakeLists.txt b/examples/apis/node_value_converter/CMakeLists.txt new file mode 100644 index 00000000..e7176246 --- /dev/null +++ b/examples/apis/node_value_converter/CMakeLists.txt @@ -0,0 +1,16 @@ +file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +foreach(EX_SRC_FILE ${EX_SRC_FILES}) + file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) + string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) + add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) + target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + + add_custom_command( + TARGET ${EX_SRC_FILE_BASE} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ + ) +endforeach() diff --git a/docs/examples/ex_node_value_converter_from_node.cpp b/examples/apis/node_value_converter/from_node.cpp similarity index 94% rename from docs/examples/ex_node_value_converter_from_node.cpp rename to examples/apis/node_value_converter/from_node.cpp index f74f6116..61297c9a 100644 --- a/docs/examples/ex_node_value_converter_from_node.cpp +++ b/examples/apis/node_value_converter/from_node.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_node_value_converter_from_node.output b/examples/apis/node_value_converter/from_node.output similarity index 100% rename from docs/examples/ex_node_value_converter_from_node.output rename to examples/apis/node_value_converter/from_node.output diff --git a/docs/examples/ex_node_value_converter_to_node.cpp b/examples/apis/node_value_converter/to_node.cpp similarity index 92% rename from docs/examples/ex_node_value_converter_to_node.cpp rename to examples/apis/node_value_converter/to_node.cpp index dc1075cc..482db86d 100644 --- a/docs/examples/ex_node_value_converter_to_node.cpp +++ b/examples/apis/node_value_converter/to_node.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_node_value_converter_to_node.output b/examples/apis/node_value_converter/to_node.output similarity index 100% rename from docs/examples/ex_node_value_converter_to_node.output rename to examples/apis/node_value_converter/to_node.output diff --git a/examples/apis/operator_literal_yaml/CMakeLists.txt b/examples/apis/operator_literal_yaml/CMakeLists.txt new file mode 100644 index 00000000..e7176246 --- /dev/null +++ b/examples/apis/operator_literal_yaml/CMakeLists.txt @@ -0,0 +1,16 @@ +file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +foreach(EX_SRC_FILE ${EX_SRC_FILES}) + file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) + string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) + add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) + target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + + add_custom_command( + TARGET ${EX_SRC_FILE_BASE} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ + ) +endforeach() diff --git a/docs/examples/ex_operator_literal_yaml.cpp b/examples/apis/operator_literal_yaml/operator_literal_yaml.cpp similarity index 93% rename from docs/examples/ex_operator_literal_yaml.cpp rename to examples/apis/operator_literal_yaml/operator_literal_yaml.cpp index 083ec285..0819df62 100644 --- a/docs/examples/ex_operator_literal_yaml.cpp +++ b/examples/apis/operator_literal_yaml/operator_literal_yaml.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_operator_literal_yaml.output b/examples/apis/operator_literal_yaml/operator_literal_yaml.output similarity index 100% rename from docs/examples/ex_operator_literal_yaml.output rename to examples/apis/operator_literal_yaml/operator_literal_yaml.output diff --git a/examples/apis/ordered_map/CMakeLists.txt b/examples/apis/ordered_map/CMakeLists.txt new file mode 100644 index 00000000..e7176246 --- /dev/null +++ b/examples/apis/ordered_map/CMakeLists.txt @@ -0,0 +1,16 @@ +file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +foreach(EX_SRC_FILE ${EX_SRC_FILES}) + file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) + string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) + add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) + target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + + add_custom_command( + TARGET ${EX_SRC_FILE_BASE} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ + ) +endforeach() diff --git a/docs/examples/ex_ordered_map_at.cpp b/examples/apis/ordered_map/at.cpp similarity index 92% rename from docs/examples/ex_ordered_map_at.cpp rename to examples/apis/ordered_map/at.cpp index 19fddaef..e32a60ea 100644 --- a/docs/examples/ex_ordered_map_at.cpp +++ b/examples/apis/ordered_map/at.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_ordered_map_at.output b/examples/apis/ordered_map/at.output similarity index 100% rename from docs/examples/ex_ordered_map_at.output rename to examples/apis/ordered_map/at.output diff --git a/docs/examples/ex_ordered_map_constructor_initializer_list.cpp b/examples/apis/ordered_map/constructor_initializer_list.cpp similarity index 90% rename from docs/examples/ex_ordered_map_constructor_initializer_list.cpp rename to examples/apis/ordered_map/constructor_initializer_list.cpp index fb66f29f..e6ee9eef 100644 --- a/docs/examples/ex_ordered_map_constructor_initializer_list.cpp +++ b/examples/apis/ordered_map/constructor_initializer_list.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_ordered_map_constructor_initializer_list.output b/examples/apis/ordered_map/constructor_initializer_list.output similarity index 100% rename from docs/examples/ex_ordered_map_constructor_initializer_list.output rename to examples/apis/ordered_map/constructor_initializer_list.output diff --git a/docs/examples/ex_ordered_map_constructor_noarg.cpp b/examples/apis/ordered_map/constructor_noarg.cpp similarity index 89% rename from docs/examples/ex_ordered_map_constructor_noarg.cpp rename to examples/apis/ordered_map/constructor_noarg.cpp index 3af1a41d..6a39da76 100644 --- a/docs/examples/ex_ordered_map_constructor_noarg.cpp +++ b/examples/apis/ordered_map/constructor_noarg.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_ordered_map_constructor_noarg.output b/examples/apis/ordered_map/constructor_noarg.output similarity index 100% rename from docs/examples/ex_ordered_map_constructor_noarg.output rename to examples/apis/ordered_map/constructor_noarg.output diff --git a/docs/examples/ex_ordered_map_emplace.cpp b/examples/apis/ordered_map/emplace.cpp similarity index 93% rename from docs/examples/ex_ordered_map_emplace.cpp rename to examples/apis/ordered_map/emplace.cpp index 930c0ef7..6df0a085 100644 --- a/docs/examples/ex_ordered_map_emplace.cpp +++ b/examples/apis/ordered_map/emplace.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_ordered_map_emplace.output b/examples/apis/ordered_map/emplace.output similarity index 100% rename from docs/examples/ex_ordered_map_emplace.output rename to examples/apis/ordered_map/emplace.output diff --git a/docs/examples/ex_ordered_map_find.cpp b/examples/apis/ordered_map/find.cpp similarity index 93% rename from docs/examples/ex_ordered_map_find.cpp rename to examples/apis/ordered_map/find.cpp index 01de8a8f..761115ba 100644 --- a/docs/examples/ex_ordered_map_find.cpp +++ b/examples/apis/ordered_map/find.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_ordered_map_find.output b/examples/apis/ordered_map/find.output similarity index 100% rename from docs/examples/ex_ordered_map_find.output rename to examples/apis/ordered_map/find.output diff --git a/docs/examples/ex_ordered_map_subscript_operator.cpp b/examples/apis/ordered_map/subscript_operator.cpp similarity index 92% rename from docs/examples/ex_ordered_map_subscript_operator.cpp rename to examples/apis/ordered_map/subscript_operator.cpp index 7a6932e6..d6ba97e7 100644 --- a/docs/examples/ex_ordered_map_subscript_operator.cpp +++ b/examples/apis/ordered_map/subscript_operator.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_ordered_map_subscript_operator.output b/examples/apis/ordered_map/subscript_operator.output similarity index 100% rename from docs/examples/ex_ordered_map_subscript_operator.output rename to examples/apis/ordered_map/subscript_operator.output diff --git a/examples/apis/yaml_version_type/CMakeLists.txt b/examples/apis/yaml_version_type/CMakeLists.txt new file mode 100644 index 00000000..e7176246 --- /dev/null +++ b/examples/apis/yaml_version_type/CMakeLists.txt @@ -0,0 +1,16 @@ +file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +foreach(EX_SRC_FILE ${EX_SRC_FILES}) + file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) + string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) + add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) + target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + + add_custom_command( + TARGET ${EX_SRC_FILE_BASE} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ + ) +endforeach() diff --git a/docs/examples/ex_yaml_version_type.cpp b/examples/apis/yaml_version_type/yaml_version_type.cpp similarity index 94% rename from docs/examples/ex_yaml_version_type.cpp rename to examples/apis/yaml_version_type/yaml_version_type.cpp index 0458b783..a119ac75 100644 --- a/docs/examples/ex_yaml_version_type.cpp +++ b/examples/apis/yaml_version_type/yaml_version_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/ex_yaml_version_type.output b/examples/apis/yaml_version_type/yaml_version_type.output similarity index 100% rename from docs/examples/ex_yaml_version_type.output rename to examples/apis/yaml_version_type/yaml_version_type.output diff --git a/examples/tutorials/CMakeLists.txt b/examples/tutorials/CMakeLists.txt new file mode 100644 index 00000000..d7f7436e --- /dev/null +++ b/examples/tutorials/CMakeLists.txt @@ -0,0 +1,15 @@ +file(GLOB_RECURSE TUT_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +foreach(TUT_SRC_FILE ${TUT_SRC_FILES}) + file(RELATIVE_PATH REL_TUT_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${TUT_SRC_FILE}) + string(REPLACE ".cpp" "" TUT_SRC_FILE_BASE ${REL_TUT_SRC_FILE}) + add_executable(${TUT_SRC_FILE_BASE} ${TUT_SRC_FILE}) + target_link_libraries(${TUT_SRC_FILE_BASE} example_common_config) + + add_custom_command( + TARGET ${TUT_SRC_FILE_BASE} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/example.yaml $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${TUT_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ + ) +endforeach() diff --git a/docs/examples/example.yaml b/examples/tutorials/example.yaml similarity index 100% rename from docs/examples/example.yaml rename to examples/tutorials/example.yaml diff --git a/docs/examples/tutorial_1.cpp b/examples/tutorials/tutorial_1.cpp similarity index 92% rename from docs/examples/tutorial_1.cpp rename to examples/tutorials/tutorial_1.cpp index 2ec3200f..61ba085f 100644 --- a/docs/examples/tutorial_1.cpp +++ b/examples/tutorials/tutorial_1.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/tutorial_1.output b/examples/tutorials/tutorial_1.output similarity index 100% rename from docs/examples/tutorial_1.output rename to examples/tutorials/tutorial_1.output diff --git a/docs/examples/tutorial_2.cpp b/examples/tutorials/tutorial_2.cpp similarity index 93% rename from docs/examples/tutorial_2.cpp rename to examples/tutorials/tutorial_2.cpp index d03e5492..7bd21408 100644 --- a/docs/examples/tutorial_2.cpp +++ b/examples/tutorials/tutorial_2.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/tutorial_2.output b/examples/tutorials/tutorial_2.output similarity index 100% rename from docs/examples/tutorial_2.output rename to examples/tutorials/tutorial_2.output diff --git a/docs/examples/tutorial_3.cpp b/examples/tutorials/tutorial_3.cpp similarity index 95% rename from docs/examples/tutorial_3.cpp rename to examples/tutorials/tutorial_3.cpp index e4a7e812..f6e139ab 100644 --- a/docs/examples/tutorial_3.cpp +++ b/examples/tutorials/tutorial_3.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/tutorial_3.output b/examples/tutorials/tutorial_3.output similarity index 100% rename from docs/examples/tutorial_3.output rename to examples/tutorials/tutorial_3.output diff --git a/docs/examples/tutorial_4.cpp b/examples/tutorials/tutorial_4.cpp similarity index 97% rename from docs/examples/tutorial_4.cpp rename to examples/tutorials/tutorial_4.cpp index 38bf730a..5b6bf6f0 100644 --- a/docs/examples/tutorial_4.cpp +++ b/examples/tutorials/tutorial_4.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/docs/examples/tutorial_4.output b/examples/tutorials/tutorial_4.output similarity index 100% rename from docs/examples/tutorial_4.output rename to examples/tutorials/tutorial_4.output diff --git a/include/fkYAML/detail/assert.hpp b/include/fkYAML/detail/assert.hpp index d439d5b8..cb7f7096 100644 --- a/include/fkYAML/detail/assert.hpp +++ b/include/fkYAML/detail/assert.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ASSERT_HPP diff --git a/include/fkYAML/detail/conversions/from_node.hpp b/include/fkYAML/detail/conversions/from_node.hpp index 808f6cae..3a017005 100644 --- a/include/fkYAML/detail/conversions/from_node.hpp +++ b/include/fkYAML/detail/conversions/from_node.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_CONVERSIONS_FROM_NODE_HPP diff --git a/include/fkYAML/detail/conversions/scalar_conv.hpp b/include/fkYAML/detail/conversions/scalar_conv.hpp index e694c671..539f21c0 100644 --- a/include/fkYAML/detail/conversions/scalar_conv.hpp +++ b/include/fkYAML/detail/conversions/scalar_conv.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT // **NOTE FOR LIBARARY DEVELOPERS**: diff --git a/include/fkYAML/detail/conversions/to_node.hpp b/include/fkYAML/detail/conversions/to_node.hpp index 9ff2aa1b..b6200a2b 100644 --- a/include/fkYAML/detail/conversions/to_node.hpp +++ b/include/fkYAML/detail/conversions/to_node.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_CONVERSIONS_TO_NODE_HPP diff --git a/include/fkYAML/detail/conversions/to_string.hpp b/include/fkYAML/detail/conversions/to_string.hpp index 4aa0eaf0..f1300251 100644 --- a/include/fkYAML/detail/conversions/to_string.hpp +++ b/include/fkYAML/detail/conversions/to_string.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_CONVERSIONS_TO_STRING_HPP diff --git a/include/fkYAML/detail/document_metainfo.hpp b/include/fkYAML/detail/document_metainfo.hpp index 5f25a4a7..3d2f55d7 100644 --- a/include/fkYAML/detail/document_metainfo.hpp +++ b/include/fkYAML/detail/document_metainfo.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_DOCUMENT_METAINFO_HPP diff --git a/include/fkYAML/detail/encodings/uri_encoding.hpp b/include/fkYAML/detail/encodings/uri_encoding.hpp index d70485fa..f31fc4e3 100644 --- a/include/fkYAML/detail/encodings/uri_encoding.hpp +++ b/include/fkYAML/detail/encodings/uri_encoding.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ENCODINGS_URI_ENCODING_HPP diff --git a/include/fkYAML/detail/encodings/utf_encode_detector.hpp b/include/fkYAML/detail/encodings/utf_encode_detector.hpp index 1b75d068..9a413d29 100644 --- a/include/fkYAML/detail/encodings/utf_encode_detector.hpp +++ b/include/fkYAML/detail/encodings/utf_encode_detector.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ENCODINGS_UTF_ENCODE_DETECTOR_HPP diff --git a/include/fkYAML/detail/encodings/utf_encode_t.hpp b/include/fkYAML/detail/encodings/utf_encode_t.hpp index ac753490..44ee1152 100644 --- a/include/fkYAML/detail/encodings/utf_encode_t.hpp +++ b/include/fkYAML/detail/encodings/utf_encode_t.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ENCODINGS_UTF_ENCODE_T_HPP diff --git a/include/fkYAML/detail/encodings/utf_encodings.hpp b/include/fkYAML/detail/encodings/utf_encodings.hpp index ee33944f..356e756d 100644 --- a/include/fkYAML/detail/encodings/utf_encodings.hpp +++ b/include/fkYAML/detail/encodings/utf_encodings.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ENCODINGS_UTF_ENCODINGS_HPP diff --git a/include/fkYAML/detail/encodings/yaml_escaper.hpp b/include/fkYAML/detail/encodings/yaml_escaper.hpp index 9cbbd50d..58b2c720 100644 --- a/include/fkYAML/detail/encodings/yaml_escaper.hpp +++ b/include/fkYAML/detail/encodings/yaml_escaper.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ENCODINGS_YAML_ESCAPER_HPP diff --git a/include/fkYAML/detail/input/block_scalar_header.hpp b/include/fkYAML/detail/input/block_scalar_header.hpp index cbead4a1..c51aa70a 100644 --- a/include/fkYAML/detail/input/block_scalar_header.hpp +++ b/include/fkYAML/detail/input/block_scalar_header.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_BLOCK_SCALAR_HEADER_HPP diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index 4b0aea13..b6663e1a 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_DESERIALIZER_HPP diff --git a/include/fkYAML/detail/input/input_adapter.hpp b/include/fkYAML/detail/input/input_adapter.hpp index 58c447d7..be951f01 100644 --- a/include/fkYAML/detail/input/input_adapter.hpp +++ b/include/fkYAML/detail/input/input_adapter.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_INPUT_ADAPTER_HPP diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index 20ea8949..d199e412 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_LEXICAL_ANALYZER_HPP diff --git a/include/fkYAML/detail/input/position_tracker.hpp b/include/fkYAML/detail/input/position_tracker.hpp index 1424600a..3194bdee 100644 --- a/include/fkYAML/detail/input/position_tracker.hpp +++ b/include/fkYAML/detail/input/position_tracker.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_POSITION_TRACKER_HPP diff --git a/include/fkYAML/detail/input/scalar_parser.hpp b/include/fkYAML/detail/input/scalar_parser.hpp index 92cb905b..d63859f3 100644 --- a/include/fkYAML/detail/input/scalar_parser.hpp +++ b/include/fkYAML/detail/input/scalar_parser.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_SCALAR_PARSER_HPP diff --git a/include/fkYAML/detail/input/scalar_scanner.hpp b/include/fkYAML/detail/input/scalar_scanner.hpp index 2c2992bb..821b31ca 100644 --- a/include/fkYAML/detail/input/scalar_scanner.hpp +++ b/include/fkYAML/detail/input/scalar_scanner.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_SCALAR_SCANNER_HPP diff --git a/include/fkYAML/detail/input/tag_resolver.hpp b/include/fkYAML/detail/input/tag_resolver.hpp index 3ced8054..77ee3441 100644 --- a/include/fkYAML/detail/input/tag_resolver.hpp +++ b/include/fkYAML/detail/input/tag_resolver.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_TAG_RESOLVER_HPP diff --git a/include/fkYAML/detail/input/tag_t.hpp b/include/fkYAML/detail/input/tag_t.hpp index 5a155f95..d1b11c36 100644 --- a/include/fkYAML/detail/input/tag_t.hpp +++ b/include/fkYAML/detail/input/tag_t.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_TAG_T_HPP diff --git a/include/fkYAML/detail/iterator.hpp b/include/fkYAML/detail/iterator.hpp index 4da676b2..b527752c 100644 --- a/include/fkYAML/detail/iterator.hpp +++ b/include/fkYAML/detail/iterator.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ITERATOR_HPP diff --git a/include/fkYAML/detail/macros/cpp_config_macros.hpp b/include/fkYAML/detail/macros/cpp_config_macros.hpp index 3706019f..734a2e7a 100644 --- a/include/fkYAML/detail/macros/cpp_config_macros.hpp +++ b/include/fkYAML/detail/macros/cpp_config_macros.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_MACROS_CPP_CONFIG_MACROS_HPP diff --git a/include/fkYAML/detail/macros/define_macros.hpp b/include/fkYAML/detail/macros/define_macros.hpp index dc5e7316..f870adfb 100644 --- a/include/fkYAML/detail/macros/define_macros.hpp +++ b/include/fkYAML/detail/macros/define_macros.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_MACROS_DEFINE_MACROS_HPP diff --git a/include/fkYAML/detail/macros/version_macros.hpp b/include/fkYAML/detail/macros/version_macros.hpp index 5e5b9481..c2d28b34 100644 --- a/include/fkYAML/detail/macros/version_macros.hpp +++ b/include/fkYAML/detail/macros/version_macros.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT // Check version definitions if already defined. diff --git a/include/fkYAML/detail/meta/detect.hpp b/include/fkYAML/detail/meta/detect.hpp index b70f145e..723e9803 100644 --- a/include/fkYAML/detail/meta/detect.hpp +++ b/include/fkYAML/detail/meta/detect.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_META_DETECT_HPP diff --git a/include/fkYAML/detail/meta/input_adapter_traits.hpp b/include/fkYAML/detail/meta/input_adapter_traits.hpp index 28f6c102..b1a36998 100644 --- a/include/fkYAML/detail/meta/input_adapter_traits.hpp +++ b/include/fkYAML/detail/meta/input_adapter_traits.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_META_INPUT_ADAPTER_TRAITS_HPP diff --git a/include/fkYAML/detail/meta/node_traits.hpp b/include/fkYAML/detail/meta/node_traits.hpp index e07e2e4d..9baa2da7 100644 --- a/include/fkYAML/detail/meta/node_traits.hpp +++ b/include/fkYAML/detail/meta/node_traits.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_META_NODE_TRAITS_HPP diff --git a/include/fkYAML/detail/meta/stl_supplement.hpp b/include/fkYAML/detail/meta/stl_supplement.hpp index 42f8598d..14eb60e6 100644 --- a/include/fkYAML/detail/meta/stl_supplement.hpp +++ b/include/fkYAML/detail/meta/stl_supplement.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_META_STL_SUPPLEMENT_HPP diff --git a/include/fkYAML/detail/meta/type_traits.hpp b/include/fkYAML/detail/meta/type_traits.hpp index 8b223308..d474fc47 100644 --- a/include/fkYAML/detail/meta/type_traits.hpp +++ b/include/fkYAML/detail/meta/type_traits.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_META_TYPE_TRAITS_HPP diff --git a/include/fkYAML/detail/node_attrs.hpp b/include/fkYAML/detail/node_attrs.hpp index f2b350f5..ed1f2f61 100644 --- a/include/fkYAML/detail/node_attrs.hpp +++ b/include/fkYAML/detail/node_attrs.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_NODE_ATTRS_HPP diff --git a/include/fkYAML/detail/node_property.hpp b/include/fkYAML/detail/node_property.hpp index 6b448b71..2d1a1951 100644 --- a/include/fkYAML/detail/node_property.hpp +++ b/include/fkYAML/detail/node_property.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_NODE_PROPERTY_HPP diff --git a/include/fkYAML/detail/node_ref_storage.hpp b/include/fkYAML/detail/node_ref_storage.hpp index 66350ee8..aa0f8c0d 100644 --- a/include/fkYAML/detail/node_ref_storage.hpp +++ b/include/fkYAML/detail/node_ref_storage.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_NODE_REF_STORAGE_HPP diff --git a/include/fkYAML/detail/output/serializer.hpp b/include/fkYAML/detail/output/serializer.hpp index 4b795d81..d79c46d5 100644 --- a/include/fkYAML/detail/output/serializer.hpp +++ b/include/fkYAML/detail/output/serializer.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_OUTPUT_SERIALIZER_HPP diff --git a/include/fkYAML/detail/reverse_iterator.hpp b/include/fkYAML/detail/reverse_iterator.hpp index 5eeb5a25..ccd2db5a 100644 --- a/include/fkYAML/detail/reverse_iterator.hpp +++ b/include/fkYAML/detail/reverse_iterator.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_REVERSE_ITERATOR_HPP diff --git a/include/fkYAML/detail/str_view.hpp b/include/fkYAML/detail/str_view.hpp index 41bd8455..ac25e0f5 100644 --- a/include/fkYAML/detail/str_view.hpp +++ b/include/fkYAML/detail/str_view.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_STR_VIEW_HPP diff --git a/include/fkYAML/detail/string_formatter.hpp b/include/fkYAML/detail/string_formatter.hpp index 5ca5099a..914332f3 100644 --- a/include/fkYAML/detail/string_formatter.hpp +++ b/include/fkYAML/detail/string_formatter.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_STRING_FORMATTER_HPP diff --git a/include/fkYAML/detail/types/lexical_token_t.hpp b/include/fkYAML/detail/types/lexical_token_t.hpp index 0fa6d555..2cd8f7be 100644 --- a/include/fkYAML/detail/types/lexical_token_t.hpp +++ b/include/fkYAML/detail/types/lexical_token_t.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_TYPES_LEXICAL_TOKEN_T_HPP diff --git a/include/fkYAML/detail/types/node_t.hpp b/include/fkYAML/detail/types/node_t.hpp index 301d5719..fe13d2f8 100644 --- a/include/fkYAML/detail/types/node_t.hpp +++ b/include/fkYAML/detail/types/node_t.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_TYPES_NODE_T_HPP diff --git a/include/fkYAML/detail/types/yaml_version_t.hpp b/include/fkYAML/detail/types/yaml_version_t.hpp index ea7f590d..e4961b98 100644 --- a/include/fkYAML/detail/types/yaml_version_t.hpp +++ b/include/fkYAML/detail/types/yaml_version_t.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_TYPES_YAML_VERSION_T_HPP diff --git a/include/fkYAML/exception.hpp b/include/fkYAML/exception.hpp index f3b353a7..96657da1 100644 --- a/include/fkYAML/exception.hpp +++ b/include/fkYAML/exception.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_EXCEPTION_HPP diff --git a/include/fkYAML/fkyaml_fwd.hpp b/include/fkYAML/fkyaml_fwd.hpp index 863f089b..3414dea6 100644 --- a/include/fkYAML/fkyaml_fwd.hpp +++ b/include/fkYAML/fkyaml_fwd.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_FKYAML_FWD_HPP diff --git a/include/fkYAML/node.hpp b/include/fkYAML/node.hpp index 53744541..969ea392 100644 --- a/include/fkYAML/node.hpp +++ b/include/fkYAML/node.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_NODE_HPP diff --git a/include/fkYAML/node_type.hpp b/include/fkYAML/node_type.hpp index d2e42964..2a974c41 100644 --- a/include/fkYAML/node_type.hpp +++ b/include/fkYAML/node_type.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_NODE_TYPE_HPP diff --git a/include/fkYAML/node_value_converter.hpp b/include/fkYAML/node_value_converter.hpp index 69e33386..99d26102 100644 --- a/include/fkYAML/node_value_converter.hpp +++ b/include/fkYAML/node_value_converter.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_NODE_VALUE_CONVERTER_HPP diff --git a/include/fkYAML/ordered_map.hpp b/include/fkYAML/ordered_map.hpp index ccf1c936..dd29854d 100644 --- a/include/fkYAML/ordered_map.hpp +++ b/include/fkYAML/ordered_map.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_ORDERED_MAP_HPP diff --git a/include/fkYAML/yaml_version_type.hpp b/include/fkYAML/yaml_version_type.hpp index e5817f03..4fc1f5ad 100644 --- a/include/fkYAML/yaml_version_type.hpp +++ b/include/fkYAML/yaml_version_type.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_YAML_VERSION_TYPE_HPP diff --git a/scripts/run_amalgamation.bat b/scripts/run_amalgamation.bat index 26752a15..93119a64 100644 --- a/scripts/run_amalgamation.bat +++ b/scripts/run_amalgamation.bat @@ -4,11 +4,11 @@ setlocal set CALLER_DIR=%cd% set SCRIPT_PATH=%~dp0 -set AMALGAMATION_TOOL_DIR=%SCRIPT_PATH%\..\tool\amalgamation +set AMALGAMATION_TOOLS_DIR=%SCRIPT_PATH%\..\tools\amalgamation cd %SCRIPT_PATH%\.. -python %AMALGAMATION_TOOL_DIR%\amalgamate.py -c %AMALGAMATION_TOOL_DIR%\node_hpp.json -s . --verbose=yes -python %AMALGAMATION_TOOL_DIR%\amalgamate.py -c %AMALGAMATION_TOOL_DIR%\fkyaml_fwd_hpp.json -s . --verbose=yes +python %AMALGAMATION_TOOLS_DIR%\amalgamate.py -c %AMALGAMATION_TOOLS_DIR%\node_hpp.json -s . --verbose=yes +python %AMALGAMATION_TOOLS_DIR%\amalgamate.py -c %AMALGAMATION_TOOLS_DIR%\fkyaml_fwd_hpp.json -s . --verbose=yes if %errorlevel% == 0 ( echo Amalgamation succeeded! diff --git a/scripts/run_amalgamation.sh b/scripts/run_amalgamation.sh index 85a9395b..15bdfc40 100755 --- a/scripts/run_amalgamation.sh +++ b/scripts/run_amalgamation.sh @@ -13,6 +13,6 @@ else fi ROOT_DIR="$(dirname "$0")"/.. -AMALGAMATION_TOOL_DIR="$ROOT_DIR/tool/amalgamation" -"$PYTHON_EXE" "$AMALGAMATION_TOOL_DIR"/amalgamate.py -c "$AMALGAMATION_TOOL_DIR"/node_hpp.json -s . --verbose=yes -"$PYTHON_EXE" "$AMALGAMATION_TOOL_DIR"/amalgamate.py -c "$AMALGAMATION_TOOL_DIR"/fkyaml_fwd_hpp.json -s . --verbose=yes +AMALGAMATION_TOOLS_DIR="$ROOT_DIR/tools/amalgamation" +"$PYTHON_EXE" "$AMALGAMATION_TOOLS_DIR"/amalgamate.py -c "$AMALGAMATION_TOOLS_DIR"/node_hpp.json -s . --verbose=yes +"$PYTHON_EXE" "$AMALGAMATION_TOOLS_DIR"/amalgamate.py -c "$AMALGAMATION_TOOLS_DIR"/fkyaml_fwd_hpp.json -s . --verbose=yes diff --git a/scripts/run_clang_format.bat b/scripts/run_clang_format.bat index 02544c0f..fed3e580 100644 --- a/scripts/run_clang_format.bat +++ b/scripts/run_clang_format.bat @@ -17,15 +17,15 @@ for /r %ROOT_PATH%\include %%f in (*.hpp) do ( .\venv_clang_format\Scripts\clang-format.exe %%f -i ) -for /r %ROOT_PATH%\test %%f in (*.cpp) do ( +for /r %ROOT_PATH%\tests %%f in (*.cpp) do ( .\venv_clang_format\Scripts\clang-format.exe %%f -i ) -for /r %ROOT_PATH%\docs\examples %%f in (*.cpp) do ( +for /r %ROOT_PATH%\examples %%f in (*.cpp) do ( .\venv_clang_format\Scripts\clang-format.exe %%f -i ) -for /r %ROOT_PATH%\tool\benchmark %%f in (*.cpp) do ( +for /r %ROOT_PATH%\tools\benchmark %%f in (*.cpp) do ( .\venv_clang_format\Scripts\clang-format.exe %%f -i ) diff --git a/scripts/run_clang_format.sh b/scripts/run_clang_format.sh index 0969fa98..72786e2c 100755 --- a/scripts/run_clang_format.sh +++ b/scripts/run_clang_format.sh @@ -23,6 +23,6 @@ if [ ! -e "$SCRIPT_DIR"/venv_clang_format/"$VENV_BINARY_DIR"/clang-format ]; the "$SCRIPT_DIR"/venv_clang_format/"$VENV_BINARY_DIR"/pip install clang-format==18.1.3 fi -for f in $(find "$ROOT_DIR/include" "$ROOT_DIR/test" "$ROOT_DIR/docs/examples" "$ROOT_DIR/tool/benchmark" -type f -name "*.hpp" -o -name "*.cpp" | sort); do +for f in $(find "$ROOT_DIR/include" "$ROOT_DIR/tests" "$ROOT_DIR/examples" "$ROOT_DIR/tools/benchmark" -type f -name "*.hpp" -o -name "*.cpp" | sort); do "$SCRIPT_DIR"/venv_clang_format/"$VENV_BINARY_DIR"/clang-format "$f" -i done diff --git a/single_include/fkYAML/fkyaml_fwd.hpp b/single_include/fkYAML/fkyaml_fwd.hpp index 3565407f..d35cf9ce 100644 --- a/single_include/fkYAML/fkyaml_fwd.hpp +++ b/single_include/fkYAML/fkyaml_fwd.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_FKYAML_FWD_HPP @@ -20,7 +20,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT // Check version definitions if already defined. diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 58506df1..5bd01db5 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_NODE_HPP @@ -25,7 +25,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_MACROS_DEFINE_MACROS_HPP @@ -37,7 +37,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT // Check version definitions if already defined. @@ -87,7 +87,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_MACROS_CPP_CONFIG_MACROS_HPP @@ -246,7 +246,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ASSERT_HPP @@ -270,7 +270,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_DOCUMENT_METAINFO_HPP @@ -287,7 +287,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_META_NODE_TRAITS_HPP @@ -301,7 +301,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_META_DETECT_HPP @@ -318,7 +318,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_META_STL_SUPPLEMENT_HPP @@ -770,7 +770,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_META_TYPE_TRAITS_HPP @@ -940,7 +940,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_FKYAML_FWD_HPP @@ -1130,7 +1130,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_YAML_VERSION_TYPE_HPP @@ -1195,7 +1195,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_DESERIALIZER_HPP @@ -1215,7 +1215,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_LEXICAL_ANALYZER_HPP @@ -1235,7 +1235,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ENCODINGS_URI_ENCODING_HPP @@ -1363,7 +1363,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ENCODINGS_UTF_ENCODINGS_HPP @@ -1380,7 +1380,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_EXCEPTION_HPP @@ -1399,7 +1399,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_STRING_FORMATTER_HPP @@ -1449,7 +1449,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_TYPES_NODE_T_HPP @@ -1465,7 +1465,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_NODE_TYPE_HPP @@ -2053,7 +2053,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_BLOCK_SCALAR_HEADER_HPP @@ -2091,7 +2091,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_POSITION_TRACKER_HPP @@ -2107,7 +2107,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_STR_VIEW_HPP @@ -3172,7 +3172,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_TYPES_LEXICAL_TOKEN_T_HPP @@ -4412,7 +4412,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_SCALAR_PARSER_HPP @@ -4428,7 +4428,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT // **NOTE FOR LIBARARY DEVELOPERS**: @@ -5268,7 +5268,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ENCODINGS_YAML_ESCAPER_HPP @@ -5622,7 +5622,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_SCALAR_SCANNER_HPP @@ -5958,7 +5958,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_TAG_T_HPP @@ -6565,7 +6565,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_TAG_RESOLVER_HPP @@ -6750,7 +6750,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_META_INPUT_ADAPTER_TRAITS_HPP @@ -6863,7 +6863,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_NODE_ATTRS_HPP @@ -7004,7 +7004,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_NODE_PROPERTY_HPP @@ -8347,7 +8347,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_INPUT_INPUT_ADAPTER_HPP @@ -8370,7 +8370,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ENCODINGS_UTF_ENCODE_DETECTOR_HPP @@ -8387,7 +8387,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ENCODINGS_UTF_ENCODE_T_HPP @@ -9789,7 +9789,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_ITERATOR_HPP @@ -10181,7 +10181,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_NODE_REF_STORAGE_HPP @@ -10274,7 +10274,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_OUTPUT_SERIALIZER_HPP @@ -10293,7 +10293,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_CONVERSIONS_TO_STRING_HPP @@ -10734,7 +10734,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_REVERSE_ITERATOR_HPP @@ -10950,7 +10950,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_TYPES_YAML_VERSION_T_HPP @@ -11005,7 +11005,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_NODE_VALUE_CONVERTER_HPP @@ -11021,7 +11021,7 @@ FK_YAML_DETAIL_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_CONVERSIONS_FROM_NODE_HPP @@ -11707,7 +11707,7 @@ FK_YAML_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_DETAIL_CONVERSIONS_TO_NODE_HPP @@ -12094,7 +12094,7 @@ FK_YAML_NAMESPACE_END // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifndef FK_YAML_ORDERED_MAP_HPP diff --git a/test/CMakeLists.txt b/tests/CMakeLists.txt similarity index 100% rename from test/CMakeLists.txt rename to tests/CMakeLists.txt diff --git a/test/cmake_add_subdirectory_test/CMakeLists.txt b/tests/cmake_add_subdirectory_test/CMakeLists.txt similarity index 100% rename from test/cmake_add_subdirectory_test/CMakeLists.txt rename to tests/cmake_add_subdirectory_test/CMakeLists.txt diff --git a/test/cmake_add_subdirectory_test/project/CMakeLists.txt b/tests/cmake_add_subdirectory_test/project/CMakeLists.txt similarity index 100% rename from test/cmake_add_subdirectory_test/project/CMakeLists.txt rename to tests/cmake_add_subdirectory_test/project/CMakeLists.txt diff --git a/test/cmake_fetch_content_test/project/main.cpp b/tests/cmake_add_subdirectory_test/project/main.cpp similarity index 90% rename from test/cmake_fetch_content_test/project/main.cpp rename to tests/cmake_add_subdirectory_test/project/main.cpp index 25e7d96a..e047cd1d 100644 --- a/test/cmake_fetch_content_test/project/main.cpp +++ b/tests/cmake_add_subdirectory_test/project/main.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/cmake_fetch_content_test/CMakeLists.txt b/tests/cmake_fetch_content_test/CMakeLists.txt similarity index 100% rename from test/cmake_fetch_content_test/CMakeLists.txt rename to tests/cmake_fetch_content_test/CMakeLists.txt diff --git a/test/cmake_fetch_content_test/project/CMakeLists.txt b/tests/cmake_fetch_content_test/project/CMakeLists.txt similarity index 100% rename from test/cmake_fetch_content_test/project/CMakeLists.txt rename to tests/cmake_fetch_content_test/project/CMakeLists.txt diff --git a/test/cmake_find_package_test/project/main.cpp b/tests/cmake_fetch_content_test/project/main.cpp similarity index 90% rename from test/cmake_find_package_test/project/main.cpp rename to tests/cmake_fetch_content_test/project/main.cpp index 25e7d96a..e047cd1d 100644 --- a/test/cmake_find_package_test/project/main.cpp +++ b/tests/cmake_fetch_content_test/project/main.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/cmake_find_package_test/CMakeLists.txt b/tests/cmake_find_package_test/CMakeLists.txt similarity index 100% rename from test/cmake_find_package_test/CMakeLists.txt rename to tests/cmake_find_package_test/CMakeLists.txt diff --git a/test/cmake_find_package_test/project/CMakeLists.txt b/tests/cmake_find_package_test/project/CMakeLists.txt similarity index 100% rename from test/cmake_find_package_test/project/CMakeLists.txt rename to tests/cmake_find_package_test/project/CMakeLists.txt diff --git a/test/cmake_target_include_directories_test/project/main.cpp b/tests/cmake_find_package_test/project/main.cpp similarity index 90% rename from test/cmake_target_include_directories_test/project/main.cpp rename to tests/cmake_find_package_test/project/main.cpp index 25e7d96a..e047cd1d 100644 --- a/test/cmake_target_include_directories_test/project/main.cpp +++ b/tests/cmake_find_package_test/project/main.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/cmake_target_include_directories_test/CMakeLists.txt b/tests/cmake_target_include_directories_test/CMakeLists.txt similarity index 100% rename from test/cmake_target_include_directories_test/CMakeLists.txt rename to tests/cmake_target_include_directories_test/CMakeLists.txt diff --git a/test/cmake_target_include_directories_test/project/CMakeLists.txt b/tests/cmake_target_include_directories_test/project/CMakeLists.txt similarity index 100% rename from test/cmake_target_include_directories_test/project/CMakeLists.txt rename to tests/cmake_target_include_directories_test/project/CMakeLists.txt diff --git a/test/cmake_add_subdirectory_test/project/main.cpp b/tests/cmake_target_include_directories_test/project/main.cpp similarity index 90% rename from test/cmake_add_subdirectory_test/project/main.cpp rename to tests/cmake_target_include_directories_test/project/main.cpp index 25e7d96a..e047cd1d 100644 --- a/test/cmake_add_subdirectory_test/project/main.cpp +++ b/tests/cmake_target_include_directories_test/project/main.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/CMakeLists.txt b/tests/unit_test/CMakeLists.txt similarity index 99% rename from test/unit_test/CMakeLists.txt rename to tests/unit_test/CMakeLists.txt index 7ced66b8..efce1734 100644 --- a/test/unit_test/CMakeLists.txt +++ b/tests/unit_test/CMakeLists.txt @@ -269,7 +269,7 @@ if(FK_YAML_CODE_COVERAGE) add_custom_target( generate_test_coverage COMMAND ${CMAKE_CTEST_COMMAND} -C ${CMAKE_BUILD_TYPE} --output-on-failure - COMMAND cd ${PROJECT_BINARY_DIR}/test/unit_test/CMakeFiles/${TEST_TARGET}.dir + COMMAND cd ${PROJECT_BINARY_DIR}/tests/unit_test/CMakeFiles/${TEST_TARGET}.dir COMMAND ${LCOV_TOOL} --directory . --capture --output-file ${PROJECT_NAME}.info --rc lcov_branch_coverage=1 COMMAND ${LCOV_TOOL} -e ${PROJECT_NAME}.info ${SRC_FILES} --output-file ${PROJECT_NAME}.info.filtered --rc lcov_branch_coverage=1 COMMAND ${PROJECT_SOURCE_DIR}/thirdparty/imapdl/filterbr.py ${PROJECT_NAME}.info.filtered > ${PROJECT_NAME}.info.filtered.noexcept diff --git a/test/unit_test/main.cpp b/tests/unit_test/main.cpp similarity index 86% rename from test/unit_test/main.cpp rename to tests/unit_test/main.cpp index 2c5e10da..e5cb381a 100644 --- a/test/unit_test/main.cpp +++ b/tests/unit_test/main.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #define CATCH_CONFIG_MAIN diff --git a/test/unit_test/test_custom_from_node.cpp b/tests/unit_test/test_custom_from_node.cpp similarity index 98% rename from test/unit_test/test_custom_from_node.cpp rename to tests/unit_test/test_custom_from_node.cpp index 1970db62..a4942de0 100644 --- a/test/unit_test/test_custom_from_node.cpp +++ b/tests/unit_test/test_custom_from_node.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_data/extraction_operator_test_data.yml b/tests/unit_test/test_data/extraction_operator_test_data.yml similarity index 100% rename from test/unit_test/test_data/extraction_operator_test_data.yml rename to tests/unit_test/test_data/extraction_operator_test_data.yml diff --git a/test/unit_test/test_data/input_adapter_test_data.txt b/tests/unit_test/test_data/input_adapter_test_data.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data.txt rename to tests/unit_test/test_data/input_adapter_test_data.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf16be_crlf.txt b/tests/unit_test/test_data/input_adapter_test_data_utf16be_crlf.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf16be_crlf.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf16be_crlf.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf16bebom.txt b/tests/unit_test/test_data/input_adapter_test_data_utf16bebom.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf16bebom.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf16bebom.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf16ben.txt b/tests/unit_test/test_data/input_adapter_test_data_utf16ben.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf16ben.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf16ben.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf16lebom.txt b/tests/unit_test/test_data/input_adapter_test_data_utf16lebom.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf16lebom.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf16lebom.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf16len.txt b/tests/unit_test/test_data/input_adapter_test_data_utf16len.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf16len.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf16len.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf32be_crlf.txt b/tests/unit_test/test_data/input_adapter_test_data_utf32be_crlf.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf32be_crlf.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf32be_crlf.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf32bebom.txt b/tests/unit_test/test_data/input_adapter_test_data_utf32bebom.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf32bebom.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf32bebom.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf32ben.txt b/tests/unit_test/test_data/input_adapter_test_data_utf32ben.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf32ben.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf32ben.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf32lebom.txt b/tests/unit_test/test_data/input_adapter_test_data_utf32lebom.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf32lebom.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf32lebom.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf32len.txt b/tests/unit_test/test_data/input_adapter_test_data_utf32len.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf32len.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf32len.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8_crlf.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8_crlf.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8_crlf.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8_crlf.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8bom.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8bom.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8bom.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8bom.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8n.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8n.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8n.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8n.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8n_invalid_1byte_char.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8n_invalid_1byte_char.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8n_invalid_1byte_char.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8n_invalid_1byte_char.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8n_invalid_2byte_char.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8n_invalid_2byte_char.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8n_invalid_2byte_char.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8n_invalid_2byte_char.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8n_invalid_3byte_char.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8n_invalid_3byte_char.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8n_invalid_3byte_char.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8n_invalid_3byte_char.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8n_invalid_4byte_char.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8n_invalid_4byte_char.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8n_invalid_4byte_char.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8n_invalid_4byte_char.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8n_valid_1byte_char.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8n_valid_1byte_char.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8n_valid_1byte_char.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8n_valid_1byte_char.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8n_valid_2byte_char.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8n_valid_2byte_char.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8n_valid_2byte_char.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8n_valid_2byte_char.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8n_valid_3byte_char.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8n_valid_3byte_char.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8n_valid_3byte_char.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8n_valid_3byte_char.txt diff --git a/test/unit_test/test_data/input_adapter_test_data_utf8n_valid_4byte_char.txt b/tests/unit_test/test_data/input_adapter_test_data_utf8n_valid_4byte_char.txt similarity index 100% rename from test/unit_test/test_data/input_adapter_test_data_utf8n_valid_4byte_char.txt rename to tests/unit_test/test_data/input_adapter_test_data_utf8n_valid_4byte_char.txt diff --git a/test/unit_test/test_data/single_char_byte_input.txt b/tests/unit_test/test_data/single_char_byte_input.txt similarity index 100% rename from test/unit_test/test_data/single_char_byte_input.txt rename to tests/unit_test/test_data/single_char_byte_input.txt diff --git a/test/unit_test/test_deserializer_class.cpp b/tests/unit_test/test_deserializer_class.cpp similarity index 99% rename from test/unit_test/test_deserializer_class.cpp rename to tests/unit_test/test_deserializer_class.cpp index 88d565c5..3c3baae2 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/tests/unit_test/test_deserializer_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_exception_class.cpp b/tests/unit_test/test_exception_class.cpp similarity index 93% rename from test/unit_test/test_exception_class.cpp rename to tests/unit_test/test_exception_class.cpp index f8e46067..af9edb25 100644 --- a/test/unit_test/test_exception_class.cpp +++ b/tests/unit_test/test_exception_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_input_adapter.cpp b/tests/unit_test/test_input_adapter.cpp similarity index 99% rename from test/unit_test/test_input_adapter.cpp rename to tests/unit_test/test_input_adapter.cpp index 2a15f020..92c9516f 100644 --- a/test/unit_test/test_input_adapter.cpp +++ b/tests/unit_test/test_input_adapter.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_iterator_class.cpp b/tests/unit_test/test_iterator_class.cpp similarity index 99% rename from test/unit_test/test_iterator_class.cpp rename to tests/unit_test/test_iterator_class.cpp index 9ced0000..3325f2aa 100644 --- a/test/unit_test/test_iterator_class.cpp +++ b/tests/unit_test/test_iterator_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_lexical_analyzer_class.cpp b/tests/unit_test/test_lexical_analyzer_class.cpp similarity index 99% rename from test/unit_test/test_lexical_analyzer_class.cpp rename to tests/unit_test/test_lexical_analyzer_class.cpp index 9c2eb919..f473aea2 100644 --- a/test/unit_test/test_lexical_analyzer_class.cpp +++ b/tests/unit_test/test_lexical_analyzer_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_node_attrs.cpp b/tests/unit_test/test_node_attrs.cpp similarity index 97% rename from test/unit_test/test_node_attrs.cpp rename to tests/unit_test/test_node_attrs.cpp index dba783d0..eb66f219 100644 --- a/test/unit_test/test_node_attrs.cpp +++ b/tests/unit_test/test_node_attrs.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_node_class.cpp b/tests/unit_test/test_node_class.cpp similarity index 99% rename from test/unit_test/test_node_class.cpp rename to tests/unit_test/test_node_class.cpp index 258623f8..ec880d41 100644 --- a/test/unit_test/test_node_class.cpp +++ b/tests/unit_test/test_node_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_node_ref_storage_class.cpp b/tests/unit_test/test_node_ref_storage_class.cpp similarity index 97% rename from test/unit_test/test_node_ref_storage_class.cpp rename to tests/unit_test/test_node_ref_storage_class.cpp index f091ec0f..802539e3 100644 --- a/test/unit_test/test_node_ref_storage_class.cpp +++ b/tests/unit_test/test_node_ref_storage_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_node_type.cpp b/tests/unit_test/test_node_type.cpp similarity index 94% rename from test/unit_test/test_node_type.cpp rename to tests/unit_test/test_node_type.cpp index 1eb5058d..f9b749ad 100644 --- a/test/unit_test/test_node_type.cpp +++ b/tests/unit_test/test_node_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_ordered_map_class.cpp b/tests/unit_test/test_ordered_map_class.cpp similarity index 98% rename from test/unit_test/test_ordered_map_class.cpp rename to tests/unit_test/test_ordered_map_class.cpp index 51928e0f..9351a8e5 100644 --- a/test/unit_test/test_ordered_map_class.cpp +++ b/tests/unit_test/test_ordered_map_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_position_tracker_class.cpp b/tests/unit_test/test_position_tracker_class.cpp similarity index 98% rename from test/unit_test/test_position_tracker_class.cpp rename to tests/unit_test/test_position_tracker_class.cpp index 7ca3362c..91debaa8 100644 --- a/test/unit_test/test_position_tracker_class.cpp +++ b/tests/unit_test/test_position_tracker_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_reverse_iterator_class.cpp b/tests/unit_test/test_reverse_iterator_class.cpp similarity index 99% rename from test/unit_test/test_reverse_iterator_class.cpp rename to tests/unit_test/test_reverse_iterator_class.cpp index 25ab63f3..5f02b78b 100644 --- a/test/unit_test/test_reverse_iterator_class.cpp +++ b/tests/unit_test/test_reverse_iterator_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_scalar_conv.cpp b/tests/unit_test/test_scalar_conv.cpp similarity index 99% rename from test/unit_test/test_scalar_conv.cpp rename to tests/unit_test/test_scalar_conv.cpp index 18cd86e8..6ccfe7a3 100644 --- a/test/unit_test/test_scalar_conv.cpp +++ b/tests/unit_test/test_scalar_conv.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_scalar_parser_class.cpp b/tests/unit_test/test_scalar_parser_class.cpp similarity index 99% rename from test/unit_test/test_scalar_parser_class.cpp rename to tests/unit_test/test_scalar_parser_class.cpp index 369ecc43..a1a5a6ff 100644 --- a/test/unit_test/test_scalar_parser_class.cpp +++ b/tests/unit_test/test_scalar_parser_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_scalar_scanner_class.cpp b/tests/unit_test/test_scalar_scanner_class.cpp similarity index 98% rename from test/unit_test/test_scalar_scanner_class.cpp rename to tests/unit_test/test_scalar_scanner_class.cpp index 1a8a4386..3bca58cd 100644 --- a/test/unit_test/test_scalar_scanner_class.cpp +++ b/tests/unit_test/test_scalar_scanner_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_serializer_class.cpp b/tests/unit_test/test_serializer_class.cpp similarity index 99% rename from test/unit_test/test_serializer_class.cpp rename to tests/unit_test/test_serializer_class.cpp index b2cf8d5b..7af79193 100644 --- a/test/unit_test/test_serializer_class.cpp +++ b/tests/unit_test/test_serializer_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_str_view_class.cpp b/tests/unit_test/test_str_view_class.cpp similarity index 99% rename from test/unit_test/test_str_view_class.cpp rename to tests/unit_test/test_str_view_class.cpp index 54c53115..9b2d8b93 100644 --- a/test/unit_test/test_str_view_class.cpp +++ b/tests/unit_test/test_str_view_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_string_formatter.cpp b/tests/unit_test/test_string_formatter.cpp similarity index 90% rename from test/unit_test/test_string_formatter.cpp rename to tests/unit_test/test_string_formatter.cpp index 93ca5c41..f0ceeb9c 100644 --- a/test/unit_test/test_string_formatter.cpp +++ b/tests/unit_test/test_string_formatter.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_tag_resolver_class.cpp b/tests/unit_test/test_tag_resolver_class.cpp similarity index 98% rename from test/unit_test/test_tag_resolver_class.cpp rename to tests/unit_test/test_tag_resolver_class.cpp index 357ce8b3..0ce8aa8c 100644 --- a/test/unit_test/test_tag_resolver_class.cpp +++ b/tests/unit_test/test_tag_resolver_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_uri_encoding_class.cpp b/tests/unit_test/test_uri_encoding_class.cpp similarity index 97% rename from test/unit_test/test_uri_encoding_class.cpp rename to tests/unit_test/test_uri_encoding_class.cpp index 80c93839..cc6327f2 100644 --- a/test/unit_test/test_uri_encoding_class.cpp +++ b/tests/unit_test/test_uri_encoding_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_utf_encode_detector.cpp b/tests/unit_test/test_utf_encode_detector.cpp similarity index 99% rename from test/unit_test/test_utf_encode_detector.cpp rename to tests/unit_test/test_utf_encode_detector.cpp index bffbc6bf..a384f436 100644 --- a/test/unit_test/test_utf_encode_detector.cpp +++ b/tests/unit_test/test_utf_encode_detector.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_utf_encodings.cpp b/tests/unit_test/test_utf_encodings.cpp similarity index 99% rename from test/unit_test/test_utf_encodings.cpp rename to tests/unit_test/test_utf_encodings.cpp index 7a920a75..14607a9f 100644 --- a/test/unit_test/test_utf_encodings.cpp +++ b/tests/unit_test/test_utf_encodings.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_yaml_escaper_class.cpp b/tests/unit_test/test_yaml_escaper_class.cpp similarity index 98% rename from test/unit_test/test_yaml_escaper_class.cpp rename to tests/unit_test/test_yaml_escaper_class.cpp index a0772229..3e8a5969 100644 --- a/test/unit_test/test_yaml_escaper_class.cpp +++ b/tests/unit_test/test_yaml_escaper_class.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/test/unit_test/test_yaml_version_type.cpp b/tests/unit_test/test_yaml_version_type.cpp similarity index 92% rename from test/unit_test/test_yaml_version_type.cpp rename to tests/unit_test/test_yaml_version_type.cpp index cb706712..bcdffd50 100644 --- a/test/unit_test/test_yaml_version_type.cpp +++ b/tests/unit_test/test_yaml_version_type.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #include diff --git a/tool/amalgamation/CHANGES.md b/tools/amalgamation/CHANGES.md similarity index 100% rename from tool/amalgamation/CHANGES.md rename to tools/amalgamation/CHANGES.md diff --git a/tool/amalgamation/README.md b/tools/amalgamation/README.md similarity index 100% rename from tool/amalgamation/README.md rename to tools/amalgamation/README.md diff --git a/tool/amalgamation/amalgamate.py b/tools/amalgamation/amalgamate.py similarity index 100% rename from tool/amalgamation/amalgamate.py rename to tools/amalgamation/amalgamate.py diff --git a/tool/amalgamation/fkyaml_fwd_hpp.json b/tools/amalgamation/fkyaml_fwd_hpp.json similarity index 100% rename from tool/amalgamation/fkyaml_fwd_hpp.json rename to tools/amalgamation/fkyaml_fwd_hpp.json diff --git a/tool/amalgamation/node_hpp.json b/tools/amalgamation/node_hpp.json similarity index 100% rename from tool/amalgamation/node_hpp.json rename to tools/amalgamation/node_hpp.json diff --git a/tool/benchmark/CMakeLists.txt b/tools/benchmark/CMakeLists.txt similarity index 100% rename from tool/benchmark/CMakeLists.txt rename to tools/benchmark/CMakeLists.txt diff --git a/tool/benchmark/README.md b/tools/benchmark/README.md similarity index 100% rename from tool/benchmark/README.md rename to tools/benchmark/README.md diff --git a/tool/benchmark/cases/citm_catalog.json b/tools/benchmark/cases/citm_catalog.json similarity index 100% rename from tool/benchmark/cases/citm_catalog.json rename to tools/benchmark/cases/citm_catalog.json diff --git a/tool/benchmark/cases/citm_catalog.yml b/tools/benchmark/cases/citm_catalog.yml similarity index 100% rename from tool/benchmark/cases/citm_catalog.yml rename to tools/benchmark/cases/citm_catalog.yml diff --git a/tool/benchmark/cases/ubuntu.yml b/tools/benchmark/cases/ubuntu.yml similarity index 100% rename from tool/benchmark/cases/ubuntu.yml rename to tools/benchmark/cases/ubuntu.yml diff --git a/tool/benchmark/main.cpp b/tools/benchmark/main.cpp similarity index 98% rename from tool/benchmark/main.cpp rename to tools/benchmark/main.cpp index de2fb29f..e21ece15 100644 --- a/tool/benchmark/main.cpp +++ b/tools/benchmark/main.cpp @@ -3,7 +3,7 @@ // | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // -// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani // SPDX-License-Identifier: MIT #ifdef _MSC_VER diff --git a/tool/benchmark/results/result_debug_citm_catalog_json.txt b/tools/benchmark/results/result_debug_citm_catalog_json.txt similarity index 100% rename from tool/benchmark/results/result_debug_citm_catalog_json.txt rename to tools/benchmark/results/result_debug_citm_catalog_json.txt diff --git a/tool/benchmark/results/result_debug_citm_catalog_yml.txt b/tools/benchmark/results/result_debug_citm_catalog_yml.txt similarity index 100% rename from tool/benchmark/results/result_debug_citm_catalog_yml.txt rename to tools/benchmark/results/result_debug_citm_catalog_yml.txt diff --git a/tool/benchmark/results/result_debug_ubuntu_yml.txt b/tools/benchmark/results/result_debug_ubuntu_yml.txt similarity index 100% rename from tool/benchmark/results/result_debug_ubuntu_yml.txt rename to tools/benchmark/results/result_debug_ubuntu_yml.txt diff --git a/tool/benchmark/results/result_release_citm_catalog_json.txt b/tools/benchmark/results/result_release_citm_catalog_json.txt similarity index 100% rename from tool/benchmark/results/result_release_citm_catalog_json.txt rename to tools/benchmark/results/result_release_citm_catalog_json.txt diff --git a/tool/benchmark/results/result_release_citm_catalog_yml.txt b/tools/benchmark/results/result_release_citm_catalog_yml.txt similarity index 100% rename from tool/benchmark/results/result_release_citm_catalog_yml.txt rename to tools/benchmark/results/result_release_citm_catalog_yml.txt diff --git a/tool/benchmark/results/result_release_ubuntu_yml.txt b/tools/benchmark/results/result_release_ubuntu_yml.txt similarity index 100% rename from tool/benchmark/results/result_release_ubuntu_yml.txt rename to tools/benchmark/results/result_release_ubuntu_yml.txt diff --git a/tool/clang_tidy/CMakeLists.txt b/tools/clang_tidy/CMakeLists.txt similarity index 100% rename from tool/clang_tidy/CMakeLists.txt rename to tools/clang_tidy/CMakeLists.txt diff --git a/tool/iwyu/CMakeLists.txt b/tools/iwyu/CMakeLists.txt similarity index 100% rename from tool/iwyu/CMakeLists.txt rename to tools/iwyu/CMakeLists.txt diff --git a/tool/natvis_generator/Makefile b/tools/natvis_generator/Makefile similarity index 100% rename from tool/natvis_generator/Makefile rename to tools/natvis_generator/Makefile diff --git a/tool/natvis_generator/README.md b/tools/natvis_generator/README.md similarity index 100% rename from tool/natvis_generator/README.md rename to tools/natvis_generator/README.md diff --git a/tool/natvis_generator/fkYAML.natvis.j2 b/tools/natvis_generator/fkYAML.natvis.j2 similarity index 100% rename from tool/natvis_generator/fkYAML.natvis.j2 rename to tools/natvis_generator/fkYAML.natvis.j2 diff --git a/tool/natvis_generator/natvis_generator.py b/tools/natvis_generator/natvis_generator.py similarity index 100% rename from tool/natvis_generator/natvis_generator.py rename to tools/natvis_generator/natvis_generator.py diff --git a/tool/natvis_generator/params.json b/tools/natvis_generator/params.json similarity index 100% rename from tool/natvis_generator/params.json rename to tools/natvis_generator/params.json diff --git a/tool/natvis_generator/requirements.txt b/tools/natvis_generator/requirements.txt similarity index 100% rename from tool/natvis_generator/requirements.txt rename to tools/natvis_generator/requirements.txt From 859389ef106a9dbd2389c0174a340d2505deda56 Mon Sep 17 00:00:00 2001 From: fktn Date: Fri, 3 Jan 2025 01:04:28 +0900 Subject: [PATCH 10/18] Fix invalid paths for documentation & other tools (#453) * fixed paths for publishing documentation * fixed filtering paths for workflow triggers * updated path for the reuse tool --- .github/workflows/coverage.yml | 4 ++-- .github/workflows/format_check.yml | 8 ++++---- .github/workflows/macos.yml | 4 ++-- .github/workflows/publish_docs.yml | 8 ++++---- .github/workflows/ubuntu.yml | 4 ++-- .github/workflows/windows.yml | 4 ++-- REUSE.toml | 2 +- docs/mkdocs.yml | 1 + 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 8054217a..ecc79e75 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -9,7 +9,7 @@ on: - .github/workflows/coverage.yml - cmake/** - include/** - - test/** + - tests/** - CMakeLists.txt - Makefile # to grant pull-requests write permission to fork repos as well @@ -18,7 +18,7 @@ on: - .github/workflows/coverage.yml - cmake/** - include/** - - test/** + - tests/** - CMakeLists.txt - Makefile workflow_dispatch: diff --git a/.github/workflows/format_check.yml b/.github/workflows/format_check.yml index 84ebfc87..7d568fb4 100644 --- a/.github/workflows/format_check.yml +++ b/.github/workflows/format_check.yml @@ -10,8 +10,8 @@ on: - include/** - scripts/** - single_include/** - - test/** - - tool/amalgamation/** + - tests/** + - tools/amalgamation/** - CMakeLists.txt - .clang-format # to grant contents write permission to fork repos as well @@ -21,8 +21,8 @@ on: - include/** - scripts/** - single_include/** - - test/** - - tool/amalgamation/** + - tests/** + - tools/amalgamation/** - CMakeLists.txt - .clang-format workflow_dispatch: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 566258d8..bae9567c 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -10,7 +10,7 @@ on: - cmake/** - include/** - single_include/** - - test/** + - tests/** - CMakeLists.txt pull_request: paths: @@ -18,7 +18,7 @@ on: - cmake/** - include/** - single_include/** - - test/** + - tests/** - CMakeLists.txt workflow_dispatch: diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml index 3bc0dfcb..4225ae7d 100644 --- a/.github/workflows/publish_docs.yml +++ b/.github/workflows/publish_docs.yml @@ -7,8 +7,8 @@ on: - develop paths: - .github/workflows/publish_docs.yml - - docs/examples/** - - docs/mkdocs/** + - examples/** + - docs/** workflow_dispatch: # no cancellation during uploads to avoid broken publications @@ -37,7 +37,7 @@ jobs: cmake --build ${{github.workspace}}/build --config Debug - name: Build documentation - run: make -C docs/mkdocs build + run: make build-docs - name: Setup Pages uses: actions/configure-pages@v4 @@ -45,7 +45,7 @@ jobs: - name: Upload API documents uses: actions/upload-pages-artifact@v3 with: - path: ${{github.workspace}}/docs/mkdocs/site + path: ${{github.workspace}}/docs/site deploy: if: github.repository == 'fktn-k/fkYAML' diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 8e8b36fc..6f0aac95 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -10,8 +10,8 @@ on: - cmake/** - include/** - single_include/** - - test/** - - tool/** + - tests/** + - tools/** - .clang-tidy - CMakeLists.txt - Makefile diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 800d864a..9fe6b0f3 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -10,7 +10,7 @@ on: - cmake/** - include/** - single_include/** - - test/** + - tests/** - CMakeLists.txt pull_request: paths: @@ -18,7 +18,7 @@ on: - cmake/** - include/** - single_include/** - - test/** + - tests/** - CMakeLists.txt workflow_dispatch: diff --git a/REUSE.toml b/REUSE.toml index 64e97b91..27c2c5ed 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -16,7 +16,7 @@ SPDX-FileCopyrightText = ["2017 Georg Sauthoff ", "2022, Alexander SPDX-License-Identifier = "GPL-3.0-only" [[annotations]] -path = "tool/amalgamation/**" +path = "tools/amalgamation/**" precedence = "aggregate" SPDX-FileCopyrightText = "2012 Erik Edlund " SPDX-License-Identifier = "BSD-3-Clause" diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 1026f454..252c0d62 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -170,6 +170,7 @@ nav: - (destructor): api/exception/destructor.md - what: api/exception/what.md - invalid_encoding: api/exception/invalid_encoding.md + - invalid_tag: api/exception/invalid_tag.md - out_of_range: api/exception/out_of_range.md - parse_error: api/exception/parse_error.md - type_error: api/exception/type_error.md From c15d671ca1d87540c19c70be15887570b184bc82 Mon Sep 17 00:00:00 2001 From: johan-gson <32481323+johan-gson@users.noreply.github.com> Date: Mon, 6 Jan 2025 08:53:44 +0100 Subject: [PATCH 11/18] fix: Fixed a bug where serialize didn't write out empty vectors and mappings in a correct way (#456) * fix: Fixed a bug where serialize didn't write out empty vectors and mappings in a correct way. I have not added a test case, but I tested it in my code and it behaved as expected. Adding a test case at some point would be good. --- include/fkYAML/detail/output/serializer.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/fkYAML/detail/output/serializer.hpp b/include/fkYAML/detail/output/serializer.hpp index d79c46d5..6cca9597 100644 --- a/include/fkYAML/detail/output/serializer.hpp +++ b/include/fkYAML/detail/output/serializer.hpp @@ -156,6 +156,12 @@ class basic_serializer { serialize_node(seq_item, cur_indent, str); str += "\n"; } + else if (seq_item.is_sequence() && seq_item.size() == 0) { + str += " []\n"; + } + else if (seq_item.is_mapping() && seq_item.size() == 0) { + str += " {}\n"; + } else { str += "\n"; serialize_node(seq_item, cur_indent + 2, str); @@ -207,6 +213,12 @@ class basic_serializer { serialize_node(*itr, cur_indent, str); str += "\n"; } + else if (itr->is_sequence() && itr->size() == 0) { + str += " []\n"; + } + else if (itr->is_mapping() && itr->size() == 0) { + str += " {}\n"; + } else { str += "\n"; serialize_node(*itr, cur_indent + 2, str); From 559f6a36cac3c3fc904c27efb5d25bc5f2b6440c Mon Sep 17 00:00:00 2001 From: johan-gson <32481323+johan-gson@users.noreply.github.com> Date: Mon, 6 Jan 2025 08:06:12 +0000 Subject: [PATCH 12/18] [bot] run clang-format & amalgamation --- single_include/fkYAML/node.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 5bd01db5..7afa3471 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -10530,6 +10530,12 @@ class basic_serializer { serialize_node(seq_item, cur_indent, str); str += "\n"; } + else if (seq_item.is_sequence() && seq_item.size() == 0) { + str += " []\n"; + } + else if (seq_item.is_mapping() && seq_item.size() == 0) { + str += " {}\n"; + } else { str += "\n"; serialize_node(seq_item, cur_indent + 2, str); @@ -10581,6 +10587,12 @@ class basic_serializer { serialize_node(*itr, cur_indent, str); str += "\n"; } + else if (itr->is_sequence() && itr->size() == 0) { + str += " []\n"; + } + else if (itr->is_mapping() && itr->size() == 0) { + str += " {}\n"; + } else { str += "\n"; serialize_node(*itr, cur_indent + 2, str); From 71fa437ce59722684782f7d3b2092454bf6b5f3d Mon Sep 17 00:00:00 2001 From: fktn Date: Tue, 7 Jan 2025 02:30:01 +0900 Subject: [PATCH 13/18] Add test cases for serializing empty collection nodes (#457) * added test cases for serializing empty collection nodes * modified serializer impl to address coverage loss --- include/fkYAML/detail/output/serializer.hpp | 36 ++++++++++++++------- single_include/fkYAML/node.hpp | 36 ++++++++++++++------- tests/unit_test/test_serializer_class.cpp | 30 +++++++++++++++++ 3 files changed, 78 insertions(+), 24 deletions(-) diff --git a/include/fkYAML/detail/output/serializer.hpp b/include/fkYAML/detail/output/serializer.hpp index 6cca9597..6eb721be 100644 --- a/include/fkYAML/detail/output/serializer.hpp +++ b/include/fkYAML/detail/output/serializer.hpp @@ -155,17 +155,23 @@ class basic_serializer { str += " "; serialize_node(seq_item, cur_indent, str); str += "\n"; + continue; + } + + const bool is_empty = seq_item.empty(); + if (!is_empty) { + str += "\n"; + serialize_node(seq_item, cur_indent + 2, str); + continue; } - else if (seq_item.is_sequence() && seq_item.size() == 0) { + + // an empty sequence or mapping + if (seq_item.is_sequence()) { str += " []\n"; } - else if (seq_item.is_mapping() && seq_item.size() == 0) { + else /*seq_item.is_mapping()*/ { str += " {}\n"; } - else { - str += "\n"; - serialize_node(seq_item, cur_indent + 2, str); - } } break; case node_type::MAPPING: @@ -212,17 +218,23 @@ class basic_serializer { str += " "; serialize_node(*itr, cur_indent, str); str += "\n"; + continue; + } + + const bool is_empty = itr->empty(); + if (!is_empty) { + str += "\n"; + serialize_node(*itr, cur_indent + 2, str); + continue; } - else if (itr->is_sequence() && itr->size() == 0) { + + // an empty sequence or mapping + if (itr->is_sequence()) { str += " []\n"; } - else if (itr->is_mapping() && itr->size() == 0) { + else /*itr->is_mapping()*/ { str += " {}\n"; } - else { - str += "\n"; - serialize_node(*itr, cur_indent + 2, str); - } } break; case node_type::NULL_OBJECT: diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 7afa3471..36d2290c 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -10529,17 +10529,23 @@ class basic_serializer { str += " "; serialize_node(seq_item, cur_indent, str); str += "\n"; + continue; + } + + const bool is_empty = seq_item.empty(); + if (!is_empty) { + str += "\n"; + serialize_node(seq_item, cur_indent + 2, str); + continue; } - else if (seq_item.is_sequence() && seq_item.size() == 0) { + + // an empty sequence or mapping + if (seq_item.is_sequence()) { str += " []\n"; } - else if (seq_item.is_mapping() && seq_item.size() == 0) { + else /*seq_item.is_mapping()*/ { str += " {}\n"; } - else { - str += "\n"; - serialize_node(seq_item, cur_indent + 2, str); - } } break; case node_type::MAPPING: @@ -10586,17 +10592,23 @@ class basic_serializer { str += " "; serialize_node(*itr, cur_indent, str); str += "\n"; + continue; + } + + const bool is_empty = itr->empty(); + if (!is_empty) { + str += "\n"; + serialize_node(*itr, cur_indent + 2, str); + continue; } - else if (itr->is_sequence() && itr->size() == 0) { + + // an empty sequence or mapping + if (itr->is_sequence()) { str += " []\n"; } - else if (itr->is_mapping() && itr->size() == 0) { + else /*itr->is_mapping()*/ { str += " {}\n"; } - else { - str += "\n"; - serialize_node(*itr, cur_indent + 2, str); - } } break; case node_type::NULL_OBJECT: diff --git a/tests/unit_test/test_serializer_class.cpp b/tests/unit_test/test_serializer_class.cpp index 7af79193..4e25634c 100644 --- a/tests/unit_test/test_serializer_class.cpp +++ b/tests/unit_test/test_serializer_class.cpp @@ -30,6 +30,36 @@ TEST_CASE("Serializer_MappingNode") { REQUIRE(serializer.serialize(node_str_pair.first) == node_str_pair.second); } +TEST_CASE("Serializer_EmptyCollectionNode") { + auto seq = fkyaml::node::sequence(); + auto map = fkyaml::node::mapping(); + fkyaml::detail::basic_serializer serializer; + + SECTION("child sequence item is an empty sequence node") { + seq.get_value_ref().emplace_back(fkyaml::node::sequence()); + std::string expected = "- []\n"; + REQUIRE(serializer.serialize(seq) == expected); + } + + SECTION("child sequence item is an empty mapping node") { + seq.get_value_ref().emplace_back(fkyaml::node::mapping()); + std::string expected = "- {}\n"; + REQUIRE(serializer.serialize(seq) == expected); + } + + SECTION("mapping value is an empty sequence node") { + map["foo"] = seq; + std::string expected = "foo: []\n"; + REQUIRE(serializer.serialize(map) == expected); + } + + SECTION("mapping value is an empty mapping node") { + map["foo"] = fkyaml::node::mapping(); + std::string expected = "foo: {}\n"; + REQUIRE(serializer.serialize(map) == expected); + } +} + TEST_CASE("Serializer_NullNode") { fkyaml::detail::basic_serializer serializer; fkyaml::node node; From 36ca93e245390952756f2bf23e9cf555c19c7940 Mon Sep 17 00:00:00 2001 From: fktn Date: Tue, 7 Jan 2025 12:36:53 +0900 Subject: [PATCH 14/18] Mapping key/value access in range based for loops (#458) * allow access to iterator member functions in range-based for loops * updated documentation for map_items API * modified impl for serializing mappings * fixed duplication error in CMake build target names * added doxygen comments * fixed ci errors * added doxygen comments again --- docs/docs/api/basic_node/index.md | 23 +- docs/docs/api/basic_node/iterator.md | 6 + docs/docs/api/basic_node/map_items.md | 59 +++ docs/docs/api/basic_node/map_range.md | 30 ++ docs/mkdocs.yml | 2 + examples/CMakeLists.txt | 4 +- examples/apis/basic_node/CMakeLists.txt | 15 +- .../basic_node/deserialize_docs_iterators.cpp | 2 +- examples/apis/basic_node/map_items.cpp | 31 ++ examples/apis/basic_node/map_items.output | 3 + examples/apis/exception/CMakeLists.txt | 15 +- examples/apis/macros/CMakeLists.txt | 15 +- examples/apis/node_type/CMakeLists.txt | 15 +- .../apis/node_value_converter/CMakeLists.txt | 15 +- .../apis/operator_literal_yaml/CMakeLists.txt | 15 +- examples/apis/ordered_map/CMakeLists.txt | 15 +- .../apis/yaml_version_type/CMakeLists.txt | 15 +- include/fkYAML/detail/iterator.hpp | 54 ++- include/fkYAML/detail/map_range_proxy.hpp | 190 ++++++++++ include/fkYAML/detail/output/serializer.hpp | 32 +- include/fkYAML/detail/reverse_iterator.hpp | 44 +++ include/fkYAML/node.hpp | 31 ++ single_include/fkYAML/node.hpp | 354 +++++++++++++++++- tests/unit_test/test_node_class.cpp | 58 +++ 24 files changed, 943 insertions(+), 100 deletions(-) create mode 100644 docs/docs/api/basic_node/map_items.md create mode 100644 docs/docs/api/basic_node/map_range.md create mode 100644 examples/apis/basic_node/map_items.cpp create mode 100644 examples/apis/basic_node/map_items.output create mode 100644 include/fkYAML/detail/map_range_proxy.hpp diff --git a/docs/docs/api/basic_node/index.md b/docs/docs/api/basic_node/index.md index 9ae7aa4b..e5a379ad 100644 --- a/docs/docs/api/basic_node/index.md +++ b/docs/docs/api/basic_node/index.md @@ -66,6 +66,8 @@ This class provides features to handle YAML nodes. | initializer_list_t | The type for initializer lists of `basic_node` values. | | [node_t](node_t.md) | **(DEPRECATED)** The type used to store the internal value type. | | [yaml_version_t](yaml_version_t.md) | **(DEPRECATED)** The type used to store the enable version of YAML. | +| [map_range](map_range.md) | The helper type for the `map_items()` function. | +| [const_map_range](map_range.md) | The helper type for the `map_items()` function. | ## **Member Functions** @@ -107,16 +109,17 @@ This class provides features to handle YAML nodes. | [get_value_ref](get_value_ref.md) | | converts a basic_node into reference to a target type. | ### Iterators -| Name | Description | -| -------------------- | ---------------------------------------------------------------------------- | -| [begin](begin.md) | returns a (const) iterator to the beginning of mapping/sequence | -| [cbegin](begin.md) | returns a const iterator to the beginning of mapping/sequence | -| [end](end.md) | returns a (const) iterator to the past-the-last of mapping/sequence | -| [cend](end.md) | returns a const iterator to the past-the-last of mapping/sequence | -| [rbegin](rbegin.md) | returns a (const) iterator to the first of reversed mapping/sequence | -| [crbegin](rbegin.md) | returns a const iterator to the first of reversed mapping/sequence | -| [rend](rend.md) | returns a (const) iterator to the past-the-last of reversed mapping/sequence | -| [crend](rend.md) | returns a const iterator to the past-the-last of reversed mapping/sequence | +| Name | Description | +| ------------------------- | ---------------------------------------------------------------------------------------------------------- | +| [begin](begin.md) | returns a (const) iterator to the beginning of mapping/sequence | +| [cbegin](begin.md) | returns a const iterator to the beginning of mapping/sequence | +| [end](end.md) | returns a (const) iterator to the past-the-last of mapping/sequence | +| [cend](end.md) | returns a const iterator to the past-the-last of mapping/sequence | +| [rbegin](rbegin.md) | returns a (const) iterator to the first of reversed mapping/sequence | +| [crbegin](rbegin.md) | returns a const iterator to the first of reversed mapping/sequence | +| [rend](rend.md) | returns a (const) iterator to the past-the-last of reversed mapping/sequence | +| [crend](rend.md) | returns a const iterator to the past-the-last of reversed mapping/sequence | +| [map_items](map_items.md) | returns a range of mapping entries, allowing access to iterator member functions in range-based for loops. | ### Inspection for Container Node Values | Name | Description | diff --git a/docs/docs/api/basic_node/iterator.md b/docs/docs/api/basic_node/iterator.md index 9e45ecb6..7c698159 100644 --- a/docs/docs/api/basic_node/iterator.md +++ b/docs/docs/api/basic_node/iterator.md @@ -36,6 +36,12 @@ They satisfies [LegacyBidirectionalIterator](https://en.cppreference.com/w/cpp/n | key | Returns const reference to a key node of the current key-value pair.
`fkyaml::exception` is thrown if an iterator points to a sequence element. | | value | Returns reference to a sequence element if an element points to a sequence element, or a mapping value otherwise. | +## **Non-Member Functions** + +| Name | Description | +| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| get | Returns reference to a key (if I == 0) or a value (if I == 1) mainly for structured binding support.
`fkyaml::exception` is thrown if an iterator points to a sequence element. | + ## **Examples** ??? Example diff --git a/docs/docs/api/basic_node/map_items.md b/docs/docs/api/basic_node/map_items.md new file mode 100644 index 00000000..2a086220 --- /dev/null +++ b/docs/docs/api/basic_node/map_items.md @@ -0,0 +1,59 @@ +Defined in header [``](https://github.com/fktn-k/fkYAML/blob/develop/include/fkYAML/node.hpp) + +# fkyaml::basic_node::begin, fkyaml::basic_node::cbegin + +```cpp +map_range map_items(); +const_map_range map_items() const; +``` + +Returns a (constant) range of mapping entries. +If a basic_node is not a mapping, a [`fkyaml::type_error`](../exception/type_error.md) will be thrown. + +This function allows accessing the `key()` and `value()` functions provided by `iterator` and `const_iterator` in range-based for loops: +```cpp +// without map_items() +for (auto it : mapping) { + // `it` is of type fkyaml::node::reference and has no key() member function. + std::cout << "value: " << it << std::endl; +} + +// with map_items() +for (auto it : mapping.map_items()) { + // `it` is now of type fkyaml::node::iterator and has key() member function. + std::cout << "key: " << it.key() << ", value: " << it.value() << std::endl; +} +``` + +Also, this function allows using [structured bindings](https://en.cppreference.com/w/cpp/language/structured_binding) (since C++17): +```cpp +for (auto& [key, value] : mapping.map_items()) { + // `key` and `value` are both of type fkyaml::node::reference. + std::cout << "key: " << key << ", value: " << value << std::endl; +} +``` + +## **Return Value** + +A (constant) iterator to the first element of a container node. + +## **Examples** + +??? Example + + ```cpp + --8<-- "apis/basic_node/map_items.cpp:9" + ``` + + output: + ```bash + --8<-- "apis/basic_node/map_items.output" + ``` + +### **See Also** + +* [basic_node](index.md) +* [node](node.md) +* [iterator, const_iterator](iterator.md) +* [end, cend](end.md) +* [operator<<](insertion_operator.md) diff --git a/docs/docs/api/basic_node/map_range.md b/docs/docs/api/basic_node/map_range.md new file mode 100644 index 00000000..a2639f1c --- /dev/null +++ b/docs/docs/api/basic_node/map_range.md @@ -0,0 +1,30 @@ +Defined in header [``](https://github.com/fktn-k/fkYAML/blob/develop/include/fkYAML/node.hpp) + +# fkyaml::basic_node::map_range, fkyaml::basic_node::const_map_range + +```cpp +using map_range = detail::map_range_proxy; +using const_map_range = detail::map_range_proxy; +``` + +The helper types for the [`map_items()`](map_items.md) function which allow accessing the `key()` and `value()` functions provided by `iterator` and `const_iterator` in range-based for loops. +They provides minimal functions and operators which are required for range-based for loops. + +## **Member Types** + +| Type | Definition | +| ---------------- | --------------------------------------------------------------------------------------------- | +| `iterator` | [LegacyForwardIterator](https://en.cppreference.com/w/cpp/named_req/ForwardIterator) | +| `const_iterator` | constant [LegacyForwardIterator](https://en.cppreference.com/w/cpp/named_req/ForwardIterator) | + +## **Member Functions** + +| Name | Description | +| ----- | ------------------------------------------------------------------------------ | +| begin | Returns a (constant) iterator to the first element of mapping entries. | +| end | Returns a (constant) iterator to the past-the-last element of mapping entries. | + +### **See Also** + +* [basic_node](index.md) +* [map_items](map_items.md) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 252c0d62..fae71d56 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -111,6 +111,7 @@ nav: - value_converter_type: api/basic_node/value_converter_type.md - node_t: api/basic_node/node_t.md - yaml_version_t: api/basic_node/yaml_version_t.md + - 'map_range, const_map_range': api/basic_node/map_range.md - (constructor): api/basic_node/constructor.md - (destructor): api/basic_node/destructor.md - operators: @@ -153,6 +154,7 @@ nav: - is_sequence: api/basic_node/is_sequence.md - is_string: api/basic_node/is_string.md - mapping: api/basic_node/mapping.md + - map_items: api/basic_node/map_items.md - node: api/basic_node/node.md - 'rbegin, crbegin': api/basic_node/rbegin.md - 'rend, crend': api/basic_node/rend.md diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 85806f4b..c59d186c 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -25,8 +25,6 @@ target_compile_options( > ) -# FIXME: change build instructions according to the changes in their paths. - ############################### # Build tutorial projects # ############################### @@ -37,4 +35,4 @@ add_subdirectory(tutorials) # Build example codes # ########################### - +add_subdirectory(apis) diff --git a/examples/apis/basic_node/CMakeLists.txt b/examples/apis/basic_node/CMakeLists.txt index e7176246..bea09176 100644 --- a/examples/apis/basic_node/CMakeLists.txt +++ b/examples/apis/basic_node/CMakeLists.txt @@ -2,15 +2,16 @@ file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(EX_SRC_FILE ${EX_SRC_FILES}) file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) - add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) - target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + set(TARGET_NAME "basic_node_${EX_SRC_FILE_BASE}") + add_executable(${TARGET_NAME} ${EX_SRC_FILE}) + target_link_libraries(${TARGET_NAME} example_common_config) add_custom_command( - TARGET ${EX_SRC_FILE_BASE} + TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ - COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output - WORKING_DIRECTORY $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ ) endforeach() diff --git a/examples/apis/basic_node/deserialize_docs_iterators.cpp b/examples/apis/basic_node/deserialize_docs_iterators.cpp index fd3b41a7..bd13b949 100644 --- a/examples/apis/basic_node/deserialize_docs_iterators.cpp +++ b/examples/apis/basic_node/deserialize_docs_iterators.cpp @@ -15,7 +15,7 @@ int main() { // deserialize a YAML string. - char input[] = R"( + std::string input = R"( %YAML 1.2 --- foo: true diff --git a/examples/apis/basic_node/map_items.cpp b/examples/apis/basic_node/map_items.cpp new file mode 100644 index 00000000..a2984803 --- /dev/null +++ b/examples/apis/basic_node/map_items.cpp @@ -0,0 +1,31 @@ +// _______ __ __ __ _____ __ __ __ +// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +// +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani +// SPDX-License-Identifier: MIT + +#include +#include + +int main() { + // create a mapping node. + fkyaml::node map_node = {{"foo", 123}, {"bar", true}}; + + // print all the mapping entries. + for (auto it : map_node.map_items()) { + std::cout << "key: " << it.key() << ", value: " << it.value() << std::endl; + } + + fkyaml::node seq_node = {123, false, 3.14}; + try { + // map_items() cannot be called on a sequence node. + auto invalid = seq_node.map_items(); + } + catch (const fkyaml::exception& e) { + std::cout << e.what() << std::endl; + } + + return 0; +} diff --git a/examples/apis/basic_node/map_items.output b/examples/apis/basic_node/map_items.output new file mode 100644 index 00000000..440b3819 --- /dev/null +++ b/examples/apis/basic_node/map_items.output @@ -0,0 +1,3 @@ +key: bar, value: true +key: foo, value: 123 +type_error: map_items() cannot be called on a non-mapping node. type=SEQUENCE diff --git a/examples/apis/exception/CMakeLists.txt b/examples/apis/exception/CMakeLists.txt index e7176246..f09844d6 100644 --- a/examples/apis/exception/CMakeLists.txt +++ b/examples/apis/exception/CMakeLists.txt @@ -2,15 +2,16 @@ file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(EX_SRC_FILE ${EX_SRC_FILES}) file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) - add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) - target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + set(TARGET_NAME "exception_${EX_SRC_FILE_BASE}") + add_executable(${TARGET_NAME} ${EX_SRC_FILE}) + target_link_libraries(${TARGET_NAME} example_common_config) add_custom_command( - TARGET ${EX_SRC_FILE_BASE} + TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ - COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output - WORKING_DIRECTORY $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ ) endforeach() diff --git a/examples/apis/macros/CMakeLists.txt b/examples/apis/macros/CMakeLists.txt index e7176246..643e2bb1 100644 --- a/examples/apis/macros/CMakeLists.txt +++ b/examples/apis/macros/CMakeLists.txt @@ -2,15 +2,16 @@ file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(EX_SRC_FILE ${EX_SRC_FILES}) file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) - add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) - target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + set(TARGET_NAME "macros_${EX_SRC_FILE_BASE}") + add_executable(${TARGET_NAME} ${EX_SRC_FILE}) + target_link_libraries(${TARGET_NAME} example_common_config) add_custom_command( - TARGET ${EX_SRC_FILE_BASE} + TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ - COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output - WORKING_DIRECTORY $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ ) endforeach() diff --git a/examples/apis/node_type/CMakeLists.txt b/examples/apis/node_type/CMakeLists.txt index e7176246..10a9846b 100644 --- a/examples/apis/node_type/CMakeLists.txt +++ b/examples/apis/node_type/CMakeLists.txt @@ -2,15 +2,16 @@ file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(EX_SRC_FILE ${EX_SRC_FILES}) file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) - add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) - target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + set(TARGET_NAME "node_type_${EX_SRC_FILE_BASE}") + add_executable(${TARGET_NAME} ${EX_SRC_FILE}) + target_link_libraries(${TARGET_NAME} example_common_config) add_custom_command( - TARGET ${EX_SRC_FILE_BASE} + TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ - COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output - WORKING_DIRECTORY $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ ) endforeach() diff --git a/examples/apis/node_value_converter/CMakeLists.txt b/examples/apis/node_value_converter/CMakeLists.txt index e7176246..4e1368c6 100644 --- a/examples/apis/node_value_converter/CMakeLists.txt +++ b/examples/apis/node_value_converter/CMakeLists.txt @@ -2,15 +2,16 @@ file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(EX_SRC_FILE ${EX_SRC_FILES}) file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) - add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) - target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + set(TARGET_NAME "node_value_converter_${EX_SRC_FILE_BASE}") + add_executable(${TARGET_NAME} ${EX_SRC_FILE}) + target_link_libraries(${TARGET_NAME} example_common_config) add_custom_command( - TARGET ${EX_SRC_FILE_BASE} + TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ - COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output - WORKING_DIRECTORY $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ ) endforeach() diff --git a/examples/apis/operator_literal_yaml/CMakeLists.txt b/examples/apis/operator_literal_yaml/CMakeLists.txt index e7176246..43fc7bae 100644 --- a/examples/apis/operator_literal_yaml/CMakeLists.txt +++ b/examples/apis/operator_literal_yaml/CMakeLists.txt @@ -2,15 +2,16 @@ file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(EX_SRC_FILE ${EX_SRC_FILES}) file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) - add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) - target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + set(TARGET_NAME "operator_literal_yaml_${EX_SRC_FILE_BASE}") + add_executable(${TARGET_NAME} ${EX_SRC_FILE}) + target_link_libraries(${TARGET_NAME} example_common_config) add_custom_command( - TARGET ${EX_SRC_FILE_BASE} + TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ - COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output - WORKING_DIRECTORY $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ ) endforeach() diff --git a/examples/apis/ordered_map/CMakeLists.txt b/examples/apis/ordered_map/CMakeLists.txt index e7176246..49f8de66 100644 --- a/examples/apis/ordered_map/CMakeLists.txt +++ b/examples/apis/ordered_map/CMakeLists.txt @@ -2,15 +2,16 @@ file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(EX_SRC_FILE ${EX_SRC_FILES}) file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) - add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) - target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + set(TARGET_NAME "ordered_map_${EX_SRC_FILE_BASE}") + add_executable(${TARGET_NAME} ${EX_SRC_FILE}) + target_link_libraries(${TARGET_NAME} example_common_config) add_custom_command( - TARGET ${EX_SRC_FILE_BASE} + TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ - COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output - WORKING_DIRECTORY $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ ) endforeach() diff --git a/examples/apis/yaml_version_type/CMakeLists.txt b/examples/apis/yaml_version_type/CMakeLists.txt index e7176246..78064ede 100644 --- a/examples/apis/yaml_version_type/CMakeLists.txt +++ b/examples/apis/yaml_version_type/CMakeLists.txt @@ -2,15 +2,16 @@ file(GLOB_RECURSE EX_SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(EX_SRC_FILE ${EX_SRC_FILES}) file(RELATIVE_PATH REL_EX_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR} ${EX_SRC_FILE}) string(REPLACE ".cpp" "" EX_SRC_FILE_BASE ${REL_EX_SRC_FILE}) - add_executable(${EX_SRC_FILE_BASE} ${EX_SRC_FILE}) - target_link_libraries(${EX_SRC_FILE_BASE} example_common_config) + set(TARGET_NAME "yaml_version_type_${EX_SRC_FILE_BASE}") + add_executable(${TARGET_NAME} ${EX_SRC_FILE}) + target_link_libraries(${TARGET_NAME} example_common_config) add_custom_command( - TARGET ${EX_SRC_FILE_BASE} + TARGET ${TARGET_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ - COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output - WORKING_DIRECTORY $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_YAML_PATH} $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INPUT_MULTI_YAML_PATH} $ + COMMAND $ > ${CMAKE_CURRENT_SOURCE_DIR}/${EX_SRC_FILE_BASE}.output + WORKING_DIRECTORY $ ) endforeach() diff --git a/include/fkYAML/detail/iterator.hpp b/include/fkYAML/detail/iterator.hpp index b527752c..42ac1d01 100644 --- a/include/fkYAML/detail/iterator.hpp +++ b/include/fkYAML/detail/iterator.hpp @@ -160,7 +160,7 @@ class iterator { /// @brief A dereference operator of the iterator class. /// @return reference Reference to the Node object internally referenced by the actual iterator object. - reference operator*() noexcept { + reference operator*() const noexcept { if (m_inner_iterator_type == iterator_t::SEQUENCE) { return *(m_iterator_holder.sequence_iterator); } @@ -361,7 +361,7 @@ class iterator { /// @brief Get reference to the YAML node of the current iterator. /// @return Reference to the YAML node of the current iterator. - reference value() noexcept { + reference value() const noexcept { return operator*(); } @@ -372,6 +372,56 @@ class iterator { iterator_holder m_iterator_holder {}; }; +/// @brief Get reference to a mapping key node. +/// @tparam ValueType The iterator value type. +/// @tparam I The element index. +/// @param i An iterator object. +/// @return Reference to a mapping key node. +template = 0> +inline auto get(const iterator& i) -> decltype(i.key()) { + return i.key(); +} + +/// @brief Get reference to a mapping value node. +/// @tparam ValueType The iterator value type. +/// @tparam I The element index +/// @param i An iterator object. +/// @return Reference to a mapping value node. +template = 0> +inline auto get(const iterator& i) -> decltype(i.value()) { + return i.value(); +} + FK_YAML_DETAIL_NAMESPACE_END +namespace std { + +#ifdef __clang__ +// clang emits warnings against mixed usage of class/struct for tuple_size/tuple_element. +// see also: https://groups.google.com/a/isocpp.org/g/std-discussion/c/QC-AMb5oO1w +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wmismatched-tags" +#endif + +/// @brief Parcial pecialization of std::tuple_size for iterator class. +/// @tparam ValueType The iterator value type. +template +// NOLINTNEXTLINE(cert-dcl58-cpp) +struct tuple_size<::fkyaml::detail::iterator> : integral_constant {}; + +/// @brief Parcial specialization of std::tuple_element for iterator class. +/// @tparam ValueType The iterator value type. +/// @tparam I The element index. +template +// NOLINTNEXTLINE(cert-dcl58-cpp) +struct tuple_element> { + using type = decltype(get(std::declval<::fkyaml::detail::iterator>())); +}; + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +} // namespace std + #endif /* FK_YAML_DETAIL_ITERATOR_HPP */ diff --git a/include/fkYAML/detail/map_range_proxy.hpp b/include/fkYAML/detail/map_range_proxy.hpp new file mode 100644 index 00000000..27020ce2 --- /dev/null +++ b/include/fkYAML/detail/map_range_proxy.hpp @@ -0,0 +1,190 @@ +// _______ __ __ __ _____ __ __ __ +// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +// +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani +// SPDX-License-Identifier: MIT + +#ifndef FK_YAML_DETAIL_MAP_RANGE_PROXY_HPP +#define FK_YAML_DETAIL_MAP_RANGE_PROXY_HPP + +#include +#include + +FK_YAML_DETAIL_NAMESPACE_BEGIN + +/// @brief A helper iterator class which wraps a mapping iterator object. +/// @tparam Iterator The base iterator type. +template +class map_iterator_proxy { +public: + /// @brief The type of the pointed-to elements by base iterators. + using value_type = Iterator; + + /// @brief The type to represent difference between the pointed-to elements by base iterators. + using difference_type = std::ptrdiff_t; + + /// @brief The type of the pointed-to element references by base iterators. + using reference = value_type&; + + /// @brief The type of the pointed-to element pointers by base iterators. + using pointer = value_type*; + + /// @brief The iterator category. + using iterator_category = std::forward_iterator_tag; + + /// @brief Constructs a map_iterator_proxy object. + map_iterator_proxy() = default; + + /// @brief Constructs a map_iterator_proxy object with an Iterator object. + /// @param i A base iterator object. + map_iterator_proxy(const Iterator& i) noexcept + : m_base_iterator(i) { + } + + /// @brief Copy constructs a map_iterator_proxy object. + map_iterator_proxy(const map_iterator_proxy&) = default; + + /// @brief Copy assigns a map_iterator_proxy object. + map_iterator_proxy& operator=(const map_iterator_proxy&) = default; + + /// @brief Move constructs a map_iterator_proxy object. + map_iterator_proxy(map_iterator_proxy&&) = default; + + /// @biref Move assigns a map_iterator_proxy object. + map_iterator_proxy& operator=(map_iterator_proxy&&) = default; + + /// @brief Destructs a map_iterator_proxy object. + ~map_iterator_proxy() = default; + + /// @brief Get reference to the base iterator object. + /// @return Reference to the base iterator object. + reference operator*() noexcept { + return m_base_iterator; + } + + /// @brief Get pointer to the base iterator object. + /// @return Pointer to the base iterator object. + pointer operator->() noexcept { + return &m_base_iterator; + } + + /// @brief Pre-increments the base iterator object. + /// @return Reference to this map_iterator_proxy object. + map_iterator_proxy& operator++() noexcept { + ++m_base_iterator; + return *this; + } + + /// @brief Post-increments the base iterator object. + /// @return A map_iterator_proxy object with its base iterator incremented. + map_iterator_proxy operator++(int) & noexcept { + auto result = *this; + ++(*this); + return result; + } + + /// @brief Check equality between map_iterator_proxy objects. + /// @param rhs A map_iterator_proxy object to compare with. + /// @return true if this map_iterator_proxy object is equal to `rhs`, false otherwise. + bool operator==(const map_iterator_proxy& rhs) const noexcept { + return m_base_iterator == rhs.m_base_iterator; + } + + /// @brief Check inequality between map_iterator_proxy objects. + /// @param rhs A map_iterator_proxy object to compare with. + /// @return true if this map_iterator_proxy object is not equal to `rhs`, false otherwise. + bool operator!=(const map_iterator_proxy& rhs) const noexcept { + return m_base_iterator != rhs.m_base_iterator; + } + + /// @brief Get the mapping key node pointed by the base iterator. + /// @return Reference to the mapping key node. + typename Iterator::reference key() const { + return m_base_iterator.key(); + } + + /// @brief Get the mapping value node pointed by the base iterator. + /// @return Reference to the mapping value node. + typename Iterator::reference value() const noexcept { + return m_base_iterator.value(); + } + +private: + /// The base iterator object. + Iterator m_base_iterator {}; +}; + +/// @brief A helper struct which allows accessing node iterator member functions in range-based for loops. +/// @tparam BasicNodeType A basic_node template instance type. +template +class map_range_proxy { + static_assert( + is_basic_node>::value, + "map_range_proxy only accepts a basic_node type as its template parameter."); + +public: + /// @brief The type of non-const iterators. + using iterator = map_iterator_proxy::value, typename BasicNodeType::const_iterator, + typename BasicNodeType::iterator>::type>; + + /// @brief The type of const iterators. + using const_iterator = map_iterator_proxy; + + /// @brief Constructs a map_range_proxy object with a BasicNodeType object. + /// @param map A mapping node object. + map_range_proxy(BasicNodeType& map) noexcept + : mp_map(&map) { + } + + /// @brief Copy constructs a map_range_proxy object. + map_range_proxy(const map_range_proxy&) = default; + + /// @brief Copy assigns a map_range_proxy object. + /// @return Reference to this map_range_proxy object. + map_range_proxy& operator=(const map_range_proxy&) = default; + + /// @brief Move constructs a map_range_proxy object. + map_range_proxy(map_range_proxy&&) = default; + + /// @brief Move assigns a map_range_proxy object. + /// @return Reference to this map_range_proxy object. + map_range_proxy& operator=(map_range_proxy&&) = default; + + /// @brief Destructs a map_range_proxy object. + ~map_range_proxy() = default; + + /// @brief Get an iterator to the first element. + /// @return An iterator to the first element. + iterator begin() noexcept { + return {mp_map->begin()}; + } + + /// @brief Get a const iterator to the first element. + /// @return A const iterator to the first element. + const_iterator begin() const noexcept { + return {mp_map->cbegin()}; + } + + /// @brief Get an iterator to the past-the-last element. + /// @return An iterator to the past-the-last element. + iterator end() noexcept { + return {mp_map->end()}; + } + + /// @brief Get a const iterator to the past-the-last element. + /// @return A const iterator to the past-the-last element. + const_iterator end() const noexcept { + return {mp_map->cend()}; + } + +private: + /// Pointer to the mapping node object. (non-null) + BasicNodeType* mp_map {nullptr}; +}; + +FK_YAML_DETAIL_NAMESPACE_END + +#endif /* FK_YAML_DETAIL_MAP_RANGE_PROXY_HPP */ diff --git a/include/fkYAML/detail/output/serializer.hpp b/include/fkYAML/detail/output/serializer.hpp index 6eb721be..97d95ddf 100644 --- a/include/fkYAML/detail/output/serializer.hpp +++ b/include/fkYAML/detail/output/serializer.hpp @@ -175,27 +175,30 @@ class basic_serializer { } break; case node_type::MAPPING: - for (auto itr = node.begin(); itr != node.end(); ++itr) { + for (auto itr : node.map_items()) { insert_indentation(cur_indent, str); - bool is_appended = try_append_alias(itr.key(), false, str); + // serialize a mapping key node. + const auto& key_node = itr.key(); + + bool is_appended = try_append_alias(key_node, false, str); if (is_appended) { // The trailing white space is necessary since anchor names can contain a colon (:) at its end. str += " "; } else { - const bool is_anchor_appended = try_append_anchor(itr.key(), false, str); - const bool is_tag_appended = try_append_tag(itr.key(), is_anchor_appended, str); + const bool is_anchor_appended = try_append_anchor(key_node, false, str); + const bool is_tag_appended = try_append_tag(key_node, is_anchor_appended, str); if (is_anchor_appended || is_tag_appended) { str += " "; } - const bool is_container = !itr.key().is_scalar(); + const bool is_container = !key_node.is_scalar(); if (is_container) { str += "? "; } const auto indent = static_cast(get_cur_indent(str)); - serialize_node(itr.key(), indent, str); + serialize_node(key_node, indent, str); if (is_container) { // a newline code is already inserted in the above serialize_node() call. insert_indentation(indent - 2, str); @@ -204,19 +207,22 @@ class basic_serializer { str += ":"; - is_appended = try_append_alias(*itr, true, str); + // serialize a mapping value node. + const auto& value_node = itr.value(); + + is_appended = try_append_alias(value_node, true, str); if (is_appended) { str += "\n"; continue; } - try_append_anchor(*itr, true, str); - try_append_tag(*itr, true, str); + try_append_anchor(value_node, true, str); + try_append_tag(value_node, true, str); const bool is_scalar = itr->is_scalar(); if (is_scalar) { str += " "; - serialize_node(*itr, cur_indent, str); + serialize_node(value_node, cur_indent, str); str += "\n"; continue; } @@ -224,15 +230,15 @@ class basic_serializer { const bool is_empty = itr->empty(); if (!is_empty) { str += "\n"; - serialize_node(*itr, cur_indent + 2, str); + serialize_node(value_node, cur_indent + 2, str); continue; } // an empty sequence or mapping - if (itr->is_sequence()) { + if (value_node.is_sequence()) { str += " []\n"; } - else /*itr->is_mapping()*/ { + else /*value_node.is_mapping()*/ { str += " {}\n"; } } diff --git a/include/fkYAML/detail/reverse_iterator.hpp b/include/fkYAML/detail/reverse_iterator.hpp index ccd2db5a..da064e0e 100644 --- a/include/fkYAML/detail/reverse_iterator.hpp +++ b/include/fkYAML/detail/reverse_iterator.hpp @@ -64,11 +64,18 @@ class reverse_iterator { : m_current(i) { } + /// @brief Copy constructs a reverse_iterator object with a compatible reverse_iterator object. + /// @tparam U A compatible iterator type with Iterator. + /// @param other A compatible reverse_iterator object. template >::value, int> = 0> reverse_iterator(const reverse_iterator& other) noexcept : m_current(other.base()) { } + /// @brief Copy assigns a reverse_iterator object with a compatible reverse_iterator object. + /// @tparam U A compatible iterator type with Iterator. + /// @param other A compatible reverse_iterator object. + /// @return Reference to this reverse_iterator object. template >::value, int> = 0> reverse_iterator& operator=(const reverse_iterator& other) noexcept { m_current = other.base(); @@ -172,34 +179,71 @@ class reverse_iterator { } private: + /// Iterator m_current; }; +/// @brief Check equality between reverse_iterator objects. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if the two reverse_iterator objects are equal, false otherwise. template inline bool operator==(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() == rhs.base(); } +/// @brief Check inequality between reverse_iterator objects. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if the two reverse_iterator objects are not equal, false otherwise. template inline bool operator!=(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() != rhs.base(); } +/// @brief Check if `lhs` is less than `rhs`. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if `lhs` is less than `rhs`, false otherwise. template inline bool operator<(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() > rhs.base(); } +/// @brief Check if `lhs` is less than or equal to `rhs`. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if `lhs` is less than or equal to `rhs`, false otherwise. template inline bool operator<=(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() >= rhs.base(); } +/// @brief Check if `lhs` is greater than `rhs`. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if `lhs` is greater than `rhs`, false otherwise. template inline bool operator>(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() < rhs.base(); } +/// @brief Check if `lhs` is greater than or equal to `rhs`. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if `lhs` is greater than or equal to `rhs`, false otherwise. template inline bool operator>=(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() <= rhs.base(); diff --git a/include/fkYAML/node.hpp b/include/fkYAML/node.hpp index 969ea392..5f35752e 100644 --- a/include/fkYAML/node.hpp +++ b/include/fkYAML/node.hpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -134,6 +135,14 @@ class basic_node { /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/yaml_version_t/ using yaml_version_t = detail::yaml_version_t; + /// @brief A type for mapping range objects for the map_items() function. + /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/map_range/ + using map_range = fkyaml::detail::map_range_proxy; + + /// @brief A type for constant mapping range objects for the map_items() function. + /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/map_range/ + using const_map_range = fkyaml::detail::map_range_proxy; + private: template friend struct fkyaml::detail::external_node_constructor; @@ -1594,6 +1603,28 @@ class basic_node { return rend(); } + /// @brief Returns a range of mapping entries. + /// @throw `type_error` if this basic_node is not a mapping. + /// @return A range of mapping entries. + /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/map_items/ + map_range map_items() { + if FK_YAML_UNLIKELY (!is_mapping()) { + throw type_error("map_items() cannot be called on a non-mapping node.", get_type()); + } + return {*this}; + } + + /// @brief Returns a const range of mapping entries. + /// @throw `type_error` if this basic_node is not a mapping. + /// @return A const range of mapping entries. + /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/map_items/ + const_map_range map_items() const { + if FK_YAML_UNLIKELY (!is_mapping()) { + throw type_error("map_items() cannot be called on a non-mapping node.", get_type()); + } + return {*this}; + } + private: /// @brief Returns the pointer to the node_value object of either this node or the associated anchor node. /// @return The pointer to the node_value object of either this node or the associated anchor node. diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 36d2290c..0b0aca65 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -9949,7 +9949,7 @@ class iterator { /// @brief A dereference operator of the iterator class. /// @return reference Reference to the Node object internally referenced by the actual iterator object. - reference operator*() noexcept { + reference operator*() const noexcept { if (m_inner_iterator_type == iterator_t::SEQUENCE) { return *(m_iterator_holder.sequence_iterator); } @@ -10150,7 +10150,7 @@ class iterator { /// @brief Get reference to the YAML node of the current iterator. /// @return Reference to the YAML node of the current iterator. - reference value() noexcept { + reference value() const noexcept { return operator*(); } @@ -10161,10 +10161,254 @@ class iterator { iterator_holder m_iterator_holder {}; }; +/// @brief Get reference to a mapping key node. +/// @tparam ValueType The iterator value type. +/// @tparam I The element index. +/// @param i An iterator object. +/// @return Reference to a mapping key node. +template = 0> +inline auto get(const iterator& i) -> decltype(i.key()) { + return i.key(); +} + +/// @brief Get reference to a mapping value node. +/// @tparam ValueType The iterator value type. +/// @tparam I The element index +/// @param i An iterator object. +/// @return Reference to a mapping value node. +template = 0> +inline auto get(const iterator& i) -> decltype(i.value()) { + return i.value(); +} + FK_YAML_DETAIL_NAMESPACE_END +namespace std { + +#ifdef __clang__ +// clang emits warnings against mixed usage of class/struct for tuple_size/tuple_element. +// see also: https://groups.google.com/a/isocpp.org/g/std-discussion/c/QC-AMb5oO1w +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wmismatched-tags" +#endif + +/// @brief Parcial pecialization of std::tuple_size for iterator class. +/// @tparam ValueType The iterator value type. +template +// NOLINTNEXTLINE(cert-dcl58-cpp) +struct tuple_size<::fkyaml::detail::iterator> : integral_constant {}; + +/// @brief Parcial specialization of std::tuple_element for iterator class. +/// @tparam ValueType The iterator value type. +/// @tparam I The element index. +template +// NOLINTNEXTLINE(cert-dcl58-cpp) +struct tuple_element> { + using type = decltype(get(std::declval<::fkyaml::detail::iterator>())); +}; + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +} // namespace std + #endif /* FK_YAML_DETAIL_ITERATOR_HPP */ +// #include +// _______ __ __ __ _____ __ __ __ +// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +// +// SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani +// SPDX-License-Identifier: MIT + +#ifndef FK_YAML_DETAIL_MAP_RANGE_PROXY_HPP +#define FK_YAML_DETAIL_MAP_RANGE_PROXY_HPP + +// #include + +// #include + + +FK_YAML_DETAIL_NAMESPACE_BEGIN + +/// @brief A helper iterator class which wraps a mapping iterator object. +/// @tparam Iterator The base iterator type. +template +class map_iterator_proxy { +public: + /// @brief The type of the pointed-to elements by base iterators. + using value_type = Iterator; + + /// @brief The type to represent difference between the pointed-to elements by base iterators. + using difference_type = std::ptrdiff_t; + + /// @brief The type of the pointed-to element references by base iterators. + using reference = value_type&; + + /// @brief The type of the pointed-to element pointers by base iterators. + using pointer = value_type*; + + /// @brief The iterator category. + using iterator_category = std::forward_iterator_tag; + + /// @brief Constructs a map_iterator_proxy object. + map_iterator_proxy() = default; + + /// @brief Constructs a map_iterator_proxy object with an Iterator object. + /// @param i A base iterator object. + map_iterator_proxy(const Iterator& i) noexcept + : m_base_iterator(i) { + } + + /// @brief Copy constructs a map_iterator_proxy object. + map_iterator_proxy(const map_iterator_proxy&) = default; + + /// @brief Copy assigns a map_iterator_proxy object. + map_iterator_proxy& operator=(const map_iterator_proxy&) = default; + + /// @brief Move constructs a map_iterator_proxy object. + map_iterator_proxy(map_iterator_proxy&&) = default; + + /// @biref Move assigns a map_iterator_proxy object. + map_iterator_proxy& operator=(map_iterator_proxy&&) = default; + + /// @brief Destructs a map_iterator_proxy object. + ~map_iterator_proxy() = default; + + /// @brief Get reference to the base iterator object. + /// @return Reference to the base iterator object. + reference operator*() noexcept { + return m_base_iterator; + } + + /// @brief Get pointer to the base iterator object. + /// @return Pointer to the base iterator object. + pointer operator->() noexcept { + return &m_base_iterator; + } + + /// @brief Pre-increments the base iterator object. + /// @return Reference to this map_iterator_proxy object. + map_iterator_proxy& operator++() noexcept { + ++m_base_iterator; + return *this; + } + + /// @brief Post-increments the base iterator object. + /// @return A map_iterator_proxy object with its base iterator incremented. + map_iterator_proxy operator++(int) & noexcept { + auto result = *this; + ++(*this); + return result; + } + + /// @brief Check equality between map_iterator_proxy objects. + /// @param rhs A map_iterator_proxy object to compare with. + /// @return true if this map_iterator_proxy object is equal to `rhs`, false otherwise. + bool operator==(const map_iterator_proxy& rhs) const noexcept { + return m_base_iterator == rhs.m_base_iterator; + } + + /// @brief Check inequality between map_iterator_proxy objects. + /// @param rhs A map_iterator_proxy object to compare with. + /// @return true if this map_iterator_proxy object is not equal to `rhs`, false otherwise. + bool operator!=(const map_iterator_proxy& rhs) const noexcept { + return m_base_iterator != rhs.m_base_iterator; + } + + /// @brief Get the mapping key node pointed by the base iterator. + /// @return Reference to the mapping key node. + typename Iterator::reference key() const { + return m_base_iterator.key(); + } + + /// @brief Get the mapping value node pointed by the base iterator. + /// @return Reference to the mapping value node. + typename Iterator::reference value() const noexcept { + return m_base_iterator.value(); + } + +private: + /// The base iterator object. + Iterator m_base_iterator {}; +}; + +/// @brief A helper struct which allows accessing node iterator member functions in range-based for loops. +/// @tparam BasicNodeType A basic_node template instance type. +template +class map_range_proxy { + static_assert( + is_basic_node>::value, + "map_range_proxy only accepts a basic_node type as its template parameter."); + +public: + /// @brief The type of non-const iterators. + using iterator = map_iterator_proxy::value, typename BasicNodeType::const_iterator, + typename BasicNodeType::iterator>::type>; + + /// @brief The type of const iterators. + using const_iterator = map_iterator_proxy; + + /// @brief Constructs a map_range_proxy object with a BasicNodeType object. + /// @param map A mapping node object. + map_range_proxy(BasicNodeType& map) noexcept + : mp_map(&map) { + } + + /// @brief Copy constructs a map_range_proxy object. + map_range_proxy(const map_range_proxy&) = default; + + /// @brief Copy assigns a map_range_proxy object. + /// @return Reference to this map_range_proxy object. + map_range_proxy& operator=(const map_range_proxy&) = default; + + /// @brief Move constructs a map_range_proxy object. + map_range_proxy(map_range_proxy&&) = default; + + /// @brief Move assigns a map_range_proxy object. + /// @return Reference to this map_range_proxy object. + map_range_proxy& operator=(map_range_proxy&&) = default; + + /// @brief Destructs a map_range_proxy object. + ~map_range_proxy() = default; + + /// @brief Get an iterator to the first element. + /// @return An iterator to the first element. + iterator begin() noexcept { + return {mp_map->begin()}; + } + + /// @brief Get a const iterator to the first element. + /// @return A const iterator to the first element. + const_iterator begin() const noexcept { + return {mp_map->cbegin()}; + } + + /// @brief Get an iterator to the past-the-last element. + /// @return An iterator to the past-the-last element. + iterator end() noexcept { + return {mp_map->end()}; + } + + /// @brief Get a const iterator to the past-the-last element. + /// @return A const iterator to the past-the-last element. + const_iterator end() const noexcept { + return {mp_map->cend()}; + } + +private: + /// Pointer to the mapping node object. (non-null) + BasicNodeType* mp_map {nullptr}; +}; + +FK_YAML_DETAIL_NAMESPACE_END + +#endif /* FK_YAML_DETAIL_MAP_RANGE_PROXY_HPP */ + // #include // #include @@ -10549,27 +10793,30 @@ class basic_serializer { } break; case node_type::MAPPING: - for (auto itr = node.begin(); itr != node.end(); ++itr) { + for (auto itr : node.map_items()) { insert_indentation(cur_indent, str); - bool is_appended = try_append_alias(itr.key(), false, str); + // serialize a mapping key node. + const auto& key_node = itr.key(); + + bool is_appended = try_append_alias(key_node, false, str); if (is_appended) { // The trailing white space is necessary since anchor names can contain a colon (:) at its end. str += " "; } else { - const bool is_anchor_appended = try_append_anchor(itr.key(), false, str); - const bool is_tag_appended = try_append_tag(itr.key(), is_anchor_appended, str); + const bool is_anchor_appended = try_append_anchor(key_node, false, str); + const bool is_tag_appended = try_append_tag(key_node, is_anchor_appended, str); if (is_anchor_appended || is_tag_appended) { str += " "; } - const bool is_container = !itr.key().is_scalar(); + const bool is_container = !key_node.is_scalar(); if (is_container) { str += "? "; } const auto indent = static_cast(get_cur_indent(str)); - serialize_node(itr.key(), indent, str); + serialize_node(key_node, indent, str); if (is_container) { // a newline code is already inserted in the above serialize_node() call. insert_indentation(indent - 2, str); @@ -10578,19 +10825,22 @@ class basic_serializer { str += ":"; - is_appended = try_append_alias(*itr, true, str); + // serialize a mapping value node. + const auto& value_node = itr.value(); + + is_appended = try_append_alias(value_node, true, str); if (is_appended) { str += "\n"; continue; } - try_append_anchor(*itr, true, str); - try_append_tag(*itr, true, str); + try_append_anchor(value_node, true, str); + try_append_tag(value_node, true, str); const bool is_scalar = itr->is_scalar(); if (is_scalar) { str += " "; - serialize_node(*itr, cur_indent, str); + serialize_node(value_node, cur_indent, str); str += "\n"; continue; } @@ -10598,15 +10848,15 @@ class basic_serializer { const bool is_empty = itr->empty(); if (!is_empty) { str += "\n"; - serialize_node(*itr, cur_indent + 2, str); + serialize_node(value_node, cur_indent + 2, str); continue; } // an empty sequence or mapping - if (itr->is_sequence()) { + if (value_node.is_sequence()) { str += " []\n"; } - else /*itr->is_mapping()*/ { + else /*value_node.is_mapping()*/ { str += " {}\n"; } } @@ -10821,11 +11071,18 @@ class reverse_iterator { : m_current(i) { } + /// @brief Copy constructs a reverse_iterator object with a compatible reverse_iterator object. + /// @tparam U A compatible iterator type with Iterator. + /// @param other A compatible reverse_iterator object. template >::value, int> = 0> reverse_iterator(const reverse_iterator& other) noexcept : m_current(other.base()) { } + /// @brief Copy assigns a reverse_iterator object with a compatible reverse_iterator object. + /// @tparam U A compatible iterator type with Iterator. + /// @param other A compatible reverse_iterator object. + /// @return Reference to this reverse_iterator object. template >::value, int> = 0> reverse_iterator& operator=(const reverse_iterator& other) noexcept { m_current = other.base(); @@ -10929,34 +11186,71 @@ class reverse_iterator { } private: + /// Iterator m_current; }; +/// @brief Check equality between reverse_iterator objects. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if the two reverse_iterator objects are equal, false otherwise. template inline bool operator==(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() == rhs.base(); } +/// @brief Check inequality between reverse_iterator objects. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if the two reverse_iterator objects are not equal, false otherwise. template inline bool operator!=(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() != rhs.base(); } +/// @brief Check if `lhs` is less than `rhs`. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if `lhs` is less than `rhs`, false otherwise. template inline bool operator<(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() > rhs.base(); } +/// @brief Check if `lhs` is less than or equal to `rhs`. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if `lhs` is less than or equal to `rhs`, false otherwise. template inline bool operator<=(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() >= rhs.base(); } +/// @brief Check if `lhs` is greater than `rhs`. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if `lhs` is greater than `rhs`, false otherwise. template inline bool operator>(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() < rhs.base(); } +/// @brief Check if `lhs` is greater than or equal to `rhs`. +/// @tparam IteratorL Base iterator type for `lhs`. +/// @tparam IteratorR Base iterator type for `rhs`. +/// @param lhs A reverse_iterator object. +/// @param rhs A reverse_iterator object. +/// @return true if `lhs` is greater than or equal to `rhs`, false otherwise. template inline bool operator>=(const reverse_iterator& lhs, const reverse_iterator& rhs) { return lhs.base() <= rhs.base(); @@ -12401,6 +12695,14 @@ class basic_node { /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/yaml_version_t/ using yaml_version_t = detail::yaml_version_t; + /// @brief A type for mapping range objects for the map_items() function. + /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/map_range/ + using map_range = fkyaml::detail::map_range_proxy; + + /// @brief A type for constant mapping range objects for the map_items() function. + /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/map_range/ + using const_map_range = fkyaml::detail::map_range_proxy; + private: template friend struct fkyaml::detail::external_node_constructor; @@ -13861,6 +14163,28 @@ class basic_node { return rend(); } + /// @brief Returns a range of mapping entries. + /// @throw `type_error` if this basic_node is not a mapping. + /// @return A range of mapping entries. + /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/map_items/ + map_range map_items() { + if FK_YAML_UNLIKELY (!is_mapping()) { + throw type_error("map_items() cannot be called on a non-mapping node.", get_type()); + } + return {*this}; + } + + /// @brief Returns a const range of mapping entries. + /// @throw `type_error` if this basic_node is not a mapping. + /// @return A const range of mapping entries. + /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/map_items/ + const_map_range map_items() const { + if FK_YAML_UNLIKELY (!is_mapping()) { + throw type_error("map_items() cannot be called on a non-mapping node.", get_type()); + } + return {*this}; + } + private: /// @brief Returns the pointer to the node_value object of either this node or the associated anchor node. /// @return The pointer to the node_value object of either this node or the associated anchor node. diff --git a/tests/unit_test/test_node_class.cpp b/tests/unit_test/test_node_class.cpp index ec880d41..d2ad8157 100644 --- a/tests/unit_test/test_node_class.cpp +++ b/tests/unit_test/test_node_class.cpp @@ -4489,6 +4489,64 @@ TEST_CASE("Node_ConstReverseEnd") { } } +TEST_CASE("Node_MapItems") { + int i = 0; + fkyaml::node keys[2] = {"bar", "foo"}; + fkyaml::node values[2] = {-456, 123}; + + SECTION("non-const version") { + fkyaml::node map = {{"foo", 123}, {"bar", -456}}; + + for (auto& entry : map.map_items()) { + REQUIRE(entry.key() == keys[i]); + REQUIRE(entry.value() == values[i]); + ++i; + } + + i = 0; + for (const auto& entry : map.map_items()) { + REQUIRE(entry.key() == keys[i]); + REQUIRE(entry.value() == values[i]); + ++i; + } + } + + SECTION("const version") { + const fkyaml::node c_map = {{"foo", 123}, {"bar", -456}}; + + for (const auto& c_entry : c_map.map_items()) { + REQUIRE(c_entry.key() == keys[i]); + REQUIRE(c_entry.value() == values[i]); + ++i; + } + } + + SECTION("not mapping") { + auto non_mapping = GENERATE( + fkyaml::node::sequence(), + fkyaml::node(nullptr), + fkyaml::node(true), + fkyaml::node(123), + fkyaml::node(3.14), + fkyaml::node("foo")); + const auto const_non_mapping = non_mapping; + REQUIRE_THROWS_AS(non_mapping.map_items(), fkyaml::type_error); + REQUIRE_THROWS_AS(const_non_mapping.map_items(), fkyaml::type_error); + } + +#if defined(__cpp_structured_bindings) && __cpp_structured_bindings >= 201606L + SECTION("structured bindings") { + fkyaml::node map = {{"foo", 123}, {"bar", -456}}; + + for (auto& [key, value] : map.map_items()) { + REQUIRE(key == keys[i]); + REQUIRE(value == values[i]); + ++i; + } + } +#endif +} + // // test cases for swap // From f6bae95fc8f2547b5390f3a8f013640726e777e1 Mon Sep 17 00:00:00 2001 From: johan-gson <32481323+johan-gson@users.noreply.github.com> Date: Thu, 9 Jan 2025 12:31:35 +0100 Subject: [PATCH 15/18] Fix: made sure that empty documents just serialize to [] or {} (#460) * Fix: made sure that empty documents just serialize to [] or {} * fixed tabs * fixed tabs again, missed a few ones --- include/fkYAML/detail/output/serializer.hpp | 24 +++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/include/fkYAML/detail/output/serializer.hpp b/include/fkYAML/detail/output/serializer.hpp index 97d95ddf..50640a0c 100644 --- a/include/fkYAML/detail/output/serializer.hpp +++ b/include/fkYAML/detail/output/serializer.hpp @@ -137,6 +137,10 @@ class basic_serializer { void serialize_node(const BasicNodeType& node, const uint32_t cur_indent, std::string& str) { switch (node.get_type()) { case node_type::SEQUENCE: + if (node.size() == 0) { + str += "[]\n"; + return; + } for (const auto& seq_item : node) { insert_indentation(cur_indent, str); str += "-"; @@ -175,6 +179,10 @@ class basic_serializer { } break; case node_type::MAPPING: + if (node.size() == 0) { + str += "{}\n"; + return; + } for (auto itr : node.map_items()) { insert_indentation(cur_indent, str); @@ -228,19 +236,13 @@ class basic_serializer { } const bool is_empty = itr->empty(); - if (!is_empty) { - str += "\n"; - serialize_node(value_node, cur_indent + 2, str); - continue; - } - - // an empty sequence or mapping - if (value_node.is_sequence()) { - str += " []\n"; + if (is_empty) { + str += " "; } - else /*value_node.is_mapping()*/ { - str += " {}\n"; + else { + str += "\n"; } + serialize_node(value_node, cur_indent + 2, str); } break; case node_type::NULL_OBJECT: From 6d5f1ccc1082f47d552df151d8bcb562171d0e82 Mon Sep 17 00:00:00 2001 From: johan-gson <32481323+johan-gson@users.noreply.github.com> Date: Thu, 9 Jan 2025 11:42:31 +0000 Subject: [PATCH 16/18] [bot] run clang-format & amalgamation --- single_include/fkYAML/node.hpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 0b0aca65..9b774372 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -10755,6 +10755,10 @@ class basic_serializer { void serialize_node(const BasicNodeType& node, const uint32_t cur_indent, std::string& str) { switch (node.get_type()) { case node_type::SEQUENCE: + if (node.size() == 0) { + str += "[]\n"; + return; + } for (const auto& seq_item : node) { insert_indentation(cur_indent, str); str += "-"; @@ -10793,6 +10797,10 @@ class basic_serializer { } break; case node_type::MAPPING: + if (node.size() == 0) { + str += "{}\n"; + return; + } for (auto itr : node.map_items()) { insert_indentation(cur_indent, str); @@ -10846,19 +10854,13 @@ class basic_serializer { } const bool is_empty = itr->empty(); - if (!is_empty) { - str += "\n"; - serialize_node(value_node, cur_indent + 2, str); - continue; - } - - // an empty sequence or mapping - if (value_node.is_sequence()) { - str += " []\n"; + if (is_empty) { + str += " "; } - else /*value_node.is_mapping()*/ { - str += " {}\n"; + else { + str += "\n"; } + serialize_node(value_node, cur_indent + 2, str); } break; case node_type::NULL_OBJECT: From 50f28a0cc088ea13023ace70258f50fcb4ed7f4a Mon Sep 17 00:00:00 2001 From: fktn Date: Thu, 9 Jan 2025 23:33:57 +0900 Subject: [PATCH 17/18] Add test cases for serializing root empty collections (#461) * added test cases for serializing root empty collections * fixed path filtering in ubuntu.yml --- .github/workflows/ubuntu.yml | 4 ++-- tests/unit_test/test_serializer_class.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 6f0aac95..3f15ff06 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -21,8 +21,8 @@ on: - cmake/** - include/** - single_include/** - - test/** - - tool/** + - tests/** + - tools/** - .clang-tidy - CMakeLists.txt - Makefile diff --git a/tests/unit_test/test_serializer_class.cpp b/tests/unit_test/test_serializer_class.cpp index 4e25634c..8d418ef6 100644 --- a/tests/unit_test/test_serializer_class.cpp +++ b/tests/unit_test/test_serializer_class.cpp @@ -58,6 +58,16 @@ TEST_CASE("Serializer_EmptyCollectionNode") { std::string expected = "foo: {}\n"; REQUIRE(serializer.serialize(map) == expected); } + + SECTION("root empty sequence") { + std::string expected = "[]\n"; + REQUIRE(serializer.serialize(seq) == expected); + } + + SECTION("root empty mapping") { + std::string expected = "{}\n"; + REQUIRE(serializer.serialize(map) == expected); + } } TEST_CASE("Serializer_NullNode") { From 0d43eff4ca28416e039329c2be45b540f5224929 Mon Sep 17 00:00:00 2001 From: fktn Date: Sat, 11 Jan 2025 10:33:30 +0900 Subject: [PATCH 18/18] bump version to 0.4.1 --- .reuse/templates/fkYAML.jinja2 | 2 +- .reuse/templates/fkYAML_support.jinja2 | 2 +- CHANGELOG.md | 21 ++ CMakeLists.txt | 2 +- Makefile | 2 +- docs/docs/home/releases.md | 195 +++++++++++++----- examples/apis/macros/versions.output | 2 +- fkYAML.natvis | 24 +-- include/fkYAML/detail/assert.hpp | 2 +- .../fkYAML/detail/conversions/from_node.hpp | 2 +- .../fkYAML/detail/conversions/scalar_conv.hpp | 2 +- include/fkYAML/detail/conversions/to_node.hpp | 2 +- .../fkYAML/detail/conversions/to_string.hpp | 2 +- include/fkYAML/detail/document_metainfo.hpp | 2 +- .../fkYAML/detail/encodings/uri_encoding.hpp | 2 +- .../detail/encodings/utf_encode_detector.hpp | 2 +- .../fkYAML/detail/encodings/utf_encode_t.hpp | 2 +- .../fkYAML/detail/encodings/utf_encodings.hpp | 2 +- .../fkYAML/detail/encodings/yaml_escaper.hpp | 2 +- .../detail/input/block_scalar_header.hpp | 2 +- include/fkYAML/detail/input/deserializer.hpp | 2 +- include/fkYAML/detail/input/input_adapter.hpp | 2 +- .../fkYAML/detail/input/lexical_analyzer.hpp | 2 +- .../fkYAML/detail/input/position_tracker.hpp | 2 +- include/fkYAML/detail/input/scalar_parser.hpp | 2 +- .../fkYAML/detail/input/scalar_scanner.hpp | 2 +- include/fkYAML/detail/input/tag_resolver.hpp | 2 +- include/fkYAML/detail/input/tag_t.hpp | 2 +- include/fkYAML/detail/iterator.hpp | 2 +- .../detail/macros/cpp_config_macros.hpp | 2 +- .../fkYAML/detail/macros/define_macros.hpp | 2 +- .../fkYAML/detail/macros/version_macros.hpp | 6 +- include/fkYAML/detail/map_range_proxy.hpp | 2 +- include/fkYAML/detail/meta/detect.hpp | 2 +- .../detail/meta/input_adapter_traits.hpp | 2 +- include/fkYAML/detail/meta/node_traits.hpp | 2 +- include/fkYAML/detail/meta/stl_supplement.hpp | 2 +- include/fkYAML/detail/meta/type_traits.hpp | 2 +- include/fkYAML/detail/node_attrs.hpp | 2 +- include/fkYAML/detail/node_property.hpp | 2 +- include/fkYAML/detail/node_ref_storage.hpp | 2 +- include/fkYAML/detail/output/serializer.hpp | 2 +- include/fkYAML/detail/reverse_iterator.hpp | 2 +- include/fkYAML/detail/str_view.hpp | 2 +- include/fkYAML/detail/string_formatter.hpp | 2 +- .../fkYAML/detail/types/lexical_token_t.hpp | 2 +- include/fkYAML/detail/types/node_t.hpp | 2 +- .../fkYAML/detail/types/yaml_version_t.hpp | 2 +- include/fkYAML/exception.hpp | 2 +- include/fkYAML/fkyaml_fwd.hpp | 2 +- include/fkYAML/node.hpp | 2 +- include/fkYAML/node_type.hpp | 2 +- include/fkYAML/node_value_converter.hpp | 2 +- include/fkYAML/ordered_map.hpp | 2 +- include/fkYAML/yaml_version_type.hpp | 2 +- single_include/fkYAML/fkyaml_fwd.hpp | 8 +- single_include/fkYAML/node.hpp | 98 ++++----- tools/natvis_generator/params.json | 2 +- 58 files changed, 280 insertions(+), 176 deletions(-) diff --git a/.reuse/templates/fkYAML.jinja2 b/.reuse/templates/fkYAML.jinja2 index 96628f7f..0e7948d8 100644 --- a/.reuse/templates/fkYAML.jinja2 +++ b/.reuse/templates/fkYAML.jinja2 @@ -1,6 +1,6 @@ _______ __ __ __ _____ __ __ __ | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -| __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +| __| _ < \_ _/| ___ | _ | |___ version 0.4.1 |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML {% for copyright_line in copyright_lines %} diff --git a/.reuse/templates/fkYAML_support.jinja2 b/.reuse/templates/fkYAML_support.jinja2 index bb3fe2e2..c5e26dbc 100644 --- a/.reuse/templates/fkYAML_support.jinja2 +++ b/.reuse/templates/fkYAML_support.jinja2 @@ -1,6 +1,6 @@ _______ __ __ __ _____ __ __ __ | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -| __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +| __| _ < \_ _/| ___ | _ | |___ version 0.4.1 |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML {% for copyright_line in copyright_lines %} diff --git a/CHANGELOG.md b/CHANGELOG.md index cbea1011..19be0bee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [v0.4.1](https://github.com/fktn-k/fkYAML/releases/tag/v0.4.1) (2025-01-11) + +[Full Changelog](https://github.com/fktn-k/fkYAML/compare/v0.4.0...v0.4.1) + +- Fix: made sure that empty documents just serialize to \[\] or {} [\#460](https://github.com/fktn-k/fkYAML/pull/460) ([johan-gson](https://github.com/johan-gson)) +- fix: Fixed a bug where serialize didn't write out empty vectors and mappings [\#456](https://github.com/fktn-k/fkYAML/pull/456) ([johan-gson](https://github.com/johan-gson)) +- Fix bad indentation detection for block collection entries [\#451](https://github.com/fktn-k/fkYAML/pull/451) ([fktn-k](https://github.com/fktn-k)) +- Emit an error if ":" is missing after a mapping key [\#450](https://github.com/fktn-k/fkYAML/pull/450) ([fktn-k](https://github.com/fktn-k)) + +- Add test cases for serializing root empty collections [\#461](https://github.com/fktn-k/fkYAML/pull/461) ([fktn-k](https://github.com/fktn-k)) +- Mapping key/value access in range based for loops [\#458](https://github.com/fktn-k/fkYAML/pull/458) ([fktn-k](https://github.com/fktn-k)) +- Add test cases for serializing empty collection nodes [\#457](https://github.com/fktn-k/fkYAML/pull/457) ([fktn-k](https://github.com/fktn-k)) +- Fix invalid paths for documentation & other tools [\#453](https://github.com/fktn-k/fkYAML/pull/453) ([fktn-k](https://github.com/fktn-k)) +- Update copyright year and directory structure [\#452](https://github.com/fktn-k/fkYAML/pull/452) ([fktn-k](https://github.com/fktn-k)) +- Optimize lexer implementation [\#448](https://github.com/fktn-k/fkYAML/pull/448) ([fktn-k](https://github.com/fktn-k)) +- Update workflow jobs for release artifacts [\#447](https://github.com/fktn-k/fkYAML/pull/447) ([fktn-k](https://github.com/fktn-k)) +- Revise the contents of API References [\#445](https://github.com/fktn-k/fkYAML/pull/445) ([fktn-k](https://github.com/fktn-k)) +- support std::forward\_list in from\_node [\#444](https://github.com/fktn-k/fkYAML/pull/444) ([fktn-k](https://github.com/fktn-k)) +- Add get\_value\_inplace API to basic\_node [\#443](https://github.com/fktn-k/fkYAML/pull/443) ([fktn-k](https://github.com/fktn-k)) +- Resolve CMake deprecation warning [\#442](https://github.com/fktn-k/fkYAML/pull/442) ([fktn-k](https://github.com/fktn-k)) + ## [v0.4.0](https://github.com/fktn-k/fkYAML/releases/tag/v0.4.0) (2024-12-10) [Full Changelog](https://github.com/fktn-k/fkYAML/compare/v0.3.14...v0.4.0) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6744faeb..261c59f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.8...3.10) project( fkYAML - VERSION 0.4.0 + VERSION 0.4.1 LANGUAGES CXX) ############################################################# diff --git a/Makefile b/Makefile index 62d1edc6..cfef0084 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ TOOL_SRCS = $(shell find tool -type f -name '*.cpp' | sort) # target version definition TARGET_MAJOR_VERSION := 0 TARGET_MINOR_VERSION := 4 -TARGET_PATCH_VERSION := 0 +TARGET_PATCH_VERSION := 1 TARGET_VERSION_FULL := $(TARGET_MAJOR_VERSION).$(TARGET_MINOR_VERSION).$(TARGET_PATCH_VERSION) VERSION_MACRO_FILE := include/fkYAML/detail/macros/version_macros.hpp diff --git a/docs/docs/home/releases.md b/docs/docs/home/releases.md index 5c6747fc..e1e9336e 100644 --- a/docs/docs/home/releases.md +++ b/docs/docs/home/releases.md @@ -1,5 +1,88 @@ # Releases +## **fkYAML version 0.4.1** + +!!! abstract "Release Packages" + + * CMake package of the multiple header version + * [fkYAML.zip](https://github.com/fktn-k/fkYAML/releases/download/v0.4.1/fkYAML.zip) + * [fkYAML.tgz](https://github.com/fktn-k/fkYAML/releases/download/v0.4.1/fkYAML.tgz) + * CMake package of the single header version + * [fkYAML_single_header.zip](https://github.com/fktn-k/fkYAML/releases/download/v0.4.1/fkYAML_single_header.zip) + * [fkYAML_single_header.tgz](https://github.com/fktn-k/fkYAML/releases/download/v0.4.1/fkYAML_single_header.tgz) + * minimum repository contents for CMake + * [fkYAML_min.zip](https://github.com/fktn-k/fkYAML/releases/download/v0.4.1/fkYAML_min.zip) + * [fkYAML_min.tgz](https://github.com/fktn-k/fkYAML/releases/download/v0.4.1/fkYAML_min.tgz) + * single headers + * [node.hpp](https://github.com/fktn-k/fkYAML/releases/download/v0.4.1/node.hpp) + * [fkyaml_fwd.hpp](https://github.com/fktn-k/fkYAML/releases/download/v0.4.1/fkyaml_fwd.hpp) + +### What's Changed + +#### :sparkles: New Features + +- Add get\_value\_inplace API to basic\_node ([\#443](https://github.com/fktn-k/fkYAML/pull/443), [fktn-k](https://github.com/fktn-k)) + - The new API `get_value_inplace()` converts a node value into a given type and writes the result into a given output parameter. + - The target type doesn't have to be default-constructible since the API doesn't construct an instance during the conversion. + - See [the dedicated API reference page](https://fktn-k.github.io/fkYAML/api/basic_node/get_value_inplace/) for more details. +- Mapping key/value access in range based for loops ([\#458](https://github.com/fktn-k/fkYAML/pull/458), [fktn-k](https://github.com/fktn-k)) + - Proposed by [sndth](https://github.com/sndth) in the discussion [\#400](https://github.com/fktn-k/fkYAML/discussions/400) + - The new API `map_items()` allows accessing mapping keys/values in range-based for loops. + - Structured binding support is added to `fkyaml::basic_node::iterator` and `fkyaml::basic_node::const_iterator`. + ```cpp + fkyaml::node mapping = {{"a", 123}, {"b", 3.14}}; + for (auto& [key, val] : mapping.map_items()) { + // `key` and `val` are both of type `fkyaml::node::reference`. + std::cout << "key: " << key << ", value: " << val << std::endl; + } + // output: + // key: a, value: 123 + // key: b, value: 3.14 + ``` + - See [the dedicated API reference page](https://fktn-k.github.io/fkYAML/api/basic_node/map_items/) for more details. +- support std::forward\_list in from\_node ([\#444](https://github.com/fktn-k/fkYAML/pull/444), [fktn-k](https://github.com/fktn-k)) + +#### :zap: Improvements + +- Resolve CMake deprecation warning ([\#442](https://github.com/fktn-k/fkYAML/pull/442), [fktn-k](https://github.com/fktn-k)) +- Optimize lexer implementation ([\#448](https://github.com/fktn-k/fkYAML/pull/448), [fktn-k](https://github.com/fktn-k)) + +#### :bug: Bug Fixes + +- Emit an error if ":" is missing after a mapping key ([\#450](https://github.com/fktn-k/fkYAML/pull/450), [fktn-k](https://github.com/fktn-k)) + - Reported by [sndth](https://github.com/sndth) in the issue [\#449](https://github.com/fktn-k/fkYAML/issues/449) +- Fix bad indentation detection for block collection entries ([\#451](https://github.com/fktn-k/fkYAML/pull/451), [fktn-k](https://github.com/fktn-k)) + - Reported by [sndth](https://github.com/sndth) in the issue [\#449](https://github.com/fktn-k/fkYAML/issues/449) +- Fix serialization of empty collections + - fix: Fixed a bug where serialize didn't write out empty vectors and mappings ([\#456](https://github.com/fktn-k/fkYAML/pull/456), [johan-gson](https://github.com/johan-gson)) + - Add test cases for serializing empty collection nodes ([\#457](https://github.com/fktn-k/fkYAML/pull/457), [fktn-k](https://github.com/fktn-k)) + - Fix: made sure that empty documents just serialize to \[\] or {} ([\#460](https://github.com/fktn-k/fkYAML/pull/460), [johan-gson](https://github.com/johan-gson)) + - Add test cases for serializing root empty collections ([\#461](https://github.com/fktn-k/fkYAML/pull/461), [fktn-k](https://github.com/fktn-k)) + +#### :robot: CI + +- Update workflow jobs for release artifacts ([\#447](https://github.com/fktn-k/fkYAML/pull/447), [fktn-k](https://github.com/fktn-k)) + - Adds new release artifacts (fkYAML_min.zip, fkYAML_min.tgz) which contain minimum required files for CMake. (roughly the top CMakeLists.txt & include|single_include directories) + - They reduces the cost of downloading unnecessary files for a client app by using the CMake FetchContent module. + ```cmake + FetchContent_Declare( + fkYAML + URL https://github.com/fktn-k/fkYAML/releases/download/v0.4.1/fkYAML_min.zip + ) + FetchContent_MakeAvailable(fkYAML) + ``` + +#### :memo: Documentation + +- Revise the contents of API References ([\#445](https://github.com/fktn-k/fkYAML/pull/445), [fktn-k](https://github.com/fktn-k)) +- Update copyright year and directory structure ([\#452](https://github.com/fktn-k/fkYAML/pull/452), [fktn-k](https://github.com/fktn-k)) +- Fix invalid paths for documentation & other tools ([\#453](https://github.com/fktn-k/fkYAML/pull/453), [fktn-k](https://github.com/fktn-k)) + +### Full Changelog +https://github.com/fktn-k/fkYAML/compare/v0.4.0...v0.4.1 + +--- + ## **fkYAML version 0.4.0** !!! abstract "Release Packages" @@ -22,48 +105,48 @@ Note that a breaking change has been made in the way of error handling when dese #### :boom: Breaking Changes - Stop throwing parse\_error on string-to-int/float conversion failures if not forced with tag ([\#431](https://github.com/fktn-k/fkYAML/pull/431), [fktn-k](https://github.com/fktn-k)) - - reported by [tomwpid](https://github.com/tomwpid) in the issue [\#428](https://github.com/fktn-k/fkYAML/issues/428) - - The library used to throw a `fkyaml::parse_error` upon conversion failures from a scalar to an integer or floating point value while parsing a YAML like this: - ```yaml - id: 6E-578 # "6E-578" is interpreted as a floating point value but not expressible as a `double` - # --> `fkyaml::parse_error` gets thrown due to the conversion failure. - ``` - - Such a conversion failure is now internally recovered by treating the scalar as a string scalar instead. + - reported by [tomwpid](https://github.com/tomwpid) in the issue [\#428](https://github.com/fktn-k/fkYAML/issues/428) + - The library used to throw a `fkyaml::parse_error` upon conversion failures from a scalar to an integer or floating point value while parsing a YAML like this: + ```yaml + id: 6E-578 # "6E-578" is interpreted as a floating point value but not expressible as a `double` + # --> `fkyaml::parse_error` gets thrown due to the conversion failure. + ``` + - Such a conversion failure is now internally recovered by treating the scalar as a string scalar instead. #### :sparkles: New Features - Support parsing multiline plain scalars ([\#432](https://github.com/fktn-k/fkYAML/pull/432), [fktn-k](https://github.com/fktn-k)) - - Parsing a YAML which contains multi-line plain (unquoted) scalars are now supported. - ```yaml - foo: this is - a multi-line - plain scalar # interpreted as "this is a multi-line plain scalar" - ``` + - Parsing a YAML which contains multi-line plain (unquoted) scalars are now supported. + ```yaml + foo: this is + a multi-line + plain scalar # interpreted as "this is a multi-line plain scalar" + ``` - Support reverse iterations over sequence/mapping nodes ([\#440](https://github.com/fktn-k/fkYAML/pull/440), [fktn-k](https://github.com/fktn-k)) - - You can now iterate over sequence/mapping elements in a reversed order like this: - ```cpp - // node is [1, 2, 3] - for (auto rit = node.rbegin(); rit != node.rend(); ++rit) { - std::cout << *rit << std::endl; - } - - // output: - // 3 - // 2 - // 1 - ``` + - You can now iterate over sequence/mapping elements in a reversed order like this: + ```cpp + // node is [1, 2, 3] + for (auto rit = node.rbegin(); rit != node.rend(); ++rit) { + std::cout << *rit << std::endl; + } + + // output: + // 3 + // 2 + // 1 + ``` #### :zap: Improvements - Resolve the C4800 warning when compiled with MSVC ([\#430](https://github.com/fktn-k/fkYAML/pull/430), [fktn-k](https://github.com/fktn-k)) - - reported by [tomwpid](https://github.com/tomwpid) in the issue [\#429](https://github.com/fktn-k/fkYAML/issues/429) + - reported by [tomwpid](https://github.com/tomwpid) in the issue [\#429](https://github.com/fktn-k/fkYAML/issues/429) - Make node iterators compatible with different value type const-ness ([\#438](https://github.com/fktn-k/fkYAML/pull/438), [fktn-k](https://github.com/fktn-k)) - - `fkyaml::node::iterator` and `fkyaml::node::const_iterator` are compatible in constructions, assignments and comparisons. + - `fkyaml::node::iterator` and `fkyaml::node::const_iterator` are compatible in constructions, assignments and comparisons. #### :bug: Bug Fixes - Emit error if an anchor is specified to an alias ([\#434](https://github.com/fktn-k/fkYAML/pull/434), [fktn-k](https://github.com/fktn-k)) - Fixed bugs in parsing block scalars ([\#435](https://github.com/fktn-k/fkYAML/pull/435), [fktn-k](https://github.com/fktn-k)) - Fix parsing input which begins with a newline & indentation ([\#437](https://github.com/fktn-k/fkYAML/pull/437), [fktn-k](https://github.com/fktn-k)) - Fix round-trip issue in float serialization using scientific notation ([\#439](https://github.com/fktn-k/fkYAML/pull/439), [fktn-k](https://github.com/fktn-k)) - - reported by [dyerbod](https://github.com/dyerbod) in the issue [\#405](https://github.com/fktn-k/fkYAML/issues/405) + - reported by [dyerbod](https://github.com/dyerbod) in the issue [\#405](https://github.com/fktn-k/fkYAML/issues/405) #### :robot: CI - Update GitHub Actions workflow jobs using macOS related runner images ([\#433](https://github.com/fktn-k/fkYAML/pull/433), [fktn-k](https://github.com/fktn-k)) @@ -92,27 +175,27 @@ Other changes are related to minor bug fixes in YAML scalar parsing and maintena #### :sparkles: New Features - Numeric scalar conversions inside basic\_node::get\_value API ([\#419](https://github.com/fktn-k/fkYAML/pull/419), [fktn-k](https://github.com/fktn-k)) - - Suggested by [ARessegetesStery](https://github.com/ARessegetesStery) in the issue [\#366](https://github.com/fktn-k/fkYAML/issues/366) - - Automatic value conversions among null, boolean, integer and floating-point scalar values inside [fkyaml::basic_node::get_value()](../api/basic_node/get_value.md) API calls + - Suggested by [ARessegetesStery](https://github.com/ARessegetesStery) in the issue [\#366](https://github.com/fktn-k/fkYAML/issues/366) + - Automatic value conversions among null, boolean, integer and floating-point scalar values inside [fkyaml::basic_node::get_value()](../api/basic_node/get_value.md) API calls - Add forward declaration header ([\#422](https://github.com/fktn-k/fkYAML/pull/422), [fktn-k](https://github.com/fktn-k)) - - Suggested by [abcminiuser](https://github.com/abcminiuser) in the duscussion [\#420](https://github.com/fktn-k/fkYAML/discussions/420) - - This new header provides the fkYAML namespace macros and forward declarations of fkYAML API classes. - - This file is available both in the [include](https://github.com/fktn-k/fkYAML/tree/v0.3.14/include) and [single_include](https://github.com/fktn-k/fkYAML/tree/v0.3.14/single_include) directories. + - Suggested by [abcminiuser](https://github.com/abcminiuser) in the duscussion [\#420](https://github.com/fktn-k/fkYAML/discussions/420) + - This new header provides the fkYAML namespace macros and forward declarations of fkYAML API classes. + - This file is available both in the [include](https://github.com/fktn-k/fkYAML/tree/v0.3.14/include) and [single_include](https://github.com/fktn-k/fkYAML/tree/v0.3.14/single_include) directories. #### :zap: Improvements - Support more STL types in from\_node ([\#421](https://github.com/fktn-k/fkYAML/pull/421), [fktn-k](https://github.com/fktn-k)) - - YAML node objects can now be converted into a lot more STL container types. - - See [the API documentation page](https://fktn-k.github.io/fkYAML/api/basic_node/get_value/) for more details. + - YAML node objects can now be converted into a lot more STL container types. + - See [the API documentation page](https://fktn-k.github.io/fkYAML/api/basic_node/get_value/) for more details. - Clarify type restrictions of get\_value\(\) & get\_value\_ref\(\) APIs ([\#424](https://github.com/fktn-k/fkYAML/pull/424), [fktn-k](https://github.com/fktn-k)) - - get_value calls with unsupported types (reference, pointer and C-style array types) now emits an explicit error message. + - get_value calls with unsupported types (reference, pointer and C-style array types) now emits an explicit error message. - Use std::unreachable\(\) or similar compiler specific extensions for dead but necessary code ([\#425](https://github.com/fktn-k/fkYAML/pull/425), [fktn-k](https://github.com/fktn-k)) - - Exclude detail::unreachable\(\) from coverage target ([\#426](https://github.com/fktn-k/fkYAML/pull/426), [fktn-k](https://github.com/fktn-k)) + - Exclude detail::unreachable\(\) from coverage target ([\#426](https://github.com/fktn-k/fkYAML/pull/426), [fktn-k](https://github.com/fktn-k)) #### :bug: Bug Fixes - Fix wrong scalar value type detection from floating point value token ([\#414](https://github.com/fktn-k/fkYAML/pull/414), [fktn-k](https://github.com/fktn-k)) - - reported by [ebertolazzi](https://github.com/ebertolazzi) in the issue [\#413](https://github.com/fktn-k/fkYAML/issues/413) + - reported by [ebertolazzi](https://github.com/ebertolazzi) in the issue [\#413](https://github.com/fktn-k/fkYAML/issues/413) - Disable -Wdeprecated-literal-operator warnings ([\#417](https://github.com/fktn-k/fkYAML/pull/417), [fktn-k](https://github.com/fktn-k)) - - reported by [ebertolazzi](https://github.com/ebertolazzi) in the issue [\#413](https://github.com/fktn-k/fkYAML/issues/413) + - reported by [ebertolazzi](https://github.com/ebertolazzi) in the issue [\#413](https://github.com/fktn-k/fkYAML/issues/413) #### :robot: CI - Update GA workflow jobs for ubuntu24.04 ([\#415](https://github.com/fktn-k/fkYAML/pull/415), [fktn-k](https://github.com/fktn-k)) @@ -145,18 +228,18 @@ No changes are required for migration. #### :zap: Improvements - Refine benchmarking ([\#397](https://github.com/fktn-k/fkYAML/pull/397), [fktn-k](https://github.com/fktn-k)) - - replaced data files for benchmarking for better comparison against existing YAML libraries + - replaced data files for benchmarking for better comparison against existing YAML libraries - Optimized scalar parsing ([\#409](https://github.com/fktn-k/fkYAML/pull/409), [fktn-k](https://github.com/fktn-k)) - - increased parse speed by about 5MiB/s + - increased parse speed by about 5MiB/s #### :bug: Bug Fixes - Accept % as first scalar character ([\#399](https://github.com/fktn-k/fkYAML/pull/399), [fktn-k](https://github.com/fktn-k)) - Fix compile warnings/errors when benchmarker app is compiled with msvc ([\#401](https://github.com/fktn-k/fkYAML/pull/401), [fktn-k](https://github.com/fktn-k)) - Updated natvis file ([\#402](https://github.com/fktn-k/fkYAML/pull/402), [fktn-k](https://github.com/fktn-k)) - - fixed broken natvis file contents + - fixed broken natvis file contents - Fix URI validation for tag shorthands ([\#403](https://github.com/fktn-k/fkYAML/pull/403), [fktn-k](https://github.com/fktn-k)) - Fix float scalar serialization when a float is actually an integer ([\#407](https://github.com/fktn-k/fkYAML/pull/407), [fktn-k](https://github.com/fktn-k)) - - reported by [ARessegetesStery](https://github.com/ARessegetesStery) in the issue [\#405](https://github.com/fktn-k/fkYAML/issues/405) + - reported by [ARessegetesStery](https://github.com/ARessegetesStery) in the issue [\#405](https://github.com/fktn-k/fkYAML/issues/405) - Fix infinite loops after parsing final empty block scalar ([\#410](https://github.com/fktn-k/fkYAML/pull/410), [fktn-k](https://github.com/fktn-k)) - Fix wrong parse result from single scalar document ([\#411](https://github.com/fktn-k/fkYAML/pull/411), [fktn-k](https://github.com/fktn-k)) @@ -187,19 +270,19 @@ Last but not least, several bugs have also been resolved in deserialization, and #### :sparkles: New Features - Add node\_type/yaml\_version\_type enum class APIs by [fktn-k](https://github.com/fktn-k) in [\#388](https://github.com/fktn-k/fkYAML/pull/388) - - In this PR, the following APIs has been deprecated. Although they still work as before except for compile-time deprecation warnings, it's highly recommended to replace their usages with new APIs since they are planned to be removed in v0.4.0. See the Deprecation notes in each deprecated API reference page for migration guides. - - [`fkyaml::basic_node::node_t`](https://fktn-k.github.io/fkYAML/api/basic_node/node_t/) - - Replace with: [`fkyaml::node_type`](https://fktn-k.github.io/fkYAML/api/node_type/) - - [`fkyaml::basic_node::basic_node(const fkyaml::basic_node::node_t)`](https://fktn-k.github.io/fkYAML/api/basic_node/constructor/#overload-3) - - Replace with: [`fkyaml::basic_node::basic_node(const fkyaml::node_type)`](https://fktn-k.github.io/fkYAML/api/basic_node/constructor/#overload-2) - - [`fkyaml::basic_node::node_t fkyaml::basic_node::type()`](https://fktn-k.github.io/fkYAML/api/basic_node/type/) - - Replace with: [`fkyaml::basic_node::get_type()`](https://fktn-k.github.io/fkYAML/api/basic_node/get_type/) - - [`fkyaml::basic_node::yaml_version_t`](https://fktn-k.github.io/fkYAML/api/basic_node/yaml_version_t/) - - Replace with: [`fkyaml::yaml_version_type`](https://fktn-k.github.io/fkYAML/api/yaml_version_type/) - - [`fkyaml::basic_node::yaml_version_t fkyaml::basic_node::get_yaml_version()`](https://fktn-k.github.io/fkYAML/api/basic_node/get_yaml_version/) - - Replace with: [`fkyaml::yaml_version_type fkyaml::basic_node::get_yaml_version_type()`](https://fktn-k.github.io/fkYAML/api/basic_node/get_yaml_version_type/) - - [`void fkyaml::basic_node::set_yaml_version(const fkyaml::basic_node::yaml_version_t)`](https://fktn-k.github.io/fkYAML/api/basic_node/set_yaml_version/) - - Replace with: [`void fkyaml::basic_node::set_yaml_version_type(const fkyaml::yaml_version_type)`](https://fktn-k.github.io/fkYAML/api/basic_node/set_yaml_version_type/) + - In this PR, the following APIs has been deprecated. Although they still work as before except for compile-time deprecation warnings, it's highly recommended to replace their usages with new APIs since they are planned to be removed in v0.4.0. See the Deprecation notes in each deprecated API reference page for migration guides. + - [`fkyaml::basic_node::node_t`](https://fktn-k.github.io/fkYAML/api/basic_node/node_t/) + - Replace with: [`fkyaml::node_type`](https://fktn-k.github.io/fkYAML/api/node_type/) + - [`fkyaml::basic_node::basic_node(const fkyaml::basic_node::node_t)`](https://fktn-k.github.io/fkYAML/api/basic_node/constructor/#overload-3) + - Replace with: [`fkyaml::basic_node::basic_node(const fkyaml::node_type)`](https://fktn-k.github.io/fkYAML/api/basic_node/constructor/#overload-2) + - [`fkyaml::basic_node::node_t fkyaml::basic_node::type()`](https://fktn-k.github.io/fkYAML/api/basic_node/type/) + - Replace with: [`fkyaml::basic_node::get_type()`](https://fktn-k.github.io/fkYAML/api/basic_node/get_type/) + - [`fkyaml::basic_node::yaml_version_t`](https://fktn-k.github.io/fkYAML/api/basic_node/yaml_version_t/) + - Replace with: [`fkyaml::yaml_version_type`](https://fktn-k.github.io/fkYAML/api/yaml_version_type/) + - [`fkyaml::basic_node::yaml_version_t fkyaml::basic_node::get_yaml_version()`](https://fktn-k.github.io/fkYAML/api/basic_node/get_yaml_version/) + - Replace with: [`fkyaml::yaml_version_type fkyaml::basic_node::get_yaml_version_type()`](https://fktn-k.github.io/fkYAML/api/basic_node/get_yaml_version_type/) + - [`void fkyaml::basic_node::set_yaml_version(const fkyaml::basic_node::yaml_version_t)`](https://fktn-k.github.io/fkYAML/api/basic_node/set_yaml_version/) + - Replace with: [`void fkyaml::basic_node::set_yaml_version_type(const fkyaml::yaml_version_type)`](https://fktn-k.github.io/fkYAML/api/basic_node/set_yaml_version_type/) #### :zap: Improvements diff --git a/examples/apis/macros/versions.output b/examples/apis/macros/versions.output index 58500139..c9db0791 100644 --- a/examples/apis/macros/versions.output +++ b/examples/apis/macros/versions.output @@ -1 +1 @@ -fkYAML version 0.4.0 +fkYAML version 0.4.1 diff --git a/fkYAML.natvis b/fkYAML.natvis index bb929a19..d0de9369 100644 --- a/fkYAML.natvis +++ b/fkYAML.natvis @@ -4,26 +4,26 @@ - - - {*(m_node_value.p_sequence)} - {*(m_node_value.p_mapping)} - nullptr - {m_node_value.boolean} - {m_node_value.integer} - {m_node_value.float_val} - {*(m_node_value.p_string)} + + + {*(m_node_value.p_sequence)} + {*(m_node_value.p_mapping)} + nullptr + {m_node_value.boolean} + {m_node_value.integer} + {m_node_value.float_val} + {*(m_node_value.p_string)} - + *(m_node_value.p_sequence),view(simple) - + *(m_node_value.p_mapping),view(simple) - + {second} second diff --git a/include/fkYAML/detail/assert.hpp b/include/fkYAML/detail/assert.hpp index cb7f7096..19cb94ec 100644 --- a/include/fkYAML/detail/assert.hpp +++ b/include/fkYAML/detail/assert.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/from_node.hpp b/include/fkYAML/detail/conversions/from_node.hpp index 3a017005..e0235e88 100644 --- a/include/fkYAML/detail/conversions/from_node.hpp +++ b/include/fkYAML/detail/conversions/from_node.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/scalar_conv.hpp b/include/fkYAML/detail/conversions/scalar_conv.hpp index 539f21c0..2abc3623 100644 --- a/include/fkYAML/detail/conversions/scalar_conv.hpp +++ b/include/fkYAML/detail/conversions/scalar_conv.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/to_node.hpp b/include/fkYAML/detail/conversions/to_node.hpp index b6200a2b..a8acb483 100644 --- a/include/fkYAML/detail/conversions/to_node.hpp +++ b/include/fkYAML/detail/conversions/to_node.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/to_string.hpp b/include/fkYAML/detail/conversions/to_string.hpp index f1300251..fc86a558 100644 --- a/include/fkYAML/detail/conversions/to_string.hpp +++ b/include/fkYAML/detail/conversions/to_string.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/document_metainfo.hpp b/include/fkYAML/detail/document_metainfo.hpp index 3d2f55d7..24c984ab 100644 --- a/include/fkYAML/detail/document_metainfo.hpp +++ b/include/fkYAML/detail/document_metainfo.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/uri_encoding.hpp b/include/fkYAML/detail/encodings/uri_encoding.hpp index f31fc4e3..ea62ae94 100644 --- a/include/fkYAML/detail/encodings/uri_encoding.hpp +++ b/include/fkYAML/detail/encodings/uri_encoding.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/utf_encode_detector.hpp b/include/fkYAML/detail/encodings/utf_encode_detector.hpp index 9a413d29..391dcc81 100644 --- a/include/fkYAML/detail/encodings/utf_encode_detector.hpp +++ b/include/fkYAML/detail/encodings/utf_encode_detector.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/utf_encode_t.hpp b/include/fkYAML/detail/encodings/utf_encode_t.hpp index 44ee1152..00d3b4ce 100644 --- a/include/fkYAML/detail/encodings/utf_encode_t.hpp +++ b/include/fkYAML/detail/encodings/utf_encode_t.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/utf_encodings.hpp b/include/fkYAML/detail/encodings/utf_encodings.hpp index 356e756d..a73a12c7 100644 --- a/include/fkYAML/detail/encodings/utf_encodings.hpp +++ b/include/fkYAML/detail/encodings/utf_encodings.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/yaml_escaper.hpp b/include/fkYAML/detail/encodings/yaml_escaper.hpp index 58b2c720..3df0b00e 100644 --- a/include/fkYAML/detail/encodings/yaml_escaper.hpp +++ b/include/fkYAML/detail/encodings/yaml_escaper.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/block_scalar_header.hpp b/include/fkYAML/detail/input/block_scalar_header.hpp index c51aa70a..a7b2a4a9 100644 --- a/include/fkYAML/detail/input/block_scalar_header.hpp +++ b/include/fkYAML/detail/input/block_scalar_header.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index b6663e1a..9832cf58 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/input_adapter.hpp b/include/fkYAML/detail/input/input_adapter.hpp index be951f01..f377e427 100644 --- a/include/fkYAML/detail/input/input_adapter.hpp +++ b/include/fkYAML/detail/input/input_adapter.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index d199e412..0ec766d9 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/position_tracker.hpp b/include/fkYAML/detail/input/position_tracker.hpp index 3194bdee..8ff8e203 100644 --- a/include/fkYAML/detail/input/position_tracker.hpp +++ b/include/fkYAML/detail/input/position_tracker.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/scalar_parser.hpp b/include/fkYAML/detail/input/scalar_parser.hpp index d63859f3..04e7b3fb 100644 --- a/include/fkYAML/detail/input/scalar_parser.hpp +++ b/include/fkYAML/detail/input/scalar_parser.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/scalar_scanner.hpp b/include/fkYAML/detail/input/scalar_scanner.hpp index 821b31ca..23c988d9 100644 --- a/include/fkYAML/detail/input/scalar_scanner.hpp +++ b/include/fkYAML/detail/input/scalar_scanner.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/tag_resolver.hpp b/include/fkYAML/detail/input/tag_resolver.hpp index 77ee3441..52f909c4 100644 --- a/include/fkYAML/detail/input/tag_resolver.hpp +++ b/include/fkYAML/detail/input/tag_resolver.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/tag_t.hpp b/include/fkYAML/detail/input/tag_t.hpp index d1b11c36..5c90c433 100644 --- a/include/fkYAML/detail/input/tag_t.hpp +++ b/include/fkYAML/detail/input/tag_t.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/iterator.hpp b/include/fkYAML/detail/iterator.hpp index 42ac1d01..be32417f 100644 --- a/include/fkYAML/detail/iterator.hpp +++ b/include/fkYAML/detail/iterator.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/macros/cpp_config_macros.hpp b/include/fkYAML/detail/macros/cpp_config_macros.hpp index 734a2e7a..c0a34167 100644 --- a/include/fkYAML/detail/macros/cpp_config_macros.hpp +++ b/include/fkYAML/detail/macros/cpp_config_macros.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/macros/define_macros.hpp b/include/fkYAML/detail/macros/define_macros.hpp index f870adfb..0d884448 100644 --- a/include/fkYAML/detail/macros/define_macros.hpp +++ b/include/fkYAML/detail/macros/define_macros.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/macros/version_macros.hpp b/include/fkYAML/detail/macros/version_macros.hpp index c2d28b34..ebe5219a 100644 --- a/include/fkYAML/detail/macros/version_macros.hpp +++ b/include/fkYAML/detail/macros/version_macros.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -8,7 +8,7 @@ // Check version definitions if already defined. #if defined(FK_YAML_MAJOR_VERSION) && defined(FK_YAML_MINOR_VERSION) && defined(FK_YAML_PATCH_VERSION) -#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 4 || FK_YAML_PATCH_VERSION != 0 +#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 4 || FK_YAML_PATCH_VERSION != 1 #warning Already included a different version of the fkYAML library! #else // define macros to skip defining macros down below. @@ -20,7 +20,7 @@ #define FK_YAML_MAJOR_VERSION 0 #define FK_YAML_MINOR_VERSION 4 -#define FK_YAML_PATCH_VERSION 0 +#define FK_YAML_PATCH_VERSION 1 #define FK_YAML_NAMESPACE_VERSION_CONCAT_IMPL(major, minor, patch) v##major##_##minor##_##patch diff --git a/include/fkYAML/detail/map_range_proxy.hpp b/include/fkYAML/detail/map_range_proxy.hpp index 27020ce2..16429057 100644 --- a/include/fkYAML/detail/map_range_proxy.hpp +++ b/include/fkYAML/detail/map_range_proxy.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/detect.hpp b/include/fkYAML/detail/meta/detect.hpp index 723e9803..efb24445 100644 --- a/include/fkYAML/detail/meta/detect.hpp +++ b/include/fkYAML/detail/meta/detect.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/input_adapter_traits.hpp b/include/fkYAML/detail/meta/input_adapter_traits.hpp index b1a36998..25c98bf0 100644 --- a/include/fkYAML/detail/meta/input_adapter_traits.hpp +++ b/include/fkYAML/detail/meta/input_adapter_traits.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/node_traits.hpp b/include/fkYAML/detail/meta/node_traits.hpp index 9baa2da7..5f232c7b 100644 --- a/include/fkYAML/detail/meta/node_traits.hpp +++ b/include/fkYAML/detail/meta/node_traits.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/stl_supplement.hpp b/include/fkYAML/detail/meta/stl_supplement.hpp index 14eb60e6..997aaab9 100644 --- a/include/fkYAML/detail/meta/stl_supplement.hpp +++ b/include/fkYAML/detail/meta/stl_supplement.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/type_traits.hpp b/include/fkYAML/detail/meta/type_traits.hpp index d474fc47..f0f86f09 100644 --- a/include/fkYAML/detail/meta/type_traits.hpp +++ b/include/fkYAML/detail/meta/type_traits.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/node_attrs.hpp b/include/fkYAML/detail/node_attrs.hpp index ed1f2f61..a2f9b352 100644 --- a/include/fkYAML/detail/node_attrs.hpp +++ b/include/fkYAML/detail/node_attrs.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/node_property.hpp b/include/fkYAML/detail/node_property.hpp index 2d1a1951..158e2606 100644 --- a/include/fkYAML/detail/node_property.hpp +++ b/include/fkYAML/detail/node_property.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/node_ref_storage.hpp b/include/fkYAML/detail/node_ref_storage.hpp index aa0f8c0d..35b900b9 100644 --- a/include/fkYAML/detail/node_ref_storage.hpp +++ b/include/fkYAML/detail/node_ref_storage.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/output/serializer.hpp b/include/fkYAML/detail/output/serializer.hpp index 50640a0c..516620a5 100644 --- a/include/fkYAML/detail/output/serializer.hpp +++ b/include/fkYAML/detail/output/serializer.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/reverse_iterator.hpp b/include/fkYAML/detail/reverse_iterator.hpp index da064e0e..d671ddd8 100644 --- a/include/fkYAML/detail/reverse_iterator.hpp +++ b/include/fkYAML/detail/reverse_iterator.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/str_view.hpp b/include/fkYAML/detail/str_view.hpp index ac25e0f5..8ae0a106 100644 --- a/include/fkYAML/detail/str_view.hpp +++ b/include/fkYAML/detail/str_view.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/string_formatter.hpp b/include/fkYAML/detail/string_formatter.hpp index 914332f3..1747a998 100644 --- a/include/fkYAML/detail/string_formatter.hpp +++ b/include/fkYAML/detail/string_formatter.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/types/lexical_token_t.hpp b/include/fkYAML/detail/types/lexical_token_t.hpp index 2cd8f7be..47e306e7 100644 --- a/include/fkYAML/detail/types/lexical_token_t.hpp +++ b/include/fkYAML/detail/types/lexical_token_t.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/types/node_t.hpp b/include/fkYAML/detail/types/node_t.hpp index fe13d2f8..edfe5b2d 100644 --- a/include/fkYAML/detail/types/node_t.hpp +++ b/include/fkYAML/detail/types/node_t.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/detail/types/yaml_version_t.hpp b/include/fkYAML/detail/types/yaml_version_t.hpp index e4961b98..bd7a4db6 100644 --- a/include/fkYAML/detail/types/yaml_version_t.hpp +++ b/include/fkYAML/detail/types/yaml_version_t.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/exception.hpp b/include/fkYAML/exception.hpp index 96657da1..d67014d2 100644 --- a/include/fkYAML/exception.hpp +++ b/include/fkYAML/exception.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/fkyaml_fwd.hpp b/include/fkYAML/fkyaml_fwd.hpp index 3414dea6..f95c6475 100644 --- a/include/fkYAML/fkyaml_fwd.hpp +++ b/include/fkYAML/fkyaml_fwd.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/node.hpp b/include/fkYAML/node.hpp index 5f35752e..2ab04823 100644 --- a/include/fkYAML/node.hpp +++ b/include/fkYAML/node.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/node_type.hpp b/include/fkYAML/node_type.hpp index 2a974c41..cf827360 100644 --- a/include/fkYAML/node_type.hpp +++ b/include/fkYAML/node_type.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/node_value_converter.hpp b/include/fkYAML/node_value_converter.hpp index 99d26102..aa6c42f4 100644 --- a/include/fkYAML/node_value_converter.hpp +++ b/include/fkYAML/node_value_converter.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/ordered_map.hpp b/include/fkYAML/ordered_map.hpp index dd29854d..7a300513 100644 --- a/include/fkYAML/ordered_map.hpp +++ b/include/fkYAML/ordered_map.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/include/fkYAML/yaml_version_type.hpp b/include/fkYAML/yaml_version_type.hpp index 4fc1f5ad..7435d20d 100644 --- a/include/fkYAML/yaml_version_type.hpp +++ b/include/fkYAML/yaml_version_type.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/single_include/fkYAML/fkyaml_fwd.hpp b/single_include/fkYAML/fkyaml_fwd.hpp index d35cf9ce..21423e1a 100644 --- a/single_include/fkYAML/fkyaml_fwd.hpp +++ b/single_include/fkYAML/fkyaml_fwd.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -17,7 +17,7 @@ // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -25,7 +25,7 @@ // Check version definitions if already defined. #if defined(FK_YAML_MAJOR_VERSION) && defined(FK_YAML_MINOR_VERSION) && defined(FK_YAML_PATCH_VERSION) -#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 4 || FK_YAML_PATCH_VERSION != 0 +#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 4 || FK_YAML_PATCH_VERSION != 1 #warning Already included a different version of the fkYAML library! #else // define macros to skip defining macros down below. @@ -37,7 +37,7 @@ #define FK_YAML_MAJOR_VERSION 0 #define FK_YAML_MINOR_VERSION 4 -#define FK_YAML_PATCH_VERSION 0 +#define FK_YAML_PATCH_VERSION 1 #define FK_YAML_NAMESPACE_VERSION_CONCAT_IMPL(major, minor, patch) v##major##_##minor##_##patch diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 9b774372..3dc2920c 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -22,7 +22,7 @@ // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -34,7 +34,7 @@ // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -42,7 +42,7 @@ // Check version definitions if already defined. #if defined(FK_YAML_MAJOR_VERSION) && defined(FK_YAML_MINOR_VERSION) && defined(FK_YAML_PATCH_VERSION) -#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 4 || FK_YAML_PATCH_VERSION != 0 +#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 4 || FK_YAML_PATCH_VERSION != 1 #warning Already included a different version of the fkYAML library! #else // define macros to skip defining macros down below. @@ -54,7 +54,7 @@ #define FK_YAML_MAJOR_VERSION 0 #define FK_YAML_MINOR_VERSION 4 -#define FK_YAML_PATCH_VERSION 0 +#define FK_YAML_PATCH_VERSION 1 #define FK_YAML_NAMESPACE_VERSION_CONCAT_IMPL(major, minor, patch) v##major##_##minor##_##patch @@ -84,7 +84,7 @@ // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -243,7 +243,7 @@ // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -267,7 +267,7 @@ // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -284,7 +284,7 @@ // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -298,7 +298,7 @@ // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -315,7 +315,7 @@ // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -767,7 +767,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -937,7 +937,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -1127,7 +1127,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -1192,7 +1192,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -1212,7 +1212,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -1232,7 +1232,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -1360,7 +1360,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -1377,7 +1377,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -1396,7 +1396,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -1446,7 +1446,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -1462,7 +1462,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -2050,7 +2050,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -2088,7 +2088,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -2104,7 +2104,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -3169,7 +3169,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -4409,7 +4409,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -4425,7 +4425,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -5265,7 +5265,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -5619,7 +5619,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -5955,7 +5955,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -6562,7 +6562,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -6747,7 +6747,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -6860,7 +6860,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -7001,7 +7001,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -8344,7 +8344,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -8367,7 +8367,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -8384,7 +8384,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -9786,7 +9786,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -10218,7 +10218,7 @@ struct tuple_element> { // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -10422,7 +10422,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -10515,7 +10515,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -10534,7 +10534,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -11007,7 +11007,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -11267,7 +11267,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -11322,7 +11322,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -11338,7 +11338,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -12024,7 +12024,7 @@ FK_YAML_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani @@ -12411,7 +12411,7 @@ FK_YAML_NAMESPACE_END // #include // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -// | __| _ < \_ _/| ___ | _ | |___ version 0.4.0 +// | __| _ < \_ _/| ___ | _ | |___ version 0.4.1 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2025 Kensuke Fukutani diff --git a/tools/natvis_generator/params.json b/tools/natvis_generator/params.json index 30704b00..a6a1de79 100644 --- a/tools/natvis_generator/params.json +++ b/tools/natvis_generator/params.json @@ -1 +1 @@ -{ "version": "0.4.0" } +{ "version": "0.4.1" }