refactor: deprecate TOML_API, add more specific defines

This commit is contained in:
Andrea Pappacoda 2022-02-12 13:25:43 +01:00 committed by Mark Gillard
parent 4bd9bda09f
commit 5e6008329f
30 changed files with 258 additions and 421 deletions

View File

@ -165,6 +165,10 @@ StatementMacros:
- TOML_ATTR
- TOML_CONST_GETTER
- TOML_CONST_INLINE_GETTER
- TOML_EXPORTED_CLASS
- TOML_EXPORTED_MEMBER_FUNCTION
- TOML_EXPORTED_FREE_FUNCTION
- TOML_EXPORTED_STATIC_FUNCTION
- TOML_EXTERN
- TOML_EXTERNAL_LINKAGE
- TOML_INTERNAL_LINKAGE

View File

@ -14,6 +14,20 @@ template:
-->
## Unreleased
#### Fixes:
- Fixed potential segfault when calling `at_path()` with an empty string
#### Additions:
- Added config options `TOML_EXPORTED_CLASS`, `TOML_EXPORTED_MEMBER_FUNCTION`, `TOML_EXPORTED_STATIC_FUNCTION` & `TOML_EXPORTED_FREE_FUNCTION`
#### Removals/Deprecations:
- Deprecated old `TOML_API` option in favour new `TOML_EXPORTED_X` options
(it will continue to work as it did before if none of the new function export options are defined)
## [v3.0.1](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.1) - 2022-01-13
This is a single-bugfix release to fix an ODR issue for people using header-only mode in multiple

View File

@ -145,7 +145,6 @@ won't need to mess with these at all, but if you do, set them before including t
| Option | Type | Description | Default |
|-----------------------------------|:--------------:|----------------------------------------------------------------------------------------------------------|------------------------|
| `TOML_API` | define | API annotation to add to public symbols (e.g. `__declspec(dllexport)` on Windows). | undefined |
| `TOML_ASSERT(expr)` | function macro | Sets the assert function used by the library. | `assert()` |
| `TOML_CONFIG_HEADER` | string literal | Includes the given header file before the rest of the library. | undefined |
| `TOML_ENABLE_FORMATTERS` | boolean | Enables the formatters. Set to `0` if you don't need them to improve compile times and binary size. | `1` |
@ -153,6 +152,10 @@ won't need to mess with these at all, but if you do, set them before including t
| `TOML_ENABLE_UNRELEASED_FEATURES` | boolean | Enables support for [unreleased TOML language features]. | `0` |
| `TOML_ENABLE_WINDOWS_COMPAT` | boolean | Enables support for transparent conversion between wide and narrow strings. | `1` on Windows |
| `TOML_EXCEPTIONS` | boolean | Sets whether the library uses exceptions. | per compiler settings |
| `TOML_EXPORTED_CLASS` | define | API export annotation to add to classes. | undefined |
| `TOML_EXPORTED_MEMBER_FUNCTION` | define | API export annotation to add to non-static class member functions. | undefined |
| `TOML_EXPORTED_FREE_FUNCTION` | define | API export annotation to add to free functions. | undefined |
| `TOML_EXPORTED_STATIC_FUNCTION` | define | API export annotation to add to static functions. | undefined |
| `TOML_HEADER_ONLY` | boolean | Disable this to explicitly control where toml++'s implementation is compiled (e.g. as part of a library).| `1` |
| `TOML_IMPLEMENTATION` | define | Define this to enable compilation of the library's implementation when `TOML_HEADER_ONLY` == `0`. | undefined |
| `TOML_OPTIONAL_TYPE` | type name | Overrides the `optional<T>` type used by the library if you need [something better than std::optional]. | undefined |

View File

@ -12,8 +12,10 @@
#define TOML_CONST_INLINE_GETTER inline
#define TOML_CONSTRAINED_TEMPLATE(cond, ...) template <__VA_ARGS__>
#define TOML_EMPTY_BASES
#define TOML_EXTERN
#define TOML_EXTERN_NOEXCEPT(...)
#define TOML_EXPORTED_CLASS
#define TOML_EXPORTED_FREE_FUNCTION
#define TOML_EXPORTED_MEMBER_FUNCTION
#define TOML_EXPORTED_STATIC_FUNCTION
#define TOML_EXTERNAL_LINKAGE
#define TOML_FLAGS_ENUM
#define TOML_HIDDEN_CONSTRAINT(cond, ...) template <__VA_ARGS__>
@ -21,6 +23,7 @@
#define TOML_IMPL_NAMESPACE_START namespace toml::impl
#define TOML_INTERNAL_LINKAGE static
#define TOML_LIKELY(...) (__VA_ARGS__)
#define TOML_LIKELY_CASE
#define TOML_NAMESPACE_END static_assert(true)
#define TOML_NAMESPACE_START namespace toml
#define TOML_NEVER_INLINE
@ -33,5 +36,4 @@
#define TOML_RETURNS_BY_THROWING
#define TOML_TRIVIAL_ABI
#define TOML_UNLIKELY(...) (__VA_ARGS__)
#define TOML_LIKELY_CASE
#define TOML_UNLIKELY_CASE

View File

