From e043da795fae262ad329d692496090c9ec739cf6 Mon Sep 17 00:00:00 2001 From: fktn Date: Thu, 2 May 2024 21:50:45 +0900 Subject: [PATCH 1/8] Allow false error on anchor names containing colons (:) (#335) --- .../fkYAML/detail/input/lexical_analyzer.hpp | 18 ----- single_include/fkYAML/node.hpp | 18 ----- test/unit_test/test_deserializer_class.cpp | 3 +- .../unit_test/test_lexical_analyzer_class.cpp | 74 +++++++++---------- 4 files changed, 38 insertions(+), 75 deletions(-) diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index 7f35909f..a6a7bcc0 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -556,24 +556,6 @@ class lexical_analyzer { case ',': ends_loop = true; break; - case ':': { - auto next_itr = m_cur_itr + 1; - if (next_itr == m_end_itr) { - ++m_cur_itr; - ends_loop = true; - break; - } - switch (*next_itr) { - case ' ': - case '\t': - case '\r': - case '\n': - // Stop the extraction at the key separator. - ends_loop = true; - break; - } - break; - } default: break; } diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index e7ebfeaa..9baad849 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -2808,24 +2808,6 @@ class lexical_analyzer { case ',': ends_loop = true; break; - case ':': { - auto next_itr = m_cur_itr + 1; - if (next_itr == m_end_itr) { - ++m_cur_itr; - ends_loop = true; - break; - } - switch (*next_itr) { - case ' ': - case '\t': - case '\r': - case '\n': - // Stop the extraction at the key separator. - ends_loop = true; - break; - } - break; - } default: break; } diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 04c69c98..7bff5aa2 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -1616,7 +1616,8 @@ TEST_CASE("Deserializer_Anchor") { } SECTION("parse alias mapping key") { - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("&anchor foo:\n *anchor: 123"))); + REQUIRE_NOTHROW( + root = deserializer.deserialize(fkyaml::detail::input_adapter("&anchor foo:\n *anchor : 123"))); REQUIRE(root.is_mapping()); REQUIRE(root.size() == 1); diff --git a/test/unit_test/test_lexical_analyzer_class.cpp b/test/unit_test/test_lexical_analyzer_class.cpp index 693233d4..a09e713a 100644 --- a/test/unit_test/test_lexical_analyzer_class.cpp +++ b/test/unit_test/test_lexical_analyzer_class.cpp @@ -1246,28 +1246,26 @@ TEST_CASE("LexicalAnalyzer_Anchor") { fkyaml::detail::lexical_token_t token; SECTION("valid anchor name") { - auto input = GENERATE( - std::string("&:anchor"), - std::string("&:anchor "), - std::string("&:anchor\t"), - std::string("&:anchor\r"), - std::string("&:anchor\n"), - std::string("&:anchor{"), - std::string("&:anchor}"), - std::string("&:anchor["), - std::string("&:anchor]"), - std::string("&:anchor,"), - std::string("&:anchor: "), - std::string("&:anchor:\t"), - std::string("&:anchor:\r"), - std::string("&:anchor:\n"), - std::string("&:anchor:")); - - lexer_t lexer(fkyaml::detail::input_adapter(input)); + using test_data_t = std::pair; + auto test_data = GENERATE( + test_data_t {"&anchor", "anchor"}, + test_data_t {"&anchor name", "anchor"}, + test_data_t {"&anchor\tname", "anchor"}, + test_data_t {"&anchor\rname", "anchor"}, + test_data_t {"&anchor\nname", "anchor"}, + test_data_t {"&anchor{name", "anchor"}, + test_data_t {"&anchor}name", "anchor"}, + test_data_t {"&anchor[name", "anchor"}, + test_data_t {"&anchor]name", "anchor"}, + test_data_t {"&anchor,name", "anchor"}, + test_data_t {"&anchor: ", "anchor:"}, + test_data_t {"&anchor:", "anchor:"}); + + lexer_t lexer(fkyaml::detail::input_adapter(test_data.first)); REQUIRE_NOTHROW(token = lexer.get_next_token()); REQUIRE(token == fkyaml::detail::lexical_token_t::ANCHOR_PREFIX); - REQUIRE_NOTHROW(lexer.get_string() == ":anchor"); + REQUIRE_NOTHROW(lexer.get_string() == test_data.second); } SECTION("invalid anchor name") { @@ -1281,8 +1279,7 @@ TEST_CASE("LexicalAnalyzer_Anchor") { std::string("&}"), std::string("&["), std::string("&]"), - std::string("&,"), - std::string("&: ")); + std::string("&,")); lexer_t lexer(fkyaml::detail::input_adapter(input)); REQUIRE_THROWS_AS(lexer.get_next_token(), fkyaml::parse_error); @@ -1293,24 +1290,26 @@ TEST_CASE("LexicalAnalyzer_Alias") { fkyaml::detail::lexical_token_t token; SECTION("valid anchor name") { - auto input = GENERATE( - std::string("*:anchor"), - std::string("*:anchor "), - std::string("*:anchor\t"), - std::string("*:anchor\r"), - std::string("*:anchor\n"), - std::string("*:anchor{"), - std::string("*:anchor}"), - std::string("*:anchor["), - std::string("*:anchor]"), - std::string("*:anchor,"), - std::string("*:anchor: ")); - - lexer_t lexer(fkyaml::detail::input_adapter(input)); + using test_data_t = std::pair; + auto test_data = GENERATE( + test_data_t {"*anchor", "anchor"}, + test_data_t {"*anchor name", "anchor"}, + test_data_t {"*anchor\tname", "anchor"}, + test_data_t {"*anchor\rname", "anchor"}, + test_data_t {"*anchor\nname", "anchor"}, + test_data_t {"*anchor{name", "anchor"}, + test_data_t {"*anchor}name", "anchor"}, + test_data_t {"*anchor[name", "anchor"}, + test_data_t {"*anchor]name", "anchor"}, + test_data_t {"*anchor,name", "anchor"}, + test_data_t {"*anchor: ", "anchor:"}, + test_data_t {"*anchor:", "anchor:"}); + + lexer_t lexer(fkyaml::detail::input_adapter(test_data.first)); REQUIRE_NOTHROW(token = lexer.get_next_token()); REQUIRE(token == fkyaml::detail::lexical_token_t::ALIAS_PREFIX); - REQUIRE_NOTHROW(lexer.get_string() == ":anchor"); + REQUIRE_NOTHROW(lexer.get_string() == test_data.second); } SECTION("invalid anchor name") { @@ -1324,8 +1323,7 @@ TEST_CASE("LexicalAnalyzer_Alias") { std::string("*}"), std::string("*["), std::string("*]"), - std::string("*,"), - std::string("*: ")); + std::string("*,")); lexer_t lexer(fkyaml::detail::input_adapter(input)); REQUIRE_THROWS_AS(lexer.get_next_token(), fkyaml::parse_error); From 47a331c832e5d4bf7ae38c7f900bf45feae75c65 Mon Sep 17 00:00:00 2001 From: fktn Date: Thu, 2 May 2024 23:27:04 +0900 Subject: [PATCH 2/8] Escape \ + 0x09 to a horizontal tab (\t) (#336) --- include/fkYAML/detail/input/lexical_analyzer.hpp | 1 + single_include/fkYAML/node.hpp | 1 + test/unit_test/test_lexical_analyzer_class.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index a6a7bcc0..3e2a5d81 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -765,6 +765,7 @@ class lexical_analyzer { m_value_buffer.push_back('\b'); break; case 't': + case char(0x09): m_value_buffer.push_back('\t'); break; case 'n': diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 9baad849..0d8fa6da 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -3017,6 +3017,7 @@ class lexical_analyzer { m_value_buffer.push_back('\b'); break; case 't': + case char(0x09): m_value_buffer.push_back('\t'); break; case 'n': diff --git a/test/unit_test/test_lexical_analyzer_class.cpp b/test/unit_test/test_lexical_analyzer_class.cpp index a09e713a..60690c00 100644 --- a/test/unit_test/test_lexical_analyzer_class.cpp +++ b/test/unit_test/test_lexical_analyzer_class.cpp @@ -572,6 +572,7 @@ TEST_CASE("LexicalAnalyzer_String") { value_pair_t(std::string("\"foo\\abar\""), fkyaml::node::string_type("foo\abar")), value_pair_t(std::string("\"foo\\bbar\""), fkyaml::node::string_type("foo\bbar")), value_pair_t(std::string("\"foo\\tbar\""), fkyaml::node::string_type("foo\tbar")), + value_pair_t(std::string("\"foo\\\u0009bar\""), fkyaml::node::string_type("foo\tbar")), value_pair_t(std::string("\"foo\tbar\""), fkyaml::node::string_type("foo\tbar")), value_pair_t(std::string("\"foo\\nbar\""), fkyaml::node::string_type("foo\nbar")), value_pair_t(std::string("\"foo\\vbar\""), fkyaml::node::string_type("foo\vbar")), From d949136a4b991611a4525c0b0049369b749d1e4d Mon Sep 17 00:00:00 2001 From: fktn Date: Fri, 3 May 2024 22:27:52 +0900 Subject: [PATCH 3/8] Separate YAML escaping/unescaping functionalities (#337) * separated YAML encoding functionality into a new module * cleanup test code which became redundant after YAML escaping functionality was separated --- .../fkYAML/detail/encodings/yaml_escaper.hpp | 345 ++++++++++ .../fkYAML/detail/input/lexical_analyzer.hpp | 113 +--- include/fkYAML/detail/output/serializer.hpp | 173 +---- single_include/fkYAML/node.hpp | 637 ++++++++++-------- test/unit_test/CMakeLists.txt | 1 + .../unit_test/test_lexical_analyzer_class.cpp | 19 +- test/unit_test/test_serializer_class.cpp | 43 +- test/unit_test/test_yaml_escaper_class.cpp | 123 ++++ 8 files changed, 837 insertions(+), 617 deletions(-) create mode 100644 include/fkYAML/detail/encodings/yaml_escaper.hpp create mode 100644 test/unit_test/test_yaml_escaper_class.cpp diff --git a/include/fkYAML/detail/encodings/yaml_escaper.hpp b/include/fkYAML/detail/encodings/yaml_escaper.hpp new file mode 100644 index 00000000..7d1914a1 --- /dev/null +++ b/include/fkYAML/detail/encodings/yaml_escaper.hpp @@ -0,0 +1,345 @@ +/// _______ __ __ __ _____ __ __ __ +/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +/// +/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +/// SPDX-License-Identifier: MIT +/// +/// @file + +#ifndef FK_YAML_DETAIL_ENCODINGS_YAML_ESCAPER_HPP_ +#define FK_YAML_DETAIL_ENCODINGS_YAML_ESCAPER_HPP_ + +#include + +#include +#include +#include +#include + +FK_YAML_DETAIL_NAMESPACE_BEGIN + +class yaml_escaper { + using iterator = ::std::string::const_iterator; + +public: + static bool unescape(iterator& begin, iterator end, std::string& buff) { + FK_YAML_ASSERT(*begin == '\\' && std::distance(begin, end) > 0); + bool ret = true; + + switch (*++begin) { + case 'a': + buff.push_back('\a'); + break; + case 'b': + buff.push_back('\b'); + break; + case 't': + case char(0x09): + buff.push_back('\t'); + break; + case 'n': + buff.push_back('\n'); + break; + case 'v': + buff.push_back('\v'); + break; + case 'f': + buff.push_back('\f'); + break; + case 'r': + buff.push_back('\r'); + break; + case 'e': + buff.push_back(char(0x1B)); + break; + case ' ': + buff.push_back(' '); + break; + case '\"': + buff.push_back('\"'); + break; + case '/': + buff.push_back('/'); + break; + case '\\': + buff.push_back('\\'); + break; + case 'N': // next line + unescape_escaped_unicode(0x85u, buff); + break; + case '_': // non-breaking space + unescape_escaped_unicode(0xA0u, buff); + break; + case 'L': // line separator + unescape_escaped_unicode(0x2028u, buff); + break; + case 'P': // paragraph separator + unescape_escaped_unicode(0x2029u, buff); + break; + case 'x': { + char32_t codepoint {0}; + ret = extract_codepoint(begin, end, 1, codepoint); + if (ret) { + unescape_escaped_unicode(codepoint, buff); + } + break; + } + case 'u': { + char32_t codepoint {0}; + ret = extract_codepoint(begin, end, 2, codepoint); + if (ret) { + unescape_escaped_unicode(codepoint, buff); + } + break; + } + case 'U': { + char32_t codepoint {0}; + ret = extract_codepoint(begin, end, 4, codepoint); + if (ret) { + unescape_escaped_unicode(codepoint, buff); + } + break; + } + default: + // Unsupported escape sequence is found in a string token. + ret = false; + break; + } + + return ret; + } + + static ::std::string escape(iterator begin, iterator end, bool& is_escaped) { + ::std::string escaped {}; + escaped.reserve(std::distance(begin, end)); + for (; begin != end; ++begin) { + switch (*begin) { + case 0x01: + escaped += "\\u0001"; + is_escaped = true; + break; + case 0x02: + escaped += "\\u0002"; + is_escaped = true; + break; + case 0x03: + escaped += "\\u0003"; + is_escaped = true; + break; + case 0x04: + escaped += "\\u0004"; + is_escaped = true; + break; + case 0x05: + escaped += "\\u0005"; + is_escaped = true; + break; + case 0x06: + escaped += "\\u0006"; + is_escaped = true; + break; + case '\a': + escaped += "\\a"; + is_escaped = true; + break; + case '\b': + escaped += "\\b"; + is_escaped = true; + break; + case '\t': + escaped += "\\t"; + is_escaped = true; + break; + case '\n': + escaped += "\\n"; + is_escaped = true; + break; + case '\v': + escaped += "\\v"; + is_escaped = true; + break; + case '\f': + escaped += "\\f"; + is_escaped = true; + break; + case '\r': + escaped += "\\r"; + is_escaped = true; + break; + case 0x0E: + escaped += "\\u000E"; + is_escaped = true; + break; + case 0x0F: + escaped += "\\u000F"; + is_escaped = true; + break; + case 0x10: + escaped += "\\u0010"; + is_escaped = true; + break; + case 0x11: + escaped += "\\u0011"; + is_escaped = true; + break; + case 0x12: + escaped += "\\u0012"; + is_escaped = true; + break; + case 0x13: + escaped += "\\u0013"; + is_escaped = true; + break; + case 0x14: + escaped += "\\u0014"; + is_escaped = true; + break; + case 0x15: + escaped += "\\u0015"; + is_escaped = true; + break; + case 0x16: + escaped += "\\u0016"; + is_escaped = true; + break; + case 0x17: + escaped += "\\u0017"; + is_escaped = true; + break; + case 0x18: + escaped += "\\u0018"; + is_escaped = true; + break; + case 0x19: + escaped += "\\u0019"; + is_escaped = true; + break; + case 0x1A: + escaped += "\\u001A"; + is_escaped = true; + break; + case 0x1B: + escaped += "\\e"; + is_escaped = true; + break; + case 0x1C: + escaped += "\\u001C"; + is_escaped = true; + break; + case 0x1D: + escaped += "\\u001D"; + is_escaped = true; + break; + case 0x1E: + escaped += "\\u001E"; + is_escaped = true; + break; + case 0x1F: + escaped += "\\u001F"; + is_escaped = true; + break; + case '\"': + escaped += "\\\""; + is_escaped = true; + break; + case '\\': + escaped += "\\\\"; + is_escaped = true; + break; + default: + int diff = static_cast(std::distance(begin, end)); + if (diff > 1) { + if (*begin == char(0xC2u) && *(begin + 1) == char(0x85u)) { + escaped += "\\N"; + std::advance(begin, 1); + is_escaped = true; + break; + } + else if (*begin == char(0xC2u) && *(begin + 1) == char(0xA0u)) { + escaped += "\\_"; + std::advance(begin, 1); + is_escaped = true; + break; + } + + if (diff > 2) { + if (*begin == char(0xE2u) && *(begin + 1) == char(0x80u) && *(begin + 2) == char(0xA8u)) { + escaped += "\\L"; + std::advance(begin, 2); + is_escaped = true; + break; + } + if (*begin == char(0xE2u) && *(begin + 1) == char(0x80u) && *(begin + 2) == char(0xA9u)) { + escaped += "\\P"; + std::advance(begin, 2); + is_escaped = true; + break; + } + } + } + escaped += *begin; + break; + } + } + return escaped; + } // LCOV_EXCL_LINE + +private: + static bool convert_hexchar_to_byte(char source, uint8_t& byte) { + if ('0' <= source && source <= '9') { + // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) + byte = static_cast(source - char('0')); + return true; + } + + if ('A' <= source && source <= 'F') { + // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) + byte = static_cast(source - 'A' + 10); + return true; + } + + if ('a' <= source && source <= 'f') { + // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) + byte = static_cast(source - 'a' + 10); + return true; + } + + // The given character is not hexadecimal. + return false; + } + + static bool extract_codepoint(iterator& begin, iterator end, int bytes_to_read, char32_t& codepoint) { + bool has_enough_room = static_cast(std::distance(begin, end)) >= (bytes_to_read - 1); + if (!has_enough_room) { + return false; + } + + int read_size = bytes_to_read * 2; + uint8_t byte {0}; + codepoint = 0; + + for (int i = read_size - 1; i >= 0; i--) { + bool is_valid = convert_hexchar_to_byte(*++begin, byte); + if (!is_valid) { + return false; + } + // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) + codepoint |= static_cast(byte << (4 * i)); + } + + return true; + } + + static void unescape_escaped_unicode(char32_t codepoint, std::string& buff) { + std::array encode_buff {}; + uint32_t encoded_size {0}; + utf8::from_utf32(codepoint, encode_buff, encoded_size); + buff.append(reinterpret_cast(encode_buff.data()), encoded_size); + } +}; + +FK_YAML_DETAIL_NAMESPACE_END + +#endif /* FK_YAML_DETAIL_ENCODINGS_YAML_ESCAPER_HPP_ */ diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index 3e2a5d81..772f6cf4 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -314,28 +315,6 @@ class lexical_analyzer { } private: - /// @brief A utility function to convert a hexadecimal character to an integer. - /// @param source A hexadecimal character ('0'~'9', 'A'~'F', 'a'~'f') - /// @return char A integer converted from @a source. - char convert_hex_char_to_byte(char source) const { - if ('0' <= source && source <= '9') { - // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) - return static_cast(source - '0'); - } - - if ('A' <= source && source <= 'F') { - // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) - return static_cast(source - 'A' + 10); - } - - if ('a' <= source && source <= 'f') { - // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) - return static_cast(source - 'a' + 10); - } - - emit_error("Non-hexadecimal character has been given."); - } - /// @brief Skip until a newline code or a null character is found. void scan_comment() { FK_YAML_ASSERT(*m_cur_itr == '#'); @@ -756,71 +735,9 @@ class lexical_analyzer { // Handle escaped characters. // See https://yaml.org/spec/1.2.2/#57-escaped-characters for more details. - c = *++m_cur_itr; - switch (c) { - case 'a': - m_value_buffer.push_back('\a'); - break; - case 'b': - m_value_buffer.push_back('\b'); - break; - case 't': - case char(0x09): - m_value_buffer.push_back('\t'); - break; - case 'n': - m_value_buffer.push_back('\n'); - break; - case 'v': - m_value_buffer.push_back('\v'); - break; - case 'f': - m_value_buffer.push_back('\f'); - break; - case 'r': - m_value_buffer.push_back('\r'); - break; - case 'e': - m_value_buffer.push_back(char(0x1B)); - break; - case ' ': - m_value_buffer.push_back(' '); - break; - case '\"': - m_value_buffer.push_back('\"'); - break; - case '/': - m_value_buffer.push_back('/'); - break; - case '\\': - m_value_buffer.push_back('\\'); - break; - case 'N': // next line - utf8::from_utf32(0x85u, m_encode_buffer, m_encoded_size); - m_value_buffer.append(reinterpret_cast(m_encode_buffer.data()), m_encoded_size); - break; - case '_': // non-breaking space - utf8::from_utf32(0xA0u, m_encode_buffer, m_encoded_size); - m_value_buffer.append(reinterpret_cast(m_encode_buffer.data()), m_encoded_size); - break; - case 'L': // line separator - utf8::from_utf32(0x2028u, m_encode_buffer, m_encoded_size); - m_value_buffer.append(reinterpret_cast(m_encode_buffer.data()), m_encoded_size); - break; - case 'P': // paragraph separator - utf8::from_utf32(0x2029u, m_encode_buffer, m_encoded_size); - m_value_buffer.append(reinterpret_cast(m_encode_buffer.data()), m_encoded_size); - break; - case 'x': - handle_escaped_unicode(1); - break; - case 'u': - handle_escaped_unicode(2); - break; - case 'U': - handle_escaped_unicode(4); - break; - default: + + bool is_valid_escaping = yaml_escaper::unescape(m_cur_itr, m_end_itr, m_value_buffer); + if (!is_valid_escaping) { emit_error("Unsupported escape sequence is found in a string token."); } @@ -1286,22 +1203,6 @@ class lexical_analyzer { } } - /// @brief Unescape the given escaped unicode character. - /// @param bytes_to_read The number of bytes to be read from the input buffer. - void handle_escaped_unicode(int bytes_to_read) { - int read_size = bytes_to_read * 2; - char32_t code_point = 0; - for (int i = read_size - 1; i >= 0; i--) { - char four_bits = convert_hex_char_to_byte(*++m_cur_itr); - // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) - code_point |= static_cast(four_bits << (4 * i)); - } - - // Treats the code point as a UTF-32 encoded character. - utf8::from_utf32(code_point, m_encode_buffer, m_encoded_size); - m_value_buffer.append(reinterpret_cast(m_encode_buffer.data()), m_encoded_size); - } - /// @brief Gets the metadata of a following block style string scalar. /// @param chomp_type A variable to store the retrieved chomping style type. /// @param indent A variable to store the retrieved indent size. @@ -1326,7 +1227,7 @@ class lexical_analyzer { indent = 0; if (std::isdigit(*m_cur_itr)) { - indent = convert_hex_char_to_byte(*m_cur_itr++); + indent = static_cast(*m_cur_itr++ - '0'); } // skip characters including comments. @@ -1401,10 +1302,6 @@ class lexical_analyzer { std::string m_tag_handle {}; /// The last tag prefix std::string m_tag_prefix {}; - /// A temporal buffer to store a UTF-8 encoded char sequence. - std::array m_encode_buffer {}; - /// The actual size of a UTF-8 encoded char sequence. - uint32_t m_encoded_size {0}; /// The beginning position of the last lexical token. (zero origin) uint32_t m_last_token_begin_pos {0}; /// The beginning line of the last lexical token. (zero origin) diff --git a/include/fkYAML/detail/output/serializer.hpp b/include/fkYAML/detail/output/serializer.hpp index c14969f2..7e6efaa8 100644 --- a/include/fkYAML/detail/output/serializer.hpp +++ b/include/fkYAML/detail/output/serializer.hpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -300,178 +301,8 @@ class basic_serializer { FK_YAML_ASSERT(node.is_string()); using string_type = typename BasicNodeType::string_type; - - // Check if the string value contains a character needed to be escaped on output. const string_type& s = node.template get_value_ref(); - size_t size = s.size(); - string_type escaped {}; - escaped.reserve(size); - - for (size_t i = 0; i < size; i++) { - switch (s[i]) { - case 0x01: - escaped += "\\u0001"; - is_escaped = true; - break; - case 0x02: - escaped += "\\u0002"; - is_escaped = true; - break; - case 0x03: - escaped += "\\u0003"; - is_escaped = true; - break; - case 0x04: - escaped += "\\u0004"; - is_escaped = true; - break; - case 0x05: - escaped += "\\u0005"; - is_escaped = true; - break; - case 0x06: - escaped += "\\u0006"; - is_escaped = true; - break; - case '\a': - escaped += "\\a"; - is_escaped = true; - break; - case '\b': - escaped += "\\b"; - is_escaped = true; - break; - case '\t': - escaped += "\\t"; - is_escaped = true; - break; - case '\n': - escaped += "\\n"; - is_escaped = true; - break; - case '\v': - escaped += "\\v"; - is_escaped = true; - break; - case '\f': - escaped += "\\f"; - is_escaped = true; - break; - case '\r': - escaped += "\\r"; - is_escaped = true; - break; - case 0x0E: - escaped += "\\u000E"; - is_escaped = true; - break; - case 0x0F: - escaped += "\\u000F"; - is_escaped = true; - break; - case 0x10: - escaped += "\\u0010"; - is_escaped = true; - break; - case 0x11: - escaped += "\\u0011"; - is_escaped = true; - break; - case 0x12: - escaped += "\\u0012"; - is_escaped = true; - break; - case 0x13: - escaped += "\\u0013"; - is_escaped = true; - break; - case 0x14: - escaped += "\\u0014"; - is_escaped = true; - break; - case 0x15: - escaped += "\\u0015"; - is_escaped = true; - break; - case 0x16: - escaped += "\\u0016"; - is_escaped = true; - break; - case 0x17: - escaped += "\\u0017"; - is_escaped = true; - break; - case 0x18: - escaped += "\\u0018"; - is_escaped = true; - break; - case 0x19: - escaped += "\\u0019"; - is_escaped = true; - break; - case 0x1A: - escaped += "\\u001A"; - is_escaped = true; - break; - case 0x1B: - escaped += "\\e"; - is_escaped = true; - break; - case 0x1C: - escaped += "\\u001C"; - is_escaped = true; - break; - case 0x1D: - escaped += "\\u001D"; - is_escaped = true; - break; - case 0x1E: - escaped += "\\u001E"; - is_escaped = true; - break; - case 0x1F: - escaped += "\\u001F"; - is_escaped = true; - break; - case '\"': - escaped += "\\\""; - is_escaped = true; - break; - case '\\': - escaped += "\\\\"; - is_escaped = true; - break; - default: - if (i + 1 < size && s[i] == char(0xC2u) && s[i + 1] == char(0x85u)) { - escaped += "\\N"; - i++; - is_escaped = true; - break; - } - if (i + 1 < size && s[i] == char(0xC2u) && s[i + 1] == char(0xA0u)) { - escaped += "\\_"; - i++; - is_escaped = true; - break; - } - if (i + 2 < size && s[i] == char(0xE2u) && s[i + 1] == char(0x80u) && s[i + 2] == char(0xA8u)) { - escaped += "\\L"; - i += 2; - is_escaped = true; - break; - } - if (i + 2 < size && s[i] == char(0xE2u) && s[i + 1] == char(0x80u) && s[i + 2] == char(0xA9u)) { - escaped += "\\P"; - i += 2; - is_escaped = true; - break; - } - escaped += s[i]; - break; - } - } - - return escaped; + return yaml_escaper::escape(s.begin(), s.end(), is_escaped); } // LCOV_EXCL_LINE private: diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 0d8fa6da..59491636 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -1663,6 +1663,357 @@ FK_YAML_DETAIL_NAMESPACE_END #endif /* FK_YAML_DETAIL_ENCODINGS_UTF_ENCODINGS_HPP_ */ +// #include +/// _______ __ __ __ _____ __ __ __ +/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +/// +/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +/// SPDX-License-Identifier: MIT +/// +/// @file + +#ifndef FK_YAML_DETAIL_ENCODINGS_YAML_ESCAPER_HPP_ +#define FK_YAML_DETAIL_ENCODINGS_YAML_ESCAPER_HPP_ + +#include + +// #include + +// #include + +// #include + +// #include + + +FK_YAML_DETAIL_NAMESPACE_BEGIN + +class yaml_escaper { + using iterator = ::std::string::const_iterator; + +public: + static bool unescape(iterator& begin, iterator end, std::string& buff) { + FK_YAML_ASSERT(*begin == '\\' && std::distance(begin, end) > 0); + bool ret = true; + + switch (*++begin) { + case 'a': + buff.push_back('\a'); + break; + case 'b': + buff.push_back('\b'); + break; + case 't': + case char(0x09): + buff.push_back('\t'); + break; + case 'n': + buff.push_back('\n'); + break; + case 'v': + buff.push_back('\v'); + break; + case 'f': + buff.push_back('\f'); + break; + case 'r': + buff.push_back('\r'); + break; + case 'e': + buff.push_back(char(0x1B)); + break; + case ' ': + buff.push_back(' '); + break; + case '\"': + buff.push_back('\"'); + break; + case '/': + buff.push_back('/'); + break; + case '\\': + buff.push_back('\\'); + break; + case 'N': // next line + unescape_escaped_unicode(0x85u, buff); + break; + case '_': // non-breaking space + unescape_escaped_unicode(0xA0u, buff); + break; + case 'L': // line separator + unescape_escaped_unicode(0x2028u, buff); + break; + case 'P': // paragraph separator + unescape_escaped_unicode(0x2029u, buff); + break; + case 'x': { + char32_t codepoint {0}; + ret = extract_codepoint(begin, end, 1, codepoint); + if (ret) { + unescape_escaped_unicode(codepoint, buff); + } + break; + } + case 'u': { + char32_t codepoint {0}; + ret = extract_codepoint(begin, end, 2, codepoint); + if (ret) { + unescape_escaped_unicode(codepoint, buff); + } + break; + } + case 'U': { + char32_t codepoint {0}; + ret = extract_codepoint(begin, end, 4, codepoint); + if (ret) { + unescape_escaped_unicode(codepoint, buff); + } + break; + } + default: + // Unsupported escape sequence is found in a string token. + ret = false; + break; + } + + return ret; + } + + static ::std::string escape(iterator begin, iterator end, bool& is_escaped) { + ::std::string escaped {}; + escaped.reserve(std::distance(begin, end)); + for (; begin != end; ++begin) { + switch (*begin) { + case 0x01: + escaped += "\\u0001"; + is_escaped = true; + break; + case 0x02: + escaped += "\\u0002"; + is_escaped = true; + break; + case 0x03: + escaped += "\\u0003"; + is_escaped = true; + break; + case 0x04: + escaped += "\\u0004"; + is_escaped = true; + break; + case 0x05: + escaped += "\\u0005"; + is_escaped = true; + break; + case 0x06: + escaped += "\\u0006"; + is_escaped = true; + break; + case '\a': + escaped += "\\a"; + is_escaped = true; + break; + case '\b': + escaped += "\\b"; + is_escaped = true; + break; + case '\t': + escaped += "\\t"; + is_escaped = true; + break; + case '\n': + escaped += "\\n"; + is_escaped = true; + break; + case '\v': + escaped += "\\v"; + is_escaped = true; + break; + case '\f': + escaped += "\\f"; + is_escaped = true; + break; + case '\r': + escaped += "\\r"; + is_escaped = true; + break; + case 0x0E: + escaped += "\\u000E"; + is_escaped = true; + break; + case 0x0F: + escaped += "\\u000F"; + is_escaped = true; + break; + case 0x10: + escaped += "\\u0010"; + is_escaped = true; + break; + case 0x11: + escaped += "\\u0011"; + is_escaped = true; + break; + case 0x12: + escaped += "\\u0012"; + is_escaped = true; + break; + case 0x13: + escaped += "\\u0013"; + is_escaped = true; + break; + case 0x14: + escaped += "\\u0014"; + is_escaped = true; + break; + case 0x15: + escaped += "\\u0015"; + is_escaped = true; + break; + case 0x16: + escaped += "\\u0016"; + is_escaped = true; + break; + case 0x17: + escaped += "\\u0017"; + is_escaped = true; + break; + case 0x18: + escaped += "\\u0018"; + is_escaped = true; + break; + case 0x19: + escaped += "\\u0019"; + is_escaped = true; + break; + case 0x1A: + escaped += "\\u001A"; + is_escaped = true; + break; + case 0x1B: + escaped += "\\e"; + is_escaped = true; + break; + case 0x1C: + escaped += "\\u001C"; + is_escaped = true; + break; + case 0x1D: + escaped += "\\u001D"; + is_escaped = true; + break; + case 0x1E: + escaped += "\\u001E"; + is_escaped = true; + break; + case 0x1F: + escaped += "\\u001F"; + is_escaped = true; + break; + case '\"': + escaped += "\\\""; + is_escaped = true; + break; + case '\\': + escaped += "\\\\"; + is_escaped = true; + break; + default: + int diff = static_cast(std::distance(begin, end)); + if (diff > 1) { + if (*begin == char(0xC2u) && *(begin + 1) == char(0x85u)) { + escaped += "\\N"; + std::advance(begin, 1); + is_escaped = true; + break; + } + else if (*begin == char(0xC2u) && *(begin + 1) == char(0xA0u)) { + escaped += "\\_"; + std::advance(begin, 1); + is_escaped = true; + break; + } + + if (diff > 2) { + if (*begin == char(0xE2u) && *(begin + 1) == char(0x80u) && *(begin + 2) == char(0xA8u)) { + escaped += "\\L"; + std::advance(begin, 2); + is_escaped = true; + break; + } + if (*begin == char(0xE2u) && *(begin + 1) == char(0x80u) && *(begin + 2) == char(0xA9u)) { + escaped += "\\P"; + std::advance(begin, 2); + is_escaped = true; + break; + } + } + } + escaped += *begin; + break; + } + } + return escaped; + } // LCOV_EXCL_LINE + +private: + static bool convert_hexchar_to_byte(char source, uint8_t& byte) { + if ('0' <= source && source <= '9') { + // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) + byte = static_cast(source - char('0')); + return true; + } + + if ('A' <= source && source <= 'F') { + // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) + byte = static_cast(source - 'A' + 10); + return true; + } + + if ('a' <= source && source <= 'f') { + // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) + byte = static_cast(source - 'a' + 10); + return true; + } + + // The given character is not hexadecimal. + return false; + } + + static bool extract_codepoint(iterator& begin, iterator end, int bytes_to_read, char32_t& codepoint) { + bool has_enough_room = static_cast(std::distance(begin, end)) >= (bytes_to_read - 1); + if (!has_enough_room) { + return false; + } + + int read_size = bytes_to_read * 2; + uint8_t byte {0}; + codepoint = 0; + + for (int i = read_size - 1; i >= 0; i--) { + bool is_valid = convert_hexchar_to_byte(*++begin, byte); + if (!is_valid) { + return false; + } + // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) + codepoint |= static_cast(byte << (4 * i)); + } + + return true; + } + + static void unescape_escaped_unicode(char32_t codepoint, std::string& buff) { + std::array encode_buff {}; + uint32_t encoded_size {0}; + utf8::from_utf32(codepoint, encode_buff, encoded_size); + buff.append(reinterpret_cast(encode_buff.data()), encoded_size); + } +}; + +FK_YAML_DETAIL_NAMESPACE_END + +#endif /* FK_YAML_DETAIL_ENCODINGS_YAML_ESCAPER_HPP_ */ + // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library @@ -2566,28 +2917,6 @@ class lexical_analyzer { } private: - /// @brief A utility function to convert a hexadecimal character to an integer. - /// @param source A hexadecimal character ('0'~'9', 'A'~'F', 'a'~'f') - /// @return char A integer converted from @a source. - char convert_hex_char_to_byte(char source) const { - if ('0' <= source && source <= '9') { - // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) - return static_cast(source - '0'); - } - - if ('A' <= source && source <= 'F') { - // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) - return static_cast(source - 'A' + 10); - } - - if ('a' <= source && source <= 'f') { - // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) - return static_cast(source - 'a' + 10); - } - - emit_error("Non-hexadecimal character has been given."); - } - /// @brief Skip until a newline code or a null character is found. void scan_comment() { FK_YAML_ASSERT(*m_cur_itr == '#'); @@ -3008,71 +3337,9 @@ class lexical_analyzer { // Handle escaped characters. // See https://yaml.org/spec/1.2.2/#57-escaped-characters for more details. - c = *++m_cur_itr; - switch (c) { - case 'a': - m_value_buffer.push_back('\a'); - break; - case 'b': - m_value_buffer.push_back('\b'); - break; - case 't': - case char(0x09): - m_value_buffer.push_back('\t'); - break; - case 'n': - m_value_buffer.push_back('\n'); - break; - case 'v': - m_value_buffer.push_back('\v'); - break; - case 'f': - m_value_buffer.push_back('\f'); - break; - case 'r': - m_value_buffer.push_back('\r'); - break; - case 'e': - m_value_buffer.push_back(char(0x1B)); - break; - case ' ': - m_value_buffer.push_back(' '); - break; - case '\"': - m_value_buffer.push_back('\"'); - break; - case '/': - m_value_buffer.push_back('/'); - break; - case '\\': - m_value_buffer.push_back('\\'); - break; - case 'N': // next line - utf8::from_utf32(0x85u, m_encode_buffer, m_encoded_size); - m_value_buffer.append(reinterpret_cast(m_encode_buffer.data()), m_encoded_size); - break; - case '_': // non-breaking space - utf8::from_utf32(0xA0u, m_encode_buffer, m_encoded_size); - m_value_buffer.append(reinterpret_cast(m_encode_buffer.data()), m_encoded_size); - break; - case 'L': // line separator - utf8::from_utf32(0x2028u, m_encode_buffer, m_encoded_size); - m_value_buffer.append(reinterpret_cast(m_encode_buffer.data()), m_encoded_size); - break; - case 'P': // paragraph separator - utf8::from_utf32(0x2029u, m_encode_buffer, m_encoded_size); - m_value_buffer.append(reinterpret_cast(m_encode_buffer.data()), m_encoded_size); - break; - case 'x': - handle_escaped_unicode(1); - break; - case 'u': - handle_escaped_unicode(2); - break; - case 'U': - handle_escaped_unicode(4); - break; - default: + + bool is_valid_escaping = yaml_escaper::unescape(m_cur_itr, m_end_itr, m_value_buffer); + if (!is_valid_escaping) { emit_error("Unsupported escape sequence is found in a string token."); } @@ -3538,22 +3805,6 @@ class lexical_analyzer { } } - /// @brief Unescape the given escaped unicode character. - /// @param bytes_to_read The number of bytes to be read from the input buffer. - void handle_escaped_unicode(int bytes_to_read) { - int read_size = bytes_to_read * 2; - char32_t code_point = 0; - for (int i = read_size - 1; i >= 0; i--) { - char four_bits = convert_hex_char_to_byte(*++m_cur_itr); - // NOLINTNEXTLINE(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) - code_point |= static_cast(four_bits << (4 * i)); - } - - // Treats the code point as a UTF-32 encoded character. - utf8::from_utf32(code_point, m_encode_buffer, m_encoded_size); - m_value_buffer.append(reinterpret_cast(m_encode_buffer.data()), m_encoded_size); - } - /// @brief Gets the metadata of a following block style string scalar. /// @param chomp_type A variable to store the retrieved chomping style type. /// @param indent A variable to store the retrieved indent size. @@ -3578,7 +3829,7 @@ class lexical_analyzer { indent = 0; if (std::isdigit(*m_cur_itr)) { - indent = convert_hex_char_to_byte(*m_cur_itr++); + indent = static_cast(*m_cur_itr++ - '0'); } // skip characters including comments. @@ -3653,10 +3904,6 @@ class lexical_analyzer { std::string m_tag_handle {}; /// The last tag prefix std::string m_tag_prefix {}; - /// A temporal buffer to store a UTF-8 encoded char sequence. - std::array m_encode_buffer {}; - /// The actual size of a UTF-8 encoded char sequence. - uint32_t m_encoded_size {0}; /// The beginning position of the last lexical token. (zero origin) uint32_t m_last_token_begin_pos {0}; /// The beginning line of the last lexical token. (zero origin) @@ -6581,6 +6828,8 @@ FK_YAML_DETAIL_NAMESPACE_END #endif /* TO__string_HPP_ */ +// #include + // #include // #include @@ -6870,178 +7119,8 @@ class basic_serializer { FK_YAML_ASSERT(node.is_string()); using string_type = typename BasicNodeType::string_type; - - // Check if the string value contains a character needed to be escaped on output. const string_type& s = node.template get_value_ref(); - size_t size = s.size(); - string_type escaped {}; - escaped.reserve(size); - - for (size_t i = 0; i < size; i++) { - switch (s[i]) { - case 0x01: - escaped += "\\u0001"; - is_escaped = true; - break; - case 0x02: - escaped += "\\u0002"; - is_escaped = true; - break; - case 0x03: - escaped += "\\u0003"; - is_escaped = true; - break; - case 0x04: - escaped += "\\u0004"; - is_escaped = true; - break; - case 0x05: - escaped += "\\u0005"; - is_escaped = true; - break; - case 0x06: - escaped += "\\u0006"; - is_escaped = true; - break; - case '\a': - escaped += "\\a"; - is_escaped = true; - break; - case '\b': - escaped += "\\b"; - is_escaped = true; - break; - case '\t': - escaped += "\\t"; - is_escaped = true; - break; - case '\n': - escaped += "\\n"; - is_escaped = true; - break; - case '\v': - escaped += "\\v"; - is_escaped = true; - break; - case '\f': - escaped += "\\f"; - is_escaped = true; - break; - case '\r': - escaped += "\\r"; - is_escaped = true; - break; - case 0x0E: - escaped += "\\u000E"; - is_escaped = true; - break; - case 0x0F: - escaped += "\\u000F"; - is_escaped = true; - break; - case 0x10: - escaped += "\\u0010"; - is_escaped = true; - break; - case 0x11: - escaped += "\\u0011"; - is_escaped = true; - break; - case 0x12: - escaped += "\\u0012"; - is_escaped = true; - break; - case 0x13: - escaped += "\\u0013"; - is_escaped = true; - break; - case 0x14: - escaped += "\\u0014"; - is_escaped = true; - break; - case 0x15: - escaped += "\\u0015"; - is_escaped = true; - break; - case 0x16: - escaped += "\\u0016"; - is_escaped = true; - break; - case 0x17: - escaped += "\\u0017"; - is_escaped = true; - break; - case 0x18: - escaped += "\\u0018"; - is_escaped = true; - break; - case 0x19: - escaped += "\\u0019"; - is_escaped = true; - break; - case 0x1A: - escaped += "\\u001A"; - is_escaped = true; - break; - case 0x1B: - escaped += "\\e"; - is_escaped = true; - break; - case 0x1C: - escaped += "\\u001C"; - is_escaped = true; - break; - case 0x1D: - escaped += "\\u001D"; - is_escaped = true; - break; - case 0x1E: - escaped += "\\u001E"; - is_escaped = true; - break; - case 0x1F: - escaped += "\\u001F"; - is_escaped = true; - break; - case '\"': - escaped += "\\\""; - is_escaped = true; - break; - case '\\': - escaped += "\\\\"; - is_escaped = true; - break; - default: - if (i + 1 < size && s[i] == char(0xC2u) && s[i + 1] == char(0x85u)) { - escaped += "\\N"; - i++; - is_escaped = true; - break; - } - if (i + 1 < size && s[i] == char(0xC2u) && s[i + 1] == char(0xA0u)) { - escaped += "\\_"; - i++; - is_escaped = true; - break; - } - if (i + 2 < size && s[i] == char(0xE2u) && s[i + 1] == char(0x80u) && s[i + 2] == char(0xA8u)) { - escaped += "\\L"; - i += 2; - is_escaped = true; - break; - } - if (i + 2 < size && s[i] == char(0xE2u) && s[i + 1] == char(0x80u) && s[i + 2] == char(0xA9u)) { - escaped += "\\P"; - i += 2; - is_escaped = true; - break; - } - escaped += s[i]; - break; - } - } - - return escaped; + return yaml_escaper::escape(s.begin(), s.end(), is_escaped); } // LCOV_EXCL_LINE private: diff --git a/test/unit_test/CMakeLists.txt b/test/unit_test/CMakeLists.txt index 6ec09554..734a4114 100644 --- a/test/unit_test/CMakeLists.txt +++ b/test/unit_test/CMakeLists.txt @@ -210,6 +210,7 @@ add_executable( test_tag_resolver_class.cpp test_uri_encoding_class.cpp test_utf_encodings.cpp + test_yaml_escaper_class.cpp main.cpp ) diff --git a/test/unit_test/test_lexical_analyzer_class.cpp b/test/unit_test/test_lexical_analyzer_class.cpp index 60690c00..a169fb7b 100644 --- a/test/unit_test/test_lexical_analyzer_class.cpp +++ b/test/unit_test/test_lexical_analyzer_class.cpp @@ -564,29 +564,12 @@ TEST_CASE("LexicalAnalyzer_String") { value_pair_t(std::string("\'foo\\bar\'"), fkyaml::node::string_type("foo\\bar")), value_pair_t(std::string("\"foo bar\""), fkyaml::node::string_type("foo bar")), + value_pair_t(std::string("\"foo\tbar\""), fkyaml::node::string_type("foo\tbar")), value_pair_t(std::string("\"foo's bar\""), fkyaml::node::string_type("foo's bar")), value_pair_t(std::string("\"foo:bar\""), fkyaml::node::string_type("foo:bar")), value_pair_t(std::string("\"foo,bar\""), fkyaml::node::string_type("foo,bar")), value_pair_t(std::string("\"foo]bar\""), fkyaml::node::string_type("foo]bar")), value_pair_t(std::string("\"foo}bar\""), fkyaml::node::string_type("foo}bar")), - value_pair_t(std::string("\"foo\\abar\""), fkyaml::node::string_type("foo\abar")), - value_pair_t(std::string("\"foo\\bbar\""), fkyaml::node::string_type("foo\bbar")), - value_pair_t(std::string("\"foo\\tbar\""), fkyaml::node::string_type("foo\tbar")), - value_pair_t(std::string("\"foo\\\u0009bar\""), fkyaml::node::string_type("foo\tbar")), - value_pair_t(std::string("\"foo\tbar\""), fkyaml::node::string_type("foo\tbar")), - value_pair_t(std::string("\"foo\\nbar\""), fkyaml::node::string_type("foo\nbar")), - value_pair_t(std::string("\"foo\\vbar\""), fkyaml::node::string_type("foo\vbar")), - value_pair_t(std::string("\"foo\\fbar\""), fkyaml::node::string_type("foo\fbar")), - value_pair_t(std::string("\"foo\\rbar\""), fkyaml::node::string_type("foo\rbar")), - value_pair_t(std::string("\"foo\\ebar\""), fkyaml::node::string_type("foo\u001Bbar")), - value_pair_t(std::string("\"foo\\ bar\""), fkyaml::node::string_type("foo bar")), - value_pair_t(std::string("\"foo\\\"bar\""), fkyaml::node::string_type("foo\"bar")), - value_pair_t(std::string("\"foo\\/bar\""), fkyaml::node::string_type("foo/bar")), - value_pair_t(std::string("\"foo\\\\bar\""), fkyaml::node::string_type("foo\\bar")), - value_pair_t(std::string("\"foo\\Nbar\""), fkyaml::node::string_type("foo\u0085bar")), - value_pair_t(std::string("\"foo\\_bar\""), fkyaml::node::string_type("foo\u00A0bar")), - value_pair_t(std::string("\"foo\\Lbar\""), fkyaml::node::string_type("foo\u2028bar")), - value_pair_t(std::string("\"foo\\Pbar\""), fkyaml::node::string_type("foo\u2029bar")), value_pair_t(std::string("\"\\x30\\x2B\\x6d\""), fkyaml::node::string_type("0+m"))); lexer_t lexer(fkyaml::detail::input_adapter(value_pair.first)); diff --git a/test/unit_test/test_serializer_class.cpp b/test/unit_test/test_serializer_class.cpp index 1c3e0107..0b847832 100644 --- a/test/unit_test/test_serializer_class.cpp +++ b/test/unit_test/test_serializer_class.cpp @@ -64,8 +64,6 @@ TEST_CASE("SerializeClassTest_FloatNumberNode", "[SerializeClassTest]") { TEST_CASE("Serializer_StringNode") { using node_str_pair_t = std::pair; - const char NEXT_LINE[] = {char(0xC2u), char(0x85u), char(0)}; - auto node_str_pair = GENERATE_REF( node_str_pair_t("test", "test"), node_str_pair_t("foo bar", "foo bar"), @@ -92,44 +90,8 @@ TEST_CASE("Serializer_StringNode") { node_str_pair_t(".nan", "\".nan\""), node_str_pair_t(".NaN", "\".NaN\""), node_str_pair_t(".NAN", "\".NAN\""), - node_str_pair_t(fkyaml::node::string_type({char(0x01)}), "\"\\u0001\""), - node_str_pair_t(fkyaml::node::string_type({char(0x02)}), "\"\\u0002\""), - node_str_pair_t(fkyaml::node::string_type({char(0x03)}), "\"\\u0003\""), - node_str_pair_t(fkyaml::node::string_type({char(0x04)}), "\"\\u0004\""), - node_str_pair_t(fkyaml::node::string_type({char(0x05)}), "\"\\u0005\""), - node_str_pair_t(fkyaml::node::string_type({char(0x06)}), "\"\\u0006\""), - node_str_pair_t("\a", "\"\\a\""), - node_str_pair_t("\b", "\"\\b\""), - node_str_pair_t("\t", "\"\\t\""), - node_str_pair_t("\n", "\"\\n\""), - node_str_pair_t("\v", "\"\\v\""), - node_str_pair_t("\f", "\"\\f\""), - node_str_pair_t("\r", "\"\\r\""), - node_str_pair_t(fkyaml::node::string_type({char(0x0E)}), "\"\\u000E\""), - node_str_pair_t(fkyaml::node::string_type({char(0x0F)}), "\"\\u000F\""), - node_str_pair_t(fkyaml::node::string_type({char(0x10)}), "\"\\u0010\""), - node_str_pair_t(fkyaml::node::string_type({char(0x11)}), "\"\\u0011\""), - node_str_pair_t(fkyaml::node::string_type({char(0x12)}), "\"\\u0012\""), - node_str_pair_t(fkyaml::node::string_type({char(0x13)}), "\"\\u0013\""), - node_str_pair_t(fkyaml::node::string_type({char(0x14)}), "\"\\u0014\""), - node_str_pair_t(fkyaml::node::string_type({char(0x15)}), "\"\\u0015\""), - node_str_pair_t(fkyaml::node::string_type({char(0x16)}), "\"\\u0016\""), - node_str_pair_t(fkyaml::node::string_type({char(0x17)}), "\"\\u0017\""), - node_str_pair_t(fkyaml::node::string_type({char(0x18)}), "\"\\u0018\""), - node_str_pair_t(fkyaml::node::string_type({char(0x19)}), "\"\\u0019\""), - node_str_pair_t(fkyaml::node::string_type({char(0x1A)}), "\"\\u001A\""), - node_str_pair_t(fkyaml::node::string_type({char(0x1B)}), "\"\\e\""), - node_str_pair_t(fkyaml::node::string_type({char(0x1C)}), "\"\\u001C\""), - node_str_pair_t(fkyaml::node::string_type({char(0x1D)}), "\"\\u001D\""), - node_str_pair_t(fkyaml::node::string_type({char(0x1E)}), "\"\\u001E\""), - node_str_pair_t(fkyaml::node::string_type({char(0x1F)}), "\"\\u001F\""), - node_str_pair_t("\"", "\"\\\"\""), - node_str_pair_t("\\", "\"\\\\\""), - node_str_pair_t(NEXT_LINE, "\"\\N\""), - node_str_pair_t(fkyaml::node::string_type({char(0xC2u), char(0xA0u)}), "\"\\_\""), - node_str_pair_t(fkyaml::node::string_type({char(0xC3u), char(0xA0u)}), std::string({char(0xC3u), char(0xA0u)})), + node_str_pair_t("foo\"bar", "\"foo\\\"bar\""), node_str_pair_t(fkyaml::node::string_type({char(0xC2u), char(0xA1u)}), std::string({char(0xC2u), char(0xA1u)})), - node_str_pair_t(fkyaml::node::string_type({char(0xE2u), char(0x80u), char(0xA8u)}), "\"\\L\""), node_str_pair_t( fkyaml::node::string_type({char(0xE3u), char(0x80u), char(0xA8u)}), std::string({char(0xE3u), char(0x80u), char(0xA8u)})), @@ -138,8 +100,7 @@ TEST_CASE("Serializer_StringNode") { std::string({char(0xE2u), char(0x81u), char(0xA8u)})), node_str_pair_t( fkyaml::node::string_type({char(0xE2u), char(0x80u), char(0xAAu)}), - std::string({char(0xE2u), char(0x80u), char(0xAAu)})), - node_str_pair_t(fkyaml::node::string_type({char(0xE2u), char(0x80u), char(0xA9u)}), "\"\\P\"")); + std::string({char(0xE2u), char(0x80u), char(0xAAu)}))); fkyaml::detail::basic_serializer serializer; REQUIRE(serializer.serialize(node_str_pair.first) == node_str_pair.second); diff --git a/test/unit_test/test_yaml_escaper_class.cpp b/test/unit_test/test_yaml_escaper_class.cpp new file mode 100644 index 00000000..074c0145 --- /dev/null +++ b/test/unit_test/test_yaml_escaper_class.cpp @@ -0,0 +1,123 @@ +// _______ __ __ __ _____ __ __ __ +// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +// +// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +// SPDX-License-Identifier: MIT + +#include + +#include + +#include + +TEST_CASE("YamlEscaper_Unescape") { + SECTION("valid escape sequence") { + using test_data_t = std::pair; + auto test_data = GENERATE( + test_data_t {"\\a", "\a"}, + test_data_t {"\\b", "\b"}, + test_data_t {"\\t", "\t"}, + test_data_t {"\\\u0009", "\t"}, + test_data_t {"\\n", "\n"}, + test_data_t {"\\v", "\v"}, + test_data_t {"\\f", "\f"}, + test_data_t {"\\r", "\r"}, + test_data_t {"\\e", "\u001b"}, + test_data_t {"\\ ", " "}, + test_data_t {"\\\"", "\""}, + test_data_t {"\\/", "/"}, + test_data_t {"\\\\", "\\"}, + test_data_t {"\\N", "\u0085"}, + test_data_t {"\\_", "\u00a0"}, + test_data_t {"\\L", "\u2028"}, + test_data_t {"\\P", "\u2029"}, + test_data_t {"\\x00", {char(0)}}, + test_data_t {"\\x40", {char(0x40)}}, + test_data_t {"\\x7F", {char(0x7F)}}, + test_data_t {"\\u0000", {char(0)}}, + test_data_t {"\\u0040", {char(0x40)}}, + test_data_t {"\\u007F", {char(0x7F)}}, + test_data_t {"\\U00000000", {char(0)}}, + test_data_t {"\\U00000040", {char(0x40)}}, + test_data_t {"\\U0000007F", {char(0x7F)}}); + + std::string buff {}; + auto begin_itr = test_data.first.cbegin(); + auto end_itr = test_data.first.cend(); + REQUIRE(fkyaml::detail::yaml_escaper::unescape(begin_itr, end_itr, buff)); + REQUIRE(buff == test_data.second); + } + + SECTION("invalid escape sequence") { + auto input = GENERATE( + std::string("\\Q"), + std::string("\\xw"), + std::string("\\x+"), + std::string("\\u="), + std::string("\\U^"), + std::string("\\x{")); + + std::string buff {}; + auto begin_itr = input.cbegin(); + auto end_itr = input.cend(); + REQUIRE_FALSE(fkyaml::detail::yaml_escaper::unescape(begin_itr, end_itr, buff)); + } + + SECTION("invalid UTF encoding") { + std::string input = "\\U00110000"; + auto begin_itr = input.cbegin(); + auto end_itr = input.cend(); + std::string buff {}; + REQUIRE_THROWS_AS(fkyaml::detail::yaml_escaper::unescape(begin_itr, end_itr, buff), fkyaml::invalid_encoding); + } +} + +TEST_CASE("YamlEscaper_Escape") { + using test_data_t = std::pair; + auto test_data = GENERATE( + test_data_t {{char(0x01)}, "\\u0001"}, + test_data_t {{char(0x02)}, "\\u0002"}, + test_data_t {{char(0x03)}, "\\u0003"}, + test_data_t {{char(0x04)}, "\\u0004"}, + test_data_t {{char(0x05)}, "\\u0005"}, + test_data_t {{char(0x06)}, "\\u0006"}, + test_data_t {"\a", "\\a"}, + test_data_t {"\b", "\\b"}, + test_data_t {"\t", "\\t"}, + test_data_t {"\n", "\\n"}, + test_data_t {"\v", "\\v"}, + test_data_t {"\f", "\\f"}, + test_data_t {"\r", "\\r"}, + test_data_t {{char(0x0E)}, "\\u000E"}, + test_data_t {{char(0x0F)}, "\\u000F"}, + test_data_t {{char(0x10)}, "\\u0010"}, + test_data_t {{char(0x11)}, "\\u0011"}, + test_data_t {{char(0x12)}, "\\u0012"}, + test_data_t {{char(0x13)}, "\\u0013"}, + test_data_t {{char(0x14)}, "\\u0014"}, + test_data_t {{char(0x15)}, "\\u0015"}, + test_data_t {{char(0x16)}, "\\u0016"}, + test_data_t {{char(0x17)}, "\\u0017"}, + test_data_t {{char(0x18)}, "\\u0018"}, + test_data_t {{char(0x19)}, "\\u0019"}, + test_data_t {{char(0x1A)}, "\\u001A"}, + test_data_t {{char(0x1B)}, "\\e"}, + test_data_t {{char(0x1C)}, "\\u001C"}, + test_data_t {{char(0x1D)}, "\\u001D"}, + test_data_t {{char(0x1E)}, "\\u001E"}, + test_data_t {{char(0x1F)}, "\\u001F"}, + test_data_t {"\"", "\\\""}, + test_data_t {"\\", "\\\\"}, + test_data_t {{char(0xC2u), char(0x85u)}, "\\N"}, + test_data_t {{char(0xC2u), char(0xA0u)}, "\\_"}, + test_data_t {{char(0xE2u), char(0x80u), char(0xA8u)}, "\\L"}, + test_data_t {{char(0xE2u), char(0x80u), char(0xA9u)}, "\\P"}); + + bool is_escaped = false; + auto begin_itr = test_data.first.cbegin(); + auto end_itr = test_data.first.cend(); + REQUIRE(fkyaml::detail::yaml_escaper::escape(begin_itr, end_itr, is_escaped) == test_data.second); + REQUIRE(is_escaped); +} From 1ed41cde2ec0dfcb844c584791fc3ee2bc61674a Mon Sep 17 00:00:00 2001 From: fktn Date: Sat, 4 May 2024 02:03:04 +0900 Subject: [PATCH 4/8] Fixed error on node properties for child block sequences (#338) --- include/fkYAML/detail/input/deserializer.hpp | 2 + single_include/fkYAML/node.hpp | 2 + test/unit_test/test_deserializer_class.cpp | 99 ++++++++++++++++++++ 3 files changed, 103 insertions(+) diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index b796872c..a64eddd7 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -444,6 +444,8 @@ class basic_deserializer { mp_current_node->template get_value_ref().emplace_back(node_type::sequence()); mp_current_node = &(mp_current_node->template get_value_ref().back()); 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; } diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 59491636..749d0a02 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -4560,6 +4560,8 @@ class basic_deserializer { mp_current_node->template get_value_ref().emplace_back(node_type::sequence()); mp_current_node = &(mp_current_node->template get_value_ref().back()); 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; } diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 7bff5aa2..2a0f52ea 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -195,6 +195,26 @@ TEST_CASE("Deserializer_BlockSequence") { REQUIRE(test_1_node.get_value_ref() == "bar"); } + SECTION("child block sequence whose prefixes are put as indentation") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("test:\n- foo\n- 123"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); + + fkyaml::node& root_test_node = root["test"]; + REQUIRE(root_test_node.is_sequence()); + REQUIRE(root_test_node.size() == 2); + + fkyaml::node& root_test_0_node = root_test_node[0]; + REQUIRE(root_test_0_node.is_string()); + REQUIRE(root_test_0_node.get_value_ref() == "foo"); + + fkyaml::node& root_test_1_node = root_test_node[1]; + REQUIRE(root_test_1_node.is_integer()); + REQUIRE(root_test_1_node.get_value() == 123); + } + SECTION("block sequence with nested mappings") { REQUIRE_NOTHROW( root = deserializer.deserialize( @@ -1633,6 +1653,32 @@ TEST_CASE("Deserializer_Anchor") { REQUIRE(foo_foo_node.get_value() == 123); } + SECTION("parse anchored child block sequence") { + std::string input = "test: &anchor\n" + "- foo\n" + "- 123"; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); + + fkyaml::node& test_node = root["test"]; + REQUIRE(test_node.is_anchor()); + REQUIRE(test_node.has_anchor_name()); + REQUIRE(test_node.get_anchor_name() == "anchor"); + REQUIRE(test_node.is_sequence()); + REQUIRE(test_node.size() == 2); + + fkyaml::node& test_0_node = test_node[0]; + REQUIRE(test_0_node.is_string()); + REQUIRE(test_0_node.get_value_ref() == "foo"); + + fkyaml::node& test_1_node = test_node[1]; + REQUIRE(test_1_node.is_integer()); + REQUIRE(test_1_node.get_value() == 123); + } + SECTION("multiple anchors specified") { auto input = GENERATE(std::string("foo: &anchor &anchor2\n bar: baz"), std::string("&anchor &anchor2 foo: bar")); @@ -1770,6 +1816,59 @@ TEST_CASE("Deserializer_Tag") { REQUIRE(seq_flow_1_node.get_value() == 3.14f); } + SECTION("valid tags for block sequence/mapping") { + std::string input = "seq: !!seq\n" + "- !!bool true\n" + "- !!seq\n" + " - !!str true\n" + "map: !!map\n" + " foo: bar"; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 2); + REQUIRE(root.contains("seq")); + REQUIRE(root.contains("map")); + + fkyaml::node& seq_node = root["seq"]; + REQUIRE(seq_node.has_tag_name()); + REQUIRE(seq_node.get_tag_name() == "!!seq"); + REQUIRE(seq_node.is_sequence()); + REQUIRE(seq_node.size() == 2); + + fkyaml::node& seq_0_node = seq_node[0]; + REQUIRE(seq_0_node.has_tag_name()); + REQUIRE(seq_0_node.get_tag_name() == "!!bool"); + REQUIRE(seq_0_node.is_boolean()); + REQUIRE(seq_0_node.get_value() == true); + + fkyaml::node& seq_1_node = seq_node[1]; + REQUIRE(seq_1_node.has_tag_name()); + REQUIRE(seq_1_node.get_tag_name() == "!!seq"); + REQUIRE(seq_1_node.is_sequence()); + REQUIRE(seq_1_node.size() == 1); + + fkyaml::node& seq_1_0_node = seq_1_node[0]; + REQUIRE(seq_1_0_node.has_tag_name()); + REQUIRE(seq_1_0_node.get_tag_name() == "!!str"); + REQUIRE(seq_1_0_node.is_string()); + REQUIRE(seq_1_0_node.get_value_ref() == "true"); + + fkyaml::node& map_node = root["map"]; + REQUIRE(map_node.has_tag_name()); + REQUIRE(map_node.get_tag_name() == "!!map"); + REQUIRE(map_node.is_mapping()); + REQUIRE(map_node.size() == 1); + REQUIRE(map_node.contains("foo")); + + // Make sure that the !!map tag is not applied to the child mapping key. + REQUIRE_FALSE(map_node.begin().value().has_tag_name()); + + fkyaml::node& map_foo_node = map_node["foo"]; + REQUIRE(map_foo_node.is_string()); + REQUIRE(map_foo_node.get_value_ref() == "bar"); + } + SECTION("specify tags using TAG directives") { std::string input = "%TAG !e! tag:example.com,2000:app/\n" "---\n" From 22204cd652264c6af6eb871d98e44043f9adccb1 Mon Sep 17 00:00:00 2001 From: fktn Date: Sat, 4 May 2024 02:41:00 +0900 Subject: [PATCH 5/8] Fix the C6262 warning on Windows (#339) * reorganized the parser test cases for block mappings --- test/unit_test/test_deserializer_class.cpp | 328 +++++++++++---------- 1 file changed, 170 insertions(+), 158 deletions(-) diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 2a0f52ea..56ee4ee1 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -685,10 +685,172 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(qux_node.get_value_ref() == "corge"); } - SECTION("block mapping with a block sequence of a block mapping with several key-value pairs") { + SECTION("block mapping with keys containing flow indicators") { REQUIRE_NOTHROW( - root = deserializer.deserialize( - fkyaml::detail::input_adapter("foo:\n - bar: true\n baz: 123\nqux: corge"))); + root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo,Bar: true\nBaz[123]: 3.14"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 2); + REQUIRE(root.contains("Foo,Bar")); + REQUIRE(root.contains("Baz[123]")); + + fkyaml::node& foobar_node = root["Foo,Bar"]; + REQUIRE(foobar_node.is_boolean()); + REQUIRE(foobar_node.get_value() == true); + + fkyaml::node& baz123_node = root["Baz[123]"]; + REQUIRE(baz123_node.is_float_number()); + REQUIRE(baz123_node.get_value() == 3.14); + } + + SECTION("Flow indicators inside unquoted plain scalar values") { + SECTION("plain scalar contains \'{\'") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc{abc"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("Foo")); + + fkyaml::node& foo_node = root["Foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "Bar, abc{abc"); + } + + SECTION("plain scalar contains \'}\'") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc}abc"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("Foo")); + + fkyaml::node& foo_node = root["Foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "Bar, abc}abc"); + } + + SECTION("plain scalar contains \'[\'") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc[abc"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("Foo")); + + fkyaml::node& foo_node = root["Foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "Bar, abc[abc"); + } + + SECTION("plain scalar contains \']\'") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc]abc"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("Foo")); + + fkyaml::node& foo_node = root["Foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "Bar, abc]abc"); + } + + SECTION("plain scalar contains \':\'") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, {[123] :3.14}"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("Foo")); + + fkyaml::node& foo_node = root["Foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "Bar, {[123] :3.14}"); + } + + SECTION("plain scalar contains \": \"") { + REQUIRE_THROWS_AS( + root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, {[123] : 3.14}")), + fkyaml::parse_error); + } + } + + SECTION("a comment right after a block mapping key.") { + REQUIRE_NOTHROW( + root = deserializer.deserialize(fkyaml::detail::input_adapter("baz: # comment2\n qux: 123\n"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("baz")); + + fkyaml::node& baz_node = root["baz"]; + REQUIRE(baz_node.is_mapping()); + REQUIRE(baz_node.size() == 1); + REQUIRE(baz_node.contains("qux")); + + fkyaml::node& baz_qux_node = baz_node["qux"]; + REQUIRE(baz_qux_node.is_integer()); + REQUIRE(baz_qux_node.get_value() == 123); + } + + SECTION("mapping entries split across newlines") { + std::string input = "foo:\n" + " bar\n" + "baz:\n" + " 123\n" + "null:\n" + " {false: 3.14}\n" + "qux:\n" + " [r, g, b]"; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 4); + REQUIRE(root.contains("foo")); + REQUIRE(root.contains("baz")); + REQUIRE(root.contains(nullptr)); + REQUIRE(root.contains("qux")); + + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "bar"); + + fkyaml::node& baz_node = root["baz"]; + REQUIRE(baz_node.is_integer()); + REQUIRE(baz_node.get_value() == 123); + + fkyaml::node& null_node = root[nullptr]; + REQUIRE(null_node.is_mapping()); + REQUIRE(null_node.contains(false)); + + fkyaml::node& null_false_node = null_node[false]; + REQUIRE(null_false_node.is_float_number()); + REQUIRE(null_false_node.get_value() == 3.14); + + fkyaml::node& qux_node = root["qux"]; + REQUIRE(qux_node.is_sequence()); + REQUIRE(qux_node.size() == 3); + + fkyaml::node& qux_0_node = qux_node[0]; + REQUIRE(qux_0_node.is_string()); + REQUIRE(qux_0_node.get_value_ref() == "r"); + + fkyaml::node& qux_1_node = qux_node[1]; + REQUIRE(qux_1_node.is_string()); + REQUIRE(qux_1_node.get_value_ref() == "g"); + + fkyaml::node& qux_2_node = qux_node[2]; + REQUIRE(qux_2_node.is_string()); + REQUIRE(qux_2_node.get_value_ref() == "b"); + } +} + +TEST_CASE("Deserializer_BlockMappingAsBlockSequenceEntry") { + fkyaml::detail::basic_deserializer deserializer; + fkyaml::node root; + + SECTION("block mapping with a block sequence of a block mapping with several key-value pairs") { + std::string input = "foo:\n" + " - bar: true\n" + " baz: 123\n" + "qux: corge"; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); @@ -854,6 +1016,11 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(stuff_1_name_node.is_string()); REQUIRE(stuff_1_name_node.get_value_ref() == "Bar"); } +} + +TEST_CASE("Deserializer_ExplicitBlockMapping") { + fkyaml::detail::basic_deserializer deserializer; + fkyaml::node root; SECTION("block mapping with explicit block mappings") { auto input_adapter = fkyaml::detail::input_adapter("null: 3.14\n" @@ -915,161 +1082,6 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(key2_1_node.is_string()); REQUIRE(key2_1_node.get_value_ref() == "qux"); } - - SECTION("block mapping with keys containing flow indicators") { - REQUIRE_NOTHROW( - root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo,Bar: true\nBaz[123]: 3.14"))); - - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 2); - REQUIRE(root.contains("Foo,Bar")); - REQUIRE(root.contains("Baz[123]")); - - fkyaml::node& foobar_node = root["Foo,Bar"]; - REQUIRE(foobar_node.is_boolean()); - REQUIRE(foobar_node.get_value() == true); - - fkyaml::node& baz123_node = root["Baz[123]"]; - REQUIRE(baz123_node.is_float_number()); - REQUIRE(baz123_node.get_value() == 3.14); - } - - SECTION("Flow indicators inside unquoted plain scalar values") { - SECTION("plain scalar contains \'{\'") { - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc{abc"))); - - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("Foo")); - - fkyaml::node& foo_node = root["Foo"]; - REQUIRE(foo_node.is_string()); - REQUIRE(foo_node.get_value_ref() == "Bar, abc{abc"); - } - - SECTION("plain scalar contains \'}\'") { - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc}abc"))); - - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("Foo")); - - fkyaml::node& foo_node = root["Foo"]; - REQUIRE(foo_node.is_string()); - REQUIRE(foo_node.get_value_ref() == "Bar, abc}abc"); - } - - SECTION("plain scalar contains \'[\'") { - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc[abc"))); - - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("Foo")); - - fkyaml::node& foo_node = root["Foo"]; - REQUIRE(foo_node.is_string()); - REQUIRE(foo_node.get_value_ref() == "Bar, abc[abc"); - } - - SECTION("plain scalar contains \']\'") { - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc]abc"))); - - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("Foo")); - - fkyaml::node& foo_node = root["Foo"]; - REQUIRE(foo_node.is_string()); - REQUIRE(foo_node.get_value_ref() == "Bar, abc]abc"); - } - - SECTION("plain scalar contains \':\'") { - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, {[123] :3.14}"))); - - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("Foo")); - - fkyaml::node& foo_node = root["Foo"]; - REQUIRE(foo_node.is_string()); - REQUIRE(foo_node.get_value_ref() == "Bar, {[123] :3.14}"); - } - - SECTION("plain scalar contains \": \"") { - REQUIRE_THROWS_AS( - root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, {[123] : 3.14}")), - fkyaml::parse_error); - } - } - - SECTION("a comment right after a block mapping key.") { - REQUIRE_NOTHROW( - root = deserializer.deserialize(fkyaml::detail::input_adapter("baz: # comment2\n qux: 123\n"))); - - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("baz")); - - fkyaml::node& baz_node = root["baz"]; - REQUIRE(baz_node.is_mapping()); - REQUIRE(baz_node.size() == 1); - REQUIRE(baz_node.contains("qux")); - - fkyaml::node& baz_qux_node = baz_node["qux"]; - REQUIRE(baz_qux_node.is_integer()); - REQUIRE(baz_qux_node.get_value() == 123); - } - - SECTION("mapping entries split across newlines") { - REQUIRE_NOTHROW( - root = deserializer.deserialize(fkyaml::detail::input_adapter("foo:\n" - " bar\n" - "baz:\n" - " 123\n" - "null:\n" - " {false: 3.14}\n" - "qux:\n" - " [r, g, b]"))); - - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 4); - REQUIRE(root.contains("foo")); - REQUIRE(root.contains("baz")); - REQUIRE(root.contains(nullptr)); - REQUIRE(root.contains("qux")); - - fkyaml::node& foo_node = root["foo"]; - REQUIRE(foo_node.is_string()); - REQUIRE(foo_node.get_value_ref() == "bar"); - - fkyaml::node& baz_node = root["baz"]; - REQUIRE(baz_node.is_integer()); - REQUIRE(baz_node.get_value() == 123); - - fkyaml::node& null_node = root[nullptr]; - REQUIRE(null_node.is_mapping()); - REQUIRE(null_node.contains(false)); - - fkyaml::node& null_false_node = null_node[false]; - REQUIRE(null_false_node.is_float_number()); - REQUIRE(null_false_node.get_value() == 3.14); - - fkyaml::node& qux_node = root["qux"]; - REQUIRE(qux_node.is_sequence()); - REQUIRE(qux_node.size() == 3); - - fkyaml::node& qux_0_node = qux_node[0]; - REQUIRE(qux_0_node.is_string()); - REQUIRE(qux_0_node.get_value_ref() == "r"); - - fkyaml::node& qux_1_node = qux_node[1]; - REQUIRE(qux_1_node.is_string()); - REQUIRE(qux_1_node.get_value_ref() == "g"); - - fkyaml::node& qux_2_node = qux_node[2]; - REQUIRE(qux_2_node.is_string()); - REQUIRE(qux_2_node.get_value_ref() == "b"); - } } TEST_CASE("Deserializer_FlowSequence") { From ce763cce3dd86ad043fbeb63b53df9f3dded4360 Mon Sep 17 00:00:00 2001 From: fktn Date: Sun, 12 May 2024 15:31:23 +0900 Subject: [PATCH 6/8] Improve anchor alias node management (#340) * improved the way of managing anchor/alias nodes * add test cases for uncovered lines/branches & removed redundant runtime assertions * removed unnecessary member variable in deserializer anymore * fixed memory leak due to unreleased anchored node objects * resolved maybe-uninitialized GCC warning in basic_node ctor with initializer_list_t --- ...irective_set.hpp => document_metainfo.hpp} | 12 +- include/fkYAML/detail/input/deserializer.hpp | 57 +- include/fkYAML/detail/input/tag_resolver.hpp | 12 +- include/fkYAML/detail/node_property.hpp | 5 + include/fkYAML/detail/output/serializer.hpp | 31 +- include/fkYAML/node.hpp | 602 ++++--- single_include/fkYAML/node.hpp | 1530 +++++++++-------- test/unit_test/test_node_class.cpp | 22 +- test/unit_test/test_tag_resolver_class.cpp | 36 +- 9 files changed, 1319 insertions(+), 988 deletions(-) rename include/fkYAML/detail/{directive_set.hpp => document_metainfo.hpp} (71%) diff --git a/include/fkYAML/detail/directive_set.hpp b/include/fkYAML/detail/document_metainfo.hpp similarity index 71% rename from include/fkYAML/detail/directive_set.hpp rename to include/fkYAML/detail/document_metainfo.hpp index 90756628..fc419c76 100644 --- a/include/fkYAML/detail/directive_set.hpp +++ b/include/fkYAML/detail/document_metainfo.hpp @@ -8,19 +8,21 @@ /// /// @file -#ifndef FK_YAML_DETAIL_DIRECTIVE_SET_HPP_ -#define FK_YAML_DETAIL_DIRECTIVE_SET_HPP_ +#ifndef FK_YAML_DETAIL_DOCUMENT_METAINFO_HPP_ +#define FK_YAML_DETAIL_DOCUMENT_METAINFO_HPP_ #include #include #include +#include #include FK_YAML_DETAIL_NAMESPACE_BEGIN /// @brief The set of directives for a YAML document. -struct directive_set { +template ::value>> +struct document_metainfo { /// The YAML version used for the YAML document. yaml_version_t version {yaml_version_t::VER_1_2}; /// Whether or not the YAML version has been specified. @@ -31,8 +33,10 @@ struct directive_set { std::string secondary_handle_prefix {}; /// The map of handle-prefix pairs. std::map named_handle_map {}; + /// The map of anchor node which allowes for key duplication. + std::multimap anchor_table {}; }; FK_YAML_DETAIL_NAMESPACE_END -#endif /* FK_YAML_DETAIL_DIRECTIVE_SET_HPP_ */ +#endif /* FK_YAML_DETAIL_DOCUMENT_METAINFO_HPP_ */ diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index a64eddd7..f5f59972 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -17,12 +17,13 @@ #include #include -#include +#include #include #include #include #include #include +#include #include #include @@ -38,6 +39,10 @@ class basic_deserializer { using node_type = BasicNodeType; /** A type for the lexical analyzer. */ using lexer_type = lexical_analyzer; + /** A type for the document metainfo. */ + using doc_metainfo_type = document_metainfo; + /** A type for the tag resolver. */ + using tag_resolver_type = tag_resolver; /** A type for sequence node value containers. */ using sequence_type = typename node_type::sequence_type; /** A type for mapping node value containers. */ @@ -97,6 +102,7 @@ class basic_deserializer { lexical_token_t type {lexical_token_t::END_OF_BUFFER}; node_type root; + mp_meta = root.mp_meta; // parse directives first. deserialize_directives(lexer, type); @@ -144,9 +150,9 @@ class basic_deserializer { // reset parameters for the next call. mp_current_node = nullptr; - mp_directive_set.reset(); + mp_meta.reset(); + m_needs_tag_impl = false; m_needs_anchor_impl = false; - m_anchor_table.clear(); m_context_stack.clear(); return root; @@ -162,52 +168,44 @@ class basic_deserializer { switch (type) { case lexical_token_t::YAML_VER_DIRECTIVE: - if (!mp_directive_set) { - mp_directive_set = std::shared_ptr(new directive_set()); - } - - if (mp_directive_set->is_version_specified) { + if (mp_meta->is_version_specified) { throw parse_error( "YAML version cannot be specified more than once.", lexer.get_lines_processed(), lexer.get_last_token_begin_pos()); } - mp_directive_set->version = convert_yaml_version(lexer.get_yaml_version()); - mp_directive_set->is_version_specified = true; + mp_meta->version = convert_yaml_version(lexer.get_yaml_version()); + mp_meta->is_version_specified = true; break; case lexical_token_t::TAG_DIRECTIVE: { - if (!mp_directive_set) { - mp_directive_set = std::shared_ptr(new directive_set()); - } - const std::string& tag_handle = lexer.get_tag_handle(); switch (tag_handle.size()) { case 1: { - bool is_already_specified = !mp_directive_set->primary_handle_prefix.empty(); + bool is_already_specified = !mp_meta->primary_handle_prefix.empty(); if (is_already_specified) { throw parse_error( "Primary handle cannot be specified more than once.", lexer.get_lines_processed(), lexer.get_last_token_begin_pos()); } - mp_directive_set->primary_handle_prefix = lexer.get_tag_prefix(); + mp_meta->primary_handle_prefix = lexer.get_tag_prefix(); break; } case 2: { - bool is_already_specified = !mp_directive_set->secondary_handle_prefix.empty(); + bool is_already_specified = !mp_meta->secondary_handle_prefix.empty(); if (is_already_specified) { throw parse_error( "Secondary handle cannot be specified more than once.", lexer.get_lines_processed(), lexer.get_last_token_begin_pos()); } - mp_directive_set->secondary_handle_prefix = lexer.get_tag_prefix(); + mp_meta->secondary_handle_prefix = lexer.get_tag_prefix(); break; } default: { bool is_already_specified = - !(mp_directive_set->named_handle_map.emplace(tag_handle, lexer.get_tag_prefix()).second); + !(mp_meta->named_handle_map.emplace(tag_handle, lexer.get_tag_prefix()).second); if (is_already_specified) { throw parse_error( "The same named handle cannot be specified more than once.", @@ -337,7 +335,7 @@ class basic_deserializer { if (line > old_line) { if (m_needs_tag_impl) { - tag_t tag_type = tag_resolver::resolve_tag(m_tag_name, mp_directive_set); + tag_t tag_type = tag_resolver_type::resolve_tag(m_tag_name, mp_meta); if (tag_type == tag_t::MAPPING) { // set YAML node properties here to distinguish them from those for the first key node // as shown in the following snippet: @@ -716,7 +714,7 @@ class basic_deserializer { throw parse_error("Tag cannot be specified to alias nodes", line, indent); } - tag_t tag_type = tag_resolver::resolve_tag(m_tag_name, mp_directive_set); + tag_t tag_type = tag_resolver_type::resolve_tag(m_tag_name, mp_meta); FK_YAML_ASSERT(tag_type != tag_t::SEQUENCE && tag_type != tag_t::MAPPING); @@ -766,11 +764,13 @@ class basic_deserializer { break; case lexical_token_t::ALIAS_PREFIX: { const string_type& alias_name = lexer.get_string(); - auto itr = m_anchor_table.find(alias_name); - if (itr == m_anchor_table.end()) { + uint32_t anchor_counts = static_cast(mp_meta->anchor_table.count(alias_name)); + if (anchor_counts == 0) { throw parse_error("The given anchor name must appear prior to the alias node.", line, indent); } - node = node_type::alias_of(m_anchor_table[alias_name]); + node.m_prop.anchor_status = detail::anchor_status_t::ALIAS; + node.m_prop.anchor = alias_name; + node.m_prop.anchor_offset = anchor_counts - 1; break; } default: // LCOV_EXCL_LINE @@ -844,9 +844,7 @@ class basic_deserializer { /// @brief Set YAML directive properties to the given node. /// @param node A node_type object to be set YAML directive properties. void apply_directive_set(node_type& node) noexcept { - if (mp_directive_set) { - node.mp_directive_set = mp_directive_set; - } + node.mp_meta = mp_meta; } /// @brief Set YAML node properties (anchor and/or tag names) to the given node. @@ -854,7 +852,6 @@ class basic_deserializer { void apply_node_properties(node_type& node) { if (m_needs_anchor_impl) { node.add_anchor_name(m_anchor_name); - m_anchor_table[m_anchor_name] = node; m_needs_anchor_impl = false; m_anchor_name.clear(); } @@ -880,15 +877,13 @@ class basic_deserializer { /// The current depth of flow contexts. uint32_t m_flow_context_depth {0}; /// The set of YAML directives. - std::shared_ptr mp_directive_set {}; + std::shared_ptr mp_meta {}; /// A flag to determine the need for YAML anchor node implementation. bool m_needs_anchor_impl {false}; /// A flag to determine the need for a corresponding node with the last YAML tag. bool m_needs_tag_impl {false}; /// The last YAML anchor name. string_type m_anchor_name {}; - /// The table of YAML anchor nodes. - std::unordered_map m_anchor_table {}; /// The last tag name. string_type m_tag_name {}; }; diff --git a/include/fkYAML/detail/input/tag_resolver.hpp b/include/fkYAML/detail/input/tag_resolver.hpp index f31faf25..003834f6 100644 --- a/include/fkYAML/detail/input/tag_resolver.hpp +++ b/include/fkYAML/detail/input/tag_resolver.hpp @@ -17,8 +17,9 @@ #include #include -#include +#include #include +#include #include FK_YAML_DETAIL_NAMESPACE_BEGIN @@ -31,18 +32,23 @@ const std::string default_secondary_handle_prefix = "tag:yaml.org,2002:"; } // namespace +template class tag_resolver { + static_assert(is_basic_node::value, "tag_resolver only accepts basic_node<...>."); + using doc_metainfo_type = document_metainfo; + public: /// @brief Resolve the input tag name into an expanded tag name prepended with a registered prefix. /// @param tag The input tag name. /// @return The type of a node deduced from the given tag name. - static tag_t resolve_tag(const std::string& tag, const std::shared_ptr& directives) { + static tag_t resolve_tag(const std::string& tag, const std::shared_ptr& directives) { std::string normalized = normalize_tag_name(tag, directives); return convert_to_tag_type(normalized); } private: - static std::string normalize_tag_name(const std::string& tag, const std::shared_ptr& directives) { + static std::string normalize_tag_name( + const std::string& tag, const std::shared_ptr& directives) { if (tag.empty()) { throw invalid_tag("tag must not be empty.", ""); } diff --git a/include/fkYAML/detail/node_property.hpp b/include/fkYAML/detail/node_property.hpp index c3b21b6c..acbe9462 100644 --- a/include/fkYAML/detail/node_property.hpp +++ b/include/fkYAML/detail/node_property.hpp @@ -24,9 +24,14 @@ enum class anchor_status_t { }; struct node_property { + /// The tag name property. std::string tag {}; + /// The status regarding node anchoring/aliasing. anchor_status_t anchor_status {anchor_status_t::NONE}; + /// The anchor name property. std::string anchor {}; + /// The offset index value used to reference the anchor node implementation. + uint32_t anchor_offset {0}; }; FK_YAML_DETAIL_NAMESPACE_END diff --git a/include/fkYAML/detail/output/serializer.hpp b/include/fkYAML/detail/output/serializer.hpp index 7e6efaa8..8991c80e 100644 --- a/include/fkYAML/detail/output/serializer.hpp +++ b/include/fkYAML/detail/output/serializer.hpp @@ -52,15 +52,12 @@ class basic_serializer { /// @param node The targe node. /// @param str A string to hold serialization result. void serialize_directives(const BasicNodeType& node, std::string& str) { - if (!node.mp_directive_set) { - return; - } + const auto& p_meta = node.mp_meta; + bool needs_directive_end = false; - const auto& directives = node.mp_directive_set; - - if (directives->is_version_specified) { + if (p_meta->is_version_specified) { str += "%YAML "; - switch (directives->version) { + switch (p_meta->version) { case yaml_version_t::VER_1_1: str += "1.1\n"; break; @@ -68,31 +65,37 @@ class basic_serializer { str += "1.2\n"; break; } + needs_directive_end = true; } - if (!directives->primary_handle_prefix.empty()) { + if (!p_meta->primary_handle_prefix.empty()) { str += "%TAG ! "; - str += directives->primary_handle_prefix; + str += p_meta->primary_handle_prefix; str += "\n"; + needs_directive_end = true; } - if (!directives->secondary_handle_prefix.empty()) { + if (!p_meta->secondary_handle_prefix.empty()) { str += "%TAG !! "; - str += directives->secondary_handle_prefix; + str += p_meta->secondary_handle_prefix; str += "\n"; + needs_directive_end = true; } - if (!directives->named_handle_map.empty()) { - for (const auto& itr : directives->named_handle_map) { + if (!p_meta->named_handle_map.empty()) { + for (const auto& itr : p_meta->named_handle_map) { str += "%TAG "; str += itr.first; str += " "; str += itr.second; str += "\n"; } + needs_directive_end = true; } - str += "---\n"; + if (needs_directive_end) { + str += "---\n"; + } } /// @brief Recursively serialize each Node object. diff --git a/include/fkYAML/node.hpp b/include/fkYAML/node.hpp index 1530c144..207443ad 100644 --- a/include/fkYAML/node.hpp +++ b/include/fkYAML/node.hpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -171,6 +171,17 @@ class basic_node { basic_node current_node(std::move(stack.back())); stack.pop_back(); + if (current_node.is_alias()) { + continue; + } + + if (current_node.is_anchor()) { + auto itr = current_node.mp_meta->anchor_table.equal_range(current_node.m_prop.anchor).first; + std::advance(itr, current_node.m_prop.anchor_offset); + stack.emplace_back(std::move(itr->second)); + continue; + } + if (current_node.is_sequence()) { std::move( current_node.m_node_value.p_sequence->begin(), @@ -230,7 +241,7 @@ class basic_node { using AllocType = std::allocator; using AllocTraitsType = std::allocator_traits; - AllocType alloc; + AllocType alloc {}; auto deleter = [&](ObjType* obj) { AllocTraitsType::destroy(alloc, obj); AllocTraitsType::deallocate(alloc, obj, 1); @@ -273,33 +284,32 @@ class basic_node { /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/constructor/ basic_node(const basic_node& rhs) : m_node_type(rhs.m_node_type), - mp_directive_set(rhs.mp_directive_set), + mp_meta(rhs.mp_meta), m_prop(rhs.m_prop) { - switch (m_node_type) { - case node_t::SEQUENCE: - m_node_value.p_sequence = create_object(*(rhs.m_node_value.p_sequence)); - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - break; - case node_t::MAPPING: - m_node_value.p_mapping = create_object(*(rhs.m_node_value.p_mapping)); - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - break; - case node_t::NULL_OBJECT: - m_node_value.p_mapping = nullptr; - break; - case node_t::BOOLEAN: - m_node_value.boolean = rhs.m_node_value.boolean; - break; - case node_t::INTEGER: - m_node_value.integer = rhs.m_node_value.integer; - break; - case node_t::FLOAT_NUMBER: - m_node_value.float_val = rhs.m_node_value.float_val; - break; - case node_t::STRING: - m_node_value.p_string = create_object(*(rhs.m_node_value.p_string)); - FK_YAML_ASSERT(m_node_value.p_string != nullptr); - break; + if (!has_anchor_name()) { + switch (m_node_type) { + case node_t::SEQUENCE: + m_node_value.p_sequence = create_object(*(rhs.m_node_value.p_sequence)); + break; + case node_t::MAPPING: + m_node_value.p_mapping = create_object(*(rhs.m_node_value.p_mapping)); + break; + case node_t::NULL_OBJECT: + m_node_value.p_mapping = nullptr; + break; + case node_t::BOOLEAN: + m_node_value.boolean = rhs.m_node_value.boolean; + break; + case node_t::INTEGER: + m_node_value.integer = rhs.m_node_value.integer; + break; + case node_t::FLOAT_NUMBER: + m_node_value.float_val = rhs.m_node_value.float_val; + break; + case node_t::STRING: + m_node_value.p_string = create_object(*(rhs.m_node_value.p_string)); + break; + } } } @@ -308,40 +318,42 @@ class basic_node { /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/constructor/ basic_node(basic_node&& rhs) noexcept : m_node_type(rhs.m_node_type), - mp_directive_set(std::move(rhs.mp_directive_set)), + mp_meta(std::move(rhs.mp_meta)), m_prop(std::move(rhs.m_prop)) { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(rhs.m_node_value.p_sequence != nullptr); - m_node_value.p_sequence = rhs.m_node_value.p_sequence; - rhs.m_node_value.p_sequence = nullptr; - break; - case node_t::MAPPING: - FK_YAML_ASSERT(rhs.m_node_value.p_mapping != nullptr); - m_node_value.p_mapping = rhs.m_node_value.p_mapping; - rhs.m_node_value.p_mapping = nullptr; - break; - case node_t::NULL_OBJECT: - FK_YAML_ASSERT(rhs.m_node_value.p_mapping == nullptr); - m_node_value.p_mapping = rhs.m_node_value.p_mapping; - break; - case node_t::BOOLEAN: - m_node_value.boolean = rhs.m_node_value.boolean; - rhs.m_node_value.boolean = static_cast(false); - break; - case node_t::INTEGER: - m_node_value.integer = rhs.m_node_value.integer; - rhs.m_node_value.integer = static_cast(0); - break; - case node_t::FLOAT_NUMBER: - m_node_value.float_val = rhs.m_node_value.float_val; - rhs.m_node_value.float_val = static_cast(0.0); - break; - case node_t::STRING: - FK_YAML_ASSERT(rhs.m_node_value.p_string != nullptr); - m_node_value.p_string = rhs.m_node_value.p_string; - rhs.m_node_value.p_string = nullptr; - break; + if (!has_anchor_name()) { + switch (m_node_type) { + case node_t::SEQUENCE: + FK_YAML_ASSERT(rhs.m_node_value.p_sequence != nullptr); + m_node_value.p_sequence = rhs.m_node_value.p_sequence; + rhs.m_node_value.p_sequence = nullptr; + break; + case node_t::MAPPING: + FK_YAML_ASSERT(rhs.m_node_value.p_mapping != nullptr); + m_node_value.p_mapping = rhs.m_node_value.p_mapping; + rhs.m_node_value.p_mapping = nullptr; + break; + case node_t::NULL_OBJECT: + FK_YAML_ASSERT(rhs.m_node_value.p_mapping == nullptr); + m_node_value.p_mapping = rhs.m_node_value.p_mapping; + break; + case node_t::BOOLEAN: + m_node_value.boolean = rhs.m_node_value.boolean; + rhs.m_node_value.boolean = static_cast(false); + break; + case node_t::INTEGER: + m_node_value.integer = rhs.m_node_value.integer; + rhs.m_node_value.integer = static_cast(0); + break; + case node_t::FLOAT_NUMBER: + m_node_value.float_val = rhs.m_node_value.float_val; + rhs.m_node_value.float_val = static_cast(0.0); + break; + case node_t::STRING: + FK_YAML_ASSERT(rhs.m_node_value.p_string != nullptr); + m_node_value.p_string = rhs.m_node_value.p_string; + rhs.m_node_value.p_string = nullptr; + break; + } } rhs.m_node_type = node_t::NULL_OBJECT; @@ -398,7 +410,11 @@ class basic_node { } else { m_node_type = node_t::SEQUENCE; - m_node_value.p_sequence = create_object(init.begin(), init.end()); + m_node_value.p_sequence = create_object(); + m_node_value.p_sequence->reserve(std::distance(init.begin(), init.end())); + for (auto& elem_ref : init) { + m_node_value.p_sequence->emplace_back(std::move(elem_ref.release())); + } } } @@ -406,8 +422,23 @@ class basic_node { /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/destructor/ ~basic_node() noexcept // NOLINT(bugprone-exception-escape) { - m_node_value.destroy(m_node_type); + switch (m_prop.anchor_status) { + case detail::anchor_status_t::NONE: + m_node_value.destroy(m_node_type); + break; + case detail::anchor_status_t::ANCHOR: { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + itr->second.m_node_value.destroy(itr->second.m_node_type); + itr->second.m_node_type = node_t::NULL_OBJECT; + itr->second.mp_meta.reset(); + break; + } + case detail::anchor_status_t::ALIAS: + break; + } m_node_type = node_t::NULL_OBJECT; + mp_meta.reset(); } public: @@ -448,7 +479,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::SEQUENCE; node.m_node_value.p_sequence = create_object(); - FK_YAML_ASSERT(node.m_node_value.p_sequence != nullptr); return node; } // LCOV_EXCL_LINE @@ -460,7 +490,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::SEQUENCE; node.m_node_value.p_sequence = create_object(seq); - FK_YAML_ASSERT(node.m_node_value.p_sequence != nullptr); return node; } // LCOV_EXCL_LINE @@ -472,7 +501,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::SEQUENCE; node.m_node_value.p_sequence = create_object(std::move(seq)); - FK_YAML_ASSERT(node.m_node_value.p_sequence != nullptr); return node; } // LCOV_EXCL_LINE @@ -483,7 +511,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::MAPPING; node.m_node_value.p_mapping = create_object(); - FK_YAML_ASSERT(node.m_node_value.p_mapping != nullptr); return node; } // LCOV_EXCL_LINE @@ -495,7 +522,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::MAPPING; node.m_node_value.p_mapping = create_object(map); - FK_YAML_ASSERT(node.m_node_value.p_mapping != nullptr); return node; } // LCOV_EXCL_LINE @@ -507,7 +533,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::MAPPING; node.m_node_value.p_mapping = create_object(std::move(map)); - FK_YAML_ASSERT(node.m_node_value.p_mapping != nullptr); return node; } // LCOV_EXCL_LINE @@ -523,7 +548,6 @@ class basic_node { basic_node node = anchor_node; node.m_prop.anchor_status = detail::anchor_status_t::ALIAS; - node.m_prop.anchor = anchor_node.m_prop.anchor; return node; } // LCOV_EXCL_LINE @@ -559,22 +583,22 @@ class basic_node { int> = 0> basic_node& operator[](KeyType&& key) { if (is_scalar()) { - throw fkyaml::type_error("operator[] is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("operator[] is unavailable for a scalar node.", type()); } basic_node n = std::forward(key); + const node_value* p_node_value = get_node_value_ptr(); if (is_sequence()) { if (!n.is_integer()) { - throw fkyaml::type_error( - "An argument of operator[] for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of operator[] for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->operator[](n.get_value()); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->operator[](n.get_value()); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->operator[](std::move(n)); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->operator[](std::move(n)); } /// @brief A subscript operator of the basic_node class with a key of a compatible type with basic_node. @@ -590,22 +614,22 @@ class basic_node { int> = 0> const basic_node& operator[](KeyType&& key) const { if (is_scalar()) { - throw fkyaml::type_error("operator[] is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("operator[] is unavailable for a scalar node.", type()); } basic_node node_key = std::forward(key); + const node_value* p_node_value = get_node_value_ptr(); if (is_sequence()) { if (!node_key.is_integer()) { - throw fkyaml::type_error( - "An argument of operator[] for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of operator[] for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->operator[](node_key.get_value()); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->operator[](node_key.get_value()); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->operator[](std::move(node_key)); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->operator[](std::move(node_key)); } /// @brief A subscript operator of the basic_node class with a basic_node key object. @@ -617,20 +641,21 @@ class basic_node { typename KeyType, detail::enable_if_t>::value, int> = 0> basic_node& operator[](KeyType&& key) { if (is_scalar()) { - throw fkyaml::type_error("operator[] is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("operator[] is unavailable for a scalar node.", type()); } + const node_value* p_node_value = get_node_value_ptr(); + if (is_sequence()) { if (!key.is_integer()) { - throw fkyaml::type_error( - "An argument of operator[] for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of operator[] for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->operator[](key.template get_value()); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->operator[](key.template get_value()); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->operator[](std::forward(key)); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->operator[](std::forward(key)); } /// @brief A subscript operator of the basic_node class with a basic_node key object. @@ -642,20 +667,21 @@ class basic_node { typename KeyType, detail::enable_if_t>::value, int> = 0> const basic_node& operator[](KeyType&& key) const { if (is_scalar()) { - throw fkyaml::type_error("operator[] is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("operator[] is unavailable for a scalar node.", type()); } + const node_value* p_node_value = get_node_value_ptr(); + if (is_sequence()) { if (!key.is_integer()) { - throw fkyaml::type_error( - "An argument of operator[] for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of operator[] for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->operator[](key.template get_value()); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->operator[](key.template get_value()); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->operator[](std::forward(key)); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->operator[](std::forward(key)); } /// @brief An equal-to operator of the basic_node class. @@ -663,35 +689,39 @@ class basic_node { /// @return true if both types and values are equal, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/operator_eq/ bool operator==(const basic_node& rhs) const noexcept { - if (m_node_type != rhs.m_node_type) { + node_t this_type = type(); + const node_value* this_node_value_ptr = get_node_value_ptr(); + const node_value* other_node_value_ptr = rhs.get_node_value_ptr(); + + if (this_type != rhs.type()) { return false; } bool ret = false; - switch (m_node_type) { + switch (this_type) { case node_t::SEQUENCE: - ret = (*(m_node_value.p_sequence) == *(rhs.m_node_value.p_sequence)); + ret = (*(this_node_value_ptr->p_sequence) == *(other_node_value_ptr->p_sequence)); break; case node_t::MAPPING: - ret = (*(m_node_value.p_mapping) == *(rhs.m_node_value.p_mapping)); + ret = (*(this_node_value_ptr->p_mapping) == *(other_node_value_ptr->p_mapping)); break; case node_t::NULL_OBJECT: // Always true for comparisons between null nodes. ret = true; break; case node_t::BOOLEAN: - ret = (m_node_value.boolean == rhs.m_node_value.boolean); + ret = (this_node_value_ptr->boolean == other_node_value_ptr->boolean); break; case node_t::INTEGER: - ret = (m_node_value.integer == rhs.m_node_value.integer); + ret = (this_node_value_ptr->integer == other_node_value_ptr->integer); break; case node_t::FLOAT_NUMBER: ret = - (std::abs(m_node_value.float_val - rhs.m_node_value.float_val) < + (std::abs(this_node_value_ptr->float_val - other_node_value_ptr->float_val) < std::numeric_limits::epsilon()); break; case node_t::STRING: - ret = (*(m_node_value.p_string) == *(rhs.m_node_value.p_string)); + ret = (*(this_node_value_ptr->p_string) == *(other_node_value_ptr->p_string)); break; } @@ -715,37 +745,43 @@ class basic_node { return false; } - if (uint32_t(m_node_type) < uint32_t(rhs.m_node_type)) { + node_t this_type = type(); + node_t other_type = rhs.type(); + + if (static_cast(this_type) < static_cast(other_type)) { return true; } - if (m_node_type != rhs.m_node_type) { + if (this_type != other_type) { return false; } + const node_value* p_this_value = get_node_value_ptr(); + const node_value* p_other_value = rhs.get_node_value_ptr(); + bool ret = false; - switch (m_node_type) { + switch (this_type) { case node_t::SEQUENCE: - ret = (*(m_node_value.p_sequence) < *(rhs.m_node_value.p_sequence)); + ret = (*(p_this_value->p_sequence) < *(p_other_value->p_sequence)); break; case node_t::MAPPING: - ret = (*(m_node_value.p_mapping) < *(rhs.m_node_value.p_mapping)); + ret = (*(p_this_value->p_mapping) < *(p_other_value->p_mapping)); break; case node_t::NULL_OBJECT: // LCOV_EXCL_LINE // Will not come here since null nodes are alyways the same. break; // LCOV_EXCL_LINE case node_t::BOOLEAN: // false < true - ret = (!m_node_value.boolean && rhs.m_node_value.boolean); + ret = (!p_this_value->boolean && p_other_value->boolean); break; case node_t::INTEGER: - ret = (m_node_value.integer < rhs.m_node_value.integer); + ret = (p_this_value->integer < p_other_value->integer); break; case node_t::FLOAT_NUMBER: - ret = (m_node_value.float_val < rhs.m_node_value.float_val); + ret = (p_this_value->float_val < p_other_value->float_val); break; case node_t::STRING: - ret = (*(m_node_value.p_string) < *(rhs.m_node_value.p_string)); + ret = (*(p_this_value->p_string) < *(p_other_value->p_string)); break; } @@ -781,6 +817,11 @@ class basic_node { /// @return The type of the YAML node value. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/type/ node_t type() const noexcept { + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + return itr->second.m_node_type; + } return m_node_type; } @@ -788,49 +829,49 @@ class basic_node { /// @return true if the type is sequence, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_sequence/ bool is_sequence() const noexcept { - return m_node_type == node_t::SEQUENCE; + return type() == node_t::SEQUENCE; } /// @brief Tests whether the current basic_node value is of mapping type. /// @return true if the type is mapping, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_mapping/ bool is_mapping() const noexcept { - return m_node_type == node_t::MAPPING; + return type() == node_t::MAPPING; } /// @brief Tests whether the current basic_node value is of null type. /// @return true if the type is null, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_null/ bool is_null() const noexcept { - return m_node_type == node_t::NULL_OBJECT; + return type() == node_t::NULL_OBJECT; } /// @brief Tests whether the current basic_node value is of boolean type. /// @return true if the type is boolean, false otherwise /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_boolean/ bool is_boolean() const noexcept { - return m_node_type == node_t::BOOLEAN; + return type() == node_t::BOOLEAN; } /// @brief Tests whether the current basic_node value is of integer type. /// @return true if the type is integer, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_integer/ bool is_integer() const noexcept { - return m_node_type == node_t::INTEGER; + return type() == node_t::INTEGER; } /// @brief Tests whether the current basic_node value is of float number type. /// @return true if the type is floating point number, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_float_number/ bool is_float_number() const noexcept { - return m_node_type == node_t::FLOAT_NUMBER; + return type() == node_t::FLOAT_NUMBER; } /// @brief Tests whether the current basic_node value is of string type. /// @return true if the type is string, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_string/ bool is_string() const noexcept { - return m_node_type == node_t::STRING; + return type() == node_t::STRING; } /// @brief Tests whether the current basic_node value is of scalar types. @@ -858,18 +899,24 @@ class basic_node { /// @return true if the node value is empty, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/empty/ bool empty() const { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->empty(); - case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->empty(); - case node_t::STRING: - FK_YAML_ASSERT(m_node_value.p_string != nullptr); - return m_node_value.p_string->empty(); + switch (type()) { + case node_t::SEQUENCE: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->empty(); + } + case node_t::MAPPING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->empty(); + } + case node_t::STRING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_string != nullptr); + return p_node_value->p_string->empty(); + } default: - throw fkyaml::type_error("The target node is not of a container type.", m_node_type); + throw fkyaml::type_error("The target node is not of a container type.", type()); } } @@ -877,18 +924,19 @@ class basic_node { /// @return The size of a node value. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/size/ std::size_t size() const { - switch (m_node_type) { + const node_value* p_node_value = get_node_value_ptr(); + switch (type()) { case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->size(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->size(); case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->size(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->size(); case node_t::STRING: - FK_YAML_ASSERT(m_node_value.p_string != nullptr); - return m_node_value.p_string->size(); + FK_YAML_ASSERT(p_node_value->p_string != nullptr); + return p_node_value->p_string->size(); default: - throw fkyaml::type_error("The target node is not of a container type.", m_node_type); + throw fkyaml::type_error("The target node is not of a container type.", type()); } } @@ -904,10 +952,12 @@ class basic_node { detail::is_node_compatible_type>>::value, int> = 0> bool contains(KeyType&& key) const { - switch (m_node_type) { + switch (type()) { case node_t::MAPPING: { - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - mapping_type& map = *m_node_value.p_mapping; + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + + mapping_type& map = *p_node_value->p_mapping; basic_node node_key = std::forward(key); return map.find(node_key) != map.end(); } @@ -924,10 +974,12 @@ class basic_node { template < typename KeyType, detail::enable_if_t>::value, int> = 0> bool contains(KeyType&& key) const { - switch (m_node_type) { + switch (type()) { case node_t::MAPPING: { - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - mapping_type& map = *m_node_value.p_mapping; + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + + mapping_type& map = *p_node_value->p_mapping; return map.find(std::forward(key)) != map.end(); } default: @@ -948,31 +1000,32 @@ class basic_node { int> = 0> basic_node& at(KeyType&& key) { if (is_scalar()) { - throw fkyaml::type_error("at() is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("at() is unavailable for a scalar node.", type()); } basic_node node_key = std::forward(key); + const node_value* p_node_value = get_node_value_ptr(); if (is_sequence()) { if (!node_key.is_integer()) { - throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); int index = node_key.template get_value(); - int size = static_cast(m_node_value.p_sequence->size()); + int size = static_cast(p_node_value->p_sequence->size()); if (index >= size) { throw fkyaml::out_of_range(index); } - return m_node_value.p_sequence->at(index); + return p_node_value->p_sequence->at(index); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - bool is_found = m_node_value.p_mapping->find(node_key) != m_node_value.p_mapping->end(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + bool is_found = p_node_value->p_mapping->find(node_key) != p_node_value->p_mapping->end(); if (!is_found) { throw fkyaml::out_of_range(serialize(node_key).c_str()); } - return m_node_value.p_mapping->at(node_key); + return p_node_value->p_mapping->at(node_key); } /// @brief Get a basic_node object with a key of a compatible type. @@ -988,31 +1041,32 @@ class basic_node { int> = 0> const basic_node& at(KeyType&& key) const { if (is_scalar()) { - throw fkyaml::type_error("at() is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("at() is unavailable for a scalar node.", type()); } basic_node node_key = std::forward(key); + const node_value* p_node_value = get_node_value_ptr(); if (is_sequence()) { if (!node_key.is_integer()) { - throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); int index = node_key.template get_value(); - int size = static_cast(m_node_value.p_sequence->size()); + int size = static_cast(p_node_value->p_sequence->size()); if (index >= size) { throw fkyaml::out_of_range(index); } - return m_node_value.p_sequence->at(index); + return p_node_value->p_sequence->at(index); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - bool is_found = m_node_value.p_mapping->find(node_key) != m_node_value.p_mapping->end(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + bool is_found = p_node_value->p_mapping->find(node_key) != p_node_value->p_mapping->end(); if (!is_found) { throw fkyaml::out_of_range(serialize(node_key).c_str()); } - return m_node_value.p_mapping->at(node_key); + return p_node_value->p_mapping->at(node_key); } /// @brief Get a basic_node object with a basic_node key object. @@ -1024,29 +1078,31 @@ class basic_node { typename KeyType, detail::enable_if_t>::value, int> = 0> basic_node& at(KeyType&& key) { if (is_scalar()) { - throw fkyaml::type_error("at() is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("at() is unavailable for a scalar node.", type()); } + const node_value* p_node_value = get_node_value_ptr(); + if (is_sequence()) { if (!key.is_integer()) { - throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); int index = std::forward(key).template get_value(); - int size = static_cast(m_node_value.p_sequence->size()); + int size = static_cast(p_node_value->p_sequence->size()); if (index >= size) { throw fkyaml::out_of_range(index); } - return m_node_value.p_sequence->at(index); + return p_node_value->p_sequence->at(index); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - bool is_found = m_node_value.p_mapping->find(key) != m_node_value.p_mapping->end(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + bool is_found = p_node_value->p_mapping->find(key) != p_node_value->p_mapping->end(); if (!is_found) { throw fkyaml::out_of_range(serialize(key).c_str()); } - return m_node_value.p_mapping->at(key); + return p_node_value->p_mapping->at(key); } /// @brief Get a basic_node object with a basic_node key object. @@ -1058,37 +1114,38 @@ class basic_node { typename KeyType, detail::enable_if_t>::value, int> = 0> const basic_node& at(KeyType&& key) const { if (is_scalar()) { - throw fkyaml::type_error("at() is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("at() is unavailable for a scalar node.", type()); } + const node_value* p_node_value = get_node_value_ptr(); + if (is_sequence()) { if (!key.is_integer()) { - throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); int index = std::forward(key).template get_value(); - int size = static_cast(m_node_value.p_sequence->size()); + int size = static_cast(p_node_value->p_sequence->size()); if (index >= size) { throw fkyaml::out_of_range(index); } - return m_node_value.p_sequence->at(index); + return p_node_value->p_sequence->at(index); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - bool is_found = m_node_value.p_mapping->find(key) != m_node_value.p_mapping->end(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + bool is_found = p_node_value->p_mapping->find(key) != p_node_value->p_mapping->end(); if (!is_found) { throw fkyaml::out_of_range(serialize(key).c_str()); } - return m_node_value.p_mapping->at(key); + return p_node_value->p_mapping->at(key); } /// @brief Get the YAML version specification for this basic_node object. /// @return The YAML version if any is applied to the basic_node object, `yaml_version_t::VER_1_2` otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/get_yaml_version/ yaml_version_t get_yaml_version() const noexcept { - return (mp_directive_set && mp_directive_set->is_version_specified) ? mp_directive_set->version - : yaml_version_t::VER_1_2; + return (mp_meta && mp_meta->is_version_specified) ? mp_meta->version : yaml_version_t::VER_1_2; } /// @brief Set the YAML version specification for this basic_node object. @@ -1096,11 +1153,8 @@ class basic_node { /// @param[in] A version of the YAML format. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/set_yaml_version/ void set_yaml_version(const yaml_version_t version) noexcept { - if (!mp_directive_set) { - mp_directive_set = std::shared_ptr(new detail::directive_set()); - } - mp_directive_set->version = version; - mp_directive_set->is_version_specified = true; + mp_meta->version = version; + mp_meta->is_version_specified = true; } /// @brief Check whether or not this basic_node object has already had any anchor name. @@ -1127,8 +1181,26 @@ class basic_node { /// @param[in] anchor_name An anchor name. This should not be empty. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/add_anchor_name/ void add_anchor_name(const std::string& anchor_name) { + if (is_anchor()) { + m_prop.anchor_status = detail::anchor_status_t::NONE; + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + mp_meta.reset(); + itr->second.swap(*this); + mp_meta->anchor_table.erase(itr); + } + + auto p_meta = mp_meta; + uint32_t anchor_counts = static_cast(p_meta->anchor_table.count(anchor_name)); + + basic_node node; + node.swap(*this); + p_meta->anchor_table.emplace(anchor_name, std::move(node)); + + mp_meta = p_meta; m_prop.anchor_status = detail::anchor_status_t::ANCHOR; m_prop.anchor = anchor_name; + m_prop.anchor_offset = anchor_counts; } /// @brief Add an anchor name to this basic_node object. @@ -1136,8 +1208,26 @@ class basic_node { /// @param[in] anchor_name An anchor name. This should not be empty. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/add_anchor_name/ void add_anchor_name(std::string&& anchor_name) { + if (is_anchor()) { + m_prop.anchor_status = detail::anchor_status_t::NONE; + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + mp_meta.reset(); + itr->second.swap(*this); + mp_meta->anchor_table.erase(itr); + } + + auto p_meta = mp_meta; + uint32_t anchor_counts = static_cast(p_meta->anchor_table.count(anchor_name)); + + basic_node node; + node.swap(*this); + p_meta->anchor_table.emplace(anchor_name, std::move(node)); + + mp_meta = p_meta; m_prop.anchor_status = detail::anchor_status_t::ANCHOR; m_prop.anchor = std::move(anchor_name); + m_prop.anchor_offset = anchor_counts; } /// @brief Check whether or not this basic_node object has already had any tag name. @@ -1190,7 +1280,14 @@ class basic_node { T get_value() const noexcept( noexcept(ConverterType::from_node(std::declval(), std::declval()))) { auto ret = ValueType(); - ConverterType::from_node(*this, ret); + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + ConverterType::from_node(itr->second, ret); + } + else { + ConverterType::from_node(*this, ret); + } return ret; } @@ -1200,6 +1297,11 @@ class basic_node { /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/get_value_ref/ template ::value, int> = 0> ReferenceType get_value_ref() { + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + return itr->second.get_value_ref_impl(static_cast>(nullptr)); + } return get_value_ref_impl(static_cast>(nullptr)); } @@ -1214,6 +1316,11 @@ class basic_node { std::is_reference, std::is_const>>::value, int> = 0> ReferenceType get_value_ref() const { + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + return itr->second.get_value_ref_impl(static_cast>(nullptr)); + } return get_value_ref_impl(static_cast>(nullptr)); } @@ -1223,7 +1330,7 @@ class basic_node { void swap(basic_node& rhs) noexcept { using std::swap; swap(m_node_type, rhs.m_node_type); - swap(mp_directive_set, rhs.mp_directive_set); + swap(mp_meta, rhs.mp_meta); node_value tmp {}; std::memcpy(&tmp, &m_node_value, sizeof(node_value)); @@ -1233,6 +1340,7 @@ class basic_node { swap(m_prop.tag, rhs.m_prop.tag); swap(m_prop.anchor_status, rhs.m_prop.anchor_status); swap(m_prop.anchor, rhs.m_prop.anchor); + swap(m_prop.anchor_offset, rhs.m_prop.anchor_offset); } /// @brief Returns the first iterator of basic_node values of container types (sequence or mapping) from a non-const @@ -1240,15 +1348,19 @@ class basic_node { /// @return An iterator to the first element of a YAML node value (either sequence or mapping). /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/begin/ iterator begin() { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return {detail::sequence_iterator_tag(), m_node_value.p_sequence->begin()}; - case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return {detail::mapping_iterator_tag(), m_node_value.p_mapping->begin()}; + switch (type()) { + case node_t::SEQUENCE: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return {detail::sequence_iterator_tag(), p_node_value->p_sequence->begin()}; + } + case node_t::MAPPING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return {detail::mapping_iterator_tag(), p_node_value->p_mapping->begin()}; + } default: - throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", m_node_type); + throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", type()); } } @@ -1257,15 +1369,19 @@ class basic_node { /// @return A constant iterator to the first element of a YAML node value (either sequence or mapping). /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/begin/ const_iterator begin() const { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return {detail::sequence_iterator_tag(), m_node_value.p_sequence->begin()}; - case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return {detail::mapping_iterator_tag(), m_node_value.p_mapping->begin()}; + switch (type()) { + case node_t::SEQUENCE: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return {detail::sequence_iterator_tag(), p_node_value->p_sequence->begin()}; + } + case node_t::MAPPING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return {detail::mapping_iterator_tag(), p_node_value->p_mapping->begin()}; + } default: - throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", m_node_type); + throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", type()); } } @@ -1274,15 +1390,19 @@ class basic_node { /// @return An iterator to the past-the end element of a YAML node value (either sequence or mapping). /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/end/ iterator end() { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return {detail::sequence_iterator_tag(), m_node_value.p_sequence->end()}; - case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return {detail::mapping_iterator_tag(), m_node_value.p_mapping->end()}; + switch (type()) { + case node_t::SEQUENCE: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return {detail::sequence_iterator_tag(), p_node_value->p_sequence->end()}; + } + case node_t::MAPPING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return {detail::mapping_iterator_tag(), p_node_value->p_mapping->end()}; + } default: - throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", m_node_type); + throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", type()); } } @@ -1291,25 +1411,40 @@ class basic_node { /// @return A constant iterator to the past-the end element of a YAML node value (either sequence or mapping). /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/end/ const_iterator end() const { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return {detail::sequence_iterator_tag(), m_node_value.p_sequence->end()}; - case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return {detail::mapping_iterator_tag(), m_node_value.p_mapping->end()}; + switch (type()) { + case node_t::SEQUENCE: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return {detail::sequence_iterator_tag(), p_node_value->p_sequence->end()}; + } + case node_t::MAPPING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return {detail::mapping_iterator_tag(), p_node_value->p_mapping->end()}; + } default: - throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", m_node_type); + throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", type()); } } 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. + const node_value* get_node_value_ptr() const { + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + return &(itr->second.m_node_value); + } + return &m_node_value; + } + /// @brief Returns reference to the sequence node value. /// @throw fkyaml::exception The node value is not a sequence. /// @return Reference to the sequence node value. sequence_type& get_value_ref_impl(sequence_type* /*unused*/) { if (!is_sequence()) { - throw fkyaml::type_error("The node value is not a sequence.", m_node_type); + throw fkyaml::type_error("The node value is not a sequence.", type()); } return *(m_node_value.p_sequence); } @@ -1319,7 +1454,7 @@ class basic_node { /// @return Constant reference to the sequence node value. const sequence_type& get_value_ref_impl(const sequence_type* /*unused*/) const { if (!is_sequence()) { - throw fkyaml::type_error("The node value is not a sequence.", m_node_type); + throw fkyaml::type_error("The node value is not a sequence.", type()); } return *(m_node_value.p_sequence); } @@ -1329,7 +1464,7 @@ class basic_node { /// @return Reference to the mapping node value. mapping_type& get_value_ref_impl(mapping_type* /*unused*/) { if (!is_mapping()) { - throw fkyaml::type_error("The node value is not a mapping.", m_node_type); + throw fkyaml::type_error("The node value is not a mapping.", type()); } return *(m_node_value.p_mapping); } @@ -1339,7 +1474,7 @@ class basic_node { /// @return Constant reference to the mapping node value. const mapping_type& get_value_ref_impl(const mapping_type* /*unused*/) const { if (!is_mapping()) { - throw fkyaml::type_error("The node value is not a mapping.", m_node_type); + throw fkyaml::type_error("The node value is not a mapping.", type()); } return *(m_node_value.p_mapping); } @@ -1349,7 +1484,7 @@ class basic_node { /// @return Reference to the boolean node value. boolean_type& get_value_ref_impl(boolean_type* /*unused*/) { if (!is_boolean()) { - throw fkyaml::type_error("The node value is not a boolean.", m_node_type); + throw fkyaml::type_error("The node value is not a boolean.", type()); } return m_node_value.boolean; } @@ -1359,7 +1494,7 @@ class basic_node { /// @return Constant reference to the boolean node value. const boolean_type& get_value_ref_impl(const boolean_type* /*unused*/) const { if (!is_boolean()) { - throw fkyaml::type_error("The node value is not a boolean.", m_node_type); + throw fkyaml::type_error("The node value is not a boolean.", type()); } return m_node_value.boolean; } @@ -1369,7 +1504,7 @@ class basic_node { /// @return Reference to the integer node value. integer_type& get_value_ref_impl(integer_type* /*unused*/) { if (!is_integer()) { - throw fkyaml::type_error("The node value is not an integer.", m_node_type); + throw fkyaml::type_error("The node value is not an integer.", type()); } return m_node_value.integer; } @@ -1379,7 +1514,7 @@ class basic_node { /// @return Constant reference to the integer node value. const integer_type& get_value_ref_impl(const integer_type* /*unused*/) const { if (!is_integer()) { - throw fkyaml::type_error("The node value is not an integer.", m_node_type); + throw fkyaml::type_error("The node value is not an integer.", type()); } return m_node_value.integer; } @@ -1389,7 +1524,7 @@ class basic_node { /// @return Reference to the floating point number node value. float_number_type& get_value_ref_impl(float_number_type* /*unused*/) { if (!is_float_number()) { - throw fkyaml::type_error("The node value is not a floating point number.", m_node_type); + throw fkyaml::type_error("The node value is not a floating point number.", type()); } return m_node_value.float_val; } @@ -1399,7 +1534,7 @@ class basic_node { /// @return Constant reference to the floating point number node value. const float_number_type& get_value_ref_impl(const float_number_type* /*unused*/) const { if (!is_float_number()) { - throw fkyaml::type_error("The node value is not a floating point number.", m_node_type); + throw fkyaml::type_error("The node value is not a floating point number.", type()); } return m_node_value.float_val; } @@ -1409,7 +1544,7 @@ class basic_node { /// @return Reference to the string node value. string_type& get_value_ref_impl(string_type* /*unused*/) { if (!is_string()) { - throw fkyaml::type_error("The node value is not a string.", m_node_type); + throw fkyaml::type_error("The node value is not a string.", type()); } return *(m_node_value.p_string); } @@ -1419,7 +1554,7 @@ class basic_node { /// @return Constant reference to the string node value. const string_type& get_value_ref_impl(const string_type* /*unused*/) const { if (!is_string()) { - throw fkyaml::type_error("The node value is not a string.", m_node_type); + throw fkyaml::type_error("The node value is not a string.", type()); } return *(m_node_value.p_string); } @@ -1427,7 +1562,8 @@ class basic_node { /// The current node value type. node_t m_node_type {node_t::NULL_OBJECT}; /// The shared set of YAML directives applied to this node. - mutable std::shared_ptr mp_directive_set {}; + mutable std::shared_ptr> mp_meta { + std::shared_ptr>(new detail::document_metainfo())}; /// The current node value. node_value m_node_value {}; /// The property set of this node. diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 749d0a02..3c7796ad 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -161,7 +161,7 @@ #endif /* FK_YAML_DETAIL_ASSERT_HPP_ */ -// #include +// #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library /// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 @@ -172,90 +172,15 @@ /// /// @file -#ifndef FK_YAML_DETAIL_DIRECTIVE_SET_HPP_ -#define FK_YAML_DETAIL_DIRECTIVE_SET_HPP_ +#ifndef FK_YAML_DETAIL_DOCUMENT_METAINFO_HPP_ +#define FK_YAML_DETAIL_DOCUMENT_METAINFO_HPP_ #include #include // #include -// #include -/// _______ __ __ __ _____ __ __ __ -/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 -/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML -/// -/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani -/// SPDX-License-Identifier: MIT -/// -/// @file - -#ifndef FK_YAML_DETAIL_TYPES_YAML_VERSION_T_HPP_ -#define FK_YAML_DETAIL_TYPES_YAML_VERSION_T_HPP_ - -#include - -// #include - - -FK_YAML_DETAIL_NAMESPACE_BEGIN - -/// @brief Definition of YAML version types. -enum class yaml_version_t : std::uint32_t { - VER_1_1, //!< YAML version 1.1 - VER_1_2, //!< YAML version 1.2 -}; - -FK_YAML_DETAIL_NAMESPACE_END - -#endif /* FK_YAML_DETAIL_TYPES_YAML_VERSION_T_HPP_ */ - - -FK_YAML_DETAIL_NAMESPACE_BEGIN - -/// @brief The set of directives for a YAML document. -struct directive_set { - /// The YAML version used for the YAML document. - yaml_version_t version {yaml_version_t::VER_1_2}; - /// Whether or not the YAML version has been specified. - bool is_version_specified {false}; - /// The prefix of the primary handle. - std::string primary_handle_prefix {}; - /// The prefix of the secondary handle. - std::string secondary_handle_prefix {}; - /// The map of handle-prefix pairs. - std::map named_handle_map {}; -}; - -FK_YAML_DETAIL_NAMESPACE_END - -#endif /* FK_YAML_DETAIL_DIRECTIVE_SET_HPP_ */ - -// #include -/// _______ __ __ __ _____ __ __ __ -/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 -/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML -/// -/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani -/// SPDX-License-Identifier: MIT -/// -/// @file - -#ifndef FK_YAML_DETAIL_INPUT_DESERIALIZER_HPP_ -#define FK_YAML_DETAIL_INPUT_DESERIALIZER_HPP_ - -#include -#include -#include -#include - -// #include - -// #include - -// #include +// #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library /// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 @@ -266,22 +191,12 @@ FK_YAML_DETAIL_NAMESPACE_END /// /// @file -#ifndef FK_YAML_DETAIL_INPUT_LEXICAL_ANALIZER_HPP_ -#define FK_YAML_DETAIL_INPUT_LEXICAL_ANALIZER_HPP_ - -#include -#include -#include -#include -#include -#include -#include +#ifndef FK_YAML_DETAIL_META_NODE_TRAITS_HPP_ +#define FK_YAML_DETAIL_META_NODE_TRAITS_HPP_ // #include -// #include - -// #include +// #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library /// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 @@ -292,13 +207,9 @@ FK_YAML_DETAIL_NAMESPACE_END /// /// @file -#ifndef FK_YAML_DETAIL_CONVERSIONS_FROM_STRING_HPP_ -#define FK_YAML_DETAIL_CONVERSIONS_FROM_STRING_HPP_ +#ifndef FK_YAML_DETAIL_META_DETECT_HPP_ +#define FK_YAML_DETAIL_META_DETECT_HPP_ -#include -#include -#include -#include #include // #include @@ -487,45 +398,6 @@ FK_YAML_DETAIL_NAMESPACE_END #endif /* FK_YAML_DETAIL_META_STL_SUPPLEMENT_HPP_ */ -// #include -/// _______ __ __ __ _____ __ __ __ -/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 -/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML -/// -/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani -/// SPDX-License-Identifier: MIT -/// -/// @file - -#ifndef FK_YAML_DETAIL_META_TYPE_TRAITS_HPP_ -#define FK_YAML_DETAIL_META_TYPE_TRAITS_HPP_ - -#include -#include - -// #include - -// #include -/// _______ __ __ __ _____ __ __ __ -/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 -/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML -/// -/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani -/// SPDX-License-Identifier: MIT -/// -/// @file - -#ifndef FK_YAML_DETAIL_META_DETECT_HPP_ -#define FK_YAML_DETAIL_META_DETECT_HPP_ - -#include - -// #include - -// #include - FK_YAML_DETAIL_NAMESPACE_BEGIN @@ -590,6 +462,29 @@ FK_YAML_DETAIL_NAMESPACE_END // #include +// #include +/// _______ __ __ __ _____ __ __ __ +/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +/// +/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +/// SPDX-License-Identifier: MIT +/// +/// @file + +#ifndef FK_YAML_DETAIL_META_TYPE_TRAITS_HPP_ +#define FK_YAML_DETAIL_META_TYPE_TRAITS_HPP_ + +#include +#include + +// #include + +// #include + +// #include + FK_YAML_DETAIL_NAMESPACE_BEGIN @@ -678,59 +573,336 @@ struct is_complete_type : std::false_type {}; template struct is_complete_type : std::true_type {}; -/// @brief A utility struct to generate static constant instance. -/// @tparam T A target type for the resulting static constant instance. -template -struct static_const { - static FK_YAML_INLINE_VAR constexpr T value {}; // NOLINT(readability-identifier-naming) -}; +/// @brief A utility struct to generate static constant instance. +/// @tparam T A target type for the resulting static constant instance. +template +struct static_const { + static FK_YAML_INLINE_VAR constexpr T value {}; // NOLINT(readability-identifier-naming) +}; + +#ifndef FK_YAML_HAS_CXX_17 +/// @brief A instantiation of static_const::value instance. +/// @note This is required if inline variables are not available. C++11-14 do not provide such a feature yet. +/// @tparam T A target type for the resulting static constant instance. +template +constexpr T static_const::value; +#endif + +/// @brief A helper structure for tag dispatch. +/// @tparam T A tag type. +template +struct type_tag { + /// @brief A tagged type. + using type = T; +}; + +/// @brief A utility struct to retrieve the first type in variadic template arguments. +/// @tparam Types Types of variadic template arguments. +template +struct get_head_type; + +/// @brief A specialization of get_head_type if variadic template has no arguments. +/// @tparam N/A +template <> +struct get_head_type<> { + /// @brief A head type + using type = void; +}; + +/// @brief A partial specialization of get_head_type if variadic template has one or more argument(s). +/// @tparam First The first type in the arguments +/// @tparam Rest The rest of the types in the arguments. +template +struct get_head_type { + /// @brief A head type. + using type = First; +}; + +/// @brief An alias template to retrieve the first type in variadic template arguments. +/// @tparam Types Types of variadic template arguments. +template +using head_type = typename get_head_type::type; + +FK_YAML_DETAIL_NAMESPACE_END + +#endif /* FK_YAML_DETAIL_META_TYPE_TRAITS_HPP_ */ + + +FK_YAML_NAMESPACE_BEGIN + +// forward declaration for basic_node<...> +template < + template class SequenceType, template class MappingType, + typename BooleanType, typename IntegerType, typename FloatNumberType, typename StringType, + template class ConverterType> +class basic_node; + +FK_YAML_NAMESPACE_END + +FK_YAML_DETAIL_NAMESPACE_BEGIN + +///////////////////////////// +// is_basic_node traits +///////////////////////////// + +/// @brief A struct to check the template parameter class is a kind of basic_node template class. +/// @tparam T A class to be checked if it's a kind of basic_node template class. +template +struct is_basic_node : std::false_type {}; + +/// @brief A partial specialization of is_basic_node for basic_node template class. +/// @tparam SequenceType A type for sequence node value containers. +/// @tparam MappingType A type for mapping node value containers. +/// @tparam BooleanType A type for boolean node values. +/// @tparam IntegerType A type for integer node values. +/// @tparam FloatNumberType A type for float number node values. +/// @tparam StringType A type for string node values. +/// @tparam Converter A type for +template < + template class SequenceType, template class MappingType, + typename BooleanType, typename IntegerType, typename FloatNumberType, typename StringType, + template class Converter> +struct is_basic_node< + basic_node> + : std::true_type {}; + +/////////////////////////////////// +// is_node_ref_storage traits +/////////////////////////////////// + +// forward declaration for node_ref_storage<...> +template +class node_ref_storage; + +/// @brief A struct to check the template parameter class is a kind of node_ref_storage_template class. +/// @tparam T A type to be checked if it's a kind of node_ref_storage template class. +template +struct is_node_ref_storage : std::false_type {}; + +/// @brief A partial specialization for node_ref_storage template class. +/// @tparam T A template parameter type of node_ref_storage template class. +template +struct is_node_ref_storage> : std::true_type {}; + +/////////////////////////////////////////////////////// +// basic_node conversion API representative types +/////////////////////////////////////////////////////// + +/// @brief A type represent from_node function. +/// @tparam T A type which provides from_node function. +/// @tparam Args Argument types passed to from_node function. +template +using from_node_function_t = decltype(T::from_node(std::declval()...)); + +/// @brief A type which represent to_node function. +/// @tparam T A type which provides to_node function. +/// @tparam Args Argument types passed to to_node function. +template +using to_node_funcion_t = decltype(T::to_node(std::declval()...)); + +/////////////////////////////////////////////////// +// basic_node conversion API detection traits +/////////////////////////////////////////////////// + +/// @brief Type traits to check if T is a compatible type for BasicNodeType in terms of from_node function. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam T A target type passed to from_node function. +/// @tparam typename N/A +template +struct has_from_node : std::false_type {}; + +/// @brief A partial specialization of has_from_node if T is not a basic_node template instance type. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam T A target type passed to from_node function. +template +struct has_from_node::value>> { + using converter = typename BasicNodeType::template value_converter_type; + + // NOLINTNEXTLINE(readability-identifier-naming) + static constexpr bool value = + is_detected_exact::value; +}; + +/// @brief Type traits to check if T is a compatible type for BasicNodeType in terms of to_node function. +/// @warning Do not pass basic_node type as BasicNodeType to avoid infinite type instantiation. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam T A target type passed to to_node function. +/// @tparam typename N/A +template +struct has_to_node : std::false_type {}; + +/// @brief A partial specialization of has_to_node if T is not a basic_node template instance type. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam T A target type passed to to_node function. +template +struct has_to_node::value>> { + using converter = typename BasicNodeType::template value_converter_type; + + // NOLINTNEXTLINE(readability-identifier-naming) + static constexpr bool value = is_detected_exact::value; +}; + +/////////////////////////////////////// +// is_node_compatible_type traits +/////////////////////////////////////// + +/// @brief Type traits implementation of is_node_compatible_type to check if CompatibleType is a compatible type for +/// BasicNodeType. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam CompatibleType A target type for compatibility check. +/// @tparam typename N/A +template +struct is_node_compatible_type_impl : std::false_type {}; + +/// @brief A partial specialization of is_node_compatible_type_impl if CompatibleType is a complete type and is +/// compatible for BasicNodeType. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam CompatibleType A target type for compatibility check. +template +struct is_node_compatible_type_impl< + BasicNodeType, CompatibleType, + enable_if_t, has_to_node>::value>> + : std::true_type {}; + +/// @brief Type traits to check if CompatibleType is a compatible type for BasicNodeType. +/// @tparam BasicNodeType A basic_node template instance type. +/// @tparam CompatibleType A target type for compatibility check. +template +struct is_node_compatible_type : is_node_compatible_type_impl {}; + +FK_YAML_DETAIL_NAMESPACE_END + +#endif /* FK_YAML_DETAIL_META_NODE_TRAITS_HPP_ */ + +// #include +/// _______ __ __ __ _____ __ __ __ +/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +/// +/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +/// SPDX-License-Identifier: MIT +/// +/// @file + +#ifndef FK_YAML_DETAIL_TYPES_YAML_VERSION_T_HPP_ +#define FK_YAML_DETAIL_TYPES_YAML_VERSION_T_HPP_ + +#include + +// #include + + +FK_YAML_DETAIL_NAMESPACE_BEGIN + +/// @brief Definition of YAML version types. +enum class yaml_version_t : std::uint32_t { + VER_1_1, //!< YAML version 1.1 + VER_1_2, //!< YAML version 1.2 +}; + +FK_YAML_DETAIL_NAMESPACE_END + +#endif /* FK_YAML_DETAIL_TYPES_YAML_VERSION_T_HPP_ */ + + +FK_YAML_DETAIL_NAMESPACE_BEGIN + +/// @brief The set of directives for a YAML document. +template ::value>> +struct document_metainfo { + /// The YAML version used for the YAML document. + yaml_version_t version {yaml_version_t::VER_1_2}; + /// Whether or not the YAML version has been specified. + bool is_version_specified {false}; + /// The prefix of the primary handle. + std::string primary_handle_prefix {}; + /// The prefix of the secondary handle. + std::string secondary_handle_prefix {}; + /// The map of handle-prefix pairs. + std::map named_handle_map {}; + /// The map of anchor node which allowes for key duplication. + std::multimap anchor_table {}; +}; + +FK_YAML_DETAIL_NAMESPACE_END + +#endif /* FK_YAML_DETAIL_DOCUMENT_METAINFO_HPP_ */ + +// #include +/// _______ __ __ __ _____ __ __ __ +/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +/// +/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +/// SPDX-License-Identifier: MIT +/// +/// @file + +#ifndef FK_YAML_DETAIL_INPUT_DESERIALIZER_HPP_ +#define FK_YAML_DETAIL_INPUT_DESERIALIZER_HPP_ + +#include +#include +#include +#include + +// #include + +// #include + +// #include +/// _______ __ __ __ _____ __ __ __ +/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +/// +/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +/// SPDX-License-Identifier: MIT +/// +/// @file + +#ifndef FK_YAML_DETAIL_INPUT_LEXICAL_ANALIZER_HPP_ +#define FK_YAML_DETAIL_INPUT_LEXICAL_ANALIZER_HPP_ -#ifndef FK_YAML_HAS_CXX_17 -/// @brief A instantiation of static_const::value instance. -/// @note This is required if inline variables are not available. C++11-14 do not provide such a feature yet. -/// @tparam T A target type for the resulting static constant instance. -template -constexpr T static_const::value; -#endif +#include +#include +#include +#include +#include +#include +#include -/// @brief A helper structure for tag dispatch. -/// @tparam T A tag type. -template -struct type_tag { - /// @brief A tagged type. - using type = T; -}; +// #include -/// @brief A utility struct to retrieve the first type in variadic template arguments. -/// @tparam Types Types of variadic template arguments. -template -struct get_head_type; +// #include -/// @brief A specialization of get_head_type if variadic template has no arguments. -/// @tparam N/A -template <> -struct get_head_type<> { - /// @brief A head type - using type = void; -}; +// #include +/// _______ __ __ __ _____ __ __ __ +/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +/// +/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +/// SPDX-License-Identifier: MIT +/// +/// @file -/// @brief A partial specialization of get_head_type if variadic template has one or more argument(s). -/// @tparam First The first type in the arguments -/// @tparam Rest The rest of the types in the arguments. -template -struct get_head_type { - /// @brief A head type. - using type = First; -}; +#ifndef FK_YAML_DETAIL_CONVERSIONS_FROM_STRING_HPP_ +#define FK_YAML_DETAIL_CONVERSIONS_FROM_STRING_HPP_ -/// @brief An alias template to retrieve the first type in variadic template arguments. -/// @tparam Types Types of variadic template arguments. -template -using head_type = typename get_head_type::type; +#include +#include +#include +#include +#include -FK_YAML_DETAIL_NAMESPACE_END +// #include -#endif /* FK_YAML_DETAIL_META_TYPE_TRAITS_HPP_ */ +// #include + +// #include // #include /// _______ __ __ __ _____ __ __ __ @@ -2430,203 +2602,36 @@ class position_tracker { return m_position.cur_pos; } - /// @brief Get the current position in the current line. - /// @return uint32_t The current position in the current line. - uint32_t get_cur_pos_in_line() const noexcept { - return m_position.cur_pos_in_line; - } - - /// @brief Get the number of lines which have already been read. - /// @return uint32_t The number of lines which have already been read. - uint32_t get_lines_read() const noexcept { - return m_position.lines_read; - } - -private: - /// The iterator to the beginning element in the target buffer. - std::string::const_iterator m_begin {}; - /// The iterator to the past-the-end element in the target buffer. - std::string::const_iterator m_end {}; - /// The iterator to the last updated element in the target buffer. - std::string::const_iterator m_last {}; - /// The current position in the target buffer. - position m_position {}; -}; - -FK_YAML_DETAIL_NAMESPACE_END - -#endif /* FK_YAML_DETAIL_INPUT_POSITION_TRACKER_HPP_ */ - -// #include - -// #include -/// _______ __ __ __ _____ __ __ __ -/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 -/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML -/// -/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani -/// SPDX-License-Identifier: MIT -/// -/// @file - -#ifndef FK_YAML_DETAIL_META_NODE_TRAITS_HPP_ -#define FK_YAML_DETAIL_META_NODE_TRAITS_HPP_ - -// #include - -// #include - -// #include - -// #include - - -FK_YAML_NAMESPACE_BEGIN - -// forward declaration for basic_node<...> -template < - template class SequenceType, template class MappingType, - typename BooleanType, typename IntegerType, typename FloatNumberType, typename StringType, - template class ConverterType> -class basic_node; - -FK_YAML_NAMESPACE_END - -FK_YAML_DETAIL_NAMESPACE_BEGIN - -///////////////////////////// -// is_basic_node traits -///////////////////////////// - -/// @brief A struct to check the template parameter class is a kind of basic_node template class. -/// @tparam T A class to be checked if it's a kind of basic_node template class. -template -struct is_basic_node : std::false_type {}; - -/// @brief A partial specialization of is_basic_node for basic_node template class. -/// @tparam SequenceType A type for sequence node value containers. -/// @tparam MappingType A type for mapping node value containers. -/// @tparam BooleanType A type for boolean node values. -/// @tparam IntegerType A type for integer node values. -/// @tparam FloatNumberType A type for float number node values. -/// @tparam StringType A type for string node values. -/// @tparam Converter A type for -template < - template class SequenceType, template class MappingType, - typename BooleanType, typename IntegerType, typename FloatNumberType, typename StringType, - template class Converter> -struct is_basic_node< - basic_node> - : std::true_type {}; - -/////////////////////////////////// -// is_node_ref_storage traits -/////////////////////////////////// - -// forward declaration for node_ref_storage<...> -template -class node_ref_storage; - -/// @brief A struct to check the template parameter class is a kind of node_ref_storage_template class. -/// @tparam T A type to be checked if it's a kind of node_ref_storage template class. -template -struct is_node_ref_storage : std::false_type {}; - -/// @brief A partial specialization for node_ref_storage template class. -/// @tparam T A template parameter type of node_ref_storage template class. -template -struct is_node_ref_storage> : std::true_type {}; - -/////////////////////////////////////////////////////// -// basic_node conversion API representative types -/////////////////////////////////////////////////////// - -/// @brief A type represent from_node function. -/// @tparam T A type which provides from_node function. -/// @tparam Args Argument types passed to from_node function. -template -using from_node_function_t = decltype(T::from_node(std::declval()...)); - -/// @brief A type which represent to_node function. -/// @tparam T A type which provides to_node function. -/// @tparam Args Argument types passed to to_node function. -template -using to_node_funcion_t = decltype(T::to_node(std::declval()...)); - -/////////////////////////////////////////////////// -// basic_node conversion API detection traits -/////////////////////////////////////////////////// - -/// @brief Type traits to check if T is a compatible type for BasicNodeType in terms of from_node function. -/// @tparam BasicNodeType A basic_node template instance type. -/// @tparam T A target type passed to from_node function. -/// @tparam typename N/A -template -struct has_from_node : std::false_type {}; - -/// @brief A partial specialization of has_from_node if T is not a basic_node template instance type. -/// @tparam BasicNodeType A basic_node template instance type. -/// @tparam T A target type passed to from_node function. -template -struct has_from_node::value>> { - using converter = typename BasicNodeType::template value_converter_type; - - // NOLINTNEXTLINE(readability-identifier-naming) - static constexpr bool value = - is_detected_exact::value; -}; - -/// @brief Type traits to check if T is a compatible type for BasicNodeType in terms of to_node function. -/// @warning Do not pass basic_node type as BasicNodeType to avoid infinite type instantiation. -/// @tparam BasicNodeType A basic_node template instance type. -/// @tparam T A target type passed to to_node function. -/// @tparam typename N/A -template -struct has_to_node : std::false_type {}; - -/// @brief A partial specialization of has_to_node if T is not a basic_node template instance type. -/// @tparam BasicNodeType A basic_node template instance type. -/// @tparam T A target type passed to to_node function. -template -struct has_to_node::value>> { - using converter = typename BasicNodeType::template value_converter_type; - - // NOLINTNEXTLINE(readability-identifier-naming) - static constexpr bool value = is_detected_exact::value; -}; - -/////////////////////////////////////// -// is_node_compatible_type traits -/////////////////////////////////////// - -/// @brief Type traits implementation of is_node_compatible_type to check if CompatibleType is a compatible type for -/// BasicNodeType. -/// @tparam BasicNodeType A basic_node template instance type. -/// @tparam CompatibleType A target type for compatibility check. -/// @tparam typename N/A -template -struct is_node_compatible_type_impl : std::false_type {}; - -/// @brief A partial specialization of is_node_compatible_type_impl if CompatibleType is a complete type and is -/// compatible for BasicNodeType. -/// @tparam BasicNodeType A basic_node template instance type. -/// @tparam CompatibleType A target type for compatibility check. -template -struct is_node_compatible_type_impl< - BasicNodeType, CompatibleType, - enable_if_t, has_to_node>::value>> - : std::true_type {}; + /// @brief Get the current position in the current line. + /// @return uint32_t The current position in the current line. + uint32_t get_cur_pos_in_line() const noexcept { + return m_position.cur_pos_in_line; + } -/// @brief Type traits to check if CompatibleType is a compatible type for BasicNodeType. -/// @tparam BasicNodeType A basic_node template instance type. -/// @tparam CompatibleType A target type for compatibility check. -template -struct is_node_compatible_type : is_node_compatible_type_impl {}; + /// @brief Get the number of lines which have already been read. + /// @return uint32_t The number of lines which have already been read. + uint32_t get_lines_read() const noexcept { + return m_position.lines_read; + } + +private: + /// The iterator to the beginning element in the target buffer. + std::string::const_iterator m_begin {}; + /// The iterator to the past-the-end element in the target buffer. + std::string::const_iterator m_end {}; + /// The iterator to the last updated element in the target buffer. + std::string::const_iterator m_last {}; + /// The current position in the target buffer. + position m_position {}; +}; FK_YAML_DETAIL_NAMESPACE_END -#endif /* FK_YAML_DETAIL_META_NODE_TRAITS_HPP_ */ +#endif /* FK_YAML_DETAIL_INPUT_POSITION_TRACKER_HPP_ */ + +// #include + +// #include // #include @@ -3938,7 +3943,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include -// #include +// #include // #include /// _______ __ __ __ _____ __ __ __ @@ -3976,6 +3981,8 @@ FK_YAML_DETAIL_NAMESPACE_END #endif /* FK_YAML_DETAIL_INPUT_TAG_T_HPP_ */ +// #include + // #include @@ -3989,18 +3996,23 @@ const std::string default_secondary_handle_prefix = "tag:yaml.org,2002:"; } // namespace +template class tag_resolver { + static_assert(is_basic_node::value, "tag_resolver only accepts basic_node<...>."); + using doc_metainfo_type = document_metainfo; + public: /// @brief Resolve the input tag name into an expanded tag name prepended with a registered prefix. /// @param tag The input tag name. /// @return The type of a node deduced from the given tag name. - static tag_t resolve_tag(const std::string& tag, const std::shared_ptr& directives) { + static tag_t resolve_tag(const std::string& tag, const std::shared_ptr& directives) { std::string normalized = normalize_tag_name(tag, directives); return convert_to_tag_type(normalized); } private: - static std::string normalize_tag_name(const std::string& tag, const std::shared_ptr& directives) { + static std::string normalize_tag_name( + const std::string& tag, const std::shared_ptr& directives) { if (tag.empty()) { throw invalid_tag("tag must not be empty.", ""); } @@ -4137,6 +4149,48 @@ FK_YAML_DETAIL_NAMESPACE_END // #include +// #include +/// _______ __ __ __ _____ __ __ __ +/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML +/// +/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani +/// SPDX-License-Identifier: MIT +/// +/// @file + +#ifndef FK_YAML_DETAIL_NODE_PROPERTY_HPP_ +#define FK_YAML_DETAIL_NODE_PROPERTY_HPP_ + +#include + +// #include + + +FK_YAML_DETAIL_NAMESPACE_BEGIN + +enum class anchor_status_t { + NONE, + ANCHOR, + ALIAS, +}; + +struct node_property { + /// The tag name property. + std::string tag {}; + /// The status regarding node anchoring/aliasing. + anchor_status_t anchor_status {anchor_status_t::NONE}; + /// The anchor name property. + std::string anchor {}; + /// The offset index value used to reference the anchor node implementation. + uint32_t anchor_offset {0}; +}; + +FK_YAML_DETAIL_NAMESPACE_END + +#endif /* FK_YAML_DETAIL_NODE_PROPERTY_HPP_ */ + // #include // #include @@ -4154,6 +4208,10 @@ class basic_deserializer { using node_type = BasicNodeType; /** A type for the lexical analyzer. */ using lexer_type = lexical_analyzer; + /** A type for the document metainfo. */ + using doc_metainfo_type = document_metainfo; + /** A type for the tag resolver. */ + using tag_resolver_type = tag_resolver; /** A type for sequence node value containers. */ using sequence_type = typename node_type::sequence_type; /** A type for mapping node value containers. */ @@ -4213,6 +4271,7 @@ class basic_deserializer { lexical_token_t type {lexical_token_t::END_OF_BUFFER}; node_type root; + mp_meta = root.mp_meta; // parse directives first. deserialize_directives(lexer, type); @@ -4260,9 +4319,9 @@ class basic_deserializer { // reset parameters for the next call. mp_current_node = nullptr; - mp_directive_set.reset(); + mp_meta.reset(); + m_needs_tag_impl = false; m_needs_anchor_impl = false; - m_anchor_table.clear(); m_context_stack.clear(); return root; @@ -4278,52 +4337,44 @@ class basic_deserializer { switch (type) { case lexical_token_t::YAML_VER_DIRECTIVE: - if (!mp_directive_set) { - mp_directive_set = std::shared_ptr(new directive_set()); - } - - if (mp_directive_set->is_version_specified) { + if (mp_meta->is_version_specified) { throw parse_error( "YAML version cannot be specified more than once.", lexer.get_lines_processed(), lexer.get_last_token_begin_pos()); } - mp_directive_set->version = convert_yaml_version(lexer.get_yaml_version()); - mp_directive_set->is_version_specified = true; + mp_meta->version = convert_yaml_version(lexer.get_yaml_version()); + mp_meta->is_version_specified = true; break; case lexical_token_t::TAG_DIRECTIVE: { - if (!mp_directive_set) { - mp_directive_set = std::shared_ptr(new directive_set()); - } - const std::string& tag_handle = lexer.get_tag_handle(); switch (tag_handle.size()) { case 1: { - bool is_already_specified = !mp_directive_set->primary_handle_prefix.empty(); + bool is_already_specified = !mp_meta->primary_handle_prefix.empty(); if (is_already_specified) { throw parse_error( "Primary handle cannot be specified more than once.", lexer.get_lines_processed(), lexer.get_last_token_begin_pos()); } - mp_directive_set->primary_handle_prefix = lexer.get_tag_prefix(); + mp_meta->primary_handle_prefix = lexer.get_tag_prefix(); break; } case 2: { - bool is_already_specified = !mp_directive_set->secondary_handle_prefix.empty(); + bool is_already_specified = !mp_meta->secondary_handle_prefix.empty(); if (is_already_specified) { throw parse_error( "Secondary handle cannot be specified more than once.", lexer.get_lines_processed(), lexer.get_last_token_begin_pos()); } - mp_directive_set->secondary_handle_prefix = lexer.get_tag_prefix(); + mp_meta->secondary_handle_prefix = lexer.get_tag_prefix(); break; } default: { bool is_already_specified = - !(mp_directive_set->named_handle_map.emplace(tag_handle, lexer.get_tag_prefix()).second); + !(mp_meta->named_handle_map.emplace(tag_handle, lexer.get_tag_prefix()).second); if (is_already_specified) { throw parse_error( "The same named handle cannot be specified more than once.", @@ -4453,7 +4504,7 @@ class basic_deserializer { if (line > old_line) { if (m_needs_tag_impl) { - tag_t tag_type = tag_resolver::resolve_tag(m_tag_name, mp_directive_set); + tag_t tag_type = tag_resolver_type::resolve_tag(m_tag_name, mp_meta); if (tag_type == tag_t::MAPPING) { // set YAML node properties here to distinguish them from those for the first key node // as shown in the following snippet: @@ -4832,7 +4883,7 @@ class basic_deserializer { throw parse_error("Tag cannot be specified to alias nodes", line, indent); } - tag_t tag_type = tag_resolver::resolve_tag(m_tag_name, mp_directive_set); + tag_t tag_type = tag_resolver_type::resolve_tag(m_tag_name, mp_meta); FK_YAML_ASSERT(tag_type != tag_t::SEQUENCE && tag_type != tag_t::MAPPING); @@ -4882,11 +4933,13 @@ class basic_deserializer { break; case lexical_token_t::ALIAS_PREFIX: { const string_type& alias_name = lexer.get_string(); - auto itr = m_anchor_table.find(alias_name); - if (itr == m_anchor_table.end()) { + uint32_t anchor_counts = static_cast(mp_meta->anchor_table.count(alias_name)); + if (anchor_counts == 0) { throw parse_error("The given anchor name must appear prior to the alias node.", line, indent); } - node = node_type::alias_of(m_anchor_table[alias_name]); + node.m_prop.anchor_status = detail::anchor_status_t::ALIAS; + node.m_prop.anchor = alias_name; + node.m_prop.anchor_offset = anchor_counts - 1; break; } default: // LCOV_EXCL_LINE @@ -4960,9 +5013,7 @@ class basic_deserializer { /// @brief Set YAML directive properties to the given node. /// @param node A node_type object to be set YAML directive properties. void apply_directive_set(node_type& node) noexcept { - if (mp_directive_set) { - node.mp_directive_set = mp_directive_set; - } + node.mp_meta = mp_meta; } /// @brief Set YAML node properties (anchor and/or tag names) to the given node. @@ -4970,7 +5021,6 @@ class basic_deserializer { void apply_node_properties(node_type& node) { if (m_needs_anchor_impl) { node.add_anchor_name(m_anchor_name); - m_anchor_table[m_anchor_name] = node; m_needs_anchor_impl = false; m_anchor_name.clear(); } @@ -4996,15 +5046,13 @@ class basic_deserializer { /// The current depth of flow contexts. uint32_t m_flow_context_depth {0}; /// The set of YAML directives. - std::shared_ptr mp_directive_set {}; + std::shared_ptr mp_meta {}; /// A flag to determine the need for YAML anchor node implementation. bool m_needs_anchor_impl {false}; /// A flag to determine the need for a corresponding node with the last YAML tag. bool m_needs_tag_impl {false}; /// The last YAML anchor name. string_type m_anchor_name {}; - /// The table of YAML anchor nodes. - std::unordered_map m_anchor_table {}; /// The last tag name. string_type m_tag_name {}; }; @@ -6589,41 +6637,6 @@ FK_YAML_DETAIL_NAMESPACE_END // #include // #include -/// _______ __ __ __ _____ __ __ __ -/// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 -/// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML -/// -/// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani -/// SPDX-License-Identifier: MIT -/// -/// @file - -#ifndef FK_YAML_DETAIL_NODE_PROPERTY_HPP_ -#define FK_YAML_DETAIL_NODE_PROPERTY_HPP_ - -#include - -// #include - - -FK_YAML_DETAIL_NAMESPACE_BEGIN - -enum class anchor_status_t { - NONE, - ANCHOR, - ALIAS, -}; - -struct node_property { - std::string tag {}; - anchor_status_t anchor_status {anchor_status_t::NONE}; - std::string anchor {}; -}; - -FK_YAML_DETAIL_NAMESPACE_END - -#endif /* FK_YAML_DETAIL_NODE_PROPERTY_HPP_ */ // #include /// _______ __ __ __ _____ __ __ __ @@ -6872,15 +6885,12 @@ class basic_serializer { /// @param node The targe node. /// @param str A string to hold serialization result. void serialize_directives(const BasicNodeType& node, std::string& str) { - if (!node.mp_directive_set) { - return; - } + const auto& p_meta = node.mp_meta; + bool needs_directive_end = false; - const auto& directives = node.mp_directive_set; - - if (directives->is_version_specified) { + if (p_meta->is_version_specified) { str += "%YAML "; - switch (directives->version) { + switch (p_meta->version) { case yaml_version_t::VER_1_1: str += "1.1\n"; break; @@ -6888,31 +6898,37 @@ class basic_serializer { str += "1.2\n"; break; } + needs_directive_end = true; } - if (!directives->primary_handle_prefix.empty()) { + if (!p_meta->primary_handle_prefix.empty()) { str += "%TAG ! "; - str += directives->primary_handle_prefix; + str += p_meta->primary_handle_prefix; str += "\n"; + needs_directive_end = true; } - if (!directives->secondary_handle_prefix.empty()) { + if (!p_meta->secondary_handle_prefix.empty()) { str += "%TAG !! "; - str += directives->secondary_handle_prefix; + str += p_meta->secondary_handle_prefix; str += "\n"; + needs_directive_end = true; } - if (!directives->named_handle_map.empty()) { - for (const auto& itr : directives->named_handle_map) { + if (!p_meta->named_handle_map.empty()) { + for (const auto& itr : p_meta->named_handle_map) { str += "%TAG "; str += itr.first; str += " "; str += itr.second; str += "\n"; } + needs_directive_end = true; } - str += "---\n"; + if (needs_directive_end) { + str += "---\n"; + } } /// @brief Recursively serialize each Node object. @@ -8149,6 +8165,17 @@ class basic_node { basic_node current_node(std::move(stack.back())); stack.pop_back(); + if (current_node.is_alias()) { + continue; + } + + if (current_node.is_anchor()) { + auto itr = current_node.mp_meta->anchor_table.equal_range(current_node.m_prop.anchor).first; + std::advance(itr, current_node.m_prop.anchor_offset); + stack.emplace_back(std::move(itr->second)); + continue; + } + if (current_node.is_sequence()) { std::move( current_node.m_node_value.p_sequence->begin(), @@ -8208,7 +8235,7 @@ class basic_node { using AllocType = std::allocator; using AllocTraitsType = std::allocator_traits; - AllocType alloc; + AllocType alloc {}; auto deleter = [&](ObjType* obj) { AllocTraitsType::destroy(alloc, obj); AllocTraitsType::deallocate(alloc, obj, 1); @@ -8251,33 +8278,32 @@ class basic_node { /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/constructor/ basic_node(const basic_node& rhs) : m_node_type(rhs.m_node_type), - mp_directive_set(rhs.mp_directive_set), + mp_meta(rhs.mp_meta), m_prop(rhs.m_prop) { - switch (m_node_type) { - case node_t::SEQUENCE: - m_node_value.p_sequence = create_object(*(rhs.m_node_value.p_sequence)); - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - break; - case node_t::MAPPING: - m_node_value.p_mapping = create_object(*(rhs.m_node_value.p_mapping)); - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - break; - case node_t::NULL_OBJECT: - m_node_value.p_mapping = nullptr; - break; - case node_t::BOOLEAN: - m_node_value.boolean = rhs.m_node_value.boolean; - break; - case node_t::INTEGER: - m_node_value.integer = rhs.m_node_value.integer; - break; - case node_t::FLOAT_NUMBER: - m_node_value.float_val = rhs.m_node_value.float_val; - break; - case node_t::STRING: - m_node_value.p_string = create_object(*(rhs.m_node_value.p_string)); - FK_YAML_ASSERT(m_node_value.p_string != nullptr); - break; + if (!has_anchor_name()) { + switch (m_node_type) { + case node_t::SEQUENCE: + m_node_value.p_sequence = create_object(*(rhs.m_node_value.p_sequence)); + break; + case node_t::MAPPING: + m_node_value.p_mapping = create_object(*(rhs.m_node_value.p_mapping)); + break; + case node_t::NULL_OBJECT: + m_node_value.p_mapping = nullptr; + break; + case node_t::BOOLEAN: + m_node_value.boolean = rhs.m_node_value.boolean; + break; + case node_t::INTEGER: + m_node_value.integer = rhs.m_node_value.integer; + break; + case node_t::FLOAT_NUMBER: + m_node_value.float_val = rhs.m_node_value.float_val; + break; + case node_t::STRING: + m_node_value.p_string = create_object(*(rhs.m_node_value.p_string)); + break; + } } } @@ -8286,40 +8312,42 @@ class basic_node { /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/constructor/ basic_node(basic_node&& rhs) noexcept : m_node_type(rhs.m_node_type), - mp_directive_set(std::move(rhs.mp_directive_set)), + mp_meta(std::move(rhs.mp_meta)), m_prop(std::move(rhs.m_prop)) { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(rhs.m_node_value.p_sequence != nullptr); - m_node_value.p_sequence = rhs.m_node_value.p_sequence; - rhs.m_node_value.p_sequence = nullptr; - break; - case node_t::MAPPING: - FK_YAML_ASSERT(rhs.m_node_value.p_mapping != nullptr); - m_node_value.p_mapping = rhs.m_node_value.p_mapping; - rhs.m_node_value.p_mapping = nullptr; - break; - case node_t::NULL_OBJECT: - FK_YAML_ASSERT(rhs.m_node_value.p_mapping == nullptr); - m_node_value.p_mapping = rhs.m_node_value.p_mapping; - break; - case node_t::BOOLEAN: - m_node_value.boolean = rhs.m_node_value.boolean; - rhs.m_node_value.boolean = static_cast(false); - break; - case node_t::INTEGER: - m_node_value.integer = rhs.m_node_value.integer; - rhs.m_node_value.integer = static_cast(0); - break; - case node_t::FLOAT_NUMBER: - m_node_value.float_val = rhs.m_node_value.float_val; - rhs.m_node_value.float_val = static_cast(0.0); - break; - case node_t::STRING: - FK_YAML_ASSERT(rhs.m_node_value.p_string != nullptr); - m_node_value.p_string = rhs.m_node_value.p_string; - rhs.m_node_value.p_string = nullptr; - break; + if (!has_anchor_name()) { + switch (m_node_type) { + case node_t::SEQUENCE: + FK_YAML_ASSERT(rhs.m_node_value.p_sequence != nullptr); + m_node_value.p_sequence = rhs.m_node_value.p_sequence; + rhs.m_node_value.p_sequence = nullptr; + break; + case node_t::MAPPING: + FK_YAML_ASSERT(rhs.m_node_value.p_mapping != nullptr); + m_node_value.p_mapping = rhs.m_node_value.p_mapping; + rhs.m_node_value.p_mapping = nullptr; + break; + case node_t::NULL_OBJECT: + FK_YAML_ASSERT(rhs.m_node_value.p_mapping == nullptr); + m_node_value.p_mapping = rhs.m_node_value.p_mapping; + break; + case node_t::BOOLEAN: + m_node_value.boolean = rhs.m_node_value.boolean; + rhs.m_node_value.boolean = static_cast(false); + break; + case node_t::INTEGER: + m_node_value.integer = rhs.m_node_value.integer; + rhs.m_node_value.integer = static_cast(0); + break; + case node_t::FLOAT_NUMBER: + m_node_value.float_val = rhs.m_node_value.float_val; + rhs.m_node_value.float_val = static_cast(0.0); + break; + case node_t::STRING: + FK_YAML_ASSERT(rhs.m_node_value.p_string != nullptr); + m_node_value.p_string = rhs.m_node_value.p_string; + rhs.m_node_value.p_string = nullptr; + break; + } } rhs.m_node_type = node_t::NULL_OBJECT; @@ -8376,7 +8404,11 @@ class basic_node { } else { m_node_type = node_t::SEQUENCE; - m_node_value.p_sequence = create_object(init.begin(), init.end()); + m_node_value.p_sequence = create_object(); + m_node_value.p_sequence->reserve(std::distance(init.begin(), init.end())); + for (auto& elem_ref : init) { + m_node_value.p_sequence->emplace_back(std::move(elem_ref.release())); + } } } @@ -8384,8 +8416,23 @@ class basic_node { /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/destructor/ ~basic_node() noexcept // NOLINT(bugprone-exception-escape) { - m_node_value.destroy(m_node_type); + switch (m_prop.anchor_status) { + case detail::anchor_status_t::NONE: + m_node_value.destroy(m_node_type); + break; + case detail::anchor_status_t::ANCHOR: { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + itr->second.m_node_value.destroy(itr->second.m_node_type); + itr->second.m_node_type = node_t::NULL_OBJECT; + itr->second.mp_meta.reset(); + break; + } + case detail::anchor_status_t::ALIAS: + break; + } m_node_type = node_t::NULL_OBJECT; + mp_meta.reset(); } public: @@ -8426,7 +8473,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::SEQUENCE; node.m_node_value.p_sequence = create_object(); - FK_YAML_ASSERT(node.m_node_value.p_sequence != nullptr); return node; } // LCOV_EXCL_LINE @@ -8438,7 +8484,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::SEQUENCE; node.m_node_value.p_sequence = create_object(seq); - FK_YAML_ASSERT(node.m_node_value.p_sequence != nullptr); return node; } // LCOV_EXCL_LINE @@ -8450,7 +8495,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::SEQUENCE; node.m_node_value.p_sequence = create_object(std::move(seq)); - FK_YAML_ASSERT(node.m_node_value.p_sequence != nullptr); return node; } // LCOV_EXCL_LINE @@ -8461,7 +8505,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::MAPPING; node.m_node_value.p_mapping = create_object(); - FK_YAML_ASSERT(node.m_node_value.p_mapping != nullptr); return node; } // LCOV_EXCL_LINE @@ -8473,7 +8516,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::MAPPING; node.m_node_value.p_mapping = create_object(map); - FK_YAML_ASSERT(node.m_node_value.p_mapping != nullptr); return node; } // LCOV_EXCL_LINE @@ -8485,7 +8527,6 @@ class basic_node { basic_node node; node.m_node_type = node_t::MAPPING; node.m_node_value.p_mapping = create_object(std::move(map)); - FK_YAML_ASSERT(node.m_node_value.p_mapping != nullptr); return node; } // LCOV_EXCL_LINE @@ -8501,7 +8542,6 @@ class basic_node { basic_node node = anchor_node; node.m_prop.anchor_status = detail::anchor_status_t::ALIAS; - node.m_prop.anchor = anchor_node.m_prop.anchor; return node; } // LCOV_EXCL_LINE @@ -8537,22 +8577,22 @@ class basic_node { int> = 0> basic_node& operator[](KeyType&& key) { if (is_scalar()) { - throw fkyaml::type_error("operator[] is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("operator[] is unavailable for a scalar node.", type()); } basic_node n = std::forward(key); + const node_value* p_node_value = get_node_value_ptr(); if (is_sequence()) { if (!n.is_integer()) { - throw fkyaml::type_error( - "An argument of operator[] for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of operator[] for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->operator[](n.get_value()); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->operator[](n.get_value()); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->operator[](std::move(n)); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->operator[](std::move(n)); } /// @brief A subscript operator of the basic_node class with a key of a compatible type with basic_node. @@ -8568,22 +8608,22 @@ class basic_node { int> = 0> const basic_node& operator[](KeyType&& key) const { if (is_scalar()) { - throw fkyaml::type_error("operator[] is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("operator[] is unavailable for a scalar node.", type()); } basic_node node_key = std::forward(key); + const node_value* p_node_value = get_node_value_ptr(); if (is_sequence()) { if (!node_key.is_integer()) { - throw fkyaml::type_error( - "An argument of operator[] for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of operator[] for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->operator[](node_key.get_value()); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->operator[](node_key.get_value()); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->operator[](std::move(node_key)); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->operator[](std::move(node_key)); } /// @brief A subscript operator of the basic_node class with a basic_node key object. @@ -8595,20 +8635,21 @@ class basic_node { typename KeyType, detail::enable_if_t>::value, int> = 0> basic_node& operator[](KeyType&& key) { if (is_scalar()) { - throw fkyaml::type_error("operator[] is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("operator[] is unavailable for a scalar node.", type()); } + const node_value* p_node_value = get_node_value_ptr(); + if (is_sequence()) { if (!key.is_integer()) { - throw fkyaml::type_error( - "An argument of operator[] for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of operator[] for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->operator[](key.template get_value()); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->operator[](key.template get_value()); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->operator[](std::forward(key)); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->operator[](std::forward(key)); } /// @brief A subscript operator of the basic_node class with a basic_node key object. @@ -8620,20 +8661,21 @@ class basic_node { typename KeyType, detail::enable_if_t>::value, int> = 0> const basic_node& operator[](KeyType&& key) const { if (is_scalar()) { - throw fkyaml::type_error("operator[] is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("operator[] is unavailable for a scalar node.", type()); } + const node_value* p_node_value = get_node_value_ptr(); + if (is_sequence()) { if (!key.is_integer()) { - throw fkyaml::type_error( - "An argument of operator[] for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of operator[] for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->operator[](key.template get_value()); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->operator[](key.template get_value()); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->operator[](std::forward(key)); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->operator[](std::forward(key)); } /// @brief An equal-to operator of the basic_node class. @@ -8641,35 +8683,39 @@ class basic_node { /// @return true if both types and values are equal, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/operator_eq/ bool operator==(const basic_node& rhs) const noexcept { - if (m_node_type != rhs.m_node_type) { + node_t this_type = type(); + const node_value* this_node_value_ptr = get_node_value_ptr(); + const node_value* other_node_value_ptr = rhs.get_node_value_ptr(); + + if (this_type != rhs.type()) { return false; } bool ret = false; - switch (m_node_type) { + switch (this_type) { case node_t::SEQUENCE: - ret = (*(m_node_value.p_sequence) == *(rhs.m_node_value.p_sequence)); + ret = (*(this_node_value_ptr->p_sequence) == *(other_node_value_ptr->p_sequence)); break; case node_t::MAPPING: - ret = (*(m_node_value.p_mapping) == *(rhs.m_node_value.p_mapping)); + ret = (*(this_node_value_ptr->p_mapping) == *(other_node_value_ptr->p_mapping)); break; case node_t::NULL_OBJECT: // Always true for comparisons between null nodes. ret = true; break; case node_t::BOOLEAN: - ret = (m_node_value.boolean == rhs.m_node_value.boolean); + ret = (this_node_value_ptr->boolean == other_node_value_ptr->boolean); break; case node_t::INTEGER: - ret = (m_node_value.integer == rhs.m_node_value.integer); + ret = (this_node_value_ptr->integer == other_node_value_ptr->integer); break; case node_t::FLOAT_NUMBER: ret = - (std::abs(m_node_value.float_val - rhs.m_node_value.float_val) < + (std::abs(this_node_value_ptr->float_val - other_node_value_ptr->float_val) < std::numeric_limits::epsilon()); break; case node_t::STRING: - ret = (*(m_node_value.p_string) == *(rhs.m_node_value.p_string)); + ret = (*(this_node_value_ptr->p_string) == *(other_node_value_ptr->p_string)); break; } @@ -8693,37 +8739,43 @@ class basic_node { return false; } - if (uint32_t(m_node_type) < uint32_t(rhs.m_node_type)) { + node_t this_type = type(); + node_t other_type = rhs.type(); + + if (static_cast(this_type) < static_cast(other_type)) { return true; } - if (m_node_type != rhs.m_node_type) { + if (this_type != other_type) { return false; } + const node_value* p_this_value = get_node_value_ptr(); + const node_value* p_other_value = rhs.get_node_value_ptr(); + bool ret = false; - switch (m_node_type) { + switch (this_type) { case node_t::SEQUENCE: - ret = (*(m_node_value.p_sequence) < *(rhs.m_node_value.p_sequence)); + ret = (*(p_this_value->p_sequence) < *(p_other_value->p_sequence)); break; case node_t::MAPPING: - ret = (*(m_node_value.p_mapping) < *(rhs.m_node_value.p_mapping)); + ret = (*(p_this_value->p_mapping) < *(p_other_value->p_mapping)); break; case node_t::NULL_OBJECT: // LCOV_EXCL_LINE // Will not come here since null nodes are alyways the same. break; // LCOV_EXCL_LINE case node_t::BOOLEAN: // false < true - ret = (!m_node_value.boolean && rhs.m_node_value.boolean); + ret = (!p_this_value->boolean && p_other_value->boolean); break; case node_t::INTEGER: - ret = (m_node_value.integer < rhs.m_node_value.integer); + ret = (p_this_value->integer < p_other_value->integer); break; case node_t::FLOAT_NUMBER: - ret = (m_node_value.float_val < rhs.m_node_value.float_val); + ret = (p_this_value->float_val < p_other_value->float_val); break; case node_t::STRING: - ret = (*(m_node_value.p_string) < *(rhs.m_node_value.p_string)); + ret = (*(p_this_value->p_string) < *(p_other_value->p_string)); break; } @@ -8759,6 +8811,11 @@ class basic_node { /// @return The type of the YAML node value. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/type/ node_t type() const noexcept { + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + return itr->second.m_node_type; + } return m_node_type; } @@ -8766,49 +8823,49 @@ class basic_node { /// @return true if the type is sequence, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_sequence/ bool is_sequence() const noexcept { - return m_node_type == node_t::SEQUENCE; + return type() == node_t::SEQUENCE; } /// @brief Tests whether the current basic_node value is of mapping type. /// @return true if the type is mapping, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_mapping/ bool is_mapping() const noexcept { - return m_node_type == node_t::MAPPING; + return type() == node_t::MAPPING; } /// @brief Tests whether the current basic_node value is of null type. /// @return true if the type is null, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_null/ bool is_null() const noexcept { - return m_node_type == node_t::NULL_OBJECT; + return type() == node_t::NULL_OBJECT; } /// @brief Tests whether the current basic_node value is of boolean type. /// @return true if the type is boolean, false otherwise /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_boolean/ bool is_boolean() const noexcept { - return m_node_type == node_t::BOOLEAN; + return type() == node_t::BOOLEAN; } /// @brief Tests whether the current basic_node value is of integer type. /// @return true if the type is integer, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_integer/ bool is_integer() const noexcept { - return m_node_type == node_t::INTEGER; + return type() == node_t::INTEGER; } /// @brief Tests whether the current basic_node value is of float number type. /// @return true if the type is floating point number, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_float_number/ bool is_float_number() const noexcept { - return m_node_type == node_t::FLOAT_NUMBER; + return type() == node_t::FLOAT_NUMBER; } /// @brief Tests whether the current basic_node value is of string type. /// @return true if the type is string, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/is_string/ bool is_string() const noexcept { - return m_node_type == node_t::STRING; + return type() == node_t::STRING; } /// @brief Tests whether the current basic_node value is of scalar types. @@ -8836,18 +8893,24 @@ class basic_node { /// @return true if the node value is empty, false otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/empty/ bool empty() const { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->empty(); - case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->empty(); - case node_t::STRING: - FK_YAML_ASSERT(m_node_value.p_string != nullptr); - return m_node_value.p_string->empty(); + switch (type()) { + case node_t::SEQUENCE: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->empty(); + } + case node_t::MAPPING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->empty(); + } + case node_t::STRING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_string != nullptr); + return p_node_value->p_string->empty(); + } default: - throw fkyaml::type_error("The target node is not of a container type.", m_node_type); + throw fkyaml::type_error("The target node is not of a container type.", type()); } } @@ -8855,18 +8918,19 @@ class basic_node { /// @return The size of a node value. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/size/ std::size_t size() const { - switch (m_node_type) { + const node_value* p_node_value = get_node_value_ptr(); + switch (type()) { case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return m_node_value.p_sequence->size(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return p_node_value->p_sequence->size(); case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return m_node_value.p_mapping->size(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return p_node_value->p_mapping->size(); case node_t::STRING: - FK_YAML_ASSERT(m_node_value.p_string != nullptr); - return m_node_value.p_string->size(); + FK_YAML_ASSERT(p_node_value->p_string != nullptr); + return p_node_value->p_string->size(); default: - throw fkyaml::type_error("The target node is not of a container type.", m_node_type); + throw fkyaml::type_error("The target node is not of a container type.", type()); } } @@ -8882,10 +8946,12 @@ class basic_node { detail::is_node_compatible_type>>::value, int> = 0> bool contains(KeyType&& key) const { - switch (m_node_type) { + switch (type()) { case node_t::MAPPING: { - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - mapping_type& map = *m_node_value.p_mapping; + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + + mapping_type& map = *p_node_value->p_mapping; basic_node node_key = std::forward(key); return map.find(node_key) != map.end(); } @@ -8902,10 +8968,12 @@ class basic_node { template < typename KeyType, detail::enable_if_t>::value, int> = 0> bool contains(KeyType&& key) const { - switch (m_node_type) { + switch (type()) { case node_t::MAPPING: { - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - mapping_type& map = *m_node_value.p_mapping; + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + + mapping_type& map = *p_node_value->p_mapping; return map.find(std::forward(key)) != map.end(); } default: @@ -8926,31 +8994,32 @@ class basic_node { int> = 0> basic_node& at(KeyType&& key) { if (is_scalar()) { - throw fkyaml::type_error("at() is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("at() is unavailable for a scalar node.", type()); } basic_node node_key = std::forward(key); + const node_value* p_node_value = get_node_value_ptr(); if (is_sequence()) { if (!node_key.is_integer()) { - throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); int index = node_key.template get_value(); - int size = static_cast(m_node_value.p_sequence->size()); + int size = static_cast(p_node_value->p_sequence->size()); if (index >= size) { throw fkyaml::out_of_range(index); } - return m_node_value.p_sequence->at(index); + return p_node_value->p_sequence->at(index); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - bool is_found = m_node_value.p_mapping->find(node_key) != m_node_value.p_mapping->end(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + bool is_found = p_node_value->p_mapping->find(node_key) != p_node_value->p_mapping->end(); if (!is_found) { throw fkyaml::out_of_range(serialize(node_key).c_str()); } - return m_node_value.p_mapping->at(node_key); + return p_node_value->p_mapping->at(node_key); } /// @brief Get a basic_node object with a key of a compatible type. @@ -8966,31 +9035,32 @@ class basic_node { int> = 0> const basic_node& at(KeyType&& key) const { if (is_scalar()) { - throw fkyaml::type_error("at() is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("at() is unavailable for a scalar node.", type()); } basic_node node_key = std::forward(key); + const node_value* p_node_value = get_node_value_ptr(); if (is_sequence()) { if (!node_key.is_integer()) { - throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); int index = node_key.template get_value(); - int size = static_cast(m_node_value.p_sequence->size()); + int size = static_cast(p_node_value->p_sequence->size()); if (index >= size) { throw fkyaml::out_of_range(index); } - return m_node_value.p_sequence->at(index); + return p_node_value->p_sequence->at(index); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - bool is_found = m_node_value.p_mapping->find(node_key) != m_node_value.p_mapping->end(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + bool is_found = p_node_value->p_mapping->find(node_key) != p_node_value->p_mapping->end(); if (!is_found) { throw fkyaml::out_of_range(serialize(node_key).c_str()); } - return m_node_value.p_mapping->at(node_key); + return p_node_value->p_mapping->at(node_key); } /// @brief Get a basic_node object with a basic_node key object. @@ -9002,29 +9072,31 @@ class basic_node { typename KeyType, detail::enable_if_t>::value, int> = 0> basic_node& at(KeyType&& key) { if (is_scalar()) { - throw fkyaml::type_error("at() is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("at() is unavailable for a scalar node.", type()); } + const node_value* p_node_value = get_node_value_ptr(); + if (is_sequence()) { if (!key.is_integer()) { - throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); int index = std::forward(key).template get_value(); - int size = static_cast(m_node_value.p_sequence->size()); + int size = static_cast(p_node_value->p_sequence->size()); if (index >= size) { throw fkyaml::out_of_range(index); } - return m_node_value.p_sequence->at(index); + return p_node_value->p_sequence->at(index); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - bool is_found = m_node_value.p_mapping->find(key) != m_node_value.p_mapping->end(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + bool is_found = p_node_value->p_mapping->find(key) != p_node_value->p_mapping->end(); if (!is_found) { throw fkyaml::out_of_range(serialize(key).c_str()); } - return m_node_value.p_mapping->at(key); + return p_node_value->p_mapping->at(key); } /// @brief Get a basic_node object with a basic_node key object. @@ -9036,37 +9108,38 @@ class basic_node { typename KeyType, detail::enable_if_t>::value, int> = 0> const basic_node& at(KeyType&& key) const { if (is_scalar()) { - throw fkyaml::type_error("at() is unavailable for a scalar node.", m_node_type); + throw fkyaml::type_error("at() is unavailable for a scalar node.", type()); } + const node_value* p_node_value = get_node_value_ptr(); + if (is_sequence()) { if (!key.is_integer()) { - throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", m_node_type); + throw fkyaml::type_error("An argument of at() for sequence nodes must be an integer.", type()); } - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); int index = std::forward(key).template get_value(); - int size = static_cast(m_node_value.p_sequence->size()); + int size = static_cast(p_node_value->p_sequence->size()); if (index >= size) { throw fkyaml::out_of_range(index); } - return m_node_value.p_sequence->at(index); + return p_node_value->p_sequence->at(index); } - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - bool is_found = m_node_value.p_mapping->find(key) != m_node_value.p_mapping->end(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + bool is_found = p_node_value->p_mapping->find(key) != p_node_value->p_mapping->end(); if (!is_found) { throw fkyaml::out_of_range(serialize(key).c_str()); } - return m_node_value.p_mapping->at(key); + return p_node_value->p_mapping->at(key); } /// @brief Get the YAML version specification for this basic_node object. /// @return The YAML version if any is applied to the basic_node object, `yaml_version_t::VER_1_2` otherwise. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/get_yaml_version/ yaml_version_t get_yaml_version() const noexcept { - return (mp_directive_set && mp_directive_set->is_version_specified) ? mp_directive_set->version - : yaml_version_t::VER_1_2; + return (mp_meta && mp_meta->is_version_specified) ? mp_meta->version : yaml_version_t::VER_1_2; } /// @brief Set the YAML version specification for this basic_node object. @@ -9074,11 +9147,8 @@ class basic_node { /// @param[in] A version of the YAML format. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/set_yaml_version/ void set_yaml_version(const yaml_version_t version) noexcept { - if (!mp_directive_set) { - mp_directive_set = std::shared_ptr(new detail::directive_set()); - } - mp_directive_set->version = version; - mp_directive_set->is_version_specified = true; + mp_meta->version = version; + mp_meta->is_version_specified = true; } /// @brief Check whether or not this basic_node object has already had any anchor name. @@ -9105,8 +9175,26 @@ class basic_node { /// @param[in] anchor_name An anchor name. This should not be empty. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/add_anchor_name/ void add_anchor_name(const std::string& anchor_name) { + if (is_anchor()) { + m_prop.anchor_status = detail::anchor_status_t::NONE; + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + mp_meta.reset(); + itr->second.swap(*this); + mp_meta->anchor_table.erase(itr); + } + + auto p_meta = mp_meta; + uint32_t anchor_counts = static_cast(p_meta->anchor_table.count(anchor_name)); + + basic_node node; + node.swap(*this); + p_meta->anchor_table.emplace(anchor_name, std::move(node)); + + mp_meta = p_meta; m_prop.anchor_status = detail::anchor_status_t::ANCHOR; m_prop.anchor = anchor_name; + m_prop.anchor_offset = anchor_counts; } /// @brief Add an anchor name to this basic_node object. @@ -9114,8 +9202,26 @@ class basic_node { /// @param[in] anchor_name An anchor name. This should not be empty. /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/add_anchor_name/ void add_anchor_name(std::string&& anchor_name) { + if (is_anchor()) { + m_prop.anchor_status = detail::anchor_status_t::NONE; + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + mp_meta.reset(); + itr->second.swap(*this); + mp_meta->anchor_table.erase(itr); + } + + auto p_meta = mp_meta; + uint32_t anchor_counts = static_cast(p_meta->anchor_table.count(anchor_name)); + + basic_node node; + node.swap(*this); + p_meta->anchor_table.emplace(anchor_name, std::move(node)); + + mp_meta = p_meta; m_prop.anchor_status = detail::anchor_status_t::ANCHOR; m_prop.anchor = std::move(anchor_name); + m_prop.anchor_offset = anchor_counts; } /// @brief Check whether or not this basic_node object has already had any tag name. @@ -9168,7 +9274,14 @@ class basic_node { T get_value() const noexcept( noexcept(ConverterType::from_node(std::declval(), std::declval()))) { auto ret = ValueType(); - ConverterType::from_node(*this, ret); + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + ConverterType::from_node(itr->second, ret); + } + else { + ConverterType::from_node(*this, ret); + } return ret; } @@ -9178,6 +9291,11 @@ class basic_node { /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/get_value_ref/ template ::value, int> = 0> ReferenceType get_value_ref() { + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + return itr->second.get_value_ref_impl(static_cast>(nullptr)); + } return get_value_ref_impl(static_cast>(nullptr)); } @@ -9192,6 +9310,11 @@ class basic_node { std::is_reference, std::is_const>>::value, int> = 0> ReferenceType get_value_ref() const { + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + return itr->second.get_value_ref_impl(static_cast>(nullptr)); + } return get_value_ref_impl(static_cast>(nullptr)); } @@ -9201,7 +9324,7 @@ class basic_node { void swap(basic_node& rhs) noexcept { using std::swap; swap(m_node_type, rhs.m_node_type); - swap(mp_directive_set, rhs.mp_directive_set); + swap(mp_meta, rhs.mp_meta); node_value tmp {}; std::memcpy(&tmp, &m_node_value, sizeof(node_value)); @@ -9211,6 +9334,7 @@ class basic_node { swap(m_prop.tag, rhs.m_prop.tag); swap(m_prop.anchor_status, rhs.m_prop.anchor_status); swap(m_prop.anchor, rhs.m_prop.anchor); + swap(m_prop.anchor_offset, rhs.m_prop.anchor_offset); } /// @brief Returns the first iterator of basic_node values of container types (sequence or mapping) from a non-const @@ -9218,15 +9342,19 @@ class basic_node { /// @return An iterator to the first element of a YAML node value (either sequence or mapping). /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/begin/ iterator begin() { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return {detail::sequence_iterator_tag(), m_node_value.p_sequence->begin()}; - case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return {detail::mapping_iterator_tag(), m_node_value.p_mapping->begin()}; + switch (type()) { + case node_t::SEQUENCE: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return {detail::sequence_iterator_tag(), p_node_value->p_sequence->begin()}; + } + case node_t::MAPPING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return {detail::mapping_iterator_tag(), p_node_value->p_mapping->begin()}; + } default: - throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", m_node_type); + throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", type()); } } @@ -9235,15 +9363,19 @@ class basic_node { /// @return A constant iterator to the first element of a YAML node value (either sequence or mapping). /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/begin/ const_iterator begin() const { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return {detail::sequence_iterator_tag(), m_node_value.p_sequence->begin()}; - case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return {detail::mapping_iterator_tag(), m_node_value.p_mapping->begin()}; + switch (type()) { + case node_t::SEQUENCE: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return {detail::sequence_iterator_tag(), p_node_value->p_sequence->begin()}; + } + case node_t::MAPPING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return {detail::mapping_iterator_tag(), p_node_value->p_mapping->begin()}; + } default: - throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", m_node_type); + throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", type()); } } @@ -9252,15 +9384,19 @@ class basic_node { /// @return An iterator to the past-the end element of a YAML node value (either sequence or mapping). /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/end/ iterator end() { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return {detail::sequence_iterator_tag(), m_node_value.p_sequence->end()}; - case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return {detail::mapping_iterator_tag(), m_node_value.p_mapping->end()}; + switch (type()) { + case node_t::SEQUENCE: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return {detail::sequence_iterator_tag(), p_node_value->p_sequence->end()}; + } + case node_t::MAPPING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return {detail::mapping_iterator_tag(), p_node_value->p_mapping->end()}; + } default: - throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", m_node_type); + throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", type()); } } @@ -9269,25 +9405,40 @@ class basic_node { /// @return A constant iterator to the past-the end element of a YAML node value (either sequence or mapping). /// @sa https://fktn-k.github.io/fkYAML/api/basic_node/end/ const_iterator end() const { - switch (m_node_type) { - case node_t::SEQUENCE: - FK_YAML_ASSERT(m_node_value.p_sequence != nullptr); - return {detail::sequence_iterator_tag(), m_node_value.p_sequence->end()}; - case node_t::MAPPING: - FK_YAML_ASSERT(m_node_value.p_mapping != nullptr); - return {detail::mapping_iterator_tag(), m_node_value.p_mapping->end()}; + switch (type()) { + case node_t::SEQUENCE: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_sequence != nullptr); + return {detail::sequence_iterator_tag(), p_node_value->p_sequence->end()}; + } + case node_t::MAPPING: { + const node_value* p_node_value = get_node_value_ptr(); + FK_YAML_ASSERT(p_node_value->p_mapping != nullptr); + return {detail::mapping_iterator_tag(), p_node_value->p_mapping->end()}; + } default: - throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", m_node_type); + throw fkyaml::type_error("The target node is neither of sequence nor mapping types.", type()); } } 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. + const node_value* get_node_value_ptr() const { + if (has_anchor_name()) { + auto itr = mp_meta->anchor_table.equal_range(m_prop.anchor).first; + std::advance(itr, m_prop.anchor_offset); + return &(itr->second.m_node_value); + } + return &m_node_value; + } + /// @brief Returns reference to the sequence node value. /// @throw fkyaml::exception The node value is not a sequence. /// @return Reference to the sequence node value. sequence_type& get_value_ref_impl(sequence_type* /*unused*/) { if (!is_sequence()) { - throw fkyaml::type_error("The node value is not a sequence.", m_node_type); + throw fkyaml::type_error("The node value is not a sequence.", type()); } return *(m_node_value.p_sequence); } @@ -9297,7 +9448,7 @@ class basic_node { /// @return Constant reference to the sequence node value. const sequence_type& get_value_ref_impl(const sequence_type* /*unused*/) const { if (!is_sequence()) { - throw fkyaml::type_error("The node value is not a sequence.", m_node_type); + throw fkyaml::type_error("The node value is not a sequence.", type()); } return *(m_node_value.p_sequence); } @@ -9307,7 +9458,7 @@ class basic_node { /// @return Reference to the mapping node value. mapping_type& get_value_ref_impl(mapping_type* /*unused*/) { if (!is_mapping()) { - throw fkyaml::type_error("The node value is not a mapping.", m_node_type); + throw fkyaml::type_error("The node value is not a mapping.", type()); } return *(m_node_value.p_mapping); } @@ -9317,7 +9468,7 @@ class basic_node { /// @return Constant reference to the mapping node value. const mapping_type& get_value_ref_impl(const mapping_type* /*unused*/) const { if (!is_mapping()) { - throw fkyaml::type_error("The node value is not a mapping.", m_node_type); + throw fkyaml::type_error("The node value is not a mapping.", type()); } return *(m_node_value.p_mapping); } @@ -9327,7 +9478,7 @@ class basic_node { /// @return Reference to the boolean node value. boolean_type& get_value_ref_impl(boolean_type* /*unused*/) { if (!is_boolean()) { - throw fkyaml::type_error("The node value is not a boolean.", m_node_type); + throw fkyaml::type_error("The node value is not a boolean.", type()); } return m_node_value.boolean; } @@ -9337,7 +9488,7 @@ class basic_node { /// @return Constant reference to the boolean node value. const boolean_type& get_value_ref_impl(const boolean_type* /*unused*/) const { if (!is_boolean()) { - throw fkyaml::type_error("The node value is not a boolean.", m_node_type); + throw fkyaml::type_error("The node value is not a boolean.", type()); } return m_node_value.boolean; } @@ -9347,7 +9498,7 @@ class basic_node { /// @return Reference to the integer node value. integer_type& get_value_ref_impl(integer_type* /*unused*/) { if (!is_integer()) { - throw fkyaml::type_error("The node value is not an integer.", m_node_type); + throw fkyaml::type_error("The node value is not an integer.", type()); } return m_node_value.integer; } @@ -9357,7 +9508,7 @@ class basic_node { /// @return Constant reference to the integer node value. const integer_type& get_value_ref_impl(const integer_type* /*unused*/) const { if (!is_integer()) { - throw fkyaml::type_error("The node value is not an integer.", m_node_type); + throw fkyaml::type_error("The node value is not an integer.", type()); } return m_node_value.integer; } @@ -9367,7 +9518,7 @@ class basic_node { /// @return Reference to the floating point number node value. float_number_type& get_value_ref_impl(float_number_type* /*unused*/) { if (!is_float_number()) { - throw fkyaml::type_error("The node value is not a floating point number.", m_node_type); + throw fkyaml::type_error("The node value is not a floating point number.", type()); } return m_node_value.float_val; } @@ -9377,7 +9528,7 @@ class basic_node { /// @return Constant reference to the floating point number node value. const float_number_type& get_value_ref_impl(const float_number_type* /*unused*/) const { if (!is_float_number()) { - throw fkyaml::type_error("The node value is not a floating point number.", m_node_type); + throw fkyaml::type_error("The node value is not a floating point number.", type()); } return m_node_value.float_val; } @@ -9387,7 +9538,7 @@ class basic_node { /// @return Reference to the string node value. string_type& get_value_ref_impl(string_type* /*unused*/) { if (!is_string()) { - throw fkyaml::type_error("The node value is not a string.", m_node_type); + throw fkyaml::type_error("The node value is not a string.", type()); } return *(m_node_value.p_string); } @@ -9397,7 +9548,7 @@ class basic_node { /// @return Constant reference to the string node value. const string_type& get_value_ref_impl(const string_type* /*unused*/) const { if (!is_string()) { - throw fkyaml::type_error("The node value is not a string.", m_node_type); + throw fkyaml::type_error("The node value is not a string.", type()); } return *(m_node_value.p_string); } @@ -9405,7 +9556,8 @@ class basic_node { /// The current node value type. node_t m_node_type {node_t::NULL_OBJECT}; /// The shared set of YAML directives applied to this node. - mutable std::shared_ptr mp_directive_set {}; + mutable std::shared_ptr> mp_meta { + std::shared_ptr>(new detail::document_metainfo())}; /// The current node value. node_value m_node_value {}; /// The property set of this node. diff --git a/test/unit_test/test_node_class.cpp b/test/unit_test/test_node_class.cpp index 51fabf96..d1f4fb83 100644 --- a/test/unit_test/test_node_class.cpp +++ b/test/unit_test/test_node_class.cpp @@ -359,6 +359,17 @@ TEST_CASE("Node_InitializerListCtor") { REQUIRE(node[fkyaml::node {{"bar", nullptr}}]["baz"].get_value_ref() == "qux"); } +TEST_CASE("Node_CopyAssignmentOperator") { + fkyaml::node node(123); + fkyaml::node copied(true); + + node = copied; + REQUIRE(node.is_boolean()); + REQUIRE(node.get_value() == true); + REQUIRE(copied.is_boolean()); + REQUIRE(copied.get_value() == true); +} + // // test cases for serialization/deserialization features // @@ -2135,7 +2146,16 @@ TEST_CASE("Node_AddAnchorName") { REQUIRE(node.get_anchor_name().compare("anchor_name") == 0); } - SECTION("overwrite an existing anchor name") { + SECTION("overwrite an existing anchor name with lvalue anchor name") { + node.add_anchor_name(anchor_name); + std::string overwritten_name = "overwritten_name"; + node.add_anchor_name(overwritten_name); + REQUIRE_NOTHROW(node.get_anchor_name()); + REQUIRE_FALSE(node.get_anchor_name().compare("anchor_name") == 0); + REQUIRE(node.get_anchor_name().compare("overwritten_name") == 0); + } + + SECTION("overwrite an existing anchor name with rvalue anchor name") { node.add_anchor_name(anchor_name); node.add_anchor_name("overwritten_name"); REQUIRE_NOTHROW(node.get_anchor_name()); diff --git a/test/unit_test/test_tag_resolver_class.cpp b/test/unit_test/test_tag_resolver_class.cpp index cea9763d..9631ab16 100644 --- a/test/unit_test/test_tag_resolver_class.cpp +++ b/test/unit_test/test_tag_resolver_class.cpp @@ -14,7 +14,7 @@ TEST_CASE("TagResolver_ResolveTag") { using test_pair_t = std::pair; fkyaml::detail::tag_t tag_type {}; - std::shared_ptr directives {}; + std::shared_ptr> directives {}; SECTION("valid tag name with default tag handle prefixes") { auto test_pair = GENERATE( @@ -38,24 +38,28 @@ TEST_CASE("TagResolver_ResolveTag") { test_pair_t {"!!float", fkyaml::detail::tag_t::FLOATING_NUMBER}, test_pair_t {"!!str", fkyaml::detail::tag_t::STRING}); - REQUIRE_NOTHROW(tag_type = fkyaml::detail::tag_resolver::resolve_tag(test_pair.first, directives)); + REQUIRE_NOTHROW( + tag_type = fkyaml::detail::tag_resolver::resolve_tag(test_pair.first, directives)); REQUIRE(tag_type == test_pair.second); } SECTION("valid tag name with non-default primary handle prefix") { - directives = std::shared_ptr(new fkyaml::detail::directive_set()); + directives = std::shared_ptr>( + new fkyaml::detail::document_metainfo()); directives->primary_handle_prefix = "tag:example.com,2000:"; auto test_pair = GENERATE( test_pair_t {"!str", fkyaml::detail::tag_t::CUSTOM_TAG}, test_pair_t {"!", fkyaml::detail::tag_t::CUSTOM_TAG}); - REQUIRE_NOTHROW(tag_type = fkyaml::detail::tag_resolver::resolve_tag(test_pair.first, directives)); + REQUIRE_NOTHROW( + tag_type = fkyaml::detail::tag_resolver::resolve_tag(test_pair.first, directives)); REQUIRE(tag_type == test_pair.second); } SECTION("valid tag name with non-default secondary handle prefix") { - directives = std::shared_ptr(new fkyaml::detail::directive_set()); + directives = std::shared_ptr>( + new fkyaml::detail::document_metainfo()); directives->secondary_handle_prefix = "tag:example.com,2000"; auto test_pair = GENERATE( @@ -67,12 +71,14 @@ TEST_CASE("TagResolver_ResolveTag") { test_pair_t {"!!float", fkyaml::detail::tag_t::CUSTOM_TAG}, test_pair_t {"!!str", fkyaml::detail::tag_t::CUSTOM_TAG}); - REQUIRE_NOTHROW(tag_type = fkyaml::detail::tag_resolver::resolve_tag(test_pair.first, directives)); + REQUIRE_NOTHROW( + tag_type = fkyaml::detail::tag_resolver::resolve_tag(test_pair.first, directives)); REQUIRE(tag_type == test_pair.second); } SECTION("valid tag name with named handles") { - directives = std::shared_ptr(new fkyaml::detail::directive_set()); + directives = std::shared_ptr>( + new fkyaml::detail::document_metainfo()); directives->named_handle_map.emplace("!yaml!", "tag:yaml.org,2002:"); directives->named_handle_map.emplace("!test0!", "!test-"); @@ -86,22 +92,26 @@ TEST_CASE("TagResolver_ResolveTag") { test_pair_t {"!yaml!str", fkyaml::detail::tag_t::STRING}, test_pair_t {"!test0!foo", fkyaml::detail::tag_t::CUSTOM_TAG}); - REQUIRE_NOTHROW(tag_type = fkyaml::detail::tag_resolver::resolve_tag(test_pair.first, directives)); + REQUIRE_NOTHROW( + tag_type = fkyaml::detail::tag_resolver::resolve_tag(test_pair.first, directives)); REQUIRE(tag_type == test_pair.second); } - SECTION("invalid tag name with empty directive_set") { + SECTION("invalid tag name with empty document_metainfo") { auto tag = GENERATE(std::string(""), std::string("invalid"), std::string("!invalid!tag")); - REQUIRE_THROWS_AS(fkyaml::detail::tag_resolver::resolve_tag(tag, directives), fkyaml::invalid_tag); + REQUIRE_THROWS_AS( + fkyaml::detail::tag_resolver::resolve_tag(tag, directives), fkyaml::invalid_tag); } - SECTION("invalid tag name with non-empty directive_set") { - directives = std::shared_ptr(new fkyaml::detail::directive_set()); + SECTION("invalid tag name with non-empty document_metainfo") { + directives = std::shared_ptr>( + new fkyaml::detail::document_metainfo()); directives->named_handle_map.emplace("!valid!", "tag:example.com,2000"); auto tag = GENERATE(std::string("!invalid!tag")); - REQUIRE_THROWS_AS(fkyaml::detail::tag_resolver::resolve_tag(tag, directives), fkyaml::invalid_tag); + REQUIRE_THROWS_AS( + fkyaml::detail::tag_resolver::resolve_tag(tag, directives), fkyaml::invalid_tag); } } From dec1ee75a1b9eb132c3167d90acbb164ab310bd3 Mon Sep 17 00:00:00 2001 From: fktn Date: Tue, 14 May 2024 00:58:28 +0900 Subject: [PATCH 7/8] Run and apply the result of clang-format & amalagamation in GA workflows (#341) * run and apply the result of clang-format & amalagamation * make dummy change in the source for debugging * fixed ref param passed to the checkout action * applied the result of clang-format & amalgamation * use PAT in the format check workflow so another workflow will be initiated by the commit from inside the workflow * added an ill-formated line for debugging * applied the result of clang-format & amalgamation * renamed concurrency groups in the workflows * add an ill-formatted line for debugging * applied the result of clang-format & amalgamation * updated CONTRIBUTING.md on code formatting and amalgamation * changed the commit message in the format check workflow --- .github/workflows/amalgamation_check.yml | 36 ------------- .github/workflows/clang_format_check.yml | 46 ----------------- .github/workflows/coverage.yml | 2 + .github/workflows/format_check.yml | 65 ++++++++++++++++++++++++ .github/workflows/macos.yml | 2 +- .github/workflows/ubuntu.yml | 2 +- .github/workflows/windows.yml | 2 +- CONTRIBUTING.md | 21 ++++---- 8 files changed, 80 insertions(+), 96 deletions(-) delete mode 100644 .github/workflows/amalgamation_check.yml delete mode 100644 .github/workflows/clang_format_check.yml create mode 100644 .github/workflows/format_check.yml diff --git a/.github/workflows/amalgamation_check.yml b/.github/workflows/amalgamation_check.yml deleted file mode 100644 index 207f1eed..00000000 --- a/.github/workflows/amalgamation_check.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Amalgamation_Check - -on: - push: - branches: - - develop - - main - paths: - - .github/workflows/amalgamation_check.yml - - include/fkYAML/** - - single_include/fkYAML/** - - scripts/*_amalgamation.* - pull_request: - paths: - - .github/workflows/amalgamation_check.yml - - include/fkYAML/** - - single_include/fkYAML/** - - scripts/*_amalgamation.* - workflow_dispatch: - -concurrency: - group: ${{github.workflow}}-${{github.ref || github.run_id}} - cancel-in-progress: true - -jobs: - amalgamation-check: - runs-on: ubuntu-latest - permissions: - contents: read - timeout-minutes: 10 - - steps: - - uses: actions/checkout@v4 - - - name: Check if the amalgamated header file is up-to-date. - run: make check-amalgamate diff --git a/.github/workflows/clang_format_check.yml b/.github/workflows/clang_format_check.yml deleted file mode 100644 index 00e8c5c3..00000000 --- a/.github/workflows/clang_format_check.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Clang_Format_Check - -on: - push: - branches: - - develop - - main - paths: - - .github/workflows/clang_format_check.yml - - include/** - - test/unit_test/** - - .clang-format - - scripts/run_clang_format.* - pull_request: - paths: - - .github/workflows/clang_format_check.yml - - include/** - - test/unit_test/** - - .clang-format - - scripts/run_clang_format.* - workflow_dispatch: - -concurrency: - group: ${{github.workflow}}-${{github.ref || github.run_id}} - cancel-in-progress: true - -jobs: - format-check: - timeout-minutes: 10 - runs-on: ubuntu-latest - strategy: - matrix: - path: - - include/fkYAML - - test/unit_test - - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Run clang-format style check - uses: jidicula/clang-format-action@v4.11.0 - with: - clang-format-version: '14' - check-path: ${{matrix.path}} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1b44749b..32c98fd3 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -22,6 +22,8 @@ on: - Makefile workflow_dispatch: + + jobs: coverage: timeout-minutes: 10 diff --git a/.github/workflows/format_check.yml b/.github/workflows/format_check.yml new file mode 100644 index 00000000..ce3c47bb --- /dev/null +++ b/.github/workflows/format_check.yml @@ -0,0 +1,65 @@ +name: Format_Check + +on: + push: + branches: + - develop + - main + paths: + - .github/workflows/format_check.yml + - include/** + - scripts/** + - single_include/** + - test/** + - tool/amalgamation/** + - CMakeLists.txt + - .clang-format + pull_request: + paths: + - .github/workflows/format_check.yml + - include/** + - scripts/** + - single_include/** + - test/** + - tool/amalgamation/** + - CMakeLists.txt + - .clang-format + workflow_dispatch: + +concurrency: + group: ${{github.workflow}}-${{github.ref}} + cancel-in-progress: true + +jobs: + format-check: + timeout-minutes: 10 + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{github.head_ref}} + token: ${{secrets.FKYAML_FORMAT_CHECK_PAT}} + submodules: recursive + + - name: Run clang-format style check + run: ${{github.workspace}}/scripts/run_clang_format.sh + + - name: Run amalgamation check + run: ${{github.workspace}}/scripts/run_amalgamation.sh + + - name: Detect diffs caused by formatting scripts + id: format_diff + run: git diff --name-only --exit-code + + - name: Commit and push the diffs + if: failure() && steps.format_diff.outcome == 'failure' + run: | + set -x + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + git add . + git commit --author="$(git log --pretty=format:"%an <%ae>")" -m "[bot] run clang-format & amalgamation" + git push diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e86052e7..f141133f 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -23,7 +23,7 @@ on: workflow_dispatch: concurrency: - group: ${{github.workflow}}-${{github.ref || github.run_id}} + group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true jobs: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 03dc18a5..d4bccbe8 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -32,7 +32,7 @@ env: JOBS: 3 concurrency: - group: ${{github.workflow}}-${{github.ref || github.run_id}} + group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true jobs: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 252cad55..4a6e437b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -23,7 +23,7 @@ on: workflow_dispatch: concurrency: - group: ${{github.workflow}}-${{github.ref || github.run_id}} + group: ${{github.workflow}}-${{github.ref}} cancel-in-progress: true env: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c40a21a6..050817da 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,9 +27,9 @@ To make changes to the fkYAML project, you need to edit the following files: ### 1. [`include/fkYAML/**.hpp`](https://github.com/fktn-k/fkYAML/tree/develop/include/fkYAML) -These files are the sources of the fkYAML library. After making changes in those files, please run the script ([`run_amalgamation.bat`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.bat) for Windows, [`run_amalgamation.sh`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.sh) otherwise) to regenerate [`single_include/fkYAML/node.hpp`](https://github.com/fktn-k/fkYAML/tree/develop/single_include/fkYAML/node.hpp) at least before making a PR, with the following commands: +These files are the sources of the fkYAML library and **DO NOT** directly change the single header version under the [`single_include`](https://github.com/fktn-k/fkYAML/tree/develop/single_include/) directory. Alghough amalgamation is automatically executed in the GitHub Actions workflows, you can run the script ([`run_amalgamation.bat`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.bat) for Windows, [`run_amalgamation.sh`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.sh) otherwise) to regenerate [`single_include/fkYAML/node.hpp`](https://github.com/fktn-k/fkYAML/tree/develop/single_include/fkYAML/node.hpp) locally, which will save you from waiting unnecessarily long for the workflow results. -**Windows** +**Windows (Command Prompt)** ```batch cd path\to\fkYAML scripts\run_amalgamation.bat @@ -41,9 +41,9 @@ cd path/to/fkYAML scripts/run_amalgamation.sh ``` -If you just want to check if amalgamation is needed, run the script ([`run_amalgamation.bat`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.bat) for Windows, [`run_amalgamation.sh`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.sh) otherwise) with the following commands: +If you just want to check if amalgamation is needed locally, run the script ([`run_amalgamation.bat`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.bat) for Windows, [`run_amalgamation.sh`](https://github.com/fktn-k/fkYAML/scripts/run_amalgamation.sh) otherwise) with the following commands: -**Windows** +**Windows (Command Prompt)** ```batch cd path\to\fkYAML scripts\check_amalgamation.bat @@ -105,14 +105,13 @@ The commands above will automatically install all the dependencies using [Python ### 4. Format source files -[GitHub Actions](https://github.com/fktn-k/fkYAML/actions) will test the updated project with the [Clang-Format](https://releases.llvm.org/14.0.0/tools/clang/docs/ClangFormat.html) tool (14.0.0) when you push commits which include changes in the source files in either `include` or `test` directories. -So, it would be more efficient to check if your changes follow the rules defined in the [`.clang-format`](https://github.com/fktn-k/fkYAML/tree/develop/.clang-format) file on your local environment in advance. -Since the Clang-Format tool does not seem to gurantee backward compatibility and its behaviors vary from version to version, the script files ([`run_clang_format.bat`](https://github.com/fktn-k/fkYAML/scripts/run_clang_format.bat) for Windows, [`run_clang_format.sh`](https://github.com/fktn-k/fkYAML/scripts/run_clang_format.sh) otherwise) are available to avoid unnecessary confusion for that kind of reason. -The scripts uses [the Clang-Format Python distribution](https://pypi.org/project/clang-format/14.0.0/) and installs it using [the Python venv module](https://docs.python.org/3/library/venv.html) if it's not installed yet. -So, all you need to run the script is only Python 3.3 or better. -You can run it with the following commands: +[GitHub Actions](https://github.com/fktn-k/fkYAML/actions) will test the updated project with the [Clang-Format](https://releases.llvm.org/14.0.0/tools/clang/docs/ClangFormat.html) tool (14.0.0) once you open a PR or push commits afterwards which include changes in the source files under either [`include`](https://github.com/fktn-k/fkYAML/tree/develop/include) or [`test`](https://github.com/fktn-k/fkYAML/tree/develop/test) directories. +Although code formatting is automatically executed in the GitHub Actions workflows, you can run the script files ([`run_clang_format.bat`](https://github.com/fktn-k/fkYAML/scripts/run_clang_format.bat) for Windows, [`run_clang_format.sh`](https://github.com/fktn-k/fkYAML/scripts/run_clang_format.sh) otherwise) to check if your changes follow the rules defined in the [`.clang-format`](https://github.com/fktn-k/fkYAML/tree/develop/.clang-format) file on your local environment in advance. +Note that, since the Clang-Format tool does not gurantee backward compatibility especially in its edge cases and its behaviors might therefore vary from version to version, it's highly recommended that you use the above script files to avoid unnecessary confusion for that kind of reason. +The scripts uses [the Clang-Format Python distribution](https://pypi.org/project/clang-format/14.0.0/) and installs it using [the Python venv module](https://docs.python.org/3/library/venv.html) if it's not been installed yet. +You can run the scripts with the following commands: -**Windows** +**Windows (Command Prompt)** ```batch cd path\to\fkYAML scripts\run_clang_format.bat From 8eadaf84233d91e762bea636fff809d16083caa3 Mon Sep 17 00:00:00 2001 From: fktn Date: Fri, 17 May 2024 00:02:33 +0900 Subject: [PATCH 8/8] set version to 0.3.7 --- .reuse/templates/fkYAML.commented.jinja2 | 2 +- .reuse/templates/fkYAML_support.jinja2 | 2 +- CHANGELOG.md | 13 ++++ CMakeLists.txt | 2 +- Makefile | 2 +- .../ex_basic_node_add_anchor_name.cpp | 2 +- docs/examples/ex_basic_node_add_tag_name.cpp | 2 +- docs/examples/ex_basic_node_alias_of.cpp | 2 +- docs/examples/ex_basic_node_at_basic_node.cpp | 2 +- .../ex_basic_node_at_compatible_type.cpp | 2 +- docs/examples/ex_basic_node_begin.cpp | 2 +- docs/examples/ex_basic_node_boolean_type.cpp | 2 +- .../examples/ex_basic_node_const_iterator.cpp | 2 +- docs/examples/ex_basic_node_constructor_1.cpp | 2 +- docs/examples/ex_basic_node_constructor_2.cpp | 2 +- docs/examples/ex_basic_node_constructor_3.cpp | 2 +- docs/examples/ex_basic_node_constructor_4.cpp | 2 +- docs/examples/ex_basic_node_constructor_5.cpp | 2 +- docs/examples/ex_basic_node_constructor_6.cpp | 2 +- docs/examples/ex_basic_node_constructor_7.cpp | 2 +- docs/examples/ex_basic_node_contains.cpp | 2 +- ...ex_basic_node_copy_assignment_operator.cpp | 2 +- .../ex_basic_node_deserialize_char_array.cpp | 2 +- ...ex_basic_node_deserialize_file_pointer.cpp | 2 +- .../ex_basic_node_deserialize_iterators.cpp | 2 +- .../ex_basic_node_deserialize_string.cpp | 2 +- docs/examples/ex_basic_node_empty.cpp | 2 +- docs/examples/ex_basic_node_end.cpp | 2 +- .../ex_basic_node_extraction_operator.cpp | 2 +- .../ex_basic_node_float_number_type.cpp | 2 +- .../ex_basic_node_get_anchor_name.cpp | 2 +- docs/examples/ex_basic_node_get_tag_name.cpp | 2 +- docs/examples/ex_basic_node_get_value.cpp | 2 +- docs/examples/ex_basic_node_get_value_ref.cpp | 2 +- .../ex_basic_node_get_yaml_version.cpp | 2 +- .../ex_basic_node_has_anchor_name.cpp | 2 +- docs/examples/ex_basic_node_has_tag_name.cpp | 2 +- .../ex_basic_node_insertion_operator.cpp | 2 +- docs/examples/ex_basic_node_integer_type.cpp | 2 +- docs/examples/ex_basic_node_is_alias.cpp | 2 +- docs/examples/ex_basic_node_is_anchor.cpp | 2 +- docs/examples/ex_basic_node_is_boolean.cpp | 2 +- .../ex_basic_node_is_float_number.cpp | 2 +- docs/examples/ex_basic_node_is_integer.cpp | 2 +- docs/examples/ex_basic_node_is_mapping.cpp | 2 +- docs/examples/ex_basic_node_is_null.cpp | 2 +- docs/examples/ex_basic_node_is_scalar.cpp | 2 +- docs/examples/ex_basic_node_is_sequence.cpp | 2 +- docs/examples/ex_basic_node_is_string.cpp | 2 +- docs/examples/ex_basic_node_iterator.cpp | 2 +- docs/examples/ex_basic_node_mapping.cpp | 2 +- docs/examples/ex_basic_node_mapping_type.cpp | 2 +- docs/examples/ex_basic_node_node.cpp | 2 +- docs/examples/ex_basic_node_node_t.cpp | 2 +- docs/examples/ex_basic_node_operator_eq.cpp | 2 +- docs/examples/ex_basic_node_operator_ge.cpp | 2 +- docs/examples/ex_basic_node_operator_gt.cpp | 2 +- docs/examples/ex_basic_node_operator_le.cpp | 2 +- docs/examples/ex_basic_node_operator_lt.cpp | 2 +- docs/examples/ex_basic_node_operator_ne.cpp | 2 +- docs/examples/ex_basic_node_sequence.cpp | 2 +- docs/examples/ex_basic_node_sequence_type.cpp | 2 +- docs/examples/ex_basic_node_serialize.cpp | 2 +- .../ex_basic_node_set_yaml_version.cpp | 2 +- docs/examples/ex_basic_node_size.cpp | 2 +- docs/examples/ex_basic_node_string_type.cpp | 2 +- ...sic_node_subscript_operator_basic_node.cpp | 2 +- ...ode_subscript_operator_compatible_type.cpp | 2 +- docs/examples/ex_basic_node_swap_member.cpp | 2 +- docs/examples/ex_basic_node_swap_std.cpp | 2 +- docs/examples/ex_basic_node_type.cpp | 2 +- .../ex_basic_node_value_converter_type.cpp | 2 +- .../examples/ex_basic_node_yaml_version_t.cpp | 2 +- .../examples/ex_exception_constructor_msg.cpp | 2 +- .../ex_exception_constructor_noarg.cpp | 2 +- docs/examples/ex_exception_what.cpp | 2 +- docs/examples/ex_macros_versions.cpp | 2 +- docs/examples/ex_macros_versions.output | 2 +- .../ex_node_value_converter_from_node.cpp | 2 +- .../ex_node_value_converter_to_node.cpp | 2 +- docs/examples/ex_operator_literal_yaml.cpp | 2 +- docs/examples/ex_ordered_map_at.cpp | 2 +- ...dered_map_constructor_initializer_list.cpp | 2 +- .../ex_ordered_map_constructor_noarg.cpp | 2 +- docs/examples/ex_ordered_map_emplace.cpp | 2 +- docs/examples/ex_ordered_map_find.cpp | 2 +- .../ex_ordered_map_subscript_operator.cpp | 2 +- docs/examples/tutorial_1.cpp | 2 +- docs/examples/tutorial_2.cpp | 2 +- docs/examples/tutorial_3.cpp | 2 +- docs/examples/tutorial_4.cpp | 2 +- docs/mkdocs/docs/home/releases.md | 41 ++++++++++ .../docs/tutorials/cmake_integration.md | 2 +- fkYAML.natvis | 24 +++--- include/fkYAML/detail/assert.hpp | 2 +- .../fkYAML/detail/conversions/from_node.hpp | 2 +- .../fkYAML/detail/conversions/from_string.hpp | 2 +- include/fkYAML/detail/conversions/to_node.hpp | 2 +- .../fkYAML/detail/conversions/to_string.hpp | 2 +- include/fkYAML/detail/document_metainfo.hpp | 2 +- .../detail/encodings/encode_detector.hpp | 2 +- .../fkYAML/detail/encodings/uri_encoding.hpp | 2 +- .../fkYAML/detail/encodings/utf_encode_t.hpp | 2 +- .../fkYAML/detail/encodings/utf_encodings.hpp | 2 +- .../fkYAML/detail/encodings/yaml_escaper.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 +- .../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/version_macros.hpp | 6 +- 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_property.hpp | 2 +- include/fkYAML/detail/node_ref_storage.hpp | 2 +- include/fkYAML/detail/output/serializer.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/node.hpp | 2 +- include/fkYAML/node_value_converter.hpp | 2 +- include/fkYAML/ordered_map.hpp | 2 +- single_include/fkYAML/node.hpp | 78 +++++++++---------- .../project/main.cpp | 2 +- .../project/CMakeLists.txt | 2 +- .../cmake_fetch_content_test/project/main.cpp | 2 +- test/cmake_find_package_test/project/main.cpp | 2 +- .../project/main.cpp | 2 +- test/unit_test/main.cpp | 2 +- test/unit_test/test_custom_from_node.cpp | 2 +- test/unit_test/test_deserializer_class.cpp | 2 +- test/unit_test/test_encode_detector.cpp | 2 +- test/unit_test/test_exception_class.cpp | 2 +- test/unit_test/test_from_string.cpp | 2 +- test/unit_test/test_input_adapter.cpp | 2 +- test/unit_test/test_iterator_class.cpp | 2 +- .../unit_test/test_lexical_analyzer_class.cpp | 2 +- test/unit_test/test_node_class.cpp | 2 +- .../unit_test/test_node_ref_storage_class.cpp | 2 +- test/unit_test/test_ordered_map_class.cpp | 2 +- .../unit_test/test_position_tracker_class.cpp | 2 +- test/unit_test/test_scalar_scanner_class.cpp | 2 +- test/unit_test/test_serializer_class.cpp | 2 +- test/unit_test/test_string_formatter.cpp | 2 +- test/unit_test/test_tag_resolver_class.cpp | 2 +- test/unit_test/test_uri_encoding_class.cpp | 2 +- test/unit_test/test_utf_encodings.cpp | 2 +- test/unit_test/test_yaml_escaper_class.cpp | 2 +- tool/natvis_generator/params.json | 2 +- 158 files changed, 261 insertions(+), 207 deletions(-) diff --git a/.reuse/templates/fkYAML.commented.jinja2 b/.reuse/templates/fkYAML.commented.jinja2 index d9d2b7ce..cca488a7 100644 --- a/.reuse/templates/fkYAML.commented.jinja2 +++ b/.reuse/templates/fkYAML.commented.jinja2 @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| 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 2231b73c..4a249846 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.3.6 +| __| _ < \_ _/| ___ | _ | |___ version 0.3.7 |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML {% for copyright_line in copyright_lines %} diff --git a/CHANGELOG.md b/CHANGELOG.md index f3c02234..264b5cdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [v0.3.7](https://github.com/fktn-k/fkYAML/releases/tag/v0.3.7) (2024-05-16) + +[Full Changelog](https://github.com/fktn-k/fkYAML/compare/v0.3.6...v0.3.7) + +- Fixed error on node properties for child block sequences [\#338](https://github.com/fktn-k/fkYAML/pull/338) ([fktn-k](https://github.com/fktn-k)) +- Escape backslash\(\\) + 0x09 to a horizontal tab \(\t\) [\#336](https://github.com/fktn-k/fkYAML/pull/336) ([fktn-k](https://github.com/fktn-k)) +- Fix false error on anchor names containing colons \(:\) [\#335](https://github.com/fktn-k/fkYAML/pull/335) ([fktn-k](https://github.com/fktn-k)) + +- Run and apply the result of clang-format & amalagamation in GA workflows [\#341](https://github.com/fktn-k/fkYAML/pull/341) ([fktn-k](https://github.com/fktn-k)) +- Improve anchor alias node management [\#340](https://github.com/fktn-k/fkYAML/pull/340) ([fktn-k](https://github.com/fktn-k)) +- Fix the C6262 warning on Windows [\#339](https://github.com/fktn-k/fkYAML/pull/339) ([fktn-k](https://github.com/fktn-k)) +- Separate YAML escaping/unescaping functionalities [\#337](https://github.com/fktn-k/fkYAML/pull/337) ([fktn-k](https://github.com/fktn-k)) + ## [v0.3.6](https://github.com/fktn-k/fkYAML/releases/tag/v0.3.6) (2024-05-02) [Full Changelog](https://github.com/fktn-k/fkYAML/compare/v0.3.5...v0.3.6) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9026f3f..eb7c0ba9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.8) project( fkYAML - VERSION 0.3.6 + VERSION 0.3.7 LANGUAGES CXX) ############################################################# diff --git a/Makefile b/Makefile index c4f29de2..a9c556cd 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ EXAMPLE_SRCS = $(shell find docs/examples -type f -name '*.cpp' | sort) # target version definition TARGET_MAJOR_VERSION := 0 TARGET_MINOR_VERSION := 3 -TARGET_PATCH_VERSION := 6 +TARGET_PATCH_VERSION := 7 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/examples/ex_basic_node_add_anchor_name.cpp b/docs/examples/ex_basic_node_add_anchor_name.cpp index 9f869513..302a3905 100644 --- a/docs/examples/ex_basic_node_add_anchor_name.cpp +++ b/docs/examples/ex_basic_node_add_anchor_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_add_tag_name.cpp b/docs/examples/ex_basic_node_add_tag_name.cpp index 05f05b15..c1990b05 100644 --- a/docs/examples/ex_basic_node_add_tag_name.cpp +++ b/docs/examples/ex_basic_node_add_tag_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_alias_of.cpp b/docs/examples/ex_basic_node_alias_of.cpp index 19d7b362..85d17618 100644 --- a/docs/examples/ex_basic_node_alias_of.cpp +++ b/docs/examples/ex_basic_node_alias_of.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_at_basic_node.cpp b/docs/examples/ex_basic_node_at_basic_node.cpp index f0b51d20..a40df504 100644 --- a/docs/examples/ex_basic_node_at_basic_node.cpp +++ b/docs/examples/ex_basic_node_at_basic_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_at_compatible_type.cpp b/docs/examples/ex_basic_node_at_compatible_type.cpp index 3d3757dc..1e1d43b3 100644 --- a/docs/examples/ex_basic_node_at_compatible_type.cpp +++ b/docs/examples/ex_basic_node_at_compatible_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_begin.cpp b/docs/examples/ex_basic_node_begin.cpp index 3f21d76e..5cf412b9 100644 --- a/docs/examples/ex_basic_node_begin.cpp +++ b/docs/examples/ex_basic_node_begin.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_boolean_type.cpp b/docs/examples/ex_basic_node_boolean_type.cpp index 8b0d7c0e..6abe6d32 100644 --- a/docs/examples/ex_basic_node_boolean_type.cpp +++ b/docs/examples/ex_basic_node_boolean_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_const_iterator.cpp b/docs/examples/ex_basic_node_const_iterator.cpp index 195023ad..6f27612f 100644 --- a/docs/examples/ex_basic_node_const_iterator.cpp +++ b/docs/examples/ex_basic_node_const_iterator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_1.cpp b/docs/examples/ex_basic_node_constructor_1.cpp index 911a4843..09b54909 100644 --- a/docs/examples/ex_basic_node_constructor_1.cpp +++ b/docs/examples/ex_basic_node_constructor_1.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_2.cpp b/docs/examples/ex_basic_node_constructor_2.cpp index 1d867479..dcb065b6 100644 --- a/docs/examples/ex_basic_node_constructor_2.cpp +++ b/docs/examples/ex_basic_node_constructor_2.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_3.cpp b/docs/examples/ex_basic_node_constructor_3.cpp index 096162b5..72910bb9 100644 --- a/docs/examples/ex_basic_node_constructor_3.cpp +++ b/docs/examples/ex_basic_node_constructor_3.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_4.cpp b/docs/examples/ex_basic_node_constructor_4.cpp index 096162b5..72910bb9 100644 --- a/docs/examples/ex_basic_node_constructor_4.cpp +++ b/docs/examples/ex_basic_node_constructor_4.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_5.cpp b/docs/examples/ex_basic_node_constructor_5.cpp index e2e3ae13..2038c27d 100644 --- a/docs/examples/ex_basic_node_constructor_5.cpp +++ b/docs/examples/ex_basic_node_constructor_5.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_6.cpp b/docs/examples/ex_basic_node_constructor_6.cpp index 7d20efcc..7fc37827 100644 --- a/docs/examples/ex_basic_node_constructor_6.cpp +++ b/docs/examples/ex_basic_node_constructor_6.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_7.cpp b/docs/examples/ex_basic_node_constructor_7.cpp index 90524c88..9a42a8d2 100644 --- a/docs/examples/ex_basic_node_constructor_7.cpp +++ b/docs/examples/ex_basic_node_constructor_7.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_contains.cpp b/docs/examples/ex_basic_node_contains.cpp index ce6cda9b..965d8c1b 100644 --- a/docs/examples/ex_basic_node_contains.cpp +++ b/docs/examples/ex_basic_node_contains.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_copy_assignment_operator.cpp b/docs/examples/ex_basic_node_copy_assignment_operator.cpp index 8a4f88a3..9809a856 100644 --- a/docs/examples/ex_basic_node_copy_assignment_operator.cpp +++ b/docs/examples/ex_basic_node_copy_assignment_operator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_deserialize_char_array.cpp b/docs/examples/ex_basic_node_deserialize_char_array.cpp index a0c2d4eb..e0530834 100644 --- a/docs/examples/ex_basic_node_deserialize_char_array.cpp +++ b/docs/examples/ex_basic_node_deserialize_char_array.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_deserialize_file_pointer.cpp b/docs/examples/ex_basic_node_deserialize_file_pointer.cpp index b9bc1743..d4c8851b 100644 --- a/docs/examples/ex_basic_node_deserialize_file_pointer.cpp +++ b/docs/examples/ex_basic_node_deserialize_file_pointer.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_deserialize_iterators.cpp b/docs/examples/ex_basic_node_deserialize_iterators.cpp index fc6b492c..4167df78 100644 --- a/docs/examples/ex_basic_node_deserialize_iterators.cpp +++ b/docs/examples/ex_basic_node_deserialize_iterators.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_deserialize_string.cpp b/docs/examples/ex_basic_node_deserialize_string.cpp index 100dd4d6..ec7979a6 100644 --- a/docs/examples/ex_basic_node_deserialize_string.cpp +++ b/docs/examples/ex_basic_node_deserialize_string.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_empty.cpp b/docs/examples/ex_basic_node_empty.cpp index e50097f6..342ca2a0 100644 --- a/docs/examples/ex_basic_node_empty.cpp +++ b/docs/examples/ex_basic_node_empty.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_end.cpp b/docs/examples/ex_basic_node_end.cpp index d5d40f79..4a1fa9ce 100644 --- a/docs/examples/ex_basic_node_end.cpp +++ b/docs/examples/ex_basic_node_end.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_extraction_operator.cpp b/docs/examples/ex_basic_node_extraction_operator.cpp index 7f62dd04..86dc859d 100644 --- a/docs/examples/ex_basic_node_extraction_operator.cpp +++ b/docs/examples/ex_basic_node_extraction_operator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_float_number_type.cpp b/docs/examples/ex_basic_node_float_number_type.cpp index 92a7874d..acdeb1d7 100644 --- a/docs/examples/ex_basic_node_float_number_type.cpp +++ b/docs/examples/ex_basic_node_float_number_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_get_anchor_name.cpp b/docs/examples/ex_basic_node_get_anchor_name.cpp index f26666b7..de649dc5 100644 --- a/docs/examples/ex_basic_node_get_anchor_name.cpp +++ b/docs/examples/ex_basic_node_get_anchor_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_get_tag_name.cpp b/docs/examples/ex_basic_node_get_tag_name.cpp index 9ebcf2de..d234a094 100644 --- a/docs/examples/ex_basic_node_get_tag_name.cpp +++ b/docs/examples/ex_basic_node_get_tag_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_get_value.cpp b/docs/examples/ex_basic_node_get_value.cpp index 61e23828..b9072008 100644 --- a/docs/examples/ex_basic_node_get_value.cpp +++ b/docs/examples/ex_basic_node_get_value.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_get_value_ref.cpp b/docs/examples/ex_basic_node_get_value_ref.cpp index 5c20f9ad..0e1d26c5 100644 --- a/docs/examples/ex_basic_node_get_value_ref.cpp +++ b/docs/examples/ex_basic_node_get_value_ref.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_get_yaml_version.cpp b/docs/examples/ex_basic_node_get_yaml_version.cpp index c55be144..10e0bcfd 100644 --- a/docs/examples/ex_basic_node_get_yaml_version.cpp +++ b/docs/examples/ex_basic_node_get_yaml_version.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_has_anchor_name.cpp b/docs/examples/ex_basic_node_has_anchor_name.cpp index e4a809bf..54176a8d 100644 --- a/docs/examples/ex_basic_node_has_anchor_name.cpp +++ b/docs/examples/ex_basic_node_has_anchor_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_has_tag_name.cpp b/docs/examples/ex_basic_node_has_tag_name.cpp index aedc035b..48367af5 100644 --- a/docs/examples/ex_basic_node_has_tag_name.cpp +++ b/docs/examples/ex_basic_node_has_tag_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_insertion_operator.cpp b/docs/examples/ex_basic_node_insertion_operator.cpp index 99680f97..673240d1 100644 --- a/docs/examples/ex_basic_node_insertion_operator.cpp +++ b/docs/examples/ex_basic_node_insertion_operator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_integer_type.cpp b/docs/examples/ex_basic_node_integer_type.cpp index 656dea15..03cf653b 100644 --- a/docs/examples/ex_basic_node_integer_type.cpp +++ b/docs/examples/ex_basic_node_integer_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_alias.cpp b/docs/examples/ex_basic_node_is_alias.cpp index 4db9efcd..633ce446 100644 --- a/docs/examples/ex_basic_node_is_alias.cpp +++ b/docs/examples/ex_basic_node_is_alias.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_anchor.cpp b/docs/examples/ex_basic_node_is_anchor.cpp index 4567ccd4..3f5ada47 100644 --- a/docs/examples/ex_basic_node_is_anchor.cpp +++ b/docs/examples/ex_basic_node_is_anchor.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_boolean.cpp b/docs/examples/ex_basic_node_is_boolean.cpp index dbac84cf..116b0cc3 100644 --- a/docs/examples/ex_basic_node_is_boolean.cpp +++ b/docs/examples/ex_basic_node_is_boolean.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_float_number.cpp b/docs/examples/ex_basic_node_is_float_number.cpp index 484ade7c..b4b5bbf9 100644 --- a/docs/examples/ex_basic_node_is_float_number.cpp +++ b/docs/examples/ex_basic_node_is_float_number.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_integer.cpp b/docs/examples/ex_basic_node_is_integer.cpp index 1b43dd9b..8ab49203 100644 --- a/docs/examples/ex_basic_node_is_integer.cpp +++ b/docs/examples/ex_basic_node_is_integer.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_mapping.cpp b/docs/examples/ex_basic_node_is_mapping.cpp index 4011bad6..54ac01d3 100644 --- a/docs/examples/ex_basic_node_is_mapping.cpp +++ b/docs/examples/ex_basic_node_is_mapping.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_null.cpp b/docs/examples/ex_basic_node_is_null.cpp index 8f203485..9d678b21 100644 --- a/docs/examples/ex_basic_node_is_null.cpp +++ b/docs/examples/ex_basic_node_is_null.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_scalar.cpp b/docs/examples/ex_basic_node_is_scalar.cpp index dfe77c26..2254beea 100644 --- a/docs/examples/ex_basic_node_is_scalar.cpp +++ b/docs/examples/ex_basic_node_is_scalar.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_sequence.cpp b/docs/examples/ex_basic_node_is_sequence.cpp index b75c48f8..e15b8e37 100644 --- a/docs/examples/ex_basic_node_is_sequence.cpp +++ b/docs/examples/ex_basic_node_is_sequence.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_string.cpp b/docs/examples/ex_basic_node_is_string.cpp index 87c84c92..10a72c14 100644 --- a/docs/examples/ex_basic_node_is_string.cpp +++ b/docs/examples/ex_basic_node_is_string.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_iterator.cpp b/docs/examples/ex_basic_node_iterator.cpp index f63802b0..ee3f6662 100644 --- a/docs/examples/ex_basic_node_iterator.cpp +++ b/docs/examples/ex_basic_node_iterator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_mapping.cpp b/docs/examples/ex_basic_node_mapping.cpp index e72952bb..f6145c5e 100644 --- a/docs/examples/ex_basic_node_mapping.cpp +++ b/docs/examples/ex_basic_node_mapping.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_mapping_type.cpp b/docs/examples/ex_basic_node_mapping_type.cpp index 7b6868f9..a8a3a305 100644 --- a/docs/examples/ex_basic_node_mapping_type.cpp +++ b/docs/examples/ex_basic_node_mapping_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_node.cpp b/docs/examples/ex_basic_node_node.cpp index 0891be84..12d2fa3d 100644 --- a/docs/examples/ex_basic_node_node.cpp +++ b/docs/examples/ex_basic_node_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_node_t.cpp b/docs/examples/ex_basic_node_node_t.cpp index fad3c8d4..fe1d1fbe 100644 --- a/docs/examples/ex_basic_node_node_t.cpp +++ b/docs/examples/ex_basic_node_node_t.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_eq.cpp b/docs/examples/ex_basic_node_operator_eq.cpp index 321d3843..721a0f26 100644 --- a/docs/examples/ex_basic_node_operator_eq.cpp +++ b/docs/examples/ex_basic_node_operator_eq.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_ge.cpp b/docs/examples/ex_basic_node_operator_ge.cpp index 6fea0b6f..170a603b 100644 --- a/docs/examples/ex_basic_node_operator_ge.cpp +++ b/docs/examples/ex_basic_node_operator_ge.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_gt.cpp b/docs/examples/ex_basic_node_operator_gt.cpp index cc956506..ea51a6b4 100644 --- a/docs/examples/ex_basic_node_operator_gt.cpp +++ b/docs/examples/ex_basic_node_operator_gt.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_le.cpp b/docs/examples/ex_basic_node_operator_le.cpp index f33e9b34..3b11d2c3 100644 --- a/docs/examples/ex_basic_node_operator_le.cpp +++ b/docs/examples/ex_basic_node_operator_le.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_lt.cpp b/docs/examples/ex_basic_node_operator_lt.cpp index 7793f572..f817d0c3 100644 --- a/docs/examples/ex_basic_node_operator_lt.cpp +++ b/docs/examples/ex_basic_node_operator_lt.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_ne.cpp b/docs/examples/ex_basic_node_operator_ne.cpp index b533d960..319610af 100644 --- a/docs/examples/ex_basic_node_operator_ne.cpp +++ b/docs/examples/ex_basic_node_operator_ne.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_sequence.cpp b/docs/examples/ex_basic_node_sequence.cpp index c68de4fa..e7acf229 100644 --- a/docs/examples/ex_basic_node_sequence.cpp +++ b/docs/examples/ex_basic_node_sequence.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_sequence_type.cpp b/docs/examples/ex_basic_node_sequence_type.cpp index 380ab949..e8442b55 100644 --- a/docs/examples/ex_basic_node_sequence_type.cpp +++ b/docs/examples/ex_basic_node_sequence_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_serialize.cpp b/docs/examples/ex_basic_node_serialize.cpp index e720234a..e5566f98 100644 --- a/docs/examples/ex_basic_node_serialize.cpp +++ b/docs/examples/ex_basic_node_serialize.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_set_yaml_version.cpp b/docs/examples/ex_basic_node_set_yaml_version.cpp index 98929195..ea7ab514 100644 --- a/docs/examples/ex_basic_node_set_yaml_version.cpp +++ b/docs/examples/ex_basic_node_set_yaml_version.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_size.cpp b/docs/examples/ex_basic_node_size.cpp index a4e0a577..1585c211 100644 --- a/docs/examples/ex_basic_node_size.cpp +++ b/docs/examples/ex_basic_node_size.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_string_type.cpp b/docs/examples/ex_basic_node_string_type.cpp index 60eb8825..510d7a49 100644 --- a/docs/examples/ex_basic_node_string_type.cpp +++ b/docs/examples/ex_basic_node_string_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_subscript_operator_basic_node.cpp b/docs/examples/ex_basic_node_subscript_operator_basic_node.cpp index 63861002..c34b5db3 100644 --- a/docs/examples/ex_basic_node_subscript_operator_basic_node.cpp +++ b/docs/examples/ex_basic_node_subscript_operator_basic_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp b/docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp index 71d4ce24..cb2354c7 100644 --- a/docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp +++ b/docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_swap_member.cpp b/docs/examples/ex_basic_node_swap_member.cpp index 431917c8..9baf643a 100644 --- a/docs/examples/ex_basic_node_swap_member.cpp +++ b/docs/examples/ex_basic_node_swap_member.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_swap_std.cpp b/docs/examples/ex_basic_node_swap_std.cpp index f02c8fe2..685bea24 100644 --- a/docs/examples/ex_basic_node_swap_std.cpp +++ b/docs/examples/ex_basic_node_swap_std.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_type.cpp b/docs/examples/ex_basic_node_type.cpp index fad3c8d4..fe1d1fbe 100644 --- a/docs/examples/ex_basic_node_type.cpp +++ b/docs/examples/ex_basic_node_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_value_converter_type.cpp b/docs/examples/ex_basic_node_value_converter_type.cpp index 07b4fbda..5d9cd394 100644 --- a/docs/examples/ex_basic_node_value_converter_type.cpp +++ b/docs/examples/ex_basic_node_value_converter_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_yaml_version_t.cpp b/docs/examples/ex_basic_node_yaml_version_t.cpp index c1adaf1e..e2d9c130 100644 --- a/docs/examples/ex_basic_node_yaml_version_t.cpp +++ b/docs/examples/ex_basic_node_yaml_version_t.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_exception_constructor_msg.cpp b/docs/examples/ex_exception_constructor_msg.cpp index ac528940..205e64fb 100644 --- a/docs/examples/ex_exception_constructor_msg.cpp +++ b/docs/examples/ex_exception_constructor_msg.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_exception_constructor_noarg.cpp b/docs/examples/ex_exception_constructor_noarg.cpp index 4c0783cf..e521aaf4 100644 --- a/docs/examples/ex_exception_constructor_noarg.cpp +++ b/docs/examples/ex_exception_constructor_noarg.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_exception_what.cpp b/docs/examples/ex_exception_what.cpp index b9f98c11..242644e2 100644 --- a/docs/examples/ex_exception_what.cpp +++ b/docs/examples/ex_exception_what.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_macros_versions.cpp b/docs/examples/ex_macros_versions.cpp index 812740ec..97812f53 100644 --- a/docs/examples/ex_macros_versions.cpp +++ b/docs/examples/ex_macros_versions.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_macros_versions.output b/docs/examples/ex_macros_versions.output index e7a1b090..172d95b2 100644 --- a/docs/examples/ex_macros_versions.output +++ b/docs/examples/ex_macros_versions.output @@ -1 +1 @@ -fkYAML version 0.3.6 +fkYAML version 0.3.7 diff --git a/docs/examples/ex_node_value_converter_from_node.cpp b/docs/examples/ex_node_value_converter_from_node.cpp index 94f40269..6ad0b9ae 100644 --- a/docs/examples/ex_node_value_converter_from_node.cpp +++ b/docs/examples/ex_node_value_converter_from_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_node_value_converter_to_node.cpp b/docs/examples/ex_node_value_converter_to_node.cpp index 8f5452eb..7d4c98df 100644 --- a/docs/examples/ex_node_value_converter_to_node.cpp +++ b/docs/examples/ex_node_value_converter_to_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_operator_literal_yaml.cpp b/docs/examples/ex_operator_literal_yaml.cpp index 00e26769..0a5d203b 100644 --- a/docs/examples/ex_operator_literal_yaml.cpp +++ b/docs/examples/ex_operator_literal_yaml.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_at.cpp b/docs/examples/ex_ordered_map_at.cpp index eb215b5b..6b48c6cc 100644 --- a/docs/examples/ex_ordered_map_at.cpp +++ b/docs/examples/ex_ordered_map_at.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_constructor_initializer_list.cpp b/docs/examples/ex_ordered_map_constructor_initializer_list.cpp index 6e631c40..20ac4a9d 100644 --- a/docs/examples/ex_ordered_map_constructor_initializer_list.cpp +++ b/docs/examples/ex_ordered_map_constructor_initializer_list.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_constructor_noarg.cpp b/docs/examples/ex_ordered_map_constructor_noarg.cpp index 629788cf..c01334b9 100644 --- a/docs/examples/ex_ordered_map_constructor_noarg.cpp +++ b/docs/examples/ex_ordered_map_constructor_noarg.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_emplace.cpp b/docs/examples/ex_ordered_map_emplace.cpp index c7f5fc05..e2efcfde 100644 --- a/docs/examples/ex_ordered_map_emplace.cpp +++ b/docs/examples/ex_ordered_map_emplace.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_find.cpp b/docs/examples/ex_ordered_map_find.cpp index 2cfe10f3..6fbe1454 100644 --- a/docs/examples/ex_ordered_map_find.cpp +++ b/docs/examples/ex_ordered_map_find.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_subscript_operator.cpp b/docs/examples/ex_ordered_map_subscript_operator.cpp index e32f95f4..82ad78be 100644 --- a/docs/examples/ex_ordered_map_subscript_operator.cpp +++ b/docs/examples/ex_ordered_map_subscript_operator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/tutorial_1.cpp b/docs/examples/tutorial_1.cpp index 32073652..0315364a 100644 --- a/docs/examples/tutorial_1.cpp +++ b/docs/examples/tutorial_1.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/tutorial_2.cpp b/docs/examples/tutorial_2.cpp index 5eb15a43..a08dca10 100644 --- a/docs/examples/tutorial_2.cpp +++ b/docs/examples/tutorial_2.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/tutorial_3.cpp b/docs/examples/tutorial_3.cpp index 3000f14f..b662921a 100644 --- a/docs/examples/tutorial_3.cpp +++ b/docs/examples/tutorial_3.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/tutorial_4.cpp b/docs/examples/tutorial_4.cpp index c852d0b3..aaad6f61 100644 --- a/docs/examples/tutorial_4.cpp +++ b/docs/examples/tutorial_4.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/mkdocs/docs/home/releases.md b/docs/mkdocs/docs/home/releases.md index fc876a6c..5291a3ee 100644 --- a/docs/mkdocs/docs/home/releases.md +++ b/docs/mkdocs/docs/home/releases.md @@ -1,5 +1,46 @@ # Releases +## **fkYAML version 0.3.7** + +!!! abstract "Release Packages" + + * [fkYAML.zip](https://github.com/fktn-k/fkYAML/releases/download/v0.3.7/fkYAML.zip) + * [fkYAML.tgz](https://github.com/fktn-k/fkYAML/releases/download/v0.3.7/fkYAML.tgz) + * [fkYAML_single_header.zip](https://github.com/fktn-k/fkYAML/releases/download/v0.3.7/fkYAML_single_header.zip) + * [fkYAML_single_header.tgz](https://github.com/fktn-k/fkYAML/releases/download/v0.3.7/fkYAML_single_header.tgz) + * [node.hpp](https://github.com/fktn-k/fkYAML/releases/download/v0.3.7/node.hpp) (single header) + +### Summary + +This release includes refactoring of YAML escaping and improvement of the way of managing anchor/alias nodes. +Furthermore, several bugs found in the deserializer are resolved. + +For contributors, the results of executing clang-format and amalgamation in the GitHub Actions workflows are now automatically applied to the source files. +You can, of course, still run those tools locally but that's not required from this release on. +For more details, see the CONTRIBUTING.md file. + +### What's Changed + +#### :zap: Improvements + +- Separate YAML escaping/unescaping functionalities by [@fktn-k](https://github.com/fktn-k) in [\#337](https://github.com/fktn-k/fkYAML/pull/337) +- Improve anchor alias node management by [@fktn-k](https://github.com/fktn-k) in [\#340](https://github.com/fktn-k/fkYAML/pull/340) + +#### :bug: Bug Fixes + +- Fix false error on anchor names containing colons \(:\) by [@fktn-k](https://github.com/fktn-k) in [\#335](https://github.com/fktn-k/fkYAML/pull/335) +- Escape backslash\(\\) + 0x09 to a horizontal tab \(\t\) by [@fktn-k](https://github.com/fktn-k) in [\#336](https://github.com/fktn-k/fkYAML/pull/336) +- Fixed error on node properties for child block sequences by [@fktn-k](https://github.com/fktn-k) in [\#338](https://github.com/fktn-k/fkYAML/pull/338) +- Fix the C6262 warning on Windows by [@fktn-k](https://github.com/fktn-k) in [\#339](https://github.com/fktn-k/fkYAML/pull/339) + +#### :robot: CI + +- Run and apply the result of clang-format & amalagamation in GA workflows by [@fktn-k](https://github.com/fktn-k) in [\#341](https://github.com/fktn-k/fkYAML/pull/341) + +**Full Changelog**: https://github.com/fktn-k/fkYAML/compare/v0.3.6...v0.3.7 + +--- + ## **fkYAML version 0.3.6** !!! abstract "Release Packages" diff --git a/docs/mkdocs/docs/tutorials/cmake_integration.md b/docs/mkdocs/docs/tutorials/cmake_integration.md index cb41f037..41c18580 100644 --- a/docs/mkdocs/docs/tutorials/cmake_integration.md +++ b/docs/mkdocs/docs/tutorials/cmake_integration.md @@ -57,7 +57,7 @@ Since CMake v3.11, [`FetchContent`](https://cmake.org/cmake/help/latest/module/F FetchContent_Declare( fkYAML GIT_REPOSITORY https://github.com/fktn-k/fkYAML.git - GIT_TAG v0.3.6 + GIT_TAG v0.3.7 ) FetchContent_MakeAvailable(fkYAML) diff --git a/fkYAML.natvis b/fkYAML.natvis index e711f0bf..fb4c98a0 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 646af2e0..8f48ea18 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/from_node.hpp b/include/fkYAML/detail/conversions/from_node.hpp index 027e1f2f..1eae4184 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/from_string.hpp b/include/fkYAML/detail/conversions/from_string.hpp index 1777240f..ae89c23a 100644 --- a/include/fkYAML/detail/conversions/from_string.hpp +++ b/include/fkYAML/detail/conversions/from_string.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/to_node.hpp b/include/fkYAML/detail/conversions/to_node.hpp index 6c698b31..902f6123 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/to_string.hpp b/include/fkYAML/detail/conversions/to_string.hpp index a5be2f08..6c474a4d 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/document_metainfo.hpp b/include/fkYAML/detail/document_metainfo.hpp index fc419c76..ad904972 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/encode_detector.hpp b/include/fkYAML/detail/encodings/encode_detector.hpp index 0e9895f9..a0e4367b 100644 --- a/include/fkYAML/detail/encodings/encode_detector.hpp +++ b/include/fkYAML/detail/encodings/encode_detector.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/uri_encoding.hpp b/include/fkYAML/detail/encodings/uri_encoding.hpp index 173deced..096d31af 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/utf_encode_t.hpp b/include/fkYAML/detail/encodings/utf_encode_t.hpp index 4390c0bb..ba3df841 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/utf_encodings.hpp b/include/fkYAML/detail/encodings/utf_encodings.hpp index e9772fcf..e9bc53f3 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/yaml_escaper.hpp b/include/fkYAML/detail/encodings/yaml_escaper.hpp index 7d1914a1..2e2136ee 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index f5f59972..1456d3a3 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/input_adapter.hpp b/include/fkYAML/detail/input/input_adapter.hpp index e47e6421..2e187e7a 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index 772f6cf4..909de277 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/position_tracker.hpp b/include/fkYAML/detail/input/position_tracker.hpp index 3512700e..08a0f525 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/scalar_scanner.hpp b/include/fkYAML/detail/input/scalar_scanner.hpp index b933f460..0520a951 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/tag_resolver.hpp b/include/fkYAML/detail/input/tag_resolver.hpp index 003834f6..03cfc04d 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/tag_t.hpp b/include/fkYAML/detail/input/tag_t.hpp index 47b3b58c..e82102fd 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/iterator.hpp b/include/fkYAML/detail/iterator.hpp index 6ac7fed4..33433fe1 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/macros/cpp_config_macros.hpp b/include/fkYAML/detail/macros/cpp_config_macros.hpp index 85a39826..fc88e7b2 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/macros/version_macros.hpp b/include/fkYAML/detail/macros/version_macros.hpp index df70df1a..27f033f8 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -10,7 +10,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 != 3 || FK_YAML_PATCH_VERSION != 6 +#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 3 || FK_YAML_PATCH_VERSION != 7 #warning Already included a different version of the fkYAML library! #else // define macros to skip defining macros down below. @@ -22,7 +22,7 @@ #define FK_YAML_MAJOR_VERSION 0 #define FK_YAML_MINOR_VERSION 3 -#define FK_YAML_PATCH_VERSION 6 +#define FK_YAML_PATCH_VERSION 7 #define FK_YAML_NAMESPACE_VERSION_CONCAT_IMPL(major, minor, patch) v##major##_##minor##_##patch diff --git a/include/fkYAML/detail/meta/detect.hpp b/include/fkYAML/detail/meta/detect.hpp index 13dde5e5..ec98e8d0 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/input_adapter_traits.hpp b/include/fkYAML/detail/meta/input_adapter_traits.hpp index a0141f79..4ec0a4b4 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/node_traits.hpp b/include/fkYAML/detail/meta/node_traits.hpp index 7e72097a..155d21fb 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/stl_supplement.hpp b/include/fkYAML/detail/meta/stl_supplement.hpp index ce99cc6a..348f34c7 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/type_traits.hpp b/include/fkYAML/detail/meta/type_traits.hpp index 8b69e172..0236166b 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/node_property.hpp b/include/fkYAML/detail/node_property.hpp index acbe9462..30de53a1 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/node_ref_storage.hpp b/include/fkYAML/detail/node_ref_storage.hpp index 3505a521..d456422a 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/output/serializer.hpp b/include/fkYAML/detail/output/serializer.hpp index 8991c80e..d4d6bac3 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/string_formatter.hpp b/include/fkYAML/detail/string_formatter.hpp index ef943a0a..8d107ffb 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/types/lexical_token_t.hpp b/include/fkYAML/detail/types/lexical_token_t.hpp index 73a505e3..47a2d3e9 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/types/node_t.hpp b/include/fkYAML/detail/types/node_t.hpp index 1efdf509..0a863a10 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/types/yaml_version_t.hpp b/include/fkYAML/detail/types/yaml_version_t.hpp index b561ab38..26bd765d 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/exception.hpp b/include/fkYAML/exception.hpp index efe83925..62940976 100644 --- a/include/fkYAML/exception.hpp +++ b/include/fkYAML/exception.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/node.hpp b/include/fkYAML/node.hpp index 207443ad..aef165f7 100644 --- a/include/fkYAML/node.hpp +++ b/include/fkYAML/node.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/node_value_converter.hpp b/include/fkYAML/node_value_converter.hpp index 8b54a908..c7757916 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/ordered_map.hpp b/include/fkYAML/ordered_map.hpp index 553d375e..655b2ce2 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 3c7796ad..9ce33d17 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.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -24,7 +24,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -34,7 +34,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 != 3 || FK_YAML_PATCH_VERSION != 6 +#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 3 || FK_YAML_PATCH_VERSION != 7 #warning Already included a different version of the fkYAML library! #else // define macros to skip defining macros down below. @@ -46,7 +46,7 @@ #define FK_YAML_MAJOR_VERSION 0 #define FK_YAML_MINOR_VERSION 3 -#define FK_YAML_PATCH_VERSION 6 +#define FK_YAML_PATCH_VERSION 7 #define FK_YAML_NAMESPACE_VERSION_CONCAT_IMPL(major, minor, patch) v##major##_##minor##_##patch @@ -74,7 +74,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -138,7 +138,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -164,7 +164,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -183,7 +183,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -199,7 +199,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -217,7 +217,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -465,7 +465,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -777,7 +777,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -832,7 +832,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -855,7 +855,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -881,7 +881,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -907,7 +907,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -928,7 +928,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -977,7 +977,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -1415,7 +1415,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -1545,7 +1545,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -1838,7 +1838,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -2189,7 +2189,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -2210,7 +2210,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -2466,7 +2466,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -2487,7 +2487,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -3924,7 +3924,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -3948,7 +3948,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -4152,7 +4152,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -5064,7 +5064,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -5089,7 +5089,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -5108,7 +5108,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -6234,7 +6234,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -6641,7 +6641,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -6734,7 +6734,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -6754,7 +6754,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -7157,7 +7157,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -7175,7 +7175,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -7465,7 +7465,7 @@ FK_YAML_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -7853,7 +7853,7 @@ FK_YAML_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/cmake_add_subdirectory_test/project/main.cpp b/test/cmake_add_subdirectory_test/project/main.cpp index e1bc6c86..12df6ba1 100644 --- a/test/cmake_add_subdirectory_test/project/main.cpp +++ b/test/cmake_add_subdirectory_test/project/main.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/cmake_fetch_content_test/project/CMakeLists.txt b/test/cmake_fetch_content_test/project/CMakeLists.txt index 139532e8..4ca63394 100644 --- a/test/cmake_fetch_content_test/project/CMakeLists.txt +++ b/test/cmake_fetch_content_test/project/CMakeLists.txt @@ -6,7 +6,7 @@ include(FetchContent) FetchContent_Declare( fkYAML GIT_REPOSITORY https://github.com/fktn-k/fkYAML.git - GIT_TAG v0.3.6) + GIT_TAG v0.3.7) FetchContent_MakeAvailable(fkYAML) add_executable( diff --git a/test/cmake_fetch_content_test/project/main.cpp b/test/cmake_fetch_content_test/project/main.cpp index e1bc6c86..12df6ba1 100644 --- a/test/cmake_fetch_content_test/project/main.cpp +++ b/test/cmake_fetch_content_test/project/main.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/cmake_find_package_test/project/main.cpp b/test/cmake_find_package_test/project/main.cpp index e1bc6c86..12df6ba1 100644 --- a/test/cmake_find_package_test/project/main.cpp +++ b/test/cmake_find_package_test/project/main.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/cmake_target_include_directories_test/project/main.cpp b/test/cmake_target_include_directories_test/project/main.cpp index e1bc6c86..12df6ba1 100644 --- a/test/cmake_target_include_directories_test/project/main.cpp +++ b/test/cmake_target_include_directories_test/project/main.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/main.cpp b/test/unit_test/main.cpp index c6294cdb..5ddf0f9a 100644 --- a/test/unit_test/main.cpp +++ b/test/unit_test/main.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_custom_from_node.cpp b/test/unit_test/test_custom_from_node.cpp index 97a65adf..c57ed777 100644 --- a/test/unit_test/test_custom_from_node.cpp +++ b/test/unit_test/test_custom_from_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 56ee4ee1..748e0fd0 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_encode_detector.cpp b/test/unit_test/test_encode_detector.cpp index 6842c7af..19069b07 100644 --- a/test/unit_test/test_encode_detector.cpp +++ b/test/unit_test/test_encode_detector.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_exception_class.cpp b/test/unit_test/test_exception_class.cpp index 2f1a8a3f..cb263de5 100644 --- a/test/unit_test/test_exception_class.cpp +++ b/test/unit_test/test_exception_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_from_string.cpp b/test/unit_test/test_from_string.cpp index 176fc20a..ef492fae 100644 --- a/test/unit_test/test_from_string.cpp +++ b/test/unit_test/test_from_string.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_input_adapter.cpp b/test/unit_test/test_input_adapter.cpp index a4655a3a..ea26d377 100644 --- a/test/unit_test/test_input_adapter.cpp +++ b/test/unit_test/test_input_adapter.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_iterator_class.cpp b/test/unit_test/test_iterator_class.cpp index 0c2538ba..96658c17 100644 --- a/test/unit_test/test_iterator_class.cpp +++ b/test/unit_test/test_iterator_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_lexical_analyzer_class.cpp b/test/unit_test/test_lexical_analyzer_class.cpp index a169fb7b..fa69c2eb 100644 --- a/test/unit_test/test_lexical_analyzer_class.cpp +++ b/test/unit_test/test_lexical_analyzer_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_node_class.cpp b/test/unit_test/test_node_class.cpp index d1f4fb83..5447f124 100644 --- a/test/unit_test/test_node_class.cpp +++ b/test/unit_test/test_node_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_node_ref_storage_class.cpp b/test/unit_test/test_node_ref_storage_class.cpp index affcef29..3feb8d84 100644 --- a/test/unit_test/test_node_ref_storage_class.cpp +++ b/test/unit_test/test_node_ref_storage_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_ordered_map_class.cpp b/test/unit_test/test_ordered_map_class.cpp index 9f19c50b..84db51bf 100644 --- a/test/unit_test/test_ordered_map_class.cpp +++ b/test/unit_test/test_ordered_map_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_position_tracker_class.cpp b/test/unit_test/test_position_tracker_class.cpp index 3724d4f5..93554025 100644 --- a/test/unit_test/test_position_tracker_class.cpp +++ b/test/unit_test/test_position_tracker_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_scalar_scanner_class.cpp b/test/unit_test/test_scalar_scanner_class.cpp index fa6cef44..24f337d8 100644 --- a/test/unit_test/test_scalar_scanner_class.cpp +++ b/test/unit_test/test_scalar_scanner_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_serializer_class.cpp b/test/unit_test/test_serializer_class.cpp index 0b847832..d42a3ccf 100644 --- a/test/unit_test/test_serializer_class.cpp +++ b/test/unit_test/test_serializer_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_string_formatter.cpp b/test/unit_test/test_string_formatter.cpp index a535626a..423e238e 100644 --- a/test/unit_test/test_string_formatter.cpp +++ b/test/unit_test/test_string_formatter.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_tag_resolver_class.cpp b/test/unit_test/test_tag_resolver_class.cpp index 9631ab16..d77d278b 100644 --- a/test/unit_test/test_tag_resolver_class.cpp +++ b/test/unit_test/test_tag_resolver_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_uri_encoding_class.cpp b/test/unit_test/test_uri_encoding_class.cpp index bfd62a41..b9efea24 100644 --- a/test/unit_test/test_uri_encoding_class.cpp +++ b/test/unit_test/test_uri_encoding_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_utf_encodings.cpp b/test/unit_test/test_utf_encodings.cpp index 2f01fc09..9b495aa5 100644 --- a/test/unit_test/test_utf_encodings.cpp +++ b/test/unit_test/test_utf_encodings.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_yaml_escaper_class.cpp b/test/unit_test/test_yaml_escaper_class.cpp index 074c0145..d2599a5d 100644 --- a/test/unit_test/test_yaml_escaper_class.cpp +++ b/test/unit_test/test_yaml_escaper_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.7 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/tool/natvis_generator/params.json b/tool/natvis_generator/params.json index 1baac0dc..b593caf8 100644 --- a/tool/natvis_generator/params.json +++ b/tool/natvis_generator/params.json @@ -1 +1 @@ -{ "version": "0.3.6" } +{ "version": "0.3.7" }