added support for compiling into DLLs on windows (TOML_API
)
This commit is contained in:
parent
c668b86d8f
commit
d874264432
25
README.md
25
README.md
@ -86,18 +86,19 @@ The API is the same regardless of how you consume the library.
|
||||
A number of configurable options are exposed in the form of preprocessor `#defines`. Most likely you
|
||||
won't need to mess with these at all, but if you do, set them before including toml++.
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
|----------------------------|:--------------:|-----------------------------------|----------------------------------------------------------------------------------------------------------|
|
||||
| `TOML_ALL_INLINE` | boolean | `1` | Disable this to explicitly control where toml++'s implementation is compiled (e.g. as part of a static library). |
|
||||
| `TOML_ASSERT(expr)` | function macro | `assert(expr)`<br>(or undefined) | Sets the assert function used by the library. |
|
||||
| `TOML_CHAR_8_STRINGS` | boolean | `0` | Uses C++20 [char8_t]-based strings as the toml string data type. **_Experimental!_** |
|
||||
| `TOML_CONFIG_HEADER` | string literal | undefined | Includes the given header file before the rest of the library. |
|
||||
| `TOML_IMPLEMENTATION` | boolean | `0` | Enables the compiling of the library's implemenation. Meaningless if `TOML_ALL_INLINE` is `1`. |
|
||||
| `TOML_LARGE_FILES` | boolean | `0` | Uses 32-bit integers for line and column indices (instead of 16-bit). |
|
||||
| `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]. |
|
||||
| Option | Type | Default | Description |
|
||||
|----------------------------|:--------------:|-----------------------------------|------------------------------------------------------------------------------------------------------------|
|
||||
| `TOML_ALL_INLINE` | boolean | `1` | Disable this to explicitly control where toml++'s implementation is compiled (e.g. as part of a library). |
|
||||
| `TOML_API` | define | undefined | API annotation to add to public symbols (e.g. `__declspec(dllexport) on Windows)`. |
|
||||
| `TOML_ASSERT(expr)` | function macro | `assert(expr)`<br>(or undefined) | Sets the assert function used by the library. |
|
||||
| `TOML_CHAR_8_STRINGS` | boolean | `0` | Uses C++20 [char8_t]-based strings as the toml string data type. **_Experimental!_** |
|
||||
| `TOML_CONFIG_HEADER` | string literal | undefined | Includes the given header file before the rest of the library. |
|
||||
| `TOML_IMPLEMENTATION` | define | undefined | Define this to enable compilation of the library's implementation. Meaningless if `TOML_ALL_INLINE` is `1`.|
|
||||
| `TOML_LARGE_FILES` | boolean | `0` | Uses 32-bit integers for line and column indices (instead of 16-bit). |
|
||||
| `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]. |
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -18,12 +18,17 @@
|
||||
#include "toml_formatter.h"
|
||||
#include "toml_default_formatter.h"
|
||||
#include "toml_json_formatter.h"
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
#include "toml_node_impl.h"
|
||||
#include "toml_value_impl.h"
|
||||
#include "toml_array_impl.h"
|
||||
#include "toml_table_impl.h"
|
||||
#include "toml_parser_impl.h"
|
||||
|
||||
#endif
|
||||
|
||||
// macro hygiene
|
||||
#if TOML_UNDEF_MACROS
|
||||
#undef TOML_USE_STREAMS_FOR_FLOATS
|
||||
|
@ -151,10 +151,8 @@ TOML_IMPL_START
|
||||
}
|
||||
};
|
||||
|
||||
#if !TOML_ALL_INLINE
|
||||
extern template class array_iterator<true>;
|
||||
extern template class array_iterator<false>;
|
||||
#endif
|
||||
template class array_iterator<true>;
|
||||
template class array_iterator<false>;
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] TOML_ALWAYS_INLINE
|
||||
@ -183,7 +181,10 @@ TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
[[nodiscard]] bool operator == (const table& lhs, const table& rhs) noexcept;
|
||||
[[nodiscard]] TOML_API bool operator == (const array& lhs, const array& rhs) noexcept;
|
||||
[[nodiscard]] TOML_API bool operator != (const array& lhs, const array& rhs) noexcept;
|
||||
template <typename CHAR>
|
||||
std::basic_ostream<CHAR>& operator << (std::basic_ostream<CHAR>&, const array&) TOML_MAY_THROW;
|
||||
|
||||
/// \brief A TOML array.
|
||||
///
|
||||
@ -752,7 +753,6 @@ TOML_START
|
||||
/// \returns True if the arrays did not contain the same values.
|
||||
friend bool operator != (const array& lhs, const array& rhs) noexcept;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
template <typename T>
|
||||
@ -802,25 +802,25 @@ TOML_START
|
||||
}
|
||||
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.
|
||||
///
|
||||
/// \detail \cpp
|
||||
///
|
||||
/// auto arr = toml::array{ 1, 2, toml::array{ 3, 4, toml::array{ 5 } }, 6, toml::array{} };
|
||||
/// std::cout << arr << std::endl;
|
||||
///
|
||||
/// arr.flatten();
|
||||
/// std::cout << arr << std::endl;
|
||||
///
|
||||
/// \ecpp
|
||||
///
|
||||
/// \out
|
||||
/// [1, 2, [3, 4, [5]], 6, []]
|
||||
/// [1, 2, 3, 4, 5, 6]
|
||||
/// \eout
|
||||
///
|
||||
/// \remarks Arrays inside child tables are not flattened.
|
||||
void flatten() TOML_MAY_THROW;
|
||||
/// \brief Flattens this array, recursively hoisting the contents of child arrays up into itself.
|
||||
///
|
||||
/// \detail \cpp
|
||||
///
|
||||
/// auto arr = toml::array{ 1, 2, toml::array{ 3, 4, toml::array{ 5 } }, 6, toml::array{} };
|
||||
/// std::cout << arr << std::endl;
|
||||
///
|
||||
/// arr.flatten();
|
||||
/// std::cout << arr << std::endl;
|
||||
///
|
||||
/// \ecpp
|
||||
///
|
||||
/// \out
|
||||
/// [1, 2, [3, 4, [5]], 6, []]
|
||||
/// [1, 2, 3, 4, 5, 6]
|
||||
/// \eout
|
||||
///
|
||||
/// \remarks Arrays inside child tables are not flattened.
|
||||
void flatten() TOML_MAY_THROW;
|
||||
|
||||
template <typename CHAR>
|
||||
friend std::basic_ostream<CHAR>& operator << (std::basic_ostream<CHAR>&, const array&) TOML_MAY_THROW;
|
||||
|
@ -1,15 +1,6 @@
|
||||
#pragma once
|
||||
#include "toml_array.h"
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
TOML_IMPL_START
|
||||
{
|
||||
template class array_iterator<true>;
|
||||
template class array_iterator<false>;
|
||||
}
|
||||
TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
@ -100,7 +91,8 @@ TOML_START
|
||||
return index < values.size() ? values[index].get() : nullptr;
|
||||
}
|
||||
|
||||
[[nodiscard]] TOML_INLINE_FUNC_IMPL
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
bool operator == (const array& lhs, const array& rhs) noexcept
|
||||
{
|
||||
if (&lhs == &rhs)
|
||||
@ -125,7 +117,8 @@ TOML_START
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] TOML_INLINE_FUNC_IMPL
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
bool operator != (const array& lhs, const array& rhs) noexcept
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
@ -208,5 +201,3 @@ TOML_START
|
||||
}
|
||||
}
|
||||
TOML_END
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
@ -11,11 +11,12 @@
|
||||
#if !defined(TOML_ALL_INLINE) || (defined(TOML_ALL_INLINE) && TOML_ALL_INLINE)
|
||||
#undef TOML_ALL_INLINE
|
||||
#define TOML_ALL_INLINE 1
|
||||
#undef TOML_IMPLEMENTATION
|
||||
#define TOML_IMPLEMENTATION 1
|
||||
#endif
|
||||
|
||||
#ifndef TOML_IMPLEMENTATION
|
||||
#if defined(TOML_IMPLEMENTATION) || TOML_ALL_INLINE
|
||||
#undef TOML_IMPLEMENTATION
|
||||
#define TOML_IMPLEMENTATION 1
|
||||
#else
|
||||
#define TOML_IMPLEMENTATION 0
|
||||
#endif
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
#include "toml_node.h"
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
TOML_START
|
||||
{
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
@ -55,5 +53,3 @@ TOML_START
|
||||
TOML_INLINE_FUNC_IMPL const source_region& node::source() const noexcept { return source_; }
|
||||
}
|
||||
TOML_END
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
@ -179,7 +179,7 @@ TOML_END
|
||||
|
||||
TOML_IMPL_START
|
||||
{
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result do_parse(utf8_reader_interface&&) TOML_MAY_THROW;
|
||||
}
|
||||
TOML_IMPL_END
|
||||
@ -205,7 +205,7 @@ TOML_START
|
||||
///
|
||||
/// \returns <strong><em>With exceptions:</em></strong> A toml::table. <br>
|
||||
/// <strong><em>Without exceptions:</em></strong> A toml::parse_result detailing the parsing outcome.
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result parse(std::string_view doc, std::string_view source_path = {}) TOML_MAY_THROW;
|
||||
|
||||
/// \brief Parses a TOML document from a string view.
|
||||
@ -225,7 +225,7 @@ TOML_START
|
||||
///
|
||||
/// \returns <strong><em>With exceptions:</em></strong> A toml::table. <br>
|
||||
/// <strong><em>Without exceptions:</em></strong> A toml::parse_result detailing the parsing outcome.
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result parse(std::string_view doc, std::string&& source_path) TOML_MAY_THROW;
|
||||
|
||||
#if defined(__cpp_lib_char8_t)
|
||||
@ -251,7 +251,7 @@ TOML_START
|
||||
/// <strong><em>Without exceptions:</em></strong> A toml::parse_result detailing the parsing outcome.
|
||||
///
|
||||
/// \attention This overload is not available if your compiler does not support char8_t-based strings.
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result parse(std::u8string_view doc, std::string_view source_path = {}) TOML_MAY_THROW;
|
||||
|
||||
/// \brief Parses a TOML document from a char8_t string view.
|
||||
@ -273,7 +273,7 @@ TOML_START
|
||||
/// <strong><em>Without exceptions:</em></strong> A toml::parse_result detailing the parsing outcome.
|
||||
///
|
||||
/// \attention This overload is not available if your compiler does not support char8_t-based strings.
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result parse(std::u8string_view doc, std::string&& source_path) TOML_MAY_THROW;
|
||||
|
||||
#endif // defined(__cpp_lib_char8_t)
|
||||
@ -423,7 +423,7 @@ TOML_START
|
||||
///
|
||||
/// \returns <strong><em>With exceptions:</em></strong> A toml::table. <br>
|
||||
/// <strong><em>Without exceptions:</em></strong> A toml::parse_result detailing the parsing outcome.
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result operator"" _toml(const char* str, size_t len) noexcept;
|
||||
|
||||
#if defined(__cpp_lib_char8_t)
|
||||
@ -449,7 +449,7 @@ TOML_START
|
||||
/// <strong><em>Without exceptions:</em></strong> A toml::parse_result detailing the parsing outcome.
|
||||
///
|
||||
/// \attention This overload is not available if your compiler does not support char8_t-based strings.
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result operator"" _toml(const char8_t* str, size_t len) noexcept;
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
#include "toml_parser.h"
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
TOML_IMPL_START
|
||||
{
|
||||
#if TOML_EXCEPTIONS
|
||||
@ -2903,7 +2901,8 @@ TOML_IMPL_START
|
||||
#undef TOML_ERROR
|
||||
#undef TOML_NORETURN
|
||||
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result do_parse(utf8_reader_interface&& reader) TOML_MAY_THROW
|
||||
{
|
||||
return impl::parser{ std::move(reader) };
|
||||
@ -2913,13 +2912,15 @@ TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result parse(std::string_view doc, std::string_view source_path) TOML_MAY_THROW
|
||||
{
|
||||
return impl::do_parse(impl::utf8_reader{ doc, source_path });
|
||||
}
|
||||
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result parse(std::string_view doc, std::string&& source_path) TOML_MAY_THROW
|
||||
{
|
||||
return impl::do_parse(impl::utf8_reader{ doc, std::move(source_path) });
|
||||
@ -2927,13 +2928,15 @@ TOML_START
|
||||
|
||||
#if defined(__cpp_lib_char8_t)
|
||||
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result parse(std::u8string_view doc, std::string_view source_path) TOML_MAY_THROW
|
||||
{
|
||||
return impl::do_parse(impl::utf8_reader{ doc, source_path });
|
||||
}
|
||||
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result parse(std::u8string_view doc, std::string&& source_path) TOML_MAY_THROW
|
||||
{
|
||||
return impl::do_parse(impl::utf8_reader{ doc, std::move(source_path) });
|
||||
@ -2943,7 +2946,8 @@ TOML_START
|
||||
|
||||
inline namespace literals
|
||||
{
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result operator"" _toml(const char* str, size_t len) noexcept
|
||||
{
|
||||
return parse(std::string_view{ str, len });
|
||||
@ -2951,7 +2955,8 @@ TOML_START
|
||||
|
||||
#if defined(__cpp_lib_char8_t)
|
||||
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result operator"" _toml(const char8_t* str, size_t len) noexcept
|
||||
{
|
||||
return parse(std::u8string_view{ str, len });
|
||||
@ -2961,5 +2966,3 @@ TOML_START
|
||||
}
|
||||
}
|
||||
TOML_END
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
@ -85,12 +85,10 @@ TOML_IMPL_START
|
||||
}
|
||||
};
|
||||
|
||||
#if !TOML_ALL_INLINE
|
||||
extern template struct table_proxy_pair<true>;
|
||||
extern template struct table_proxy_pair<false>;
|
||||
extern template class table_iterator<true>;
|
||||
extern template class table_iterator<false>;
|
||||
#endif
|
||||
template struct table_proxy_pair<true>;
|
||||
template struct table_proxy_pair<false>;
|
||||
template class table_iterator<true>;
|
||||
template class table_iterator<false>;
|
||||
|
||||
struct table_init_pair final
|
||||
{
|
||||
@ -120,6 +118,11 @@ TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
[[nodiscard]] TOML_API bool operator == (const table& lhs, const table& rhs) noexcept;
|
||||
[[nodiscard]] TOML_API bool operator != (const table& lhs, const table& rhs) noexcept;
|
||||
template <typename CHAR>
|
||||
std::basic_ostream<CHAR>& operator << (std::basic_ostream<CHAR>&, const table&) TOML_MAY_THROW;
|
||||
|
||||
/// \brief A TOML table.
|
||||
///
|
||||
/// \remarks The interface of this type is modeled after std::map, with some
|
||||
|
@ -2,17 +2,6 @@
|
||||
#include "toml_table.h"
|
||||
#include "toml_node_view.h"
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
TOML_IMPL_START
|
||||
{
|
||||
template struct table_proxy_pair<true>;
|
||||
template struct table_proxy_pair<false>;
|
||||
template class table_iterator<true>;
|
||||
template class table_iterator<false>;
|
||||
}
|
||||
TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
@ -137,7 +126,8 @@ TOML_START
|
||||
return do_contains(values, key);
|
||||
}
|
||||
|
||||
[[nodiscard]] TOML_INLINE_FUNC_IMPL
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
bool operator == (const table& lhs, const table& rhs) noexcept
|
||||
{
|
||||
if (&lhs == &rhs)
|
||||
@ -166,12 +156,11 @@ TOML_START
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] TOML_INLINE_FUNC_IMPL
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
bool operator != (const table& lhs, const table& rhs) noexcept
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
}
|
||||
TOML_END
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
@ -15,7 +15,7 @@ TOML_START
|
||||
/// - toml::time
|
||||
/// - toml::date_time
|
||||
template <typename T>
|
||||
class value final : public node
|
||||
class TOML_API value final : public node
|
||||
{
|
||||
static_assert(
|
||||
impl::is_value<T>,
|
||||
@ -337,6 +337,16 @@ TOML_START
|
||||
value(TOML_SMALL_INT_TYPE) -> value<int64_t>;
|
||||
#endif
|
||||
|
||||
#if !TOML_ALL_INLINE
|
||||
extern template class TOML_API value<string>;
|
||||
extern template class TOML_API value<int64_t>;
|
||||
extern template class TOML_API value<double>;
|
||||
extern template class TOML_API value<bool>;
|
||||
extern template class TOML_API value<date>;
|
||||
extern template class TOML_API value<time>;
|
||||
extern template class TOML_API value<date_time>;
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
inline std::optional<T> node::value() const noexcept
|
||||
{
|
||||
@ -437,15 +447,5 @@ TOML_START
|
||||
return *val;
|
||||
return return_type{ std::forward<T>(default_value) };
|
||||
}
|
||||
|
||||
#if !TOML_ALL_INLINE
|
||||
extern template class value<string>;
|
||||
extern template class value<int64_t>;
|
||||
extern template class value<double>;
|
||||
extern template class value<bool>;
|
||||
extern template class value<date>;
|
||||
extern template class value<time>;
|
||||
extern template class value<date_time>;
|
||||
#endif
|
||||
}
|
||||
TOML_END
|
||||
|
@ -1,18 +1,14 @@
|
||||
#pragma once
|
||||
#include "toml_array.h"
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
#include "toml_value.h"
|
||||
|
||||
TOML_START
|
||||
{
|
||||
template class value<string>;
|
||||
template class value<int64_t>;
|
||||
template class value<double>;
|
||||
template class value<bool>;
|
||||
template class value<date>;
|
||||
template class value<time>;
|
||||
template class value<date_time>;
|
||||
template class TOML_API value<string>;
|
||||
template class TOML_API value<int64_t>;
|
||||
template class TOML_API value<double>;
|
||||
template class TOML_API value<bool>;
|
||||
template class TOML_API value<date>;
|
||||
template class TOML_API value<time>;
|
||||
template class TOML_API value<date_time>;
|
||||
}
|
||||
TOML_END
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#define TOML_LIB_MAJOR 0
|
||||
#define TOML_LIB_MINOR 3
|
||||
#define TOML_LIB_PATCH 0
|
||||
#define TOML_LIB_PATCH 1
|
||||
|
||||
#define TOML_LANG_MAJOR 0
|
||||
#define TOML_LANG_MINOR 5
|
||||
|
@ -1,5 +1,5 @@
|
||||
#define TOML_ALL_INLINE 0
|
||||
#define TOML_IMPLEMENTATION 1
|
||||
#define TOML_IMPLEMENTATION
|
||||
#include "../include/toml++/toml.h"
|
||||
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
|
164
toml.hpp
164
toml.hpp
@ -1,6 +1,6 @@
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// toml++ v0.3.0
|
||||
// toml++ v0.3.1
|
||||
// https://github.com/marzer/tomlplusplus
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
@ -77,11 +77,12 @@
|
||||
#if !defined(TOML_ALL_INLINE) || (defined(TOML_ALL_INLINE) && TOML_ALL_INLINE)
|
||||
#undef TOML_ALL_INLINE
|
||||
#define TOML_ALL_INLINE 1
|
||||
#undef TOML_IMPLEMENTATION
|
||||
#define TOML_IMPLEMENTATION 1
|
||||
#endif
|
||||
|
||||
#ifndef TOML_IMPLEMENTATION
|
||||
#if defined(TOML_IMPLEMENTATION) || TOML_ALL_INLINE
|
||||
#undef TOML_IMPLEMENTATION
|
||||
#define TOML_IMPLEMENTATION 1
|
||||
#else
|
||||
#define TOML_IMPLEMENTATION 0
|
||||
#endif
|
||||
|
||||
@ -302,7 +303,7 @@
|
||||
|
||||
#define TOML_LIB_MAJOR 0
|
||||
#define TOML_LIB_MINOR 3
|
||||
#define TOML_LIB_PATCH 0
|
||||
#define TOML_LIB_PATCH 1
|
||||
|
||||
#define TOML_LANG_MAJOR 0
|
||||
#define TOML_LANG_MINOR 5
|
||||
@ -1822,7 +1823,7 @@ TOML_END
|
||||
TOML_START
|
||||
{
|
||||
template <typename T>
|
||||
class value final : public node
|
||||
class TOML_API value final : public node
|
||||
{
|
||||
static_assert(
|
||||
impl::is_value<T>,
|
||||
@ -2036,6 +2037,16 @@ TOML_START
|
||||
value(TOML_SMALL_INT_TYPE) -> value<int64_t>;
|
||||
#endif
|
||||
|
||||
#if !TOML_ALL_INLINE
|
||||
extern template class TOML_API value<string>;
|
||||
extern template class TOML_API value<int64_t>;
|
||||
extern template class TOML_API value<double>;
|
||||
extern template class TOML_API value<bool>;
|
||||
extern template class TOML_API value<date>;
|
||||
extern template class TOML_API value<time>;
|
||||
extern template class TOML_API value<date_time>;
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
inline std::optional<T> node::value() const noexcept
|
||||
{
|
||||
@ -2136,16 +2147,6 @@ TOML_START
|
||||
return *val;
|
||||
return return_type{ std::forward<T>(default_value) };
|
||||
}
|
||||
|
||||
#if !TOML_ALL_INLINE
|
||||
extern template class value<string>;
|
||||
extern template class value<int64_t>;
|
||||
extern template class value<double>;
|
||||
extern template class value<bool>;
|
||||
extern template class value<date>;
|
||||
extern template class value<time>;
|
||||
extern template class value<date_time>;
|
||||
#endif
|
||||
}
|
||||
TOML_END
|
||||
|
||||
@ -2305,10 +2306,8 @@ TOML_IMPL_START
|
||||
}
|
||||
};
|
||||
|
||||
#if !TOML_ALL_INLINE
|
||||
extern template class array_iterator<true>;
|
||||
extern template class array_iterator<false>;
|
||||
#endif
|
||||
template class array_iterator<true>;
|
||||
template class array_iterator<false>;
|
||||
|
||||
template <typename T>
|
||||
[[nodiscard]] TOML_ALWAYS_INLINE
|
||||
@ -2337,7 +2336,10 @@ TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
[[nodiscard]] bool operator == (const table& lhs, const table& rhs) noexcept;
|
||||
[[nodiscard]] TOML_API bool operator == (const array& lhs, const array& rhs) noexcept;
|
||||
[[nodiscard]] TOML_API bool operator != (const array& lhs, const array& rhs) noexcept;
|
||||
template <typename CHAR>
|
||||
std::basic_ostream<CHAR>& operator << (std::basic_ostream<CHAR>&, const array&) TOML_MAY_THROW;
|
||||
|
||||
class TOML_API array final
|
||||
: public node
|
||||
@ -2607,7 +2609,7 @@ TOML_START
|
||||
return container_equality(lhs, rhs);
|
||||
}
|
||||
TOML_ASYMMETRICAL_EQUALITY_OPS(const array&, const std::vector<T>&, template <typename T>)
|
||||
void flatten() TOML_MAY_THROW;
|
||||
void flatten() TOML_MAY_THROW;
|
||||
|
||||
template <typename CHAR>
|
||||
friend std::basic_ostream<CHAR>& operator << (std::basic_ostream<CHAR>&, const array&) TOML_MAY_THROW;
|
||||
@ -2705,12 +2707,10 @@ TOML_IMPL_START
|
||||
}
|
||||
};
|
||||
|
||||
#if !TOML_ALL_INLINE
|
||||
extern template struct table_proxy_pair<true>;
|
||||
extern template struct table_proxy_pair<false>;
|
||||
extern template class table_iterator<true>;
|
||||
extern template class table_iterator<false>;
|
||||
#endif
|
||||
template struct table_proxy_pair<true>;
|
||||
template struct table_proxy_pair<false>;
|
||||
template class table_iterator<true>;
|
||||
template class table_iterator<false>;
|
||||
|
||||
struct table_init_pair final
|
||||
{
|
||||
@ -2740,6 +2740,11 @@ TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
[[nodiscard]] TOML_API bool operator == (const table& lhs, const table& rhs) noexcept;
|
||||
[[nodiscard]] TOML_API bool operator != (const table& lhs, const table& rhs) noexcept;
|
||||
template <typename CHAR>
|
||||
std::basic_ostream<CHAR>& operator << (std::basic_ostream<CHAR>&, const table&) TOML_MAY_THROW;
|
||||
|
||||
class TOML_API table final
|
||||
: public node
|
||||
{
|
||||
@ -4895,23 +4900,25 @@ TOML_END
|
||||
|
||||
TOML_IMPL_START
|
||||
{
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result do_parse(utf8_reader_interface&&) TOML_MAY_THROW;
|
||||
}
|
||||
TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result parse(std::string_view doc, std::string_view source_path = {}) TOML_MAY_THROW;
|
||||
[[nodiscard]]
|
||||
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result parse(std::string_view doc, std::string&& source_path) TOML_MAY_THROW;
|
||||
|
||||
#if defined(__cpp_lib_char8_t)
|
||||
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result parse(std::u8string_view doc, std::string_view source_path = {}) TOML_MAY_THROW;
|
||||
[[nodiscard]]
|
||||
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result parse(std::u8string_view doc, std::string&& source_path) TOML_MAY_THROW;
|
||||
|
||||
#endif // defined(__cpp_lib_char8_t)
|
||||
@ -4961,12 +4968,12 @@ TOML_START
|
||||
|
||||
inline namespace literals
|
||||
{
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result operator"" _toml(const char* str, size_t len) noexcept;
|
||||
|
||||
#if defined(__cpp_lib_char8_t)
|
||||
|
||||
[[nodiscard]]
|
||||
[[nodiscard]] TOML_API
|
||||
parse_result operator"" _toml(const char8_t* str, size_t len) noexcept;
|
||||
|
||||
#endif
|
||||
@ -5731,11 +5738,11 @@ TOML_END
|
||||
#pragma endregion
|
||||
//-------------------------------------- ↑ toml_json_formatter.h -----------------------------------------------------
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
//----------------------------------------------------------------- ↓ toml_node_impl.h -------------------------------
|
||||
#pragma region
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
TOML_START
|
||||
{
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
@ -5789,45 +5796,30 @@ TOML_START
|
||||
}
|
||||
TOML_END
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
||||
#pragma endregion
|
||||
//----------------------------------------------------------------- ↑ toml_node_impl.h -------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------------------ ↓ toml_value_impl.h -----
|
||||
#pragma region
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
TOML_START
|
||||
{
|
||||
template class value<string>;
|
||||
template class value<int64_t>;
|
||||
template class value<double>;
|
||||
template class value<bool>;
|
||||
template class value<date>;
|
||||
template class value<time>;
|
||||
template class value<date_time>;
|
||||
template class TOML_API value<string>;
|
||||
template class TOML_API value<int64_t>;
|
||||
template class TOML_API value<double>;
|
||||
template class TOML_API value<bool>;
|
||||
template class TOML_API value<date>;
|
||||
template class TOML_API value<time>;
|
||||
template class TOML_API value<date_time>;
|
||||
}
|
||||
TOML_END
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
||||
#pragma endregion
|
||||
//------------------------------------------------------------------------------------------ ↑ toml_value_impl.h -----
|
||||
|
||||
//--------------- ↓ toml_array_impl.h --------------------------------------------------------------------------------
|
||||
#pragma region
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
TOML_IMPL_START
|
||||
{
|
||||
template class array_iterator<true>;
|
||||
template class array_iterator<false>;
|
||||
}
|
||||
TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
@ -5918,7 +5910,8 @@ TOML_START
|
||||
return index < values.size() ? values[index].get() : nullptr;
|
||||
}
|
||||
|
||||
[[nodiscard]] TOML_INLINE_FUNC_IMPL
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
bool operator == (const array& lhs, const array& rhs) noexcept
|
||||
{
|
||||
if (&lhs == &rhs)
|
||||
@ -5943,7 +5936,8 @@ TOML_START
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] TOML_INLINE_FUNC_IMPL
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
bool operator != (const array& lhs, const array& rhs) noexcept
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
@ -6027,25 +6021,12 @@ TOML_START
|
||||
}
|
||||
TOML_END
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
||||
#pragma endregion
|
||||
//--------------- ↑ toml_array_impl.h --------------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------- ↓ toml_table_impl.h -------------------------------------------------------
|
||||
#pragma region
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
TOML_IMPL_START
|
||||
{
|
||||
template struct table_proxy_pair<true>;
|
||||
template struct table_proxy_pair<false>;
|
||||
template class table_iterator<true>;
|
||||
template class table_iterator<false>;
|
||||
}
|
||||
TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
@ -6170,7 +6151,8 @@ TOML_START
|
||||
return do_contains(values, key);
|
||||
}
|
||||
|
||||
[[nodiscard]] TOML_INLINE_FUNC_IMPL
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
bool operator == (const table& lhs, const table& rhs) noexcept
|
||||
{
|
||||
if (&lhs == &rhs)
|
||||
@ -6199,7 +6181,8 @@ TOML_START
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] TOML_INLINE_FUNC_IMPL
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
bool operator != (const table& lhs, const table& rhs) noexcept
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
@ -6207,16 +6190,12 @@ TOML_START
|
||||
}
|
||||
TOML_END
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
||||
#pragma endregion
|
||||
//---------------------------------------- ↑ toml_table_impl.h -------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------- ↓ toml_parser_impl.h ------------------------------
|
||||
#pragma region
|
||||
|
||||
#if TOML_IMPLEMENTATION
|
||||
|
||||
TOML_IMPL_START
|
||||
{
|
||||
#if TOML_EXCEPTIONS
|
||||
@ -9114,7 +9093,8 @@ TOML_IMPL_START
|
||||
#undef TOML_ERROR
|
||||
#undef TOML_NORETURN
|
||||
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result do_parse(utf8_reader_interface&& reader) TOML_MAY_THROW
|
||||
{
|
||||
return impl::parser{ std::move(reader) };
|
||||
@ -9124,13 +9104,15 @@ TOML_IMPL_END
|
||||
|
||||
TOML_START
|
||||
{
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result parse(std::string_view doc, std::string_view source_path) TOML_MAY_THROW
|
||||
{
|
||||
return impl::do_parse(impl::utf8_reader{ doc, source_path });
|
||||
}
|
||||
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result parse(std::string_view doc, std::string&& source_path) TOML_MAY_THROW
|
||||
{
|
||||
return impl::do_parse(impl::utf8_reader{ doc, std::move(source_path) });
|
||||
@ -9138,13 +9120,15 @@ TOML_START
|
||||
|
||||
#if defined(__cpp_lib_char8_t)
|
||||
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result parse(std::u8string_view doc, std::string_view source_path) TOML_MAY_THROW
|
||||
{
|
||||
return impl::do_parse(impl::utf8_reader{ doc, source_path });
|
||||
}
|
||||
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result parse(std::u8string_view doc, std::string&& source_path) TOML_MAY_THROW
|
||||
{
|
||||
return impl::do_parse(impl::utf8_reader{ doc, std::move(source_path) });
|
||||
@ -9154,7 +9138,8 @@ TOML_START
|
||||
|
||||
inline namespace literals
|
||||
{
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result operator"" _toml(const char* str, size_t len) noexcept
|
||||
{
|
||||
return parse(std::string_view{ str, len });
|
||||
@ -9162,7 +9147,8 @@ TOML_START
|
||||
|
||||
#if defined(__cpp_lib_char8_t)
|
||||
|
||||
TOML_INLINE_FUNC_IMPL TOML_API
|
||||
TOML_API
|
||||
TOML_INLINE_FUNC_IMPL
|
||||
parse_result operator"" _toml(const char8_t* str, size_t len) noexcept
|
||||
{
|
||||
return parse(std::u8string_view{ str, len });
|
||||
@ -9173,11 +9159,11 @@ TOML_START
|
||||
}
|
||||
TOML_END
|
||||
|
||||
#endif // TOML_IMPLEMENTATION
|
||||
|
||||
#pragma endregion
|
||||
//---------------------------------------------------------------- ↑ toml_parser_impl.h ------------------------------
|
||||
|
||||
#endif
|
||||
|
||||
// macro hygiene
|
||||
#if TOML_UNDEF_MACROS
|
||||
#undef TOML_USE_STREAMS_FOR_FLOATS
|
||||
|
Loading…
Reference in New Issue
Block a user