@ -261,7 +261,7 @@ TOML_NAMESPACE_START
/// [ 3, 4, 5, 'six', 7, 8.0, 'nine' ]
/// [ 3, 4, 5, 'six', 7, 8.0, 'nine', 'ten', [ 11, 12.0 ] ]
/// \eout
class array : public node
class TOML_EXPORTED_CLASS array : public node
{
private:
/// \cond
@ -272,7 +272,7 @@ TOML_NAMESPACE_START
vector_type elems_;
TOML_NODISCARD_CTOR
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
array(const impl::array_init_elem*, const impl::array_init_elem*);
TOML_NODISCARD_CTOR
@ -280,13 +280,13 @@ TOML_NAMESPACE_START
: array{ elems.begin(), elems.end() }
{}
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void preinsertion_resize(size_t idx, size_t count);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void insert_at_back(impl::node_ptr&&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
vector_iterator insert_at(const_vector_iterator, impl::node_ptr&&);
template <typename T>
@ -301,10 +301,10 @@ TOML_NAMESPACE_START
}
TOML_NODISCARD
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
size_t total_leaf_count() const noexcept;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void flatten_child(array&& child, size_t& dest_index) noexcept;
/// \endcond
@ -316,35 +316,22 @@ TOML_NAMESPACE_START
using reference = node&;
using const_reference = const node&;
#if TOML_LIFETIME_HOOKS
TOML_NODISCARD_CTOR
array() noexcept
{
TOML_ARRAY_CREATED;
}
~array() noexcept
{
TOML_ARRAY_DESTROYED;
}
#else
/// \brief Default constructor.
TOML_NODISCARD_CTOR
array() noexcept = default;
TOML_EXPORTED_MEMBER_FUNCTION
array() noexcept;
#endif
TOML_EXPORTED_MEMBER_FUNCTION
~array() noexcept;
/// \brief Copy constructor.
TOML_NODISCARD_CTOR
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
array(const array&);
/// \brief Move constructor.
TOML_NODISCARD_CTOR
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
array(array&& other) noexcept;
/// \brief Constructs an array with one or more initial elements.
@ -390,11 +377,11 @@ TOML_NAMESPACE_START
{}
/// \brief Copy-assignment operator.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
array& operator=(const array&);
/// \brief Move-assignment operator.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
array& operator=(array&& rhs) noexcept;
/// \name Type checks
@ -408,15 +395,15 @@ TOML_NAMESPACE_START
}
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
bool is_homogeneous(node_type ntype) const noexcept final;
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
bool is_homogeneous(node_type ntype, node*& first_nonmatch) noexcept final;
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
bool is_homogeneous(node_type ntype, const node*& first_nonmatch) const noexcept final;
/// \cond
@ -746,7 +733,7 @@ TOML_NAMESPACE_START
/// \brief Gets a reference to the element at a specific index, throwing `std::out_of_range` if none existed.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node& at(size_t index);
/// \brief Gets a reference to the element at a specific index, throwing `std::out_of_range` if none existed.
@ -871,11 +858,11 @@ TOML_NAMESPACE_START
}
/// \brief Reserves internal storage capacity up to a pre-determined number of elements.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void reserve(size_t new_capacity);
/// \brief Requests the removal of any unused internal storage capacity.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void shrink_to_fit();
/// \brief Shrinks the array to the given size.
@ -900,7 +887,7 @@ TOML_NAMESPACE_START
/// \eout
///
/// \remarks Does nothing if the requested size is larger than or equal to the current size.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void truncate(size_t new_size);
/// \brief Resizes the array.
@ -969,7 +956,7 @@ TOML_NAMESPACE_START
/// \param pos Iterator to the element being erased.
///
/// \returns Iterator to the first element immediately following the removed element.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
iterator erase(const_iterator pos) noexcept;
/// \brief Removes the elements in the range [first, last) from the array.
@ -991,7 +978,7 @@ TOML_NAMESPACE_START
/// \param last Iterator to the one-past-the-last element being erased.
///
/// \returns Iterator to the first element immediately following the last removed element.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
iterator erase(const_iterator first, const_iterator last) noexcept;
/// \brief Flattens this array, recursively hoisting the contents of child arrays up into itself.
@ -1013,7 +1000,7 @@ TOML_NAMESPACE_START
/// \remarks Arrays inside child tables are not flattened.
///
/// \returns A reference to the array.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
array& flatten() &;
/// \brief Flattens this array, recursively hoisting the contents of child arrays up into itself (rvalue overload).
@ -1043,7 +1030,7 @@ TOML_NAMESPACE_START
/// \param recursive Should child arrays and tables themselves be pruned?
///
/// \returns A reference to the array.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
array& prune(bool recursive = true) & noexcept;
/// \brief Removes empty child arrays and tables (rvalue overload).
@ -1057,11 +1044,11 @@ TOML_NAMESPACE_START
}
/// \brief Removes the last element from the array.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void pop_back() noexcept;
/// \brief Removes all elements from the array.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void clear() noexcept;
/// @}
@ -1406,7 +1393,7 @@ TOML_NAMESPACE_START
/// \cond
TOML_NODISCARD
TOML_API
TOML_EXPORTED_STATIC_FUNCTION
static bool equal(const array&, const array&) noexcept;
template <typename T>

View File

@ -16,6 +16,22 @@
TOML_NAMESPACE_START
{
TOML_EXTERNAL_LINKAGE
array::array() noexcept
{
#if TOML_LIFETIME_HOOKS
TOML_ARRAY_CREATED;
#endif
}
TOML_EXTERNAL_LINKAGE
array::~array() noexcept
{
#if TOML_LIFETIME_HOOKS
TOML_ARRAY_DESTROYED;
#endif
}
TOML_EXTERNAL_LINKAGE
array::array(const impl::array_init_elem* b, const impl::array_init_elem* e)
{

View File

@ -47,14 +47,14 @@ TOML_NAMESPACE_START
/// \param root The root node from which the path will be traversed.
/// \param path The "TOML path" to traverse.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
node_view<node> at_path(node & root, std::string_view path) noexcept;
/// \brief Returns a const view of the node matching a fully-qualified "TOML path".
///
/// \see #toml::at_path(node&, std::string_view)
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
node_view<const node> at_path(const node& root, std::string_view path) noexcept;
#if TOML_ENABLE_WINDOWS_COMPAT
@ -65,7 +65,7 @@ TOML_NAMESPACE_START
///
/// \see #toml::at_path(node&, std::string_view)
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
node_view<node> at_path(node & root, std::wstring_view path);
/// \brief Returns a const view of the node matching a fully-qualified "TOML path".
@ -74,7 +74,7 @@ TOML_NAMESPACE_START
///
/// \see #toml::at_path(node&, std::string_view)
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
node_view<const node> at_path(const node& root, std::wstring_view path);
#endif

View File

@ -37,7 +37,7 @@ TOML_ANON_NAMESPACE_START
bool prev_was_array_indexer = false;
bool prev_was_dot = root.is_table(); // implicit '.' at the start for tables
do
while (pos < end && current)
{
// start of an array indexer
if (path[pos] == '[')
@ -153,7 +153,6 @@ TOML_ANON_NAMESPACE_START
prev_was_array_indexer = false;
}
}
while (pos < end && current);
// a dot at the end is as if we'd asked for an empty child at the end, e.g.
//

View File

@ -33,7 +33,7 @@ TOML_IMPL_NAMESPACE_START
std::string_view indent;
};
class formatter
class TOML_EXPORTED_CLASS formatter
{
private:
const node* source_;
@ -124,57 +124,57 @@ TOML_IMPL_NAMESPACE_START
return !!(config_.flags & format_flags::allow_unicode_strings);
}
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void attach(std::ostream& stream) noexcept;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void detach() noexcept;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print_newline(bool force = false);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print_indent();
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print_unformatted(char);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print_unformatted(std::string_view);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print_string(std::string_view str, bool allow_multi_line = true, bool allow_bare = false);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const value<std::string>&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const value<int64_t>&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const value<double>&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const value<bool>&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const value<date>&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const value<time>&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const value<date_time>&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print_value(const node&, node_type);
TOML_NODISCARD
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
bool dump_failed_parse_result();
TOML_NODISCARD_CTOR
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
formatter(const node*, const parse_result*, const formatter_constants&, const formatter_config&) noexcept;
};
}

View File

@ -43,20 +43,20 @@ TOML_NAMESPACE_START
/// }
/// }
/// \eout
class json_formatter : impl::formatter
class TOML_EXPORTED_CLASS json_formatter : impl::formatter
{
private:
/// \cond
using base = impl::formatter;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const toml::table&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const toml::array&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print();
static constexpr impl::formatter_constants constants = {

View File

@ -15,7 +15,7 @@ TOML_NAMESPACE_START
///
/// \detail A parsed TOML document forms a tree made up of tables, arrays and values.
/// This type is the base of each of those, providing a lot of the polymorphic plumbing.
class TOML_ABSTRACT_BASE node
class TOML_ABSTRACT_BASE TOML_EXPORTED_CLASS node
{
private:
/// \cond
@ -65,18 +65,19 @@ TOML_NAMESPACE_START
}
protected:
node() noexcept = default;
TOML_EXPORTED_MEMBER_FUNCTION
node() noexcept;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node(const node&) noexcept;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node(node&&) noexcept;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node& operator=(const node&) noexcept;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node& operator=(node&&) noexcept;
template <typename T, typename N>
@ -132,7 +133,7 @@ TOML_NAMESPACE_START
/// \endcond
public:
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
virtual ~node() noexcept;
/// \name Type checks
@ -998,14 +999,14 @@ TOML_NAMESPACE_START
///
/// \param path The "TOML path" to traverse.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node_view<node> at_path(std::string_view path) noexcept;
/// \brief Returns a const view of the subnode matching a fully-qualified "TOML path".
///
/// \see #at_path(std::string_view)
TOML_NODISCARD
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node_view<const node> at_path(std::string_view path) const noexcept;
#if TOML_ENABLE_WINDOWS_COMPAT
@ -1016,7 +1017,7 @@ TOML_NAMESPACE_START
///
/// \see #at_path(std::string_view)
TOML_NODISCARD
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node_view<node> at_path(std::wstring_view path);
/// \brief Returns a const view of the subnode matching a fully-qualified "TOML path".
@ -1025,7 +1026,7 @@ TOML_NAMESPACE_START
///
/// \see #at_path(std::string_view)
TOML_NODISCARD
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node_view<const node> at_path(std::wstring_view path) const;
#endif // TOML_ENABLE_WINDOWS_COMPAT
@ -1039,7 +1040,7 @@ TOML_NAMESPACE_END;
TOML_IMPL_NAMESPACE_START
{
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_FREE_FUNCTION
bool node_deep_equality(const node*, const node*) noexcept;
}
TOML_IMPL_NAMESPACE_END;

View File

@ -21,6 +21,12 @@
TOML_NAMESPACE_START
{
TOML_EXTERNAL_LINKAGE
node::node() noexcept = default;
TOML_EXTERNAL_LINKAGE
node::~node() noexcept = default;
TOML_EXTERNAL_LINKAGE
node::node(node && other) noexcept //
: source_{ std::exchange(other.source_, {}) }
@ -53,9 +59,6 @@ TOML_NAMESPACE_START
return *this;
}
TOML_EXTERNAL_LINKAGE
node::~node() noexcept = default;
TOML_EXTERNAL_LINKAGE
node_view<node> node::at_path(std::string_view path) noexcept
{

View File

@ -796,10 +796,6 @@ TOML_NAMESPACE_START
TOML_NAMESPACE_END;
/// \cond
#if TOML_EXTERN_TEMPLATES && !TOML_IMPLEMENTATION
#include "node_view_extern.inl"
#endif
TOML_NAMESPACE_START
{
inline node::operator node_view<node>() noexcept

View File

@ -1,21 +0,0 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 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 "preprocessor.h"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
//# }}
#include "node_view.h"
#include "header_start.h"
#if TOML_EXTERN_TEMPLATES && TOML_IMPLEMENTATION
#include "node_view_extern.inl"
#endif // TOML_EXTERN_TEMPLATES
#include "header_end.h"

View File

@ -1,71 +0,0 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 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
/// \cond
#include "node_view.h"
TOML_NAMESPACE_START
{
TOML_EXTERN
template class TOML_API node_view<node>;
TOML_EXTERN
template class TOML_API node_view<const node>;
#define TOML_EXTERN_FUNC(name, T) \
TOML_EXTERN \
template TOML_API \
optional<T> node_view<node>::name<T>() const TOML_EXTERN_NOEXCEPT(impl::value_retrieval_is_nothrow<T>); \
TOML_EXTERN \
template TOML_API \
optional<T> node_view<const node>::name<T>() const TOML_EXTERN_NOEXCEPT(impl::value_retrieval_is_nothrow<T>)
TOML_EXTERN_FUNC(value_exact, std::string_view);
TOML_EXTERN_FUNC(value_exact, std::string);
TOML_EXTERN_FUNC(value_exact, const char*);
TOML_EXTERN_FUNC(value_exact, int64_t);
TOML_EXTERN_FUNC(value_exact, double);
TOML_EXTERN_FUNC(value_exact, date);
TOML_EXTERN_FUNC(value_exact, time);
TOML_EXTERN_FUNC(value_exact, date_time);
TOML_EXTERN_FUNC(value_exact, bool);
TOML_EXTERN_FUNC(value, std::string_view);
TOML_EXTERN_FUNC(value, std::string);
TOML_EXTERN_FUNC(value, const char*);
TOML_EXTERN_FUNC(value, signed char);
TOML_EXTERN_FUNC(value, signed short);
TOML_EXTERN_FUNC(value, signed int);
TOML_EXTERN_FUNC(value, signed long);
TOML_EXTERN_FUNC(value, signed long long);
TOML_EXTERN_FUNC(value, unsigned char);
TOML_EXTERN_FUNC(value, unsigned short);
TOML_EXTERN_FUNC(value, unsigned int);
TOML_EXTERN_FUNC(value, unsigned long);
TOML_EXTERN_FUNC(value, unsigned long long);
TOML_EXTERN_FUNC(value, double);
TOML_EXTERN_FUNC(value, float);
TOML_EXTERN_FUNC(value, date);
TOML_EXTERN_FUNC(value, time);
TOML_EXTERN_FUNC(value, date_time);
TOML_EXTERN_FUNC(value, bool);
#if TOML_HAS_CHAR8
TOML_EXTERN_FUNC(value_exact, std::u8string_view);
TOML_EXTERN_FUNC(value_exact, std::u8string);
TOML_EXTERN_FUNC(value_exact, const char8_t*);
TOML_EXTERN_FUNC(value, std::u8string_view);
TOML_EXTERN_FUNC(value, std::u8string);
TOML_EXTERN_FUNC(value, const char8_t*);
#endif
#if TOML_ENABLE_WINDOWS_COMPAT
TOML_EXTERN_FUNC(value_exact, std::wstring);
TOML_EXTERN_FUNC(value, std::wstring);
#endif
#undef TOML_EXTERN_FUNC
}
TOML_NAMESPACE_END;
/// \endcond

View File

@ -36,7 +36,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse(std::string_view doc, std::string_view source_path = {});
/// \brief Parses a TOML document from a string view.
@ -60,7 +60,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse(std::string_view doc, std::string && source_path);
/// \brief Parses a TOML document from a file.
@ -79,7 +79,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse_file(std::string_view file_path);
#if TOML_HAS_CHAR8
@ -105,7 +105,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse(std::u8string_view doc, std::string_view source_path = {});
/// \brief Parses a TOML document from a char8_t string view.
@ -129,7 +129,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse(std::u8string_view doc, std::string && source_path);
/// \brief Parses a TOML document from a file.
@ -148,7 +148,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse_file(std::u8string_view file_path);
#endif // TOML_HAS_CHAR8
@ -178,7 +178,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse(std::string_view doc, std::wstring_view source_path);
/// \brief Parses a TOML document from a stream.
@ -207,7 +207,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse(std::istream & doc, std::wstring_view source_path);
/// \brief Parses a TOML document from a file.
@ -228,7 +228,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse_file(std::wstring_view file_path);
#endif // TOML_ENABLE_WINDOWS_COMPAT
@ -258,7 +258,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse(std::u8string_view doc, std::wstring_view source_path);
#endif // TOML_HAS_CHAR8 && TOML_ENABLE_WINDOWS_COMPAT
@ -287,7 +287,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse(std::istream & doc, std::string_view source_path = {});
/// \brief Parses a TOML document from a stream.
@ -314,7 +314,7 @@ TOML_NAMESPACE_START
/// \conditional_return{Without exceptions}
/// A toml::parse_result.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
parse_result parse(std::istream & doc, std::string && source_path);
TOML_ABI_NAMESPACE_END; // TOML_EXCEPTIONS

View File

@ -380,15 +380,6 @@
#define TOML_HEADER_ONLY 0
#endif
// extern templates (for !TOML_HEADER_ONLY)
#ifndef TOML_EXTERN_TEMPLATES
#define TOML_EXTERN_TEMPLATES 1
#endif
#if (defined(DOXYGEN) || TOML_HEADER_ONLY)
#undef TOML_EXTERN_TEMPLATES
#define TOML_EXTERN_TEMPLATES 0
#endif
// internal implementation switch
#if defined(TOML_IMPLEMENTATION) || TOML_HEADER_ONLY
#undef TOML_IMPLEMENTATION
@ -397,9 +388,27 @@
#define TOML_IMPLEMENTATION 0
#endif
// dllexport etc
#ifndef TOML_API
#define TOML_API
// dll/shared lib function exports (legacy - TOML_API was the old name for this setting)
#if !defined(TOML_EXPORTED_MEMBER_FUNCTION) \
&& !defined(TOML_EXPORTED_STATIC_FUNCTION) \
&& !defined(TOML_EXPORTED_FREE_FUNCTION) \
&& defined(TOML_API)
#define TOML_EXPORTED_MEMBER_FUNCTION TOML_API
#define TOML_EXPORTED_STATIC_FUNCTION TOML_API
#define TOML_EXPORTED_FREE_FUNCTION TOML_API
#endif
#ifndef TOML_EXPORTED_CLASS
#define TOML_EXPORTED_CLASS
#endif
#ifndef TOML_EXPORTED_MEMBER_FUNCTION
#define TOML_EXPORTED_MEMBER_FUNCTION
#endif
#ifndef TOML_EXPORTED_STATIC_FUNCTION
#define TOML_EXPORTED_STATIC_FUNCTION
#endif
#ifndef TOML_EXPORTED_FREE_FUNCTION
#define TOML_EXPORTED_FREE_FUNCTION
#endif
// experimental language features
@ -729,17 +738,6 @@
#define POXY_IMPLEMENTATION_DETAIL(...) __VA_ARGS__
#endif
#if TOML_IMPLEMENTATION
#define TOML_EXTERN
#else
#define TOML_EXTERN extern
#endif
#if TOML_CLANG
#define TOML_EXTERN_NOEXCEPT(...)
#else
#define TOML_EXTERN_NOEXCEPT(...) noexcept(__VA_ARGS__)
#endif
#ifdef NDEBUG
#define TOML_PURE_GETTER TOML_NODISCARD TOML_ATTR(pure)
#define TOML_CONST_GETTER TOML_NODISCARD TOML_ATTR(const)
@ -994,10 +992,24 @@
/// \ecpp
/// \def TOML_API
/// \brief An annotation to add to public symbols.
/// \def TOML_EXPORTED_CLASS
/// \brief An 'export' annotation to add to classes.
/// \detail Not defined by default.
/// \remark You'd override this with `__declspec(dllexport)` if you were building the library
/// \remark You might override this with `__declspec(dllexport)` if you were building the library
/// into the public API of a DLL on Windows.
/// \def TOML_EXPORTED_MEMBER_FUNCTION
/// \brief An 'export' annotation to add to non-static class member functions.
/// \detail Not defined by default.
/// \remark You might override this with `__declspec(dllexport)` if you were building the library
/// into the public API of a DLL on Windows.
/// \def TOML_EXPORTED_FREE_FUNCTION
/// \brief An 'export' annotation to add to free functions.
/// \detail Not defined by default.
/// \remark You might override this with `__declspec(dllexport)` if you were building the library
/// into the public API of a DLL on Windows.

View File

@ -16,97 +16,97 @@ TOML_IMPL_NAMESPACE_START
// - I can (potentially) avoid forcing users to drag in <sstream> and <iomanip>.
// - Strings in C++. Honestly.
TOML_API
TOML_EXPORTED_FREE_FUNCTION
TOML_ATTR(nonnull)
void print_to_stream(std::ostream&, const char*, size_t);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, std::string_view);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const std::string&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, char);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, int8_t, value_flags = {}, size_t min_digits = 0);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, int16_t, value_flags = {}, size_t min_digits = 0);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, int32_t, value_flags = {}, size_t min_digits = 0);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, int64_t, value_flags = {}, size_t min_digits = 0);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, uint8_t, value_flags = {}, size_t min_digits = 0);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, uint16_t, value_flags = {}, size_t min_digits = 0);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, uint32_t, value_flags = {}, size_t min_digits = 0);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, uint64_t, value_flags = {}, size_t min_digits = 0);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, float, value_flags = {}, bool relaxed_precision = false);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, double, value_flags = {}, bool relaxed_precision = false);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, bool);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const toml::date&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const toml::time&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const toml::time_offset&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const toml::date_time&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const source_position&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const source_region&);
#if TOML_ENABLE_FORMATTERS
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const array&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const table&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const value<std::string>&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const value<int64_t>&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const value<double>&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const value<bool>&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const value<date>&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const value<time>&);
TOML_API
TOML_EXPORTED_FREE_FUNCTION
void print_to_stream(std::ostream&, const value<date_time>&);
#endif

View File

@ -31,17 +31,17 @@ namespace toml // non-abi namespace; this is not an error
TOML_IMPL_NAMESPACE_START
{
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
std::string narrow(std::wstring_view);
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
std::wstring widen(std::string_view);
#if TOML_HAS_CHAR8
TOML_NODISCARD
TOML_API
TOML_EXPORTED_FREE_FUNCTION
std::wstring widen(std::u8string_view);
#endif

View File

@ -215,7 +215,7 @@ TOML_NAMESPACE_START
/// cats : ['tiger', 'lion', 'puma']
/// fish[1] : 'trout'
/// \eout
class table : public node
class TOML_EXPORTED_CLASS table : public node
{
private:
/// \cond
@ -228,40 +228,28 @@ TOML_NAMESPACE_START
bool inline_ = false;
TOML_NODISCARD_CTOR
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
table(const impl::table_init_pair*, const impl::table_init_pair*);
/// \endcond
public:
#if TOML_LIFETIME_HOOKS
TOML_NODISCARD_CTOR
table() noexcept
{
TOML_TABLE_CREATED;
}
~table() noexcept
{
TOML_TABLE_DESTROYED;
}
#else
/// \brief Default constructor.
TOML_NODISCARD_CTOR
table() noexcept = default;
TOML_EXPORTED_MEMBER_FUNCTION
table() noexcept;
#endif
TOML_EXPORTED_MEMBER_FUNCTION
~table() noexcept;
/// \brief Copy constructor.
TOML_NODISCARD_CTOR
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
table(const table&);
/// \brief Move constructor.
TOML_NODISCARD_CTOR
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
table(table&& other) noexcept;
/// \brief Constructs a table with one or more initial key-value pairs.
@ -281,17 +269,17 @@ TOML_NAMESPACE_START
///
/// \param kvps A list of key-value pairs used to initialize the table.
TOML_NODISCARD_CTOR
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
explicit table(std::initializer_list<impl::table_init_pair> kvps) //
: table(kvps.begin(), kvps.end())
{}
/// \brief Copy-assignment operator.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
table& operator=(const table&);
/// \brief Move-assignment operator.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
table& operator=(table&& rhs) noexcept;
/// \name Type checks
@ -305,15 +293,15 @@ TOML_NAMESPACE_START
}
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
bool is_homogeneous(node_type ntype) const noexcept final;
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
bool is_homogeneous(node_type ntype, node*& first_nonmatch) noexcept final;
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
bool is_homogeneous(node_type ntype, const node*& first_nonmatch) const noexcept final;
/// \cond
@ -636,7 +624,7 @@ TOML_NAMESPACE_START
///
/// \returns A pointer to the node at the specified key, or nullptr.
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node* get(std::string_view key) noexcept;
/// \brief Gets the node at a specific key (const overload).
@ -762,7 +750,7 @@ TOML_NAMESPACE_START
/// \brief Gets a reference to the element at a specific key, throwing `std::out_of_range` if none existed.
TOML_NODISCARD
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
node& at(std::string_view key);
/// \brief Gets a reference to the element at a specific key, throwing `std::out_of_range` if none existed.
@ -875,7 +863,7 @@ TOML_NAMESPACE_START
/// \cond
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
map_iterator get_lower_bound(std::string_view) noexcept;
/// \endcond
@ -937,7 +925,7 @@ TOML_NAMESPACE_START
///
/// \returns An iterator to the node at the specified key, or end().
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
iterator find(std::string_view key) noexcept;
/// \brief Gets an iterator to the node at a specific key (const overload)
@ -946,7 +934,7 @@ TOML_NAMESPACE_START
///
/// \returns A const iterator to the node at the specified key, or cend().
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
const_iterator find(std::string_view key) const noexcept;
/// \brief Returns true if the table contains a node at the given key.
@ -1006,10 +994,10 @@ TOML_NAMESPACE_START
private:
/// \cond
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
map_iterator erase(const_map_iterator) noexcept;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
map_iterator erase(const_map_iterator, const_map_iterator) noexcept;
/// \endcond
@ -1123,7 +1111,7 @@ TOML_NAMESPACE_START
/// \param key Key to erase.
///
/// \returns Number of elements removed (0 or 1).
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
size_t erase(std::string_view key) noexcept;
#if TOML_ENABLE_WINDOWS_COMPAT
@ -1164,7 +1152,7 @@ TOML_NAMESPACE_START
/// \param recursive Should child arrays and tables themselves be pruned?
///
/// \returns A reference to the table.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
table& prune(bool recursive = true) & noexcept;
/// \brief Removes empty child arrays and tables (rvalue overload).
@ -1178,7 +1166,7 @@ TOML_NAMESPACE_START
}
/// \brief Removes all key-value pairs from the table.
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void clear() noexcept;
/// @}
@ -1189,7 +1177,7 @@ TOML_NAMESPACE_START
private:
/// \cond
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
map_iterator insert_with_hint(const_iterator, key&&, impl::node_ptr&&);
/// \endcond
@ -1682,7 +1670,7 @@ TOML_NAMESPACE_START
/// \cond
TOML_PURE_GETTER
TOML_API
TOML_EXPORTED_STATIC_FUNCTION
static bool equal(const table&, const table&) noexcept;
/// \endcond

View File

@ -17,6 +17,22 @@
TOML_NAMESPACE_START
{
TOML_EXTERNAL_LINKAGE
table::table() noexcept
{
#if TOML_LIFETIME_HOOKS
TOML_TABLE_CREATED;
#endif
}
TOML_EXTERNAL_LINKAGE
table::~table() noexcept
{
#if TOML_LIFETIME_HOOKS
TOML_TABLE_DESTROYED;
#endif
}
TOML_EXTERNAL_LINKAGE
table::table(const impl::table_init_pair* b, const impl::table_init_pair* e)
{

View File

@ -41,7 +41,7 @@ TOML_NAMESPACE_START
/// [table]
/// foo = "bar"
/// \eout
class toml_formatter : impl::formatter
class TOML_EXPORTED_CLASS toml_formatter : impl::formatter
{
private:
/// \cond
@ -50,22 +50,22 @@ TOML_NAMESPACE_START
std::vector<const key*> key_path_;
bool pending_table_separator_ = false;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print_pending_table_separator();
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const key&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print_inline(const toml::table&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const toml::array&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const toml::table&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print();
static constexpr impl::formatter_constants constants = { format_flags::none, // mandatory

View File

@ -1256,10 +1256,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
/// \cond
#if TOML_EXTERN_TEMPLATES && !TOML_IMPLEMENTATION
#include "value_extern.inl"
#endif
/// \endcond
#include "header_end.h"

View File

@ -1,21 +0,0 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 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 "preprocessor.h"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
//# }}
#include "value.h"
#include "header_start.h"
#if TOML_EXTERN_TEMPLATES && TOML_IMPLEMENTATION
#include "value_extern.inl"
#endif // TOML_EXTERN_TEMPLATES
#include "header_end.h"

View File

@ -1,76 +0,0 @@
//# This file is a part of toml++ and is subject to the the terms of the MIT license.
//# Copyright (c) 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
/// \cond
#include "value.h"
TOML_NAMESPACE_START
{
TOML_EXTERN
template class TOML_API value<std::string>;
TOML_EXTERN
template class TOML_API value<int64_t>;
TOML_EXTERN
template class TOML_API value<double>;
TOML_EXTERN
template class TOML_API value<bool>;
TOML_EXTERN
template class TOML_API value<date>;
TOML_EXTERN
template class TOML_API value<time>;
TOML_EXTERN
template class TOML_API value<date_time>;
#define TOML_EXTERN_FUNC(name, T) \
TOML_EXTERN \
template TOML_API \
optional<T> node::name<T>() const TOML_EXTERN_NOEXCEPT(impl::value_retrieval_is_nothrow<T>)
TOML_EXTERN_FUNC(value_exact, std::string_view);
TOML_EXTERN_FUNC(value_exact, std::string);
TOML_EXTERN_FUNC(value_exact, const char*);
TOML_EXTERN_FUNC(value_exact, int64_t);
TOML_EXTERN_FUNC(value_exact, double);
TOML_EXTERN_FUNC(value_exact, date);
TOML_EXTERN_FUNC(value_exact, time);
TOML_EXTERN_FUNC(value_exact, date_time);
TOML_EXTERN_FUNC(value_exact, bool);
TOML_EXTERN_FUNC(value, std::string_view);
TOML_EXTERN_FUNC(value, std::string);
TOML_EXTERN_FUNC(value, const char*);
TOML_EXTERN_FUNC(value, signed char);
TOML_EXTERN_FUNC(value, signed short);
TOML_EXTERN_FUNC(value, signed int);
TOML_EXTERN_FUNC(value, signed long);
TOML_EXTERN_FUNC(value, signed long long);
TOML_EXTERN_FUNC(value, unsigned char);
TOML_EXTERN_FUNC(value, unsigned short);
TOML_EXTERN_FUNC(value, unsigned int);
TOML_EXTERN_FUNC(value, unsigned long);
TOML_EXTERN_FUNC(value, unsigned long long);
TOML_EXTERN_FUNC(value, double);
TOML_EXTERN_FUNC(value, float);
TOML_EXTERN_FUNC(value, date);
TOML_EXTERN_FUNC(value, time);
TOML_EXTERN_FUNC(value, date_time);
TOML_EXTERN_FUNC(value, bool);
#if TOML_HAS_CHAR8
TOML_EXTERN_FUNC(value_exact, std::u8string_view);
TOML_EXTERN_FUNC(value_exact, std::u8string);
TOML_EXTERN_FUNC(value_exact, const char8_t*);
TOML_EXTERN_FUNC(value, std::u8string_view);
TOML_EXTERN_FUNC(value, std::u8string);
TOML_EXTERN_FUNC(value, const char8_t*);
#endif
#if TOML_ENABLE_WINDOWS_COMPAT
TOML_EXTERN_FUNC(value_exact, std::wstring);
TOML_EXTERN_FUNC(value, std::wstring);
#endif
#undef TOML_EXTERN_FUNC
}
TOML_NAMESPACE_END;
/// \endcond

View File

@ -37,23 +37,23 @@ TOML_NAMESPACE_START
/// texture:
/// smooth: true
/// \eout
class yaml_formatter : impl::formatter
class TOML_EXPORTED_CLASS yaml_formatter : impl::formatter
{
private:
/// \cond
using base = impl::formatter;
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print_yaml_string(const value<std::string>&);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const toml::table&, bool = false);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print(const toml::array&, bool = false);
TOML_API
TOML_EXPORTED_MEMBER_FUNCTION
void print();
static constexpr impl::formatter_constants constants = {

View File

@ -59,9 +59,7 @@ TOML_DISABLE_SUGGEST_ATTR_WARNINGS;
#include "impl/std_string.inl"
#include "impl/print_to_stream.inl"
#include "impl/node.inl"
#include "impl/node_view.inl"
#include "impl/at_path.inl"
#include "impl/value.inl"
#include "impl/array.inl"
#include "impl/table.inl"
#include "impl/unicode.inl"
@ -113,8 +111,6 @@ TOML_POP_WARNINGS;
#undef TOML_ENABLE_WARNINGS
#undef TOML_EVAL_BOOL_0
#undef TOML_EVAL_BOOL_1
#undef TOML_EXTERN
#undef TOML_EXTERN_NOEXCEPT
#undef TOML_EXTERNAL_LINKAGE
#undef TOML_FLAGS_ENUM
#undef TOML_FLOAT_CHARCONV

View File

@ -39,9 +39,6 @@
#if defined(_WIN32) ^ TOML_ENABLE_WINDOWS_COMPAT
#error TOML_ENABLE_WINDOWS_COMPAT does not match _WIN32 (default behaviour should be to match)
#endif
#if !(TOML_HEADER_ONLY ^ TOML_EXTERN_TEMPLATES) && !TOML_INTELLISENSE
#error TOML_EXTERN_TEMPLATES should hold the opposite value to TOML_HEADER_ONLY by default
#endif
#if TOML_LIB_SINGLE_HEADER ^ USE_SINGLE_HEADER
#error TOML_LIB_SINGLE_HEADER was not set correctly
#endif

View File

@ -55,7 +55,6 @@
<ClInclude Include="include\toml++\impl\node.h" />
<ClInclude Include="include\toml++\impl\node.inl" />
<ClInclude Include="include\toml++\impl\node_view.h" />
<ClInclude Include="include\toml++\impl\node_view.inl" />
<ClInclude Include="include\toml++\impl\parse_error.h" />
<ClInclude Include="include\toml++\impl\parse_result.h" />
<ClInclude Include="include\toml++\impl\parser.h" />
@ -75,8 +74,6 @@
<ClInclude Include="include\toml++\impl\table.inl" />
<ClInclude Include="include\toml++\impl\unicode.h" />
<ClInclude Include="include\toml++\impl\value.h" />
<ClInclude Include="include\toml++\impl\value.inl" />
<ClInclude Include="include\toml++\impl\value_extern.inl" />
<ClInclude Include="include\toml++\impl\version.h" />
<ClInclude Include="include\toml++\impl\std_string.inl" />
<ClInclude Include="include\toml++\impl\yaml_formatter.h" />
@ -99,7 +96,6 @@
<None Include="CONTRIBUTING.md" />
<None Include="include\toml++\impl\at_path.inl" />
<None Include="include\toml++\impl\unicode.inl" />
<None Include="include\toml++\impl\node_view_extern.inl" />
<None Include="include\toml++\impl\yaml_formatter.inl" />
<None Include="LICENSE" />
<None Include="README.md" />

View File

@ -198,7 +198,9 @@ def main():
r'TOML_ENABLE_UNRELEASED_FEATURES',
r'TOML_ENABLE_WINDOWS_COMPAT',
r'TOML_EXCEPTIONS',
r'TOML_EXTERN_TEMPLATES',
r'TOML_EXPORTED_CLASS',
r'TOML_EXPORTED_FREE_FUNCTION',
r'TOML_EXPORTED_MEMBER_FUNCTION',
r'TOML_HEADER_ONLY',
r'TOML_LANG_MAJOR',
r'TOML_LANG_MINOR',