/// 1. Drop `toml.hpp` wherever you like in your source tree
@@ -475,7 +475,7 @@
///
/// \subsection mainpage-adding-lib-python Special mention: Python
/// Yes, you read correctly, python. There exists a python wrapper built around toml++ called
-/// \gh2{bobfang1992/pytomlpp, pytomlpp}:
+/// \github{bobfang1992/pytomlpp, pytomlpp}:
///
/// \bash
/// pip install pytomlpp
@@ -496,9 +496,9 @@
//////////////////////////////////////////////////////////////////////
///
/// \section mainpage-contributing Contributing
-/// Contributions are very welcome! Either by \gh2{marzer/tomlplusplus/issues, reporting issues}
+/// Contributions are very welcome! Either by \github{marzer/tomlplusplus/issues, reporting issues}
/// or submitting pull requests. If you wish to submit a pull request,
-/// please see \gh2{marzer/tomlplusplus/blob/master/CONTRIBUTING.md, CONTRIBUTING}
+/// please see \github{marzer/tomlplusplus/blob/master/CONTRIBUTING.md, CONTRIBUTING}
/// for all the details you need to get going.
///
//////////////////////////////////////////////////////////////////////
@@ -516,7 +516,7 @@
//////////////////////////////////////////////////////////////////////
///
/// \section mainpage-contact Contacting the author
-/// For bug reports and feature requests please use the \gh2{marzer/tomlplusplus/issues, Github Issues}
+/// For bug reports and feature requests please use the \github{marzer/tomlplusplus/issues, Github Issues}
/// system. For anything else you're welcome to reach out via other means. In order of likely response speed:
/// - Twitter: [marzer8789](https://twitter.com/marzer8789)
/// - Email: [mark.gillard@outlook.com.au](mailto:mark.gillard@outlook.com.au)
diff --git a/vs/error_printer.vcxproj b/examples/error_printer.vcxproj
similarity index 91%
rename from vs/error_printer.vcxproj
rename to examples/error_printer.vcxproj
index 0ac9432..d339545 100644
--- a/vs/error_printer.vcxproj
+++ b/examples/error_printer.vcxproj
@@ -33,18 +33,18 @@
-
+ $(SolutionDir)..\examples\
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/vs/simple_parser.vcxproj b/examples/simple_parser.vcxproj
similarity index 89%
rename from vs/simple_parser.vcxproj
rename to examples/simple_parser.vcxproj
index 2d457f1..4644429 100644
--- a/vs/simple_parser.vcxproj
+++ b/examples/simple_parser.vcxproj
@@ -33,19 +33,19 @@
-
+ $(SolutionDir)..\examples\
-
+
-
-
+
+
-
+
-
\ No newline at end of file
+
diff --git a/vs/toml_generator.vcxproj b/examples/toml_generator.vcxproj
similarity index 91%
rename from vs/toml_generator.vcxproj
rename to examples/toml_generator.vcxproj
index e4a8188..95f971d 100644
--- a/vs/toml_generator.vcxproj
+++ b/examples/toml_generator.vcxproj
@@ -34,18 +34,18 @@
-
+ $(SolutionDir)..\examples\
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/vs/toml_to_json_transcoder.vcxproj b/examples/toml_to_json_transcoder.vcxproj
similarity index 91%
rename from vs/toml_to_json_transcoder.vcxproj
rename to examples/toml_to_json_transcoder.vcxproj
index 036aeb3..6891f40 100644
--- a/vs/toml_to_json_transcoder.vcxproj
+++ b/examples/toml_to_json_transcoder.vcxproj
@@ -34,18 +34,18 @@
-
+ $(SolutionDir)..\examples\
-
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/extern/Catch2 b/extern/Catch2
deleted file mode 160000
index 87074da..0000000
--- a/extern/Catch2
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 87074da73ecb1c2e7c35fd14f50ca21c4c002adc
diff --git a/extern/mcss b/extern/mcss
deleted file mode 160000
index 42d4a9a..0000000
--- a/extern/mcss
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 42d4a9a48f31f5df6e246c948403b54b50574a2a
diff --git a/extern/tloptional b/extern/tloptional
deleted file mode 160000
index 0dfc7b4..0000000
--- a/extern/tloptional
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 0dfc7b4e41b1245e47936d6c99bf8e3d80e42b9f
diff --git a/external/Catch2 b/external/Catch2
new file mode 160000
index 0000000..5c88067
--- /dev/null
+++ b/external/Catch2
@@ -0,0 +1 @@
+Subproject commit 5c88067bd339465513af4aec606bd2292f1b594a
diff --git a/external/dox b/external/dox
new file mode 160000
index 0000000..7b0185b
--- /dev/null
+++ b/external/dox
@@ -0,0 +1 @@
+Subproject commit 7b0185b36ed56e4963315aafdc444818b97d21f3
diff --git a/external/tloptional b/external/tloptional
new file mode 160000
index 0000000..e28828e
--- /dev/null
+++ b/external/tloptional
@@ -0,0 +1 @@
+Subproject commit e28828efa021bf51f1c8cc3248642ec5a636c8d7
diff --git a/extern/toml-spec-tests b/external/toml-spec-tests
similarity index 100%
rename from extern/toml-spec-tests
rename to external/toml-spec-tests
diff --git a/extern/toml-test b/external/toml-test
similarity index 100%
rename from extern/toml-test
rename to external/toml-test
diff --git a/include/toml++/toml.h b/include/toml++/toml.h
index 2af0678..405b8f3 100644
--- a/include/toml++/toml.h
+++ b/include/toml++/toml.h
@@ -12,8 +12,8 @@
#include "toml_preprocessor.h"
-TOML_PUSH_WARNINGS
-TOML_DISABLE_SPAM_WARNINGS
+TOML_PUSH_WARNINGS;
+TOML_DISABLE_SPAM_WARNINGS;
#include "toml_common.h"
#include "toml_date_time.h"
@@ -50,7 +50,7 @@ TOML_DISABLE_SPAM_WARNINGS
#endif // TOML_IMPLEMENTATION
-TOML_POP_WARNINGS // TOML_DISABLE_SPAM_WARNINGS
+TOML_POP_WARNINGS; // TOML_DISABLE_SPAM_WARNINGS
// macro hygiene
#if TOML_UNDEF_MACROS
diff --git a/include/toml++/toml_array.h b/include/toml++/toml_array.h
index 40af08b..311360d 100644
--- a/include/toml++/toml_array.h
+++ b/include/toml++/toml_array.h
@@ -6,6 +6,7 @@
#pragma once
#include "toml_value.h"
+/// \cond
TOML_IMPL_NAMESPACE_START
{
template
@@ -165,7 +166,7 @@ TOML_IMPL_NAMESPACE_START
return *(raw_ + idx)->get();
}
- TOML_DISABLE_WARNINGS
+ TOML_DISABLE_WARNINGS;
template >
operator array_iterator() const noexcept
@@ -173,7 +174,7 @@ TOML_IMPL_NAMESPACE_START
return array_iterator{ raw_ };
}
- TOML_ENABLE_WARNINGS
+ TOML_ENABLE_WARNINGS;
};
template
@@ -248,7 +249,8 @@ TOML_IMPL_NAMESPACE_START
return make_node(std::move(val.value));
}
}
-TOML_IMPL_NAMESPACE_END
+TOML_IMPL_NAMESPACE_END;
+/// \endcond
TOML_NAMESPACE_START
{
@@ -313,6 +315,8 @@ TOML_NAMESPACE_START
: public node
{
private:
+ /// \cond
+
friend class TOML_PARSER_TYPENAME;
std::vector> elements;
@@ -334,6 +338,11 @@ TOML_NAMESPACE_START
void lh_dtor() noexcept;
#endif
+ [[nodiscard]] size_t total_leaf_count() const noexcept;
+
+ void flatten_child(array&& child, size_t& dest_index) noexcept;
+ /// \endcond
+
public:
using value_type = node;
@@ -423,6 +432,9 @@ TOML_NAMESPACE_START
#endif
}
+ /// \name Type checks
+ /// @{
+
[[nodiscard]] node_type type() const noexcept override;
[[nodiscard]] bool is_table() const noexcept override;
[[nodiscard]] bool is_array() const noexcept override;
@@ -449,6 +461,11 @@ TOML_NAMESPACE_START
return is_homogeneous(impl::node_type_of);
}
+ /// @}
+
+ /// \name Array operations
+ /// @{
+
/// \brief Gets a reference to the element at a specific index.
[[nodiscard]] node& operator[] (size_t index) noexcept;
/// \brief Gets a reference to the element at a specific index.
@@ -512,10 +529,9 @@ TOML_NAMESPACE_START
/// \param pos The insertion position.
/// \param val The node or value being inserted.
///
- /// \returns Valid input:
- /// An iterator to the newly-inserted element.
- ///
- /// `val` is an empty toml::node_view:
+ /// \returns \conditional_return{Valid input}
+ /// An iterator to the newly-inserted element.
+ /// \conditional_return{Input is an empty toml::node_view}
/// end()
///
/// \attention The return value will always be `end()` if the input value was an empty toml::node_view,
@@ -559,13 +575,11 @@ TOML_NAMESPACE_START
/// \param count The number of times the node or value should be inserted.
/// \param val The node or value being inserted.
///
- /// \returns Valid input:
+ /// \returns \conditional_return{Valid input}
/// An iterator to the newly-inserted element.
- ///
- /// `count == 0`:
+ /// \conditional_return{count == 0}
/// A copy of pos
- ///
- /// `val` is an empty toml::node_view:
+ /// \conditional_return{Input is an empty toml::node_view}
/// end()
///
/// \attention The return value will always be `end()` if the input value was an empty toml::node_view,
@@ -604,13 +618,11 @@ TOML_NAMESPACE_START
/// \param first Iterator to the first node or value being inserted.
/// \param last Iterator to the one-past-the-last node or value being inserted.
///
- /// \returns Valid input:
+ /// \returns \conditional_return{Valid input}
/// An iterator to the first newly-inserted element.
- ///
- /// `first >= last`:
+ /// \conditional_return{first >= last}
/// A copy of pos
- ///
- /// All objects in the range were empty toml::node_views:
+ /// \conditional_return{All objects in the range were empty toml::node_views}
/// A copy of pos
template
iterator insert(const_iterator pos, Iter first, Iter last) noexcept
@@ -656,14 +668,12 @@ TOML_NAMESPACE_START
/// \param pos The insertion position.
/// \param ilist An initializer list containing the values to be inserted.
///
- /// \returns Valid input:
- /// An iterator to the first newly-inserted element.
- ///
- /// `ilist.size() == 0`:
- /// A copy of pos
- ///
- /// All objects in the list were empty toml::node_views:
- /// A copy of pos
+ /// \returns \conditional_return{Valid input}
+ /// An iterator to the first newly-inserted element.
+ /// \conditional_return{Input list is empty}
+ /// A copy of pos
+ /// \conditional_return{All objects in the list were empty toml::node_views}
+ /// A copy of pos
template
iterator insert(const_iterator pos, std::initializer_list ilist) noexcept
{
@@ -955,6 +965,40 @@ TOML_NAMESPACE_START
return nullptr;
}
+ /// \brief Flattens this array, recursively hoisting the contents of child arrays up into itself.
+ ///
+ /// \detail \cpp
+ ///
+ /// auto arr = toml::array{ 1, 2, toml::array{ 3, 4, toml::array{ 5 } }, 6, toml::array{} };
+ /// std::cout << arr << "\n";
+ ///
+ /// arr.flatten();
+ /// std::cout << arr << "\n";
+ ///
+ /// \ecpp
+ ///
+ /// \out
+ /// [ 1, 2, [ 3, 4, [ 5 ] ], 6, [] ]
+ /// [ 1, 2, 3, 4, 5, 6 ]
+ /// \eout
+ ///
+ /// \remarks Arrays inside child tables are not flattened.
+ ///
+ /// \returns A reference to the array.
+ array& flatten()&;
+
+ /// \brief Flattens this array, recursively hoisting the contents of child arrays up into itself (rvalue overload).
+ /// \returns An rvalue reference to the array.
+ array&& flatten()&&
+ {
+ return static_cast(this->flatten());
+ }
+
+ /// @}
+
+ /// \name Equality
+ /// @{
+
/// \brief Equality operator.
///
/// \param lhs The LHS array.
@@ -999,10 +1043,6 @@ TOML_NAMESPACE_START
return true;
}
- [[nodiscard]] size_t total_leaf_count() const noexcept;
-
- void flatten_child(array&& child, size_t& dest_index) noexcept;
-
public:
/// \brief Initializer list equality operator.
@@ -1012,7 +1052,7 @@ TOML_NAMESPACE_START
{
return container_equality(lhs, rhs);
}
- TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::initializer_list&, template )
+ TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::initializer_list&, template );
/// \brief Vector equality operator.
template
@@ -1021,36 +1061,9 @@ TOML_NAMESPACE_START
{
return container_equality(lhs, rhs);
}
- TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::vector&, template )
+ TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::vector&, template );
- /// \brief Flattens this array, recursively hoisting the contents of child arrays up into itself.
- ///
- /// \detail \cpp
- ///
- /// auto arr = toml::array{ 1, 2, toml::array{ 3, 4, toml::array{ 5 } }, 6, toml::array{} };
- /// std::cout << arr << "\n";
- ///
- /// arr.flatten();
- /// std::cout << arr << "\n";
- ///
- /// \ecpp
- ///
- /// \out
- /// [ 1, 2, [ 3, 4, [ 5 ] ], 6, [] ]
- /// [ 1, 2, 3, 4, 5, 6 ]
- /// \eout
- ///
- /// \remarks Arrays inside child tables are not flattened.
- ///
- /// \returns A reference to the array.
- array& flatten() &;
-
- /// \brief Flattens this array, recursively hoisting the contents of child arrays up into itself (rvalue overload).
- /// \returns An rvalue reference to the array.
- array&& flatten() &&
- {
- return static_cast(this->flatten());
- }
+ /// @}
/// \brief Prints the array out to a stream as formatted TOML.
template
@@ -1058,4 +1071,4 @@ TOML_NAMESPACE_START
// implemented in toml_default_formatter.h
};
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
diff --git a/include/toml++/toml_array.hpp b/include/toml++/toml_array.hpp
index 4fc018a..ef5b7dd 100644
--- a/include/toml++/toml_array.hpp
+++ b/include/toml++/toml_array.hpp
@@ -355,4 +355,4 @@ TOML_NAMESPACE_START
return is_homogeneous(node_type::table);
}
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
diff --git a/include/toml++/toml_common.h b/include/toml++/toml_common.h
index c45fd79..c47793e 100644
--- a/include/toml++/toml_common.h
+++ b/include/toml++/toml_common.h
@@ -10,7 +10,7 @@
//# INCLUDES
//#====================================================================================================================
-TOML_DISABLE_WARNINGS
+TOML_DISABLE_WARNINGS;
#include
#include
#include
@@ -30,7 +30,7 @@ TOML_DISABLE_WARNINGS
#if TOML_HAS_INCLUDE()
#include
#endif
-TOML_ENABLE_WARNINGS
+TOML_ENABLE_WARNINGS;
#ifdef __cpp_lib_launder
#define TOML_LAUNDER(x) std::launder(x)
@@ -42,7 +42,7 @@ TOML_ENABLE_WARNINGS
//# ENVIRONMENT GROUND-TRUTHS
//#====================================================================================================================
-#ifndef DOXYGEN
+/// \cond
#ifndef TOML_DISABLE_ENVIRONMENT_CHECKS
#define TOML_ENV_MESSAGE \
"If you're seeing this error it's because you're building toml++ for an environment that doesn't conform to " \
@@ -61,13 +61,14 @@ static_assert(std::numeric_limits::digits10 == 15, TOML_ENV_MESSAGE);
#undef TOML_ENV_MESSAGE
#endif // !TOML_DISABLE_ENVIRONMENT_CHECKS
-#endif // !DOXYGEN
+/// \endcond
//#====================================================================================================================
//# UNDOCUMENTED TYPEDEFS AND FORWARD DECLARATIONS
//#====================================================================================================================
-#ifndef DOXYGEN // undocumented forward declarations are hidden from doxygen because they fuck it up =/
+/// \cond
+// undocumented forward declarations are hidden from doxygen because they fuck it up =/
namespace toml // non-abi namespace; this is not an error
{
@@ -103,7 +104,7 @@ TOML_NAMESPACE_START // abi namespace
TOML_ABI_NAMESPACE_BOOL(TOML_HAS_CUSTOM_OPTIONAL_TYPE, custopt, stdopt)
struct date_time;
- TOML_ABI_NAMESPACE_END
+ TOML_ABI_NAMESPACE_END;
class node;
class array;
@@ -182,12 +183,12 @@ TOML_NAMESPACE_START // abi namespace
#define TOML_PARSER_TYPENAME TOML_NAMESPACE::impl::parser
#endif
class parser;
- TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
+ TOML_ABI_NAMESPACE_END; // TOML_EXCEPTIONS
}
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
-#endif // !DOXYGEN
+/// \endcond
//#====================================================================================================================
//# TYPEDEFS AND FORWARD DECLARATIONS
@@ -271,12 +272,13 @@ TOML_NAMESPACE_START // abi namespace
};
template inserter(T&&) -> inserter;
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
//#====================================================================================================================
//# VALUE AND NODE TRAITS
//#====================================================================================================================
+/// \cond
TOML_IMPL_NAMESPACE_START
{
// general value traits
@@ -529,7 +531,8 @@ TOML_IMPL_NAMESPACE_START
template
inline constexpr node_type node_type_of = node_type_getter>>::value;
}
-TOML_IMPL_NAMESPACE_END
+TOML_IMPL_NAMESPACE_END;
+/// \endcond
TOML_NAMESPACE_START
{
@@ -577,12 +580,13 @@ TOML_NAMESPACE_START
template
inline constexpr bool is_node_view = impl::is_one_of, node_view, node_view>;
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
//#====================================================================================================================
//# INTERNAL HELPERS
//#====================================================================================================================
+/// \cond
TOML_IMPL_NAMESPACE_START
{
template
@@ -677,7 +681,8 @@ TOML_IMPL_NAMESPACE_START
"date-time"sv
};
}
-TOML_IMPL_NAMESPACE_END
+TOML_IMPL_NAMESPACE_END;
+/// \endcond
TOML_NAMESPACE_START
{
@@ -689,7 +694,7 @@ TOML_NAMESPACE_START
return static_cast(n);
}
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
//#====================================================================================================================
//# SOURCE POSITIONS & REGIONS
@@ -824,10 +829,10 @@ TOML_NAMESPACE_START
#if TOML_WINDOWS_COMPAT
/// \brief The path to the corresponding source document as a wide-string.
+ ///
+ /// \availability This function is only available when #TOML_WINDOWS_COMPAT is enabled.
///
/// \remarks This will return an empty optional if no path was provided to toml::parse().
- ///
- /// \attention This function is only available when #TOML_WINDOWS_COMPAT is enabled.
[[nodiscard]]
optional wide_path() const noexcept
{
@@ -839,9 +844,9 @@ TOML_NAMESPACE_START
#endif
};
- TOML_ABI_NAMESPACE_END // TOML_LARGE_FILES
+ TOML_ABI_NAMESPACE_END; // TOML_LARGE_FILES
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
//#====================================================================================================================
//# OTHER
@@ -864,7 +869,7 @@ TOML_NAMESPACE_START
/// \brief Format integer values as hexadecimal.
format_as_hexadecimal = 3,
};
- TOML_MAKE_BITOPS(value_flags)
+ TOML_MAKE_BITOPS(value_flags);
/// \brief Format flags for modifying how TOML data is printed to streams.
enum class format_flags : uint8_t
@@ -884,7 +889,7 @@ TOML_NAMESPACE_START
/// \brief Values with special format flags will be formatted accordingly.
allow_value_format_flags = 8,
};
- TOML_MAKE_BITOPS(format_flags)
+ TOML_MAKE_BITOPS(format_flags);
/// \brief Pretty-prints the value of a node_type to a stream.
///
@@ -917,8 +922,7 @@ TOML_NAMESPACE_START
}
}
- #ifndef DOXYGEN
-
+ /// \cond
namespace impl
{
#define TOML_P2S_DECL(Type) \
@@ -949,7 +953,7 @@ TOML_NAMESPACE_START
extern template TOML_API std::ostream& operator << (std::ostream&, node_type);
#endif // !TOML_HEADER_ONLY
- #endif // !DOXYGEN
+ /// \endcond
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
diff --git a/include/toml++/toml_date_time.h b/include/toml++/toml_date_time.h
index 8bdfd19..ef728c4 100644
--- a/include/toml++/toml_date_time.h
+++ b/include/toml++/toml_date_time.h
@@ -400,7 +400,7 @@ TOML_NAMESPACE_START
}
};
- TOML_ABI_NAMESPACE_END // TOML_HAS_CUSTOM_OPTIONAL_TYPE
+ TOML_ABI_NAMESPACE_END; // TOML_HAS_CUSTOM_OPTIONAL_TYPE
/// \brief Prints a date_time out to a stream in RFC 3339 format.
/// \detail \cpp
@@ -425,4 +425,4 @@ TOML_NAMESPACE_START
extern template TOML_API std::ostream& operator << (std::ostream&, const date_time&);
#endif
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
diff --git a/include/toml++/toml_default_formatter.h b/include/toml++/toml_default_formatter.h
index a20a3c7..6c7c66a 100644
--- a/include/toml++/toml_default_formatter.h
+++ b/include/toml++/toml_default_formatter.h
@@ -9,16 +9,18 @@
#include "toml_array.h"
#include "toml_utf8.h"
-TOML_PUSH_WARNINGS
-TOML_DISABLE_SWITCH_WARNINGS
+TOML_PUSH_WARNINGS;
+TOML_DISABLE_SWITCH_WARNINGS;
+/// \cond
TOML_IMPL_NAMESPACE_START
{
[[nodiscard]] TOML_API std::string default_formatter_make_key_segment(const std::string&) noexcept;
[[nodiscard]] TOML_API size_t default_formatter_inline_columns(const node&) noexcept;
[[nodiscard]] TOML_API bool default_formatter_forces_multiline(const node&, size_t = 0) noexcept;
}
-TOML_IMPL_NAMESPACE_END
+TOML_IMPL_NAMESPACE_END;
+/// \endcond
TOML_NAMESPACE_START
{
@@ -406,7 +408,7 @@ TOML_NAMESPACE_START
#endif // !DOXYGEN
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
-TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS
+TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
diff --git a/include/toml++/toml_default_formatter.hpp b/include/toml++/toml_default_formatter.hpp
index b8870b1..b739425 100644
--- a/include/toml++/toml_default_formatter.hpp
+++ b/include/toml++/toml_default_formatter.hpp
@@ -12,13 +12,13 @@
//# }}
#include "toml_default_formatter.h"
-TOML_DISABLE_WARNINGS
+TOML_DISABLE_WARNINGS;
#include
-TOML_ENABLE_WARNINGS
+TOML_ENABLE_WARNINGS;
-TOML_PUSH_WARNINGS
-TOML_DISABLE_SWITCH_WARNINGS
-TOML_DISABLE_ARITHMETIC_WARNINGS
+TOML_PUSH_WARNINGS;
+TOML_DISABLE_SWITCH_WARNINGS;
+TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_IMPL_NAMESPACE_START
{
@@ -160,7 +160,7 @@ TOML_IMPL_NAMESPACE_START
return (default_formatter_inline_columns(node) + starting_column_bias) >= default_formatter_line_wrap;
}
}
-TOML_IMPL_NAMESPACE_END
+TOML_IMPL_NAMESPACE_END;
TOML_NAMESPACE_START
{
@@ -199,14 +199,14 @@ TOML_NAMESPACE_START
base::clear_naked_newline();
}
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
// implementations of windows wide string nonsense
#if TOML_WINDOWS_COMPAT
-TOML_DISABLE_WARNINGS
+TOML_DISABLE_WARNINGS;
#include // fuckkkk :(
-TOML_ENABLE_WARNINGS
+TOML_ENABLE_WARNINGS;
TOML_IMPL_NAMESPACE_START
{
@@ -260,8 +260,8 @@ TOML_IMPL_NAMESPACE_START
#endif // __cpp_lib_char8_t
}
-TOML_IMPL_NAMESPACE_END
+TOML_IMPL_NAMESPACE_END;
#endif // TOML_WINDOWS_COMPAT
-TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS, TOML_DISABLE_ARITHMETIC_WARNINGS
+TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS, TOML_DISABLE_ARITHMETIC_WARNINGS
diff --git a/include/toml++/toml_formatter.h b/include/toml++/toml_formatter.h
index d5f7791..c12073f 100644
--- a/include/toml++/toml_formatter.h
+++ b/include/toml++/toml_formatter.h
@@ -6,9 +6,10 @@
#pragma once
#include "toml_print_to_stream.h"
-TOML_PUSH_WARNINGS
-TOML_DISABLE_SWITCH_WARNINGS
+TOML_PUSH_WARNINGS;
+TOML_DISABLE_SWITCH_WARNINGS;
+/// \cond
TOML_IMPL_NAMESPACE_START
{
template
@@ -232,6 +233,7 @@ TOML_IMPL_NAMESPACE_START
#endif
}
-TOML_IMPL_NAMESPACE_END
+TOML_IMPL_NAMESPACE_END;
+/// \endcond
-TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS
+TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
diff --git a/include/toml++/toml_instantiations.hpp b/include/toml++/toml_instantiations.hpp
index 6c3f4dc..1414113 100644
--- a/include/toml++/toml_instantiations.hpp
+++ b/include/toml++/toml_instantiations.hpp
@@ -14,11 +14,11 @@
#endif
//# }}
-TOML_DISABLE_WARNINGS
+TOML_DISABLE_WARNINGS;
#include
#include
#include
-TOML_ENABLE_WARNINGS
+TOML_ENABLE_WARNINGS;
#include "toml_node_view.h"
#include "toml_default_formatter.h"
@@ -36,7 +36,7 @@ TOML_IMPL_NAMESPACE_START
// print to stream machinery
template TOML_API void print_floating_point_to_stream(double, std::ostream&, bool);
}
-TOML_IMPL_NAMESPACE_END
+TOML_IMPL_NAMESPACE_END;
// public namespace
TOML_NAMESPACE_START
@@ -148,8 +148,8 @@ TOML_NAMESPACE_START
template TOML_API parse_result parse_file(std::wstring_view) TOML_MAY_THROW;
#endif
- TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
+ TOML_ABI_NAMESPACE_END; // TOML_EXCEPTIONS
#endif // TOML_PARSER
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
diff --git a/include/toml++/toml_json_formatter.h b/include/toml++/toml_json_formatter.h
index 95d0b4c..b5caf94 100644
--- a/include/toml++/toml_json_formatter.h
+++ b/include/toml++/toml_json_formatter.h
@@ -6,8 +6,8 @@
#pragma once
#include "toml_formatter.h"
-TOML_PUSH_WARNINGS
-TOML_DISABLE_SWITCH_WARNINGS
+TOML_PUSH_WARNINGS;
+TOML_DISABLE_SWITCH_WARNINGS;
TOML_NAMESPACE_START
{
@@ -154,6 +154,6 @@ TOML_NAMESPACE_START
extern template TOML_API std::ostream& operator << (std::ostream&, json_formatter&&);
#endif
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
-TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS
+TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
diff --git a/include/toml++/toml_json_formatter.hpp b/include/toml++/toml_json_formatter.hpp
index 83cb42d..e9ceb8d 100644
--- a/include/toml++/toml_json_formatter.hpp
+++ b/include/toml++/toml_json_formatter.hpp
@@ -13,8 +13,8 @@
#include "toml_json_formatter.h"
-TOML_PUSH_WARNINGS
-TOML_DISABLE_SWITCH_WARNINGS
+TOML_PUSH_WARNINGS;
+TOML_DISABLE_SWITCH_WARNINGS;
TOML_NAMESPACE_START
{
@@ -58,6 +58,6 @@ TOML_NAMESPACE_START
base::clear_naked_newline();
}
}
-TOML_NAMESPACE_END
+TOML_NAMESPACE_END;
-TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS
+TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS
diff --git a/include/toml++/toml_node.h b/include/toml++/toml_node.h
index c5627bc..14c49b0 100644
--- a/include/toml++/toml_node.h
+++ b/include/toml++/toml_node.h
@@ -67,6 +67,35 @@ TOML_NAMESPACE_START
friend class TOML_PARSER_TYPENAME;
source_region source_{};
+ /// \cond
+
+ template
+ [[nodiscard]]
+ decltype(auto) get_value_exact() const noexcept;
+
+ template
+ [[nodiscard]]
+ TOML_ATTR(pure)
+ static decltype(auto) do_ref(N&& n) noexcept
+ {
+ using type = impl::unwrap_node;
+ static_assert(
+ (impl::is_native || impl::is_one_of) && !impl::is_cvref,
+ "The template type argument of node::ref() must be one of:"
+ TOML_SA_UNWRAPPED_NODE_TYPE_LIST
+ );
+ TOML_ASSERT(
+ n.template is()
+ && "template type argument T provided to toml::node::ref() didn't match the node's actual type"
+ );
+ if constexpr (impl::is_native)
+ return std::forward(n).template ref_cast().get();
+ else
+ return std::forward(n).template ref_cast();
+ }
+
+ /// \endcond
+
protected:
node() noexcept = default;
@@ -109,7 +138,8 @@ TOML_NAMESPACE_START
virtual ~node() noexcept = default;
-
+ /// \name Type checks
+ /// @{
#if defined(DOXYGEN) || !TOML_ICC || TOML_ICC_CL
@@ -183,35 +213,6 @@ TOML_NAMESPACE_START
else if constexpr (std::is_same_v) return is_date_time();
}
- /// \brief Returns a pointer to the node as a toml::table, if it is one.
- [[nodiscard]] virtual table* as_table() noexcept;
- /// \brief Returns a pointer to the node as a toml::array, if it is one.
- [[nodiscard]] virtual array* as_array() noexcept;
- /// \brief Returns a pointer to the node as a toml::value, if it is one.
- [[nodiscard]] virtual toml::value* as_string() noexcept;
- /// \brief Returns a pointer to the node as a toml::value, if it is one.
- [[nodiscard]] virtual toml::value* as_integer() noexcept;
- /// \brief Returns a pointer to the node as a toml::value, if it is one.
- [[nodiscard]] virtual toml::value* as_floating_point() noexcept;
- /// \brief Returns a pointer to the node as a toml::value, if it is one.
- [[nodiscard]] virtual toml::value* as_boolean() noexcept;
- /// \brief Returns a pointer to the node as a toml::value, if it is one.
- [[nodiscard]] virtual toml::value* as_date() noexcept;
- /// \brief Returns a pointer to the node as a toml::value