moved preprocessor machinery to a separate header

- added doxygen page for the configuration options
- added SPDX-License-Identifiers around the place
- changed TOML_UNRELEASED_FEATURES default to 0
- simplified ABI namespace machinery
- fixed a number of doxygen bugs
This commit is contained in:
Mark Gillard 2020-04-10 19:46:00 +03:00
parent 682436aa2e
commit f3990256ce
45 changed files with 917 additions and 789 deletions

View File

@ -112,8 +112,7 @@ won't need to mess with these at all, but if you do, set them before including t
| `TOML_PARSER` | boolean | `1` | Disable this to prevent inclusion of the parser-related parts of the library if you don't need them. |
| `TOML_SMALL_FLOAT_TYPE` | type name | undefined | If your codebase has an additional 'small' float type (e.g. half-precision), this tells toml++ about it. |
| `TOML_SMALL_INT_TYPE` | type name | undefined | If your codebase has an additional 'small' integer type (e.g. 24-bits), this tells toml++ about it. |
| `TOML_UNDEF_MACROS` | boolean | `1` | `#undefs` the library's internal macros at the end of the header. |
| `TOML_UNRELEASED_FEATURES` | boolean | `1` | Enables support for [unreleased TOML language features] not yet part of a [numbered version]. |
| `TOML_UNRELEASED_FEATURES` | boolean | `0` | Enables support for [unreleased TOML language features] not yet part of a [numbered version]. |
> _A number of these have ABI implications; the library uses inline namespaces to prevent you from accidentally
linking incompatible combinations together._
@ -121,14 +120,14 @@ linking incompatible combinations together._
<br>
# TOML Language Support
At any given time `toml++` aims to implement whatever the [most recently-released version] of TOML is, with the
addition of unreleased features from the [TOML master] and some sane cherry-picks from the
At any given time `toml++` aims to implement whatever the [most recently-released version] of TOML is, with opt-in
support for a number of unreleased features from the [TOML master] and some sane cherry-picks from the
[TOML issues list] where the discussion strongly indicates inclusion in a near-future release.
The library advertises the most recent numbered language version it fully supports via the preprocessor
defines `TOML_LANG_MAJOR`, `TOML_LANG_MINOR` and `TOML_LANG_PATCH`.
## 🔶 **Unreleased features:**
## 🟡 **Unreleased features:**
- [#516]: Allow newlines and trailing commas in inline tables
- [#562]: Allow hex floating-point values
- [#644]: Support `+` in key names
@ -136,8 +135,7 @@ defines `TOML_LANG_MAJOR`, `TOML_LANG_MINOR` and `TOML_LANG_PATCH`.
- [#687]: Relax bare key restrictions to allow additional unicode characters
- [#709]: Include an \xHH escape code sequence
> _Unreleased features can be disabled (and thus strict [TOML v1.0.0-rc.1] compliance enforced) by specifying
`TOML_UNRELEASED_FEATURES = 0` (see [Configuration](#Configuration))._
> _`#define TOML_UNRELEASED_FEATURES 1` to enable these features (see [Configuration](#Configuration))._
## 🟢 **TOML v1.0.0-rc.1:**
All features supported, including:
@ -179,6 +177,7 @@ though you're welcome to reach out via other means. In order of likely response
[homepage]: https://marzer.github.io/tomlplusplus/
[unreleased TOML language features]: #unreleased-toml-features
[most recently-released version]: https://github.com/toml-lang/toml/releases
[numbered version]: https://github.com/toml-lang/toml/releases
[char8_t]: https://en.cppreference.com/w/cpp/keyword/char8_t
[TOML master]: https://github.com/toml-lang/toml/blob/master/README.md
[TOML issues list]: https://github.com/toml-lang/toml/issues

View File

@ -345,15 +345,26 @@ EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = NO
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN=1 \
PREDEFINED = TOML_DOXYGEN=1 \
__cplusplus=201703L \
TOML_ALWAYS_INLINE=inline \
TOML_MAY_THROW= \
TOML_NODISCARD_CTOR= \
TOML_ALL_INLINE=0 \
TOML_IMPLEMENTATION=0 \
TOML_IMPLEMENTATION=1 \
TOML_EXTERNAL_LINKAGE= \
TOML_API= \
TOML_ABI_NAMESPACE_START(x)= \
TOML_ABI_NAMESPACE_END= \
TOML_GNU_ATTR(...)= \
TOML_PUSH_WARNINGS= \
TOML_DISABLE_SWITCH_WARNINGS= \
TOML_DISABLE_INIT_WARNINGS= \
TOML_DISABLE_VTABLE_WARNINGS= \
TOML_DISABLE_ALL_WARNINGS= \
TOML_POP_WARNINGS= \
__has_include(x)=0 \
__has_attribute(x)=0 \
TOML_ASYMMETRICAL_EQUALITY_OPS(...)= \
__cpp_lib_char8_t=201811L
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
@ -8,6 +9,7 @@
//# they're listed explicitly here because this file
//# is used as the source for generate_single_header.py.
#include "toml_preprocessor.h"
#include "toml_common.h"
#include "toml_date_time.h"
#include "toml_print_to_stream.h"
@ -21,22 +23,27 @@
#include "toml_formatter.h"
#include "toml_default_formatter.h"
#include "toml_json_formatter.h"
#if TOML_PARSER
#include "toml_parse_error.h"
#include "toml_utf8_streams.h"
#include "toml_parser.h"
#endif // TOML_PARSER
#if TOML_IMPLEMENTATION
#include "toml_node.hpp"
#include "toml_array.hpp"
#include "toml_table.hpp"
#include "toml_default_formatter.hpp"
#if TOML_PARSER
#include "toml_parser.hpp"
#endif // TOML_PARSER
#if !TOML_ALL_INLINE
#include "toml_instantiations.hpp"
#endif // !TOML_ALL_INLINE
#endif // TOML_IMPLEMENTATION
// macro hygiene
@ -80,9 +87,10 @@
#undef TOML_INTERNAL_LINKAGE
#undef TOML_INTERNAL_NAMESPACE
#undef TOML_COMPILER_EXCEPTIONS
#undef TOML_LAUNDER
#undef TOML_TRIVIAL_ABI
#undef TOML_ABI_NAMESPACES
#undef TOML_ABI_NAMESPACE_START
#undef TOML_ABI_NAMESPACE_END
#undef TOML_PARSER_TYPENAME
#endif
@ -111,7 +119,8 @@
/// It's header-only library so really all you have to do is clone
/// [the repository](https://github.com/marzer/tomlplusplus/) from GitHub and set your include paths.
/// There's some minor configuration you can do to customize some basic library functionality, but that's totally
/// optional. See the [README](https://github.com/marzer/tomlplusplus/blob/master/README.md) for more info.
/// optional.
/// \see \ref configuration
///
///////////////////////////////////////////////////////////////////////
///
@ -439,15 +448,15 @@
/// <strong>Step 2: Define `TOML_IMPLEMENTATION` before including `toml++` in one specific translation unit</strong>
///
/// \cpp
///
/// Additionally, if all you need to do is serialize some code-generated TOML and don't actually need the parser at all,
/// you can `#define TOML_PARSER 0`.
/// // some_code_file.cpp
///
/// #define TOML_IMPLEMENTATION
/// #include "global_header_that_includes_toml++.h"
/// \ecpp
///
/// Additionally, if all you need to do is serialize some code-generated TOML and don't actually need the parser at all,
/// you can `#define TOML_PARSER 0`.
///
///////////////////////////////////////////////////////////////////////
///
/// \section mainpage-contributing Contributing

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_value.h"
@ -802,9 +803,7 @@ namespace toml
{
return container_equality(lhs, rhs);
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::initializer_list<T>&, template <typename T>)
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::initializer_list<T>&, template <typename T>)
/// \brief Vector equality operator.
template <typename T>
@ -812,9 +811,7 @@ namespace toml
{
return container_equality(lhs, rhs);
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::vector<T>&, template <typename T>)
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::vector<T>&, template <typename T>)
/// \brief Flattens this array, recursively hoisting the contents of child arrays up into itself.
///

View File

@ -1,10 +1,12 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_array.h"
//# {{
#if !TOML_DOXYGEN
#if !defined(TOML_IMPLEMENTATION) || !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
@ -210,3 +212,6 @@ namespace toml
}
}
//# {{
#endif // !TOML_DOXYGEN
//# }}

View File

@ -1,318 +1,16 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
////////// CONFIGURATION
// clang-format off
#ifdef TOML_CONFIG_HEADER
#include TOML_CONFIG_HEADER
#endif
#if !defined(TOML_ALL_INLINE) || (defined(TOML_ALL_INLINE) && TOML_ALL_INLINE)
#undef TOML_ALL_INLINE
#define TOML_ALL_INLINE 1
#endif
#if defined(TOML_IMPLEMENTATION) || TOML_ALL_INLINE || defined(__INTELLISENSE__)
#undef TOML_IMPLEMENTATION
#define TOML_IMPLEMENTATION 1
#else
#define TOML_IMPLEMENTATION 0
#endif
#ifndef TOML_API
#define TOML_API
#endif
#ifndef TOML_CHAR_8_STRINGS
#define TOML_CHAR_8_STRINGS 0
#endif
#ifndef TOML_UNRELEASED_FEATURES
#define TOML_UNRELEASED_FEATURES 1
#endif
#ifndef TOML_LARGE_FILES
#define TOML_LARGE_FILES 0
#endif
#ifndef TOML_UNDEF_MACROS
#define TOML_UNDEF_MACROS 1
#endif
#ifndef TOML_PARSER
#define TOML_PARSER 1
#endif
// TOML_ASSERT
////////// COMPILER & ENVIRONMENT STUFF
#ifndef __cplusplus
#error toml++ is a C++ library.
#endif
#ifdef __clang__
#define TOML_PUSH_WARNINGS _Pragma("clang diagnostic push")
#define TOML_DISABLE_SWITCH_WARNINGS _Pragma("clang diagnostic ignored \"-Wswitch\"")
#define TOML_DISABLE_INIT_WARNINGS _Pragma("clang diagnostic ignored \"-Wmissing-field-initializers\"")
#define TOML_DISABLE_VTABLE_WARNINGS _Pragma("clang diagnostic ignored \"-Weverything\"") \
_Pragma("clang diagnostic ignored \"-Wweak-vtables\"")
#define TOML_DISABLE_ALL_WARNINGS _Pragma("clang diagnostic ignored \"-Weverything\"")
#define TOML_POP_WARNINGS _Pragma("clang diagnostic pop")
#define TOML_ASSUME(cond) __builtin_assume(cond)
#define TOML_UNREACHABLE __builtin_unreachable()
#define TOML_GNU_ATTR(...) __attribute__((__VA_ARGS__))
#if defined(_MSC_VER) // msvc compat mode
#ifdef __has_declspec_attribute
#if __has_declspec_attribute(novtable)
#define TOML_INTERFACE __declspec(novtable)
#endif
#if __has_declspec_attribute(empty_bases)
#define TOML_EMPTY_BASES __declspec(empty_bases)
#endif
#define TOML_ALWAYS_INLINE __forceinline
#define TOML_NEVER_INLINE __declspec(noinline)
#endif
#endif
#ifdef __has_attribute
#if !defined(TOML_ALWAYS_INLINE) && __has_attribute(always_inline)
#define TOML_ALWAYS_INLINE __attribute__((__always_inline__)) inline
#endif
#if !defined(TOML_NEVER_INLINE) && __has_attribute(noinline)
#define TOML_NEVER_INLINE __attribute__((__noinline__))
#endif
#if !defined(TOML_TRIVIAL_ABI) && __has_attribute(trivial_abi)
#define TOML_TRIVIAL_ABI __attribute__((__trivial_abi__))
#endif
#endif
#ifdef __EXCEPTIONS
#define TOML_COMPILER_EXCEPTIONS 1
#else
#define TOML_COMPILER_EXCEPTIONS 0
#endif
//floating-point from_chars and to_chars are not implemented in any version of clang as of 1/1/2020
#ifndef TOML_FLOAT_CHARCONV
#define TOML_FLOAT_CHARCONV 0
#endif
#elif defined(_MSC_VER) || (defined(__INTEL_COMPILER) && defined(__ICL))
#define TOML_CPP_VERSION _MSVC_LANG
#define TOML_PUSH_WARNINGS __pragma(warning(push))
#define TOML_DISABLE_SWITCH_WARNINGS __pragma(warning(disable: 4063))
#define TOML_DISABLE_ALL_WARNINGS __pragma(warning(pop)) \
__pragma(warning(push, 0))
#define TOML_POP_WARNINGS __pragma(warning(pop))
#define TOML_ALWAYS_INLINE __forceinline
#define TOML_NEVER_INLINE __declspec(noinline)
#define TOML_ASSUME(cond) __assume(cond)
#define TOML_UNREACHABLE __assume(0)
#define TOML_INTERFACE __declspec(novtable)
#define TOML_EMPTY_BASES __declspec(empty_bases)
#if !defined(TOML_RELOPS_REORDERING) && defined(__cpp_impl_three_way_comparison)
#define TOML_RELOPS_REORDERING 1
#endif
#ifdef _CPPUNWIND
#define TOML_COMPILER_EXCEPTIONS 1
#else
#define TOML_COMPILER_EXCEPTIONS 0
#endif
#elif defined(__GNUC__)
#define TOML_PUSH_WARNINGS _Pragma("GCC diagnostic push")
#define TOML_DISABLE_SWITCH_WARNINGS _Pragma("GCC diagnostic ignored \"-Wswitch\"")
#define TOML_DISABLE_INIT_WARNINGS _Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
_Pragma("GCC diagnostic ignored \"-Wuninitialized\"")
#define TOML_DISABLE_ALL_WARNINGS _Pragma("GCC diagnostic ignored \"-Wall\"") \
_Pragma("GCC diagnostic ignored \"-Wextra\"") \
_Pragma("GCC diagnostic ignored \"-Wchar-subscripts\"") \
_Pragma("GCC diagnostic ignored \"-Wtype-limits\"")
#define TOML_POP_WARNINGS _Pragma("GCC diagnostic pop")
#define TOML_GNU_ATTR(...) __attribute__((__VA_ARGS__))
#define TOML_ALWAYS_INLINE __attribute__((__always_inline__)) inline
#define TOML_NEVER_INLINE __attribute__((__noinline__))
#define TOML_UNREACHABLE __builtin_unreachable()
#if !defined(TOML_RELOPS_REORDERING) && defined(__cpp_impl_three_way_comparison)
#define TOML_RELOPS_REORDERING 1
#endif
#ifdef __cpp_exceptions
#define TOML_COMPILER_EXCEPTIONS 1
#else
#define TOML_COMPILER_EXCEPTIONS 0
#endif
// these pass the __has_attribute() test but cause warnings on if/else branches =/
#define TOML_LIKELY
#define TOML_UNLIKELY
// floating-point from_chars and to_chars are not implemented in any version of gcc as of 1/1/2020
#ifndef TOML_FLOAT_CHARCONV
#define TOML_FLOAT_CHARCONV 0
#endif
#endif
#ifndef TOML_CPP_VERSION
#define TOML_CPP_VERSION __cplusplus
#endif
#if TOML_CPP_VERSION < 201103L
#error toml++ requires C++17 or higher. For a TOML library supporting pre-C++11 see https://github.com/ToruNiina/Boost.toml
#elif TOML_CPP_VERSION < 201703L
#error toml++ requires C++17 or higher. For a TOML library supporting C++11 see https://github.com/skystrife/cpptoml
#elif TOML_CPP_VERSION >= 202600L
#define TOML_CPP 26
#elif TOML_CPP_VERSION >= 202300L
#define TOML_CPP 23
#elif TOML_CPP_VERSION >= 202002L
#define TOML_CPP 20
#elif TOML_CPP_VERSION >= 201703L
#define TOML_CPP 17
#endif
#ifndef TOML_COMPILER_EXCEPTIONS
#define TOML_COMPILER_EXCEPTIONS 1
#endif
#if TOML_COMPILER_EXCEPTIONS
#ifndef TOML_EXCEPTIONS
#define TOML_EXCEPTIONS 1
#endif
#else
#if defined(TOML_EXCEPTIONS) && TOML_EXCEPTIONS
#error TOML_EXCEPTIONS was explicitly enabled but exceptions are disabled/unsupported by the compiler.
#endif
#undef TOML_EXCEPTIONS
#define TOML_EXCEPTIONS 0
#endif
#if TOML_EXCEPTIONS
#define TOML_MAY_THROW
#else
#define TOML_MAY_THROW noexcept
#endif
#ifndef TOML_DISABLE_INIT_WARNINGS
#define TOML_DISABLE_INIT_WARNINGS
#endif
#ifndef TOML_INT_CHARCONV
#define TOML_INT_CHARCONV 1
#endif
#ifndef TOML_FLOAT_CHARCONV
#define TOML_FLOAT_CHARCONV 1
#endif
#if (TOML_INT_CHARCONV || TOML_FLOAT_CHARCONV) && !__has_include(<charconv>)
#undef TOML_INT_CHARCONV
#undef TOML_FLOAT_CHARCONV
#define TOML_INT_CHARCONV 0
#define TOML_FLOAT_CHARCONV 0
#endif
#ifndef TOML_PUSH_WARNINGS
#define TOML_PUSH_WARNINGS
#endif
#ifndef TOML_DISABLE_VTABLE_WARNINGS
#define TOML_DISABLE_VTABLE_WARNINGS
#endif
#ifndef TOML_DISABLE_ALL_WARNINGS
#define TOML_DISABLE_ALL_WARNINGS
#endif
#ifndef TOML_POP_WARNINGS
#define TOML_POP_WARNINGS
#endif
#ifndef TOML_GNU_ATTR
#define TOML_GNU_ATTR(...)
#endif
#ifndef TOML_INTERFACE
#define TOML_INTERFACE
#endif
#ifndef TOML_EMPTY_BASES
#define TOML_EMPTY_BASES
#endif
#ifndef TOML_ALWAYS_INLINE
#define TOML_ALWAYS_INLINE inline
#endif
#ifndef TOML_NEVER_INLINE
#define TOML_NEVER_INLINE
#endif
#ifndef TOML_ASSUME
#define TOML_ASSUME(cond) (void)0
#endif
#ifndef TOML_UNREACHABLE
#define TOML_UNREACHABLE TOML_ASSERT(false)
#endif
#define TOML_NO_DEFAULT_CASE default: TOML_UNREACHABLE
#ifdef __cpp_consteval
#define TOML_CONSTEVAL consteval
#else
#define TOML_CONSTEVAL constexpr
#endif
#ifndef __INTELLISENSE__
#if !defined(TOML_LIKELY) && __has_cpp_attribute(likely)
#define TOML_LIKELY [[likely]]
#endif
#if !defined(TOML_UNLIKELY) && __has_cpp_attribute(unlikely)
#define TOML_UNLIKELY [[unlikely]]
#endif
#if __has_cpp_attribute(nodiscard) >= 201907L
#define TOML_NODISCARD_CTOR [[nodiscard]]
#endif
#endif //__INTELLISENSE__
#ifndef TOML_LIKELY
#define TOML_LIKELY
#endif
#ifndef TOML_UNLIKELY
#define TOML_UNLIKELY
#endif
#ifndef TOML_TRIVIAL_ABI
#define TOML_TRIVIAL_ABI
#endif
#ifndef TOML_NODISCARD_CTOR
#define TOML_NODISCARD_CTOR
#endif
#ifndef TOML_RELOPS_REORDERING
#define TOML_RELOPS_REORDERING 0
#endif
#if TOML_RELOPS_REORDERING
#define TOML_ASYMMETRICAL_EQUALITY_OPS(...)
#else
#define TOML_ASYMMETRICAL_EQUALITY_OPS(LHS, RHS, ...) \
__VA_ARGS__ [[nodiscard]] friend bool operator == (RHS rhs, LHS lhs) noexcept { return lhs == rhs; } \
__VA_ARGS__ [[nodiscard]] friend bool operator != (LHS lhs, RHS rhs) noexcept { return !(lhs == rhs); } \
__VA_ARGS__ [[nodiscard]] friend bool operator != (RHS rhs, LHS lhs) noexcept { return !(lhs == rhs); }
#endif
#if TOML_ALL_INLINE
#define TOML_EXTERNAL_LINKAGE inline
#define TOML_INTERNAL_LINKAGE inline
#define TOML_INTERNAL_NAMESPACE toml::impl
#else
#define TOML_EXTERNAL_LINKAGE
#define TOML_INTERNAL_LINKAGE static
#define TOML_INTERNAL_NAMESPACE
#endif
#include "toml_version.h"
//#{{
#define TOML_LIB_SINGLE_HEADER 0
//#}}
#define TOML_MAKE_VERSION(maj, min, rev) \
((maj) * 1000 + (min) * 25 + (rev))
#if TOML_UNRELEASED_FEATURES
#define TOML_LANG_EFFECTIVE_VERSION \
TOML_MAKE_VERSION(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH+1)
#else
#define TOML_LANG_EFFECTIVE_VERSION \
TOML_MAKE_VERSION(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH)
#endif
#define TOML_LANG_HIGHER_THAN(maj, min, rev) \
(TOML_LANG_EFFECTIVE_VERSION > TOML_MAKE_VERSION(maj, min, rev))
#define TOML_LANG_AT_LEAST(maj, min, rev) \
(TOML_LANG_EFFECTIVE_VERSION >= TOML_MAKE_VERSION(maj, min, rev))
#define TOML_LANG_UNRELEASED \
TOML_LANG_HIGHER_THAN(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH)
#include "toml_preprocessor.h"
////////// INCLUDES
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
#if __has_include(<version>)
#include <version>
#endif
@ -335,33 +33,14 @@ TOML_DISABLE_ALL_WARNINGS
#define TOML_ASSERT(expr) assert(expr)
#endif
#endif
TOML_POP_WARNINGS
#if TOML_CHAR_8_STRINGS
#ifndef __cpp_lib_char8_t
#error toml++ requires implementation support to use char8_t strings, but yours does not provide it.
#endif
#define TOML_STRING_PREFIX_1(S) u8##S
#define TOML_STRING_PREFIX(S) TOML_STRING_PREFIX_1(S)
#else
#define TOML_STRING_PREFIX(S) S
#endif
#ifdef __cpp_lib_launder
#define TOML_LAUNDER(x) std::launder(x)
#else
#define TOML_LAUNDER(x) x
#endif
#if !defined(DOXYGEN) && !defined(__INTELLISENSE__)
#define TOML_ABI_NAMESPACES 1
#else
#define TOML_ABI_NAMESPACES 0
#if TOML_CHAR_8_STRINGS && !defined(__cpp_lib_char8_t)
#error toml++ requires implementation support to use char8_t strings, but yours does not provide it.
#endif
////////// FORWARD DECLARATIONS & TYPEDEFS
// clang-format on
/// \brief The root namespace for all toml++ functions and types.
namespace toml
@ -388,20 +67,20 @@ namespace toml
#else
/// \brief The base character type for keys and string values.
/// \remarks This will be an alias for char8_t if `TOML_CHAR_8_STRINGS` is `1`.
/// \remarks This will be an alias for char8_t if #TOML_CHAR_8_STRINGS is enabled.
using string_char = char;
/// \brief The string type for keys and string values.
/// \remarks This will be an alias for std::u8string if `TOML_CHAR_8_STRINGS` is `1`.
/// \remarks This will be an alias for std::u8string if #TOML_CHAR_8_STRINGS is enabled.
using string = std::string;
/// \brief The string type for keys and string values.
/// \remarks This will be an alias for std::u8string_view if `TOML_CHAR_8_STRINGS` is `1`.
/// \remarks This will be an alias for std::u8string_view if #TOML_CHAR_8_STRINGS is enabled.
using string_view = std::string_view;
#endif
#ifndef DOXYGEN
#if !TOML_DOXYGEN
// foward declarations are hidden from doxygen
// because they fuck it up =/
@ -416,21 +95,17 @@ namespace toml
template <typename> class default_formatter;
template <typename> class json_formatter;
#if TOML_ABI_NAMESPACES
#ifdef TOML_OPTIONAL_TYPE
inline namespace abi_custopt {
#else
inline namespace abi_stdopt {
#endif
#ifdef TOML_OPTIONAL_TYPE
TOML_ABI_NAMESPACE_START(custopt)
#else
TOML_ABI_NAMESPACE_START(stdopt)
#endif
struct date_time;
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_OPTIONAL_TYPE
#endif
TOML_ABI_NAMESPACE_END // TOML_OPTIONAL_TYPE
#endif // !DOXYGEN
#endif // !TOML_DOXYGEN
/// \brief TOML node type identifiers.
enum class node_type : uint8_t
@ -457,7 +132,7 @@ namespace toml
/// \brief The 'optional' type used throughout the library.
///
/// \remarks By default this will be a simple alias for std::optional, but you can change the optional type
/// used by the library by setting `TOML_OPTIONAL_TYPE`.
/// used by the library by defining #TOML_OPTIONAL_TYPE.
template <typename T>
using optional = std::optional<T>;
@ -470,7 +145,7 @@ namespace toml
#else
/// \brief The integer type used to tally line numbers and columns.
/// \remarks This will be an alias for uint32_t if `TOML_LARGE_FILES` is `1`.
/// \remarks This will be an alias for uint32_t if #TOML_LARGE_FILES is enabled.
using source_index = uint16_t;
#endif
@ -478,12 +153,10 @@ namespace toml
/// \brief A pointer to a shared string resource containing a source path.
using source_path_ptr = std::shared_ptr<const std::string>;
#if TOML_ABI_NAMESPACES
#if TOML_LARGE_FILES
inline namespace abi_lf {
#else
inline namespace abi_sf {
#endif
#if TOML_LARGE_FILES
TOML_ABI_NAMESPACE_START(lf)
#else
TOML_ABI_NAMESPACE_START(sf)
#endif
/// \brief A source document line-and-column pair.
@ -601,9 +274,7 @@ namespace toml
source_path_ptr path;
};
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_LARGE_FILES
#endif
TOML_ABI_NAMESPACE_END // TOML_LARGE_FILES
}
namespace toml::impl
@ -647,10 +318,10 @@ namespace toml::impl
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_impl_ex {
TOML_ABI_NAMESPACE_START(impl_ex)
#define TOML_PARSER_TYPENAME ::toml::impl::abi_impl_ex::parser
#else
inline namespace abi_impl_noex {
TOML_ABI_NAMESPACE_START(impl_noex)
#define TOML_PARSER_TYPENAME ::toml::impl::abi_impl_noex::parser
#endif
#else
@ -659,9 +330,7 @@ namespace toml::impl
class parser;
#if TOML_ABI_NAMESPACES
}
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
template <typename T>
inline constexpr bool is_value =

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_common.h"
@ -8,7 +9,7 @@
namespace toml
{
/// \brief A local date.
struct TOML_TRIVIAL_ABI date final
struct TOML_TRIVIAL_ABI date
{
/// \brief The year component.
uint16_t year;
@ -97,7 +98,7 @@ namespace toml
#endif
/// \brief A local time-of-day.
struct TOML_TRIVIAL_ABI time final
struct TOML_TRIVIAL_ABI time
{
/// \brief The hour component, from 0 - 23.
uint8_t hour;
@ -190,7 +191,7 @@ namespace toml
#endif
/// \brief A timezone offset.
struct TOML_TRIVIAL_ABI time_offset final
struct TOML_TRIVIAL_ABI time_offset
{
/// \brief Offset from UTC+0, in minutes.
int16_t minutes;
@ -296,16 +297,14 @@ namespace toml
extern template TOML_API std::ostream& operator << (std::ostream&, const time_offset&);
#endif
#if TOML_ABI_NAMESPACES
#ifdef TOML_OPTIONAL_TYPE
inline namespace abi_custopt {
#else
inline namespace abi_stdopt {
#endif
#ifdef TOML_OPTIONAL_TYPE
TOML_ABI_NAMESPACE_START(custopt)
#else
TOML_ABI_NAMESPACE_START(stdopt)
#endif
/// \brief A date-time.
struct date_time final
struct date_time
{
/// \brief The date component.
toml::date date;
@ -405,9 +404,7 @@ namespace toml
}
};
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_OPTIONAL_TYPE
#endif
TOML_ABI_NAMESPACE_END // TOML_OPTIONAL_TYPE
/// \brief Prints a date_time out to a stream in RFC 3339 format.
/// \detail \cpp

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_formatter.h"

View File

@ -1,10 +1,12 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_default_formatter.h"
//# {{
#if !TOML_DOXYGEN
#if !defined(TOML_IMPLEMENTATION) || !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
@ -144,3 +146,7 @@ namespace toml::impl
return (default_formatter_inline_columns(node) + starting_column_bias) > 120_sz;
}
}
//# {{
#endif // !TOML_DOXYGEN
//# }}

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_print_to_stream.h"

View File

@ -1,10 +1,12 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_common.h"
//# {{
#include "toml_preprocessor.h"
#if !TOML_DOXYGEN
#if !defined(TOML_IMPLEMENTATION) || !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
@ -83,12 +85,10 @@ namespace toml
template TOML_API std::ostream& operator << (std::ostream&, const parse_error&);
// parse() and parse_file()
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_parse_ex {
#else
inline namespace abi_parse_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(parse_ex)
#else
TOML_ABI_NAMESPACE_START(parse_noex)
#endif
template TOML_API parse_result parse(std::istream&, std::string_view) TOML_MAY_THROW;
template TOML_API parse_result parse(std::istream&, std::string&&) TOML_MAY_THROW;
@ -96,9 +96,11 @@ namespace toml
#ifdef __cpp_lib_char8_t
template TOML_API parse_result parse_file(std::u8string_view) TOML_MAY_THROW;
#endif
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
#endif // TOML_PARSER
}
//# {{
#endif // !TOML_DOXYGEN
//# }}

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_formatter.h"

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_common.h"

View File

@ -1,10 +1,12 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_node.h"
//# {{
#if !TOML_DOXYGEN
#if !defined(TOML_IMPLEMENTATION) || !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
@ -62,3 +64,6 @@ namespace toml
TOML_EXTERNAL_LINKAGE const source_region& node::source() const noexcept { return source_; }
}
//# {{
#endif // !TOML_DOXYGEN
//# }}

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_table.h"
@ -56,7 +57,7 @@ namespace toml
/// product[2]:
/// \eout
template <typename T>
class TOML_API node_view final
class TOML_API TOML_TRIVIAL_ABI node_view
{
public:
using viewed_type = T;
@ -267,9 +268,7 @@ namespace toml
const auto tbl = lhs.as<table>();
return tbl && *tbl == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const table&, )
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const table&, )
/// \brief Returns true if the viewed node is an array with the same contents as RHS.
[[nodiscard]] friend bool operator == (const node_view& lhs, const array& rhs) noexcept
@ -279,9 +278,7 @@ namespace toml
const auto arr = lhs.as<array>();
return arr && *arr == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const array&, )
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const array&, )
/// \brief Returns true if the viewed node is a value with the same value as RHS.
template <typename U>
@ -292,9 +289,7 @@ namespace toml
const auto val = lhs.as<U>();
return val && *val == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const toml::value<U>&, template <typename U>)
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const toml::value<U>&, template <typename U>)
/// \brief Returns true if the viewed node is a value with the same value as RHS.
template <typename U, typename = std::enable_if_t<impl::is_value_or_promotable<U>>>
@ -303,13 +298,11 @@ namespace toml
const auto val = lhs.as<impl::promoted<U>>();
return val && *val == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(
TOML_ASYMMETRICAL_EQUALITY_OPS(
const node_view&,
const U&,
template <typename U, typename = std::enable_if_t<impl::is_value_or_promotable<U>>>
)
#endif
)
/// \brief Returns true if the viewed node is an array with the same contents as the RHS initializer list.
template <typename U>
@ -318,9 +311,7 @@ namespace toml
const auto arr = lhs.as<array>();
return arr && *arr == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const std::initializer_list<U>&, template <typename U>)
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const std::initializer_list<U>&, template <typename U>)
/// \brief Returns true if the viewed node is an array with the same contents as the RHS vector.
template <typename U>
@ -329,9 +320,7 @@ namespace toml
const auto arr = lhs.as<array>();
return arr && *arr == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const std::vector<U>&, template <typename U>)
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const std::vector<U>&, template <typename U>)
/// \brief Returns a view of the selected subnode.
///

View File

@ -1,10 +1,11 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_common.h"
//# {{
#include "toml_preprocessor.h"
#if !TOML_PARSER
#error This header cannot not be included when TOML_PARSER is disabled.
#endif
@ -22,20 +23,15 @@ TOML_DISABLE_VTABLE_WARNINGS
namespace toml
{
#if TOML_ABI_NAMESPACES
#if TOML_LARGE_FILES
inline namespace abi_lf {
#else
inline namespace abi_sf {
#endif
#if TOML_EXCEPTIONS
inline namespace abi_ex {
#else
inline namespace abi_noex {
#endif
#if TOML_LARGE_FILES
TOML_ABI_NAMESPACE_START(lf)
#else
TOML_ABI_NAMESPACE_START(sf)
#endif
#if defined(DOXYGEN) || !TOML_EXCEPTIONS
#if TOML_DOXYGEN || !TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(noex)
/// \brief An error thrown/returned when parsing fails.
///
@ -83,6 +79,8 @@ namespace toml
#else
TOML_ABI_NAMESPACE_START(ex)
class parse_error final
: public std::runtime_error
{
@ -125,10 +123,8 @@ namespace toml
#endif
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
} //end abi namespace for TOML_LARGE_FILES
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_END // TOML_LARGE_FILES
/// \brief Prints a parse_error to a stream.
///

View File

@ -1,10 +1,11 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_common.h"
//# {{
#include "toml_preprocessor.h"
#if !TOML_PARSER
#error This header cannot not be included when TOML_PARSER is disabled.
#endif
@ -14,12 +15,16 @@
namespace toml
{
#if defined(DOXYGEN) || !TOML_EXCEPTIONS
#if TOML_DOXYGEN || !TOML_EXCEPTIONS
#if TOML_ABI_NAMESPACES
inline namespace abi_parse_noex {
#ifdef __cpp_lib_launder
#define TOML_LAUNDER(x) std::launder(x)
#else
#define TOML_LAUNDER(x) x
#endif
TOML_ABI_NAMESPACE_START(parse_noex)
/// \brief The result of a parsing operation.
///
/// \detail A parse_result is effectively a discriminated union containing either a toml::table
@ -254,9 +259,9 @@ namespace toml
}
};
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END
#undef TOML_LAUNDER
#else
@ -268,31 +273,25 @@ namespace toml
namespace toml::impl
{
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_impl_ex {
#else
inline namespace abi_impl_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(impl_ex)
#else
TOML_ABI_NAMESPACE_START(impl_noex)
#endif
[[nodiscard]] TOML_API
parse_result do_parse(utf8_reader_interface&&) TOML_MAY_THROW;
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
}
namespace toml
{
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_parse_ex {
#else
inline namespace abi_parse_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(parse_ex)
#else
TOML_ABI_NAMESPACE_START(parse_noex)
#endif
/// \brief Parses a TOML document from a string view.
@ -524,9 +523,7 @@ namespace toml
return parse_file(std::basic_string_view<Char>{ file_path });
}
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
/// \brief Convenience literal operators for working with TOML++.
///
@ -548,12 +545,10 @@ namespace toml
///
inline namespace literals
{
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_lit_ex {
#else
inline namespace abi_lit_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(lit_ex)
#else
TOML_ABI_NAMESPACE_START(lit_noex)
#endif
/// \brief Parses TOML data from a string.
@ -608,9 +603,7 @@ namespace toml
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
}
}

View File

@ -1,10 +1,12 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_parser.h"
//# {{
#if !TOML_DOXYGEN
#if !defined(TOML_IMPLEMENTATION) || !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
@ -170,12 +172,10 @@ namespace toml::impl
#define TOML_NOT_EOF TOML_ASSERT(cp != nullptr)
#endif
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_impl_ex {
#else
inline namespace abi_impl_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(impl_ex)
#else
TOML_ABI_NAMESPACE_START(impl_noex)
#endif
class parser final
@ -3231,10 +3231,7 @@ namespace toml::impl
return impl::parser{ std::move(reader) };
}
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
#undef TOML_ERROR_CHECK
#undef TOML_ERROR
#undef TOML_NORETURN
@ -3243,12 +3240,10 @@ namespace toml::impl
namespace toml
{
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_parse_ex {
#else
inline namespace abi_parse_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(parse_ex)
#else
TOML_ABI_NAMESPACE_START(parse_noex)
#endif
TOML_API
@ -3283,18 +3278,14 @@ namespace toml
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
inline namespace literals
{
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_lit_ex {
#else
inline namespace abi_lit_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(lit_ex)
#else
TOML_ABI_NAMESPACE_START(lit_noex)
#endif
TOML_API
@ -3315,9 +3306,10 @@ namespace toml
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
}
}
//# {{
#endif // !TOML_DOXYGEN
//# }}

View File

@ -0,0 +1,483 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
// clang-format off
////////// CONFIGURATION
#ifdef TOML_CONFIG_HEADER
#include TOML_CONFIG_HEADER
#endif
#if !defined(TOML_ALL_INLINE) || (defined(TOML_ALL_INLINE) && TOML_ALL_INLINE)
#undef TOML_ALL_INLINE
#define TOML_ALL_INLINE 1
#endif
#if defined(TOML_IMPLEMENTATION) || TOML_ALL_INLINE || defined(__INTELLISENSE__)
#undef TOML_IMPLEMENTATION
#define TOML_IMPLEMENTATION 1
#else
#define TOML_IMPLEMENTATION 0
#endif
#ifndef TOML_API
#define TOML_API
#endif
#ifndef TOML_CHAR_8_STRINGS
#define TOML_CHAR_8_STRINGS 0
#endif
#ifndef TOML_UNRELEASED_FEATURES
#define TOML_UNRELEASED_FEATURES 0
#endif
#ifndef TOML_LARGE_FILES
#define TOML_LARGE_FILES 0
#endif
#ifndef TOML_UNDEF_MACROS
#define TOML_UNDEF_MACROS 1
#endif
#ifndef TOML_PARSER
#define TOML_PARSER 1
#endif
////////// COMPILER & ENVIRONMENT
#ifndef TOML_DOXYGEN
#define TOML_DOXYGEN 0
#endif
#ifndef __cplusplus
#error toml++ is a C++ library.
#endif
#ifdef __clang__
#define TOML_PUSH_WARNINGS _Pragma("clang diagnostic push")
#define TOML_DISABLE_SWITCH_WARNINGS _Pragma("clang diagnostic ignored \"-Wswitch\"")
#define TOML_DISABLE_INIT_WARNINGS _Pragma("clang diagnostic ignored \"-Wmissing-field-initializers\"")
#define TOML_DISABLE_VTABLE_WARNINGS _Pragma("clang diagnostic ignored \"-Weverything\"") \
_Pragma("clang diagnostic ignored \"-Wweak-vtables\"")
#define TOML_DISABLE_ALL_WARNINGS _Pragma("clang diagnostic ignored \"-Weverything\"")
#define TOML_POP_WARNINGS _Pragma("clang diagnostic pop")
#define TOML_ASSUME(cond) __builtin_assume(cond)
#define TOML_UNREACHABLE __builtin_unreachable()
#define TOML_GNU_ATTR(...) __attribute__((__VA_ARGS__))
#if defined(_MSC_VER) // msvc compat mode
#ifdef __has_declspec_attribute
#if __has_declspec_attribute(novtable)
#define TOML_INTERFACE __declspec(novtable)
#endif
#if __has_declspec_attribute(empty_bases)
#define TOML_EMPTY_BASES __declspec(empty_bases)
#endif
#define TOML_ALWAYS_INLINE __forceinline
#define TOML_NEVER_INLINE __declspec(noinline)
#endif
#endif
#ifdef __has_attribute
#if !defined(TOML_ALWAYS_INLINE) && __has_attribute(always_inline)
#define TOML_ALWAYS_INLINE __attribute__((__always_inline__)) inline
#endif
#if !defined(TOML_NEVER_INLINE) && __has_attribute(noinline)
#define TOML_NEVER_INLINE __attribute__((__noinline__))
#endif
#if !defined(TOML_TRIVIAL_ABI) && __has_attribute(trivial_abi)
#define TOML_TRIVIAL_ABI __attribute__((__trivial_abi__))
#endif
#endif
#ifdef __EXCEPTIONS
#define TOML_COMPILER_EXCEPTIONS 1
#else
#define TOML_COMPILER_EXCEPTIONS 0
#endif
//floating-point from_chars and to_chars are not implemented in any version of clang as of 1/1/2020
#ifndef TOML_FLOAT_CHARCONV
#define TOML_FLOAT_CHARCONV 0
#endif
#elif defined(_MSC_VER) || (defined(__INTEL_COMPILER) && defined(__ICL))
#define TOML_CPP_VERSION _MSVC_LANG
#define TOML_PUSH_WARNINGS __pragma(warning(push))
#define TOML_DISABLE_SWITCH_WARNINGS __pragma(warning(disable: 4063))
#define TOML_DISABLE_ALL_WARNINGS __pragma(warning(pop)) \
__pragma(warning(push, 0))
#define TOML_POP_WARNINGS __pragma(warning(pop))
#define TOML_ALWAYS_INLINE __forceinline
#define TOML_NEVER_INLINE __declspec(noinline)
#define TOML_ASSUME(cond) __assume(cond)
#define TOML_UNREACHABLE __assume(0)
#define TOML_INTERFACE __declspec(novtable)
#define TOML_EMPTY_BASES __declspec(empty_bases)
#if !defined(TOML_RELOPS_REORDERING) && defined(__cpp_impl_three_way_comparison)
#define TOML_RELOPS_REORDERING 1
#endif
#ifdef _CPPUNWIND
#define TOML_COMPILER_EXCEPTIONS 1
#else
#define TOML_COMPILER_EXCEPTIONS 0
#endif
#elif defined(__GNUC__)
#define TOML_PUSH_WARNINGS _Pragma("GCC diagnostic push")
#define TOML_DISABLE_SWITCH_WARNINGS _Pragma("GCC diagnostic ignored \"-Wswitch\"")
#define TOML_DISABLE_INIT_WARNINGS _Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
_Pragma("GCC diagnostic ignored \"-Wuninitialized\"")
#define TOML_DISABLE_ALL_WARNINGS _Pragma("GCC diagnostic ignored \"-Wall\"") \
_Pragma("GCC diagnostic ignored \"-Wextra\"") \
_Pragma("GCC diagnostic ignored \"-Wchar-subscripts\"") \
_Pragma("GCC diagnostic ignored \"-Wtype-limits\"")
#define TOML_POP_WARNINGS _Pragma("GCC diagnostic pop")
#define TOML_GNU_ATTR(...) __attribute__((__VA_ARGS__))
#define TOML_ALWAYS_INLINE __attribute__((__always_inline__)) inline
#define TOML_NEVER_INLINE __attribute__((__noinline__))
#define TOML_UNREACHABLE __builtin_unreachable()
#if !defined(TOML_RELOPS_REORDERING) && defined(__cpp_impl_three_way_comparison)
#define TOML_RELOPS_REORDERING 1
#endif
#ifdef __cpp_exceptions
#define TOML_COMPILER_EXCEPTIONS 1
#else
#define TOML_COMPILER_EXCEPTIONS 0
#endif
// these pass the __has_attribute() test but cause warnings on if/else branches =/
#define TOML_LIKELY
#define TOML_UNLIKELY
// floating-point from_chars and to_chars are not implemented in any version of gcc as of 1/1/2020
#ifndef TOML_FLOAT_CHARCONV
#define TOML_FLOAT_CHARCONV 0
#endif
#endif
#ifndef TOML_CPP_VERSION
#define TOML_CPP_VERSION __cplusplus
#endif
#if TOML_CPP_VERSION < 201103L
#error toml++ requires C++17 or higher. For a TOML library supporting pre-C++11 see https://github.com/ToruNiina/Boost.toml
#elif TOML_CPP_VERSION < 201703L
#error toml++ requires C++17 or higher. For a TOML library supporting C++11 see https://github.com/skystrife/cpptoml
#elif TOML_CPP_VERSION >= 202600L
#define TOML_CPP 26
#elif TOML_CPP_VERSION >= 202300L
#define TOML_CPP 23
#elif TOML_CPP_VERSION >= 202002L
#define TOML_CPP 20
#elif TOML_CPP_VERSION >= 201703L
#define TOML_CPP 17
#endif
#ifndef TOML_COMPILER_EXCEPTIONS
#define TOML_COMPILER_EXCEPTIONS 1
#endif
#if TOML_COMPILER_EXCEPTIONS
#ifndef TOML_EXCEPTIONS
#define TOML_EXCEPTIONS 1
#endif
#else
#if defined(TOML_EXCEPTIONS) && TOML_EXCEPTIONS
#error TOML_EXCEPTIONS was explicitly enabled but exceptions are disabled/unsupported by the compiler.
#endif
#undef TOML_EXCEPTIONS
#define TOML_EXCEPTIONS 0
#endif
#if TOML_EXCEPTIONS
#define TOML_MAY_THROW
#else
#define TOML_MAY_THROW noexcept
#endif
#ifndef TOML_INT_CHARCONV
#define TOML_INT_CHARCONV 1
#endif
#ifndef TOML_FLOAT_CHARCONV
#define TOML_FLOAT_CHARCONV 1
#endif
#if (TOML_INT_CHARCONV || TOML_FLOAT_CHARCONV) && !__has_include(<charconv>)
#undef TOML_INT_CHARCONV
#undef TOML_FLOAT_CHARCONV
#define TOML_INT_CHARCONV 0
#define TOML_FLOAT_CHARCONV 0
#endif
#ifndef TOML_PUSH_WARNINGS
#define TOML_PUSH_WARNINGS
#endif
#ifndef TOML_DISABLE_SWITCH_WARNINGS
#define TOML_DISABLE_SWITCH_WARNINGS
#endif
#ifndef TOML_DISABLE_INIT_WARNINGS
#define TOML_DISABLE_INIT_WARNINGS
#endif
#ifndef TOML_DISABLE_VTABLE_WARNINGS
#define TOML_DISABLE_VTABLE_WARNINGS
#endif
#ifndef TOML_DISABLE_ALL_WARNINGS
#define TOML_DISABLE_ALL_WARNINGS
#endif
#ifndef TOML_POP_WARNINGS
#define TOML_POP_WARNINGS
#endif
#ifndef TOML_GNU_ATTR
#define TOML_GNU_ATTR(...)
#endif
#ifndef TOML_INTERFACE
#define TOML_INTERFACE
#endif
#ifndef TOML_EMPTY_BASES
#define TOML_EMPTY_BASES
#endif
#ifndef TOML_ALWAYS_INLINE
#define TOML_ALWAYS_INLINE inline
#endif
#ifndef TOML_NEVER_INLINE
#define TOML_NEVER_INLINE
#endif
#ifndef TOML_ASSUME
#define TOML_ASSUME(cond) (void)0
#endif
#ifndef TOML_UNREACHABLE
#define TOML_UNREACHABLE TOML_ASSERT(false)
#endif
#define TOML_NO_DEFAULT_CASE default: TOML_UNREACHABLE
#ifdef __cpp_consteval
#define TOML_CONSTEVAL consteval
#else
#define TOML_CONSTEVAL constexpr
#endif
#if !TOML_DOXYGEN && !defined(__INTELLISENSE__)
#if !defined(TOML_LIKELY) && __has_cpp_attribute(likely)
#define TOML_LIKELY [[likely]]
#endif
#if !defined(TOML_UNLIKELY) && __has_cpp_attribute(unlikely)
#define TOML_UNLIKELY [[unlikely]]
#endif
#if __has_cpp_attribute(nodiscard) >= 201907L
#define TOML_NODISCARD_CTOR [[nodiscard]]
#endif
#endif
#ifndef TOML_LIKELY
#define TOML_LIKELY
#endif
#ifndef TOML_UNLIKELY
#define TOML_UNLIKELY
#endif
#ifndef TOML_NODISCARD_CTOR
#define TOML_NODISCARD_CTOR
#endif
#ifndef TOML_TRIVIAL_ABI
#define TOML_TRIVIAL_ABI
#endif
#ifndef TOML_RELOPS_REORDERING
#define TOML_RELOPS_REORDERING 0
#endif
#if TOML_RELOPS_REORDERING
#define TOML_ASYMMETRICAL_EQUALITY_OPS(...)
#else
#define TOML_ASYMMETRICAL_EQUALITY_OPS(LHS, RHS, ...) \
__VA_ARGS__ [[nodiscard]] friend bool operator == (RHS rhs, LHS lhs) noexcept { return lhs == rhs; } \
__VA_ARGS__ [[nodiscard]] friend bool operator != (LHS lhs, RHS rhs) noexcept { return !(lhs == rhs); } \
__VA_ARGS__ [[nodiscard]] friend bool operator != (RHS rhs, LHS lhs) noexcept { return !(lhs == rhs); }
#endif
#if TOML_ALL_INLINE
#define TOML_EXTERNAL_LINKAGE inline
#define TOML_INTERNAL_LINKAGE inline
#define TOML_INTERNAL_NAMESPACE toml::impl
#else
#define TOML_EXTERNAL_LINKAGE
#define TOML_INTERNAL_LINKAGE static
#define TOML_INTERNAL_NAMESPACE
#endif
#include "toml_version.h"
//# {{
#define TOML_LIB_SINGLE_HEADER 0
//# }}
#define TOML_MAKE_VERSION(maj, min, rev) \
((maj) * 1000 + (min) * 25 + (rev))
#if TOML_UNRELEASED_FEATURES
#define TOML_LANG_EFFECTIVE_VERSION \
TOML_MAKE_VERSION(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH+1)
#else
#define TOML_LANG_EFFECTIVE_VERSION \
TOML_MAKE_VERSION(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH)
#endif
#define TOML_LANG_HIGHER_THAN(maj, min, rev) \
(TOML_LANG_EFFECTIVE_VERSION > TOML_MAKE_VERSION(maj, min, rev))
#define TOML_LANG_AT_LEAST(maj, min, rev) \
(TOML_LANG_EFFECTIVE_VERSION >= TOML_MAKE_VERSION(maj, min, rev))
#define TOML_LANG_UNRELEASED \
TOML_LANG_HIGHER_THAN(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH)
#if TOML_DOXYGEN || defined(__INTELLISENSE__)
#define TOML_ABI_NAMESPACES 0
#define TOML_ABI_NAMESPACE_START(name)
#define TOML_ABI_NAMESPACE_END
#else
#define TOML_ABI_NAMESPACES 1
#define TOML_ABI_NAMESPACE_START(name) inline namespace abi_##name {
#define TOML_ABI_NAMESPACE_END }
#endif
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
#ifndef TOML_ASSERT
#ifdef NDEBUG
#define TOML_ASSERT(expr) (void)0
#else
#include <cassert>
#define TOML_ASSERT(expr) assert(expr)
#endif
#endif
TOML_POP_WARNINGS
#if TOML_CHAR_8_STRINGS
#ifndef __cpp_lib_char8_t
#error toml++ requires implementation support to use char8_t strings, but yours does not provide it.
#endif
#define TOML_STRING_PREFIX_1(S) u8##S
#define TOML_STRING_PREFIX(S) TOML_STRING_PREFIX_1(S)
#else
#define TOML_STRING_PREFIX(S) S
#endif
//# {{
#if TOML_DOXYGEN
/// \addtogroup configuration Library Configuration
/// \brief Preprocessor macros for configuring library functionality.
/// \detail Define these before including `toml++` to alter the way it functions.
/// \remarks Some of these options have ABI implications; inline namespaces are used to prevent
/// you from trying to link incompatible combinations together.
/// @{
/// \def TOML_ALL_INLINE
/// \brief Sets whether the library is entirely inline.
/// \detail Defaults to `1`.
/// \remark Disabling this means that you must define `TOML_IMPLEMENTATION` in
/// <strong><em>exactly one</em></strong> translation unit in your project:
/// \cpp
/// // global_header_that_includes_toml++.h
/// #define TOML_ALL_INLINE 0
/// #include <toml.hpp>
///
/// // some_code_file.cpp
/// #define TOML_IMPLEMENTATION
/// #include "global_header_that_includes_toml++.h"
/// \ecpp
#define TOML_API
/// \def TOML_API
/// \brief An annotation to add to public symbols.
/// \detail Not defined by default.
/// \remark You'd override this with `__declspec(dllexport)` if you were building the library
/// into the public API of a DLL on Windows.
/// \def TOML_ASSERT(expr)
/// \brief Sets the assert function used by the library.
/// \detail Defaults to the standard C `assert()`.
/// \def TOML_CHAR_8_STRINGS
/// \brief Uses C++20 char8_t-based strings as the toml string data type.
/// \detail Defaults to `0`.
#define TOML_CONFIG_HEADER
/// \def TOML_CONFIG_HEADER
/// \brief An additional header to include before any other `toml++` header files.
/// \detail Not defined by default.
/// \def TOML_EXCEPTIONS
/// \brief Sets whether the library uses exceptions to report parsing failures.
/// \detail Defaults to `1` or `0` according to your compiler's exception mode.
/// \def TOML_IMPLEMENTATION
/// \brief Enables the library's implementation when #TOML_ALL_INLINE is enabled.
/// \detail Not defined by default. Meaningless when #TOML_ALL_INLINE is disabled.
/// \def TOML_LARGE_FILES
/// \brief Sets whether line and column indices are 32-bit integers.
/// \detail Defaults to `0`.
/// \see toml::source_index
#define TOML_OPTIONAL_TYPE
/// \def TOML_OPTIONAL_TYPE
/// \brief Overrides the `optional<T>` type used by the library.
/// \detail Not defined by default (use std::optional).
/// \warning The library uses optionals internally in a few places; if you choose to replace the optional type
/// it must be with something that is still API-compatible with std::optional
/// (e.g. [tl::optional](https://github.com/TartanLlama/optional)).
/// \def TOML_PARSER
/// \brief Sets whether the parser-related parts of the library are included.
/// \detail Defaults to `1`.
/// \remarks If you don't need to parse TOML data from any strings or files (e.g. you're only using the library to
/// serialize data as TOML), setting `TOML_PARSER` to `0` can yield decent compilation speed improvements.
#define TOML_SMALL_FLOAT_TYPE
/// \def TOML_SMALL_FLOAT_TYPE
/// \brief If your codebase has an additional 'small' float type (e.g. half-precision), this tells toml++ about it.
/// \detail Not defined by default.
#define TOML_SMALL_INT_TYPE
/// \def TOML_SMALL_INT_TYPE
/// \brief If your codebase has an additional 'small' integer type (e.g. 24-bits), this tells toml++ about it.
/// \detail Not defined by default.
/// \def TOML_UNRELEASED_FEATURES
/// \brief Enables support for unreleased TOML language features not yet part of a
/// [numbered version](https://github.com/toml-lang/toml/releases).
/// \detail Defaults to `0`.
/// \see [TOML Language Support](https://github.com/marzer/tomlplusplus/blob/master/README.md#toml-language-support)
/// @}
#endif // TOML_DOXYGEN
//# }}
// clang-format on

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_date_time.h"

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_array.h"
@ -634,9 +635,9 @@ namespace toml
static bool do_contains(Map& vals, const Key& key) noexcept
{
#if TOML_CPP >= 20
return vals.contains(key);
return vals.contains(key);
#else
return do_get(vals, key) != nullptr;
return do_get(vals, key) != nullptr;
#endif
}

View File

@ -1,11 +1,13 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_table.h"
#include "toml_node_view.h"
//# {{
#if !TOML_DOXYGEN
#if !defined(TOML_IMPLEMENTATION) || !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
@ -173,3 +175,6 @@ namespace toml
}
}
//# {{
#endif // !TOML_DOXYGEN
//# }}

View File

@ -2,9 +2,9 @@
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# Copyright (c) 2008-2010 Bjoern Hoehrmann <bjoern@hoehrmann.de> (utf8_decoder)
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_common.h"
#include "toml_utf8_generated.h"
namespace toml::impl

View File

@ -3,9 +3,10 @@
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
//#-----
//# this file was generated by generate_unicode_functions.py - do not modify it directly
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_common.h"
#include "toml_preprocessor.h"
#if TOML_LANG_UNRELEASED // toml/issues/687 (unicode bare keys)

View File

@ -1,10 +1,11 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_common.h"
//# {{
#include "toml_preprocessor.h"
#if !TOML_PARSER
#error This header cannot not be included when TOML_PARSER is disabled.
#endif
@ -116,12 +117,10 @@ namespace toml::impl
}
};
#if TOML_ABI_NAMESPACES
#if TOML_LARGE_FILES
inline namespace abi_impl_lf {
#else
inline namespace abi_impl_lf {
#endif
#if TOML_LARGE_FILES
TOML_ABI_NAMESPACE_START(impl_lf)
#else
TOML_ABI_NAMESPACE_START(impl_sf)
#endif
struct utf8_codepoint final
@ -159,22 +158,16 @@ namespace toml::impl
static_assert(std::is_trivial_v<utf8_codepoint>);
static_assert(std::is_standard_layout_v<utf8_codepoint>);
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_LARGE_FILES
#endif
TOML_ABI_NAMESPACE_END // TOML_LARGE_FILES
#if TOML_EXCEPTIONS
#define TOML_ERROR_CHECK (void)0
#define TOML_ERROR throw parse_error
#if TOML_ABI_NAMESPACES
inline namespace abi_impl_ex {
#endif
TOML_ABI_NAMESPACE_START(impl_ex)
#else
#define TOML_ERROR_CHECK if (err) return nullptr
#define TOML_ERROR err.emplace
#if TOML_ABI_NAMESPACES
inline namespace abi_impl_noex {
#endif
TOML_ABI_NAMESPACE_START(impl_noex)
#endif
TOML_PUSH_WARNINGS
@ -444,9 +437,6 @@ namespace toml::impl
#undef TOML_ERROR_CHECK
#undef TOML_ERROR
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS / !TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
TOML_POP_WARNINGS
}

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_node.h"
@ -189,9 +190,7 @@ namespace toml
/// \brief Value equality operator.
[[nodiscard]] friend bool operator == (const value& lhs, value_arg rhs) noexcept { return lhs.val_ == rhs; }
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const value&, value_arg, )
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const value&, value_arg, )
/// \brief Value less-than operator.
[[nodiscard]] friend bool operator < (const value& lhs, value_arg rhs) noexcept { return lhs.val_ < rhs; }

View File

@ -1,6 +1,7 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#pragma once

View File

@ -1,7 +1,7 @@
project(
'tomlplusplus',
'cpp',
version : '1.2.1',
version : '1.2.2',
license : 'MIT',
default_options : [
'cpp_std=c++17',

View File

@ -2,6 +2,7 @@
# This file is a part of toml++ and is subject to the the terms of the MIT license.
# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
# SPDX-License-Identifier: MIT
import sys
import os

View File

@ -2,6 +2,7 @@
# This file is a part of toml++ and is subject to the the terms of the MIT license.
# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
# SPDX-License-Identifier: MIT
import sys
import re

View File

@ -2,6 +2,7 @@
# This file is a part of toml++ and is subject to the the terms of the MIT license.
# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
# SPDX-License-Identifier: MIT
import sys
import re
@ -53,8 +54,8 @@ class Preprocessor:
text = read_all_text_from_file(path.join(get_script_folder(), '..', 'include', 'toml++', incl))
text = re.sub(r'//[#!]\s*[{][{].*?//[#!]\s*[}][}]', '', text, 0, re.I | re.S)
text = re.sub(r'^\s*#\s*pragma\s+once\s*$', '', text, 0, re.I | re.M)
text = re.sub(r'^\s*//\s*clang-format\s+(?:off|on)\s*$', '', text, 0, re.I | re.M)
text = re.sub(r'^\s*//\s*clang-format\s+.+?$', '', text, 0, re.I | re.M)
text = re.sub(r'^\s*//\s*SPDX-License-Identifier:.+?$', '', text, 0, re.I | re.M)
self.current_level += 1
text = re.sub(r'^\s*#\s*include\s+"(.+?)"', lambda m : self.preprocess(m), text, 0, re.I | re.M)
self.current_level -= 1
@ -86,6 +87,11 @@ def main():
source_text = re.sub('(?://[/#!<].*?)\n', '\n', source_text, 0, re.I | re.M) # remove 'magic' comments
source_text = re.sub('([^ \t])[ \t]+\n', '\\1\n', source_text, 0, re.I | re.M) # remove trailing whitespace
source_text = re.sub('\n(?:[ \t]*\n[ \t]*)+\n', '\n\n', source_text, 0, re.I | re.M) # remove double newlines
source_text = re.sub( # blank lines between various preprocessor directives
'[#](endif(?:\s*//[^\n]*)?)\n{2,}[#]((?:end)?ifn?(?:def)?|define)',
'#\\1\n#\\2',
source_text, 0, re.I | re.M
)
return_type_pattern \
= r'(?:' \
+ r'(?:\[\[nodiscard\]\]\s*)?' \

View File

@ -2,6 +2,7 @@
# This file is a part of toml++ and is subject to the the terms of the MIT license.
# Copyright (c) 2019-2020 Mark Gillard <mark.gillard@outlook.com.au>
# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
# SPDX-License-Identifier: MIT
import sys
import re
@ -586,6 +587,7 @@ def main():
//# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
//#-----
//# this file was generated by generate_unicode_functions.py - do not modify it directly
// SPDX-License-Identifier: MIT
#pragma once
#include "toml_common.h"

View File

@ -57,7 +57,9 @@ foreach character_type : character_types
args += '-std=c++2a'
endif
if not unreleased_features
if unreleased_features
args += '-DTOML_UNRELEASED_FEATURES=1'
else
name = name + '_strict'
args += '-DTOML_UNRELEASED_FEATURES=0'
endif

463
toml.hpp
View File

@ -49,7 +49,7 @@
#endif
#define TOML_LIB_SINGLE_HEADER 1
//----------------- ↓ toml_common.h ----------------------------------------------------------------------------------
//-------------- ↓ toml_preprocessor.h -------------------------------------------------------------------------------
#pragma region
#ifdef TOML_CONFIG_HEADER
@ -72,7 +72,7 @@
#define TOML_CHAR_8_STRINGS 0
#endif
#ifndef TOML_UNRELEASED_FEATURES
#define TOML_UNRELEASED_FEATURES 1
#define TOML_UNRELEASED_FEATURES 0
#endif
#ifndef TOML_LARGE_FILES
#define TOML_LARGE_FILES 0
@ -83,8 +83,9 @@
#ifndef TOML_PARSER
#define TOML_PARSER 1
#endif
// TOML_ASSERT
#ifndef TOML_DOXYGEN
#define TOML_DOXYGEN 0
#endif
#ifndef __cplusplus
#error toml++ is a C++ library.
#endif
@ -190,7 +191,6 @@
#ifndef TOML_FLOAT_CHARCONV
#define TOML_FLOAT_CHARCONV 0
#endif
#endif
#ifndef TOML_CPP_VERSION
@ -228,9 +228,6 @@
#else
#define TOML_MAY_THROW noexcept
#endif
#ifndef TOML_DISABLE_INIT_WARNINGS
#define TOML_DISABLE_INIT_WARNINGS
#endif
#ifndef TOML_INT_CHARCONV
#define TOML_INT_CHARCONV 1
#endif
@ -246,6 +243,12 @@
#ifndef TOML_PUSH_WARNINGS
#define TOML_PUSH_WARNINGS
#endif
#ifndef TOML_DISABLE_SWITCH_WARNINGS
#define TOML_DISABLE_SWITCH_WARNINGS
#endif
#ifndef TOML_DISABLE_INIT_WARNINGS
#define TOML_DISABLE_INIT_WARNINGS
#endif
#ifndef TOML_DISABLE_VTABLE_WARNINGS
#define TOML_DISABLE_VTABLE_WARNINGS
#endif
@ -277,12 +280,13 @@
#define TOML_UNREACHABLE TOML_ASSERT(false)
#endif
#define TOML_NO_DEFAULT_CASE default: TOML_UNREACHABLE
#ifdef __cpp_consteval
#define TOML_CONSTEVAL consteval
#else
#define TOML_CONSTEVAL constexpr
#endif
#ifndef __INTELLISENSE__
#if !TOML_DOXYGEN && !defined(__INTELLISENSE__)
#if !defined(TOML_LIKELY) && __has_cpp_attribute(likely)
#define TOML_LIKELY [[likely]]
#endif
@ -292,19 +296,19 @@
#if __has_cpp_attribute(nodiscard) >= 201907L
#define TOML_NODISCARD_CTOR [[nodiscard]]
#endif
#endif //__INTELLISENSE__
#endif
#ifndef TOML_LIKELY
#define TOML_LIKELY
#endif
#ifndef TOML_UNLIKELY
#define TOML_UNLIKELY
#endif
#ifndef TOML_TRIVIAL_ABI
#define TOML_TRIVIAL_ABI
#endif
#ifndef TOML_NODISCARD_CTOR
#define TOML_NODISCARD_CTOR
#endif
#ifndef TOML_TRIVIAL_ABI
#define TOML_TRIVIAL_ABI
#endif
#ifndef TOML_RELOPS_REORDERING
#define TOML_RELOPS_REORDERING 0
#endif
@ -325,7 +329,6 @@
#define TOML_INTERNAL_LINKAGE static
#define TOML_INTERNAL_NAMESPACE
#endif
#define TOML_LIB_MAJOR 1
#define TOML_LIB_MINOR 2
#define TOML_LIB_PATCH 2
@ -344,7 +347,6 @@
#define TOML_LANG_EFFECTIVE_VERSION \
TOML_MAKE_VERSION(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH)
#endif
#define TOML_LANG_HIGHER_THAN(maj, min, rev) \
(TOML_LANG_EFFECTIVE_VERSION > TOML_MAKE_VERSION(maj, min, rev))
@ -354,8 +356,48 @@
#define TOML_LANG_UNRELEASED \
TOML_LANG_HIGHER_THAN(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH)
#if TOML_DOXYGEN || defined(__INTELLISENSE__)
#define TOML_ABI_NAMESPACES 0
#define TOML_ABI_NAMESPACE_START(name)
#define TOML_ABI_NAMESPACE_END
#else
#define TOML_ABI_NAMESPACES 1
#define TOML_ABI_NAMESPACE_START(name) inline namespace abi_##name {
#define TOML_ABI_NAMESPACE_END }
#endif
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
#ifndef TOML_ASSERT
#ifdef NDEBUG
#define TOML_ASSERT(expr) (void)0
#else
#include <cassert>
#define TOML_ASSERT(expr) assert(expr)
#endif
#endif
TOML_POP_WARNINGS
#if TOML_CHAR_8_STRINGS
#ifndef __cpp_lib_char8_t
#error toml++ requires implementation support to use char8_t strings, but yours does not provide it.
#endif
#define TOML_STRING_PREFIX_1(S) u8##S
#define TOML_STRING_PREFIX(S) TOML_STRING_PREFIX_1(S)
#else
#define TOML_STRING_PREFIX(S) S
#endif
#pragma endregion
//-------------- ↑ toml_preprocessor.h -------------------------------------------------------------------------------
//------------------------------------------ ↓ toml_common.h ---------------------------------------------------------
#pragma region
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
#if __has_include(<version>)
#include <version>
#endif
@ -378,29 +420,11 @@ TOML_DISABLE_ALL_WARNINGS
#define TOML_ASSERT(expr) assert(expr)
#endif
#endif
TOML_POP_WARNINGS
#if TOML_CHAR_8_STRINGS
#ifndef __cpp_lib_char8_t
#error toml++ requires implementation support to use char8_t strings, but yours does not provide it.
#endif
#define TOML_STRING_PREFIX_1(S) u8##S
#define TOML_STRING_PREFIX(S) TOML_STRING_PREFIX_1(S)
#else
#define TOML_STRING_PREFIX(S) S
#endif
#ifdef __cpp_lib_launder
#define TOML_LAUNDER(x) std::launder(x)
#else
#define TOML_LAUNDER(x) x
#endif
#if !defined(DOXYGEN) && !defined(__INTELLISENSE__)
#define TOML_ABI_NAMESPACES 1
#else
#define TOML_ABI_NAMESPACES 0
#if TOML_CHAR_8_STRINGS && !defined(__cpp_lib_char8_t)
#error toml++ requires implementation support to use char8_t strings, but yours does not provide it.
#endif
namespace toml
@ -432,7 +456,7 @@ namespace toml
#endif
#ifndef DOXYGEN
#if !TOML_DOXYGEN
// foward declarations are hidden from doxygen
// because they fuck it up =/
@ -447,21 +471,17 @@ namespace toml
template <typename> class default_formatter;
template <typename> class json_formatter;
#if TOML_ABI_NAMESPACES
#ifdef TOML_OPTIONAL_TYPE
inline namespace abi_custopt {
#else
inline namespace abi_stdopt {
#endif
#ifdef TOML_OPTIONAL_TYPE
TOML_ABI_NAMESPACE_START(custopt)
#else
TOML_ABI_NAMESPACE_START(stdopt)
#endif
struct date_time;
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_OPTIONAL_TYPE
#endif
TOML_ABI_NAMESPACE_END // TOML_OPTIONAL_TYPE
#endif // !DOXYGEN
#endif // !TOML_DOXYGEN
enum class node_type : uint8_t
{
@ -501,12 +521,10 @@ namespace toml
using source_path_ptr = std::shared_ptr<const std::string>;
#if TOML_ABI_NAMESPACES
#if TOML_LARGE_FILES
inline namespace abi_lf {
#else
inline namespace abi_sf {
#endif
#if TOML_LARGE_FILES
TOML_ABI_NAMESPACE_START(lf)
#else
TOML_ABI_NAMESPACE_START(sf)
#endif
struct TOML_TRIVIAL_ABI source_position
@ -556,9 +574,7 @@ namespace toml
source_path_ptr path;
};
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_LARGE_FILES
#endif
TOML_ABI_NAMESPACE_END // TOML_LARGE_FILES
}
namespace toml::impl
@ -602,10 +618,10 @@ namespace toml::impl
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_impl_ex {
TOML_ABI_NAMESPACE_START(impl_ex)
#define TOML_PARSER_TYPENAME ::toml::impl::abi_impl_ex::parser
#else
inline namespace abi_impl_noex {
TOML_ABI_NAMESPACE_START(impl_noex)
#define TOML_PARSER_TYPENAME ::toml::impl::abi_impl_noex::parser
#endif
#else
@ -614,9 +630,7 @@ namespace toml::impl
class parser;
#if TOML_ABI_NAMESPACES
}
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
template <typename T>
inline constexpr bool is_value =
@ -828,14 +842,14 @@ namespace toml
}
#pragma endregion
//----------------- ↑ toml_common.h ----------------------------------------------------------------------------------
//------------------------------------------ ↑ toml_common.h ---------------------------------------------------------
//---------------------------------------- ↓ toml_date_time.h --------------------------------------------------------
//----------------------------------------------------------------- ↓ toml_date_time.h -------------------------------
#pragma region
namespace toml
{
struct TOML_TRIVIAL_ABI date final
struct TOML_TRIVIAL_ABI date
{
uint16_t year;
uint8_t month;
@ -906,7 +920,7 @@ namespace toml
extern template TOML_API std::ostream& operator << (std::ostream&, const date&);
#endif
struct TOML_TRIVIAL_ABI time final
struct TOML_TRIVIAL_ABI time
{
uint8_t hour;
uint8_t minute;
@ -978,7 +992,7 @@ namespace toml
extern template TOML_API std::ostream& operator << (std::ostream&, const time&);
#endif
struct TOML_TRIVIAL_ABI time_offset final
struct TOML_TRIVIAL_ABI time_offset
{
int16_t minutes;
@ -1041,15 +1055,13 @@ namespace toml
extern template TOML_API std::ostream& operator << (std::ostream&, const time_offset&);
#endif
#if TOML_ABI_NAMESPACES
#ifdef TOML_OPTIONAL_TYPE
inline namespace abi_custopt {
#else
inline namespace abi_stdopt {
#endif
#ifdef TOML_OPTIONAL_TYPE
TOML_ABI_NAMESPACE_START(custopt)
#else
TOML_ABI_NAMESPACE_START(stdopt)
#endif
struct date_time final
struct date_time
{
toml::date date;
toml::time time;
@ -1127,9 +1139,7 @@ namespace toml
}
};
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_OPTIONAL_TYPE
#endif
TOML_ABI_NAMESPACE_END // TOML_OPTIONAL_TYPE
template <typename Char>
TOML_EXTERNAL_LINKAGE
@ -1145,9 +1155,9 @@ namespace toml
}
#pragma endregion
//---------------------------------------- ↑ toml_date_time.h --------------------------------------------------------
//----------------------------------------------------------------- ↑ toml_date_time.h -------------------------------
//-------------------------------------------------------------- ↓ toml_print_to_stream.h ----------------------------
//--------------------------------------------------------------------------------------- ↓ toml_print_to_stream.h ---
#pragma region
TOML_PUSH_WARNINGS
@ -1546,9 +1556,9 @@ namespace toml
}
#pragma endregion
//-------------------------------------------------------------- ↑ toml_print_to_stream.h ----------------------------
//--------------------------------------------------------------------------------------- ↑ toml_print_to_stream.h ---
//--------------------------------------------------------------------------------------------- ↓ toml_node.h --------
//------------------ ↓ toml_node.h -----------------------------------------------------------------------------------
#pragma region
TOML_PUSH_WARNINGS
@ -1910,9 +1920,9 @@ namespace toml
TOML_POP_WARNINGS //TOML_DISABLE_VTABLE_WARNINGS
#pragma endregion
//--------------------------------------------------------------------------------------------- ↑ toml_node.h --------
//------------------ ↑ toml_node.h -----------------------------------------------------------------------------------
//----------------- ↓ toml_value.h -----------------------------------------------------------------------------------
//------------------------------------------ ↓ toml_value.h ----------------------------------------------------------
#pragma region
namespace toml
@ -2029,10 +2039,7 @@ namespace toml
}
[[nodiscard]] friend bool operator == (const value& lhs, value_arg rhs) noexcept { return lhs.val_ == rhs; }
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const value&, value_arg, )
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const value&, value_arg, )
[[nodiscard]] friend bool operator < (const value& lhs, value_arg rhs) noexcept { return lhs.val_ < rhs; }
[[nodiscard]] friend bool operator < (value_arg lhs, const value& rhs) noexcept { return lhs < rhs.val_; }
[[nodiscard]] friend bool operator <= (const value& lhs, value_arg rhs) noexcept { return lhs.val_ <= rhs; }
@ -2272,9 +2279,9 @@ namespace toml
}
#pragma endregion
//----------------- ↑ toml_value.h -----------------------------------------------------------------------------------
//------------------------------------------ ↑ toml_value.h ----------------------------------------------------------
//------------------------------------------ ↓ toml_array.h ----------------------------------------------------------
//------------------------------------------------------------------- ↓ toml_array.h ---------------------------------
#pragma region
TOML_PUSH_WARNINGS
@ -2725,19 +2732,14 @@ namespace toml
{
return container_equality(lhs, rhs);
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::initializer_list<T>&, template <typename T>)
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::initializer_list<T>&, template <typename T>)
template <typename T>
[[nodiscard]] friend bool operator == (const array& lhs, const std::vector<T>& rhs) noexcept
{
return container_equality(lhs, rhs);
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::vector<T>&, template <typename T>)
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::vector<T>&, template <typename T>)
void flatten();
template <typename Char>
@ -2748,9 +2750,9 @@ namespace toml
TOML_POP_WARNINGS //TOML_DISABLE_VTABLE_WARNINGS
#pragma endregion
//------------------------------------------ ↑ toml_array.h ----------------------------------------------------------
//------------------------------------------------------------------- ↑ toml_array.h ---------------------------------
//------------------------------------------------------------------- ↓ toml_table.h ---------------------------------
//-------------------------------------------------------------------------------------------- ↓ toml_table.h --------
#pragma region
TOML_PUSH_WARNINGS
@ -3028,9 +3030,9 @@ namespace toml
static bool do_contains(Map& vals, const Key& key) noexcept
{
#if TOML_CPP >= 20
return vals.contains(key);
return vals.contains(key);
#else
return do_get(vals, key) != nullptr;
return do_get(vals, key) != nullptr;
#endif
}
@ -3065,9 +3067,9 @@ namespace toml
TOML_POP_WARNINGS //TOML_DISABLE_VTABLE_WARNINGS
#pragma endregion
//------------------------------------------------------------------- ↑ toml_table.h ---------------------------------
//-------------------------------------------------------------------------------------------- ↑ toml_table.h --------
//------------------------------------------------------------------------------------------ ↓ toml_node_view.h ------
//--------------- ↓ toml_node_view.h ---------------------------------------------------------------------------------
#pragma region
namespace toml
@ -3076,7 +3078,7 @@ namespace toml
inline std::basic_ostream<Char>& operator << (std::basic_ostream<Char>&, const node_view<T>&);
template <typename T>
class TOML_API node_view final
class TOML_API TOML_TRIVIAL_ABI node_view
{
public:
using viewed_type = T;
@ -3201,10 +3203,7 @@ namespace toml
const auto tbl = lhs.as<table>();
return tbl && *tbl == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const table&, )
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const table&, )
[[nodiscard]] friend bool operator == (const node_view& lhs, const array& rhs) noexcept
{
if (lhs.node_ == &rhs)
@ -3212,9 +3211,7 @@ namespace toml
const auto arr = lhs.as<array>();
return arr && *arr == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const array&, )
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const array&, )
template <typename U>
[[nodiscard]] friend bool operator == (const node_view& lhs, const toml::value<U>& rhs) noexcept
@ -3224,9 +3221,7 @@ namespace toml
const auto val = lhs.as<U>();
return val && *val == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const toml::value<U>&, template <typename U>)
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const toml::value<U>&, template <typename U>)
template <typename U, typename = std::enable_if_t<impl::is_value_or_promotable<U>>>
[[nodiscard]] friend bool operator == (const node_view& lhs, const U& rhs) noexcept
@ -3234,13 +3229,11 @@ namespace toml
const auto val = lhs.as<impl::promoted<U>>();
return val && *val == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(
TOML_ASYMMETRICAL_EQUALITY_OPS(
const node_view&,
const U&,
template <typename U, typename = std::enable_if_t<impl::is_value_or_promotable<U>>>
)
#endif
)
template <typename U>
[[nodiscard]] friend bool operator == (const node_view& lhs, const std::initializer_list<U>& rhs) noexcept
@ -3248,9 +3241,7 @@ namespace toml
const auto arr = lhs.as<array>();
return arr && *arr == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const std::initializer_list<U>&, template <typename U>)
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const std::initializer_list<U>&, template <typename U>)
template <typename U>
[[nodiscard]] friend bool operator == (const node_view& lhs, const std::vector<U>& rhs) noexcept
@ -3258,9 +3249,7 @@ namespace toml
const auto arr = lhs.as<array>();
return arr && *arr == rhs;
}
#ifndef DOXYGEN
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const std::vector<U>&, template <typename U>)
#endif
TOML_ASYMMETRICAL_EQUALITY_OPS(const node_view&, const std::vector<U>&, template <typename U>)
[[nodiscard]] node_view operator[] (string_view key) const noexcept
{
@ -3303,9 +3292,9 @@ namespace toml
}
#pragma endregion
//------------------------------------------------------------------------------------------ ↑ toml_node_view.h ------
//--------------- ↑ toml_node_view.h ---------------------------------------------------------------------------------
//------------- ↓ toml_utf8_generated.h ------------------------------------------------------------------------------
//-------------------------------------- ↓ toml_utf8_generated.h -----------------------------------------------------
#pragma region
#if TOML_LANG_UNRELEASED // toml/issues/687 (unicode bare keys)
@ -4178,9 +4167,9 @@ namespace toml::impl
#endif // TOML_LANG_UNRELEASED
#pragma endregion
//------------- ↑ toml_utf8_generated.h ------------------------------------------------------------------------------
//-------------------------------------- ↑ toml_utf8_generated.h -----------------------------------------------------
//------------------------------------------- ↓ toml_utf8.h ----------------------------------------------------------
//-------------------------------------------------------------------- ↓ toml_utf8.h ---------------------------------
#pragma region
namespace toml::impl
@ -4449,9 +4438,9 @@ namespace toml::impl
}
#pragma endregion
//------------------------------------------- ↑ toml_utf8.h ----------------------------------------------------------
//-------------------------------------------------------------------- ↑ toml_utf8.h ---------------------------------
//----------------------------------------------------------------- ↓ toml_formatter.h -------------------------------
//------------------------------------------------------------------------------------------ ↓ toml_formatter.h ------
#pragma region
namespace toml
@ -4598,9 +4587,9 @@ namespace toml::impl
}
#pragma endregion
//----------------------------------------------------------------- ↑ toml_formatter.h -------------------------------
//------------------------------------------------------------------------------------------ ↑ toml_formatter.h ------
//-------------------------------------------------------------------------------------- ↓ toml_default_formatter.h --
//----------- ↓ toml_default_formatter.h -----------------------------------------------------------------------------
#pragma region
namespace toml::impl
@ -4971,9 +4960,9 @@ namespace toml
}
#pragma endregion
//-------------------------------------------------------------------------------------- ↑ toml_default_formatter.h --
//----------- ↑ toml_default_formatter.h -----------------------------------------------------------------------------
//------------- ↓ toml_json_formatter.h ------------------------------------------------------------------------------
//-------------------------------------- ↓ toml_json_formatter.h -----------------------------------------------------
#pragma region
namespace toml
@ -5118,11 +5107,11 @@ namespace toml
}
#pragma endregion
//------------- ↑ toml_json_formatter.h ------------------------------------------------------------------------------
//-------------------------------------- ↑ toml_json_formatter.h -----------------------------------------------------
#if TOML_PARSER
//--------------------------------------- ↓ toml_parse_error.h -------------------------------------------------------
//---------------------------------------------------------------- ↓ toml_parse_error.h ------------------------------
#pragma region
TOML_PUSH_WARNINGS
@ -5138,20 +5127,15 @@ TOML_DISABLE_VTABLE_WARNINGS
namespace toml
{
#if TOML_ABI_NAMESPACES
#if TOML_LARGE_FILES
inline namespace abi_lf {
#else
inline namespace abi_sf {
#endif
#if TOML_EXCEPTIONS
inline namespace abi_ex {
#else
inline namespace abi_noex {
#endif
#if TOML_LARGE_FILES
TOML_ABI_NAMESPACE_START(lf)
#else
TOML_ABI_NAMESPACE_START(sf)
#endif
#if defined(DOXYGEN) || !TOML_EXCEPTIONS
#if TOML_DOXYGEN || !TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(noex)
class parse_error final
{
@ -5192,6 +5176,8 @@ namespace toml
#else
TOML_ABI_NAMESPACE_START(ex)
class parse_error final
: public std::runtime_error
{
@ -5234,10 +5220,8 @@ namespace toml
#endif
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
} //end abi namespace for TOML_LARGE_FILES
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_END // TOML_LARGE_FILES
template <typename Char>
TOML_EXTERNAL_LINKAGE
@ -5258,9 +5242,9 @@ namespace toml
TOML_POP_WARNINGS
#pragma endregion
//--------------------------------------- ↑ toml_parse_error.h -------------------------------------------------------
//---------------------------------------------------------------- ↑ toml_parse_error.h ------------------------------
//---------------------------------------------------------------- ↓ toml_utf8_streams.h -----------------------------
//----------------------------------------------------------------------------------------- ↓ toml_utf8_streams.h ----
#pragma region
namespace toml::impl
@ -5367,12 +5351,10 @@ namespace toml::impl
}
};
#if TOML_ABI_NAMESPACES
#if TOML_LARGE_FILES
inline namespace abi_impl_lf {
#else
inline namespace abi_impl_lf {
#endif
#if TOML_LARGE_FILES
TOML_ABI_NAMESPACE_START(impl_lf)
#else
TOML_ABI_NAMESPACE_START(impl_sf)
#endif
struct utf8_codepoint final
@ -5410,22 +5392,16 @@ namespace toml::impl
static_assert(std::is_trivial_v<utf8_codepoint>);
static_assert(std::is_standard_layout_v<utf8_codepoint>);
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_LARGE_FILES
#endif
TOML_ABI_NAMESPACE_END // TOML_LARGE_FILES
#if TOML_EXCEPTIONS
#define TOML_ERROR_CHECK (void)0
#define TOML_ERROR throw parse_error
#if TOML_ABI_NAMESPACES
inline namespace abi_impl_ex {
#endif
TOML_ABI_NAMESPACE_START(impl_ex)
#else
#define TOML_ERROR_CHECK if (err) return nullptr
#define TOML_ERROR err.emplace
#if TOML_ABI_NAMESPACES
inline namespace abi_impl_noex {
#endif
TOML_ABI_NAMESPACE_START(impl_noex)
#endif
TOML_PUSH_WARNINGS
@ -5694,27 +5670,28 @@ namespace toml::impl
#undef TOML_ERROR_CHECK
#undef TOML_ERROR
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS / !TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
TOML_POP_WARNINGS
}
#pragma endregion
//---------------------------------------------------------------- ↑ toml_utf8_streams.h -----------------------------
//----------------------------------------------------------------------------------------- ↑ toml_utf8_streams.h ----
//-------------------------------------------------------------------------------------------- ↓ toml_parser.h -------
//----------------- ↓ toml_parser.h ----------------------------------------------------------------------------------
#pragma region
namespace toml
{
#if defined(DOXYGEN) || !TOML_EXCEPTIONS
#if TOML_DOXYGEN || !TOML_EXCEPTIONS
#if TOML_ABI_NAMESPACES
inline namespace abi_parse_noex {
#ifdef __cpp_lib_launder
#define TOML_LAUNDER(x) std::launder(x)
#else
#define TOML_LAUNDER(x) x
#endif
TOML_ABI_NAMESPACE_START(parse_noex)
class parse_result final
{
private:
@ -5868,9 +5845,9 @@ namespace toml
}
};
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END
#undef TOML_LAUNDER
#else
@ -5881,30 +5858,24 @@ namespace toml
namespace toml::impl
{
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_impl_ex {
#else
inline namespace abi_impl_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(impl_ex)
#else
TOML_ABI_NAMESPACE_START(impl_noex)
#endif
[[nodiscard]] TOML_API
parse_result do_parse(utf8_reader_interface&&) TOML_MAY_THROW;
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
}
namespace toml
{
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_parse_ex {
#else
inline namespace abi_parse_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(parse_ex)
#else
TOML_ABI_NAMESPACE_START(parse_noex)
#endif
[[nodiscard]]
@ -5997,18 +5968,14 @@ namespace toml
return parse_file(std::basic_string_view<Char>{ file_path });
}
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
inline namespace literals
{
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_lit_ex {
#else
inline namespace abi_lit_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(lit_ex)
#else
TOML_ABI_NAMESPACE_START(lit_noex)
#endif
[[nodiscard]]
@ -6023,19 +5990,17 @@ namespace toml
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
}
}
#pragma endregion
//-------------------------------------------------------------------------------------------- ↑ toml_parser.h -------
//----------------- ↑ toml_parser.h ----------------------------------------------------------------------------------
#endif // TOML_PARSER
#if TOML_IMPLEMENTATION
//----------------- ↓ toml_node.hpp ----------------------------------------------------------------------------------
//------------------------------------------ ↓ toml_node.hpp ---------------------------------------------------------
#pragma region
namespace toml
@ -6091,9 +6056,9 @@ namespace toml
}
#pragma endregion
//----------------- ↑ toml_node.hpp ----------------------------------------------------------------------------------
//------------------------------------------ ↑ toml_node.hpp ---------------------------------------------------------
//----------------------------------------- ↓ toml_array.hpp ---------------------------------------------------------
//------------------------------------------------------------------ ↓ toml_array.hpp --------------------------------
#pragma region
namespace toml
@ -6297,9 +6262,9 @@ namespace toml
}
#pragma endregion
//----------------------------------------- ↑ toml_array.hpp ---------------------------------------------------------
//------------------------------------------------------------------ ↑ toml_array.hpp --------------------------------
//------------------------------------------------------------------ ↓ toml_table.hpp --------------------------------
//------------------------------------------------------------------------------------------- ↓ toml_table.hpp -------
#pragma region
namespace toml
@ -6465,9 +6430,9 @@ namespace toml
}
#pragma endregion
//------------------------------------------------------------------ ↑ toml_table.hpp --------------------------------
//------------------------------------------------------------------------------------------- ↑ toml_table.hpp -------
//------------------------------------------------------------------------------------- ↓ toml_default_formatter.hpp -
//---------- ↓ toml_default_formatter.hpp ----------------------------------------------------------------------------
#pragma region
namespace toml::impl
@ -6606,11 +6571,11 @@ namespace toml::impl
}
#pragma endregion
//------------------------------------------------------------------------------------- ↑ toml_default_formatter.hpp -
//---------- ↑ toml_default_formatter.hpp ----------------------------------------------------------------------------
#if TOML_PARSER
//---------------- ↓ toml_parser.hpp ---------------------------------------------------------------------------------
//----------------------------------------- ↓ toml_parser.hpp --------------------------------------------------------
#pragma region
TOML_PUSH_WARNINGS
@ -6774,12 +6739,10 @@ namespace toml::impl
#define TOML_NOT_EOF TOML_ASSERT(cp != nullptr)
#endif
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_impl_ex {
#else
inline namespace abi_impl_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(impl_ex)
#else
TOML_ABI_NAMESPACE_START(impl_noex)
#endif
class parser final
@ -9834,10 +9797,7 @@ namespace toml::impl
return impl::parser{ std::move(reader) };
}
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
#undef TOML_ERROR_CHECK
#undef TOML_ERROR
#undef TOML_NORETURN
@ -9846,12 +9806,10 @@ namespace toml::impl
namespace toml
{
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_parse_ex {
#else
inline namespace abi_parse_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(parse_ex)
#else
TOML_ABI_NAMESPACE_START(parse_noex)
#endif
TOML_API
@ -9886,18 +9844,14 @@ namespace toml
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
inline namespace literals
{
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_lit_ex {
#else
inline namespace abi_lit_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(lit_ex)
#else
TOML_ABI_NAMESPACE_START(lit_noex)
#endif
TOML_API
@ -9918,19 +9872,17 @@ namespace toml
#endif // __cpp_lib_char8_t
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
}
}
#pragma endregion
//---------------- ↑ toml_parser.hpp ---------------------------------------------------------------------------------
//----------------------------------------- ↑ toml_parser.hpp --------------------------------------------------------
#endif // TOML_PARSER
#if !TOML_ALL_INLINE
//------------------------------------- ↓ toml_instantiations.hpp ----------------------------------------------------
//-------------------------------------------------------------- ↓ toml_instantiations.hpp ---------------------------
#pragma region
TOML_PUSH_WARNINGS
@ -10001,12 +9953,10 @@ namespace toml
template TOML_API std::ostream& operator << (std::ostream&, const parse_error&);
// parse() and parse_file()
#if TOML_ABI_NAMESPACES
#if TOML_EXCEPTIONS
inline namespace abi_parse_ex {
#else
inline namespace abi_parse_noex {
#endif
#if TOML_EXCEPTIONS
TOML_ABI_NAMESPACE_START(parse_ex)
#else
TOML_ABI_NAMESPACE_START(parse_noex)
#endif
template TOML_API parse_result parse(std::istream&, std::string_view) TOML_MAY_THROW;
template TOML_API parse_result parse(std::istream&, std::string&&) TOML_MAY_THROW;
@ -10014,15 +9964,13 @@ namespace toml
#ifdef __cpp_lib_char8_t
template TOML_API parse_result parse_file(std::u8string_view) TOML_MAY_THROW;
#endif
#if TOML_ABI_NAMESPACES
} //end abi namespace for TOML_EXCEPTIONS
#endif
TOML_ABI_NAMESPACE_END // TOML_EXCEPTIONS
#endif // TOML_PARSER
}
#pragma endregion
//------------------------------------- ↑ toml_instantiations.hpp ----------------------------------------------------
//-------------------------------------------------------------- ↑ toml_instantiations.hpp ---------------------------
#endif // !TOML_ALL_INLINE
#endif // TOML_IMPLEMENTATION
@ -10068,9 +10016,10 @@ namespace toml
#undef TOML_INTERNAL_LINKAGE
#undef TOML_INTERNAL_NAMESPACE
#undef TOML_COMPILER_EXCEPTIONS
#undef TOML_LAUNDER
#undef TOML_TRIVIAL_ABI
#undef TOML_ABI_NAMESPACES
#undef TOML_ABI_NAMESPACE_START
#undef TOML_ABI_NAMESPACE_END
#undef TOML_PARSER_TYPENAME
#endif

View File

@ -51,6 +51,7 @@
<ClCompile>
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TOML_CHAR_8_STRINGS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TOML_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PreprocessorDefinitions Condition="'%(PrecompiledHeader)'=='Use'">USING_PCH=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -51,6 +51,7 @@
<ClCompile>
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TOML_CHAR_8_STRINGS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TOML_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PreprocessorDefinitions Condition="'%(PrecompiledHeader)'=='Use'">USING_PCH=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -51,6 +51,7 @@
<ClCompile>
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TOML_CHAR_8_STRINGS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TOML_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>

View File

@ -51,6 +51,7 @@
<ClCompile>
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TOML_CHAR_8_STRINGS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TOML_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>

View File

@ -51,6 +51,7 @@
<ClCompile>
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TOML_CHAR_8_STRINGS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TOML_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PreprocessorDefinitions Condition="'%(PrecompiledHeader)'=='Use'">USING_PCH=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -51,6 +51,7 @@
<ClCompile>
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TOML_CHAR_8_STRINGS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TOML_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>tests.h</PrecompiledHeaderFile>
<PreprocessorDefinitions Condition="'%(PrecompiledHeader)'=='Use'">USING_PCH=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>

View File

@ -51,6 +51,7 @@
<ClCompile>
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TOML_CHAR_8_STRINGS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TOML_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>

View File

@ -51,6 +51,7 @@
<ClCompile>
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>TOML_CHAR_8_STRINGS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>TOML_UNRELEASED_FEATURES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>

View File

@ -31,7 +31,7 @@
<DiagnosticsFormat>Caret</DiagnosticsFormat>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed> <!-- /Os -->
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<AdditionalOptions>%(AdditionalOptions) /utf-8 /volatile:iso /Zc:__cplusplus /bigobj /Zc:inline /Zc:throwingNew</AdditionalOptions>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_CONSOLE</PreprocessorDefinitions>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_ITERATOR_DEBUG_LEVEL=0</PreprocessorDefinitions>

View File

@ -71,6 +71,7 @@
<ClInclude Include="..\include\toml++\toml_node_view.h" />
<ClInclude Include="..\include\toml++\toml_parser.hpp" />
<ClInclude Include="..\include\toml++\toml_parse_error.h" />
<ClInclude Include="..\include\toml++\toml_preprocessor.h" />
<ClInclude Include="..\include\toml++\toml_print_to_stream.h" />
<ClInclude Include="..\include\toml++\toml_table.hpp" />
<ClInclude Include="..\include\toml++\toml_utf8_generated.h" />

View File

@ -76,6 +76,9 @@
<ClInclude Include="..\include\toml++\toml_parse_error.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\toml++\toml_preprocessor.h">
<Filter>include</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\.editorconfig" />