release v3.0.1

This commit is contained in:
Mark Gillard 2022-01-13 12:09:07 +02:00
parent 71b57a3238
commit 8e669aa699
15 changed files with 83 additions and 37 deletions

View File

@ -14,7 +14,11 @@ template:
--> -->
## Unreleased ## [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
translation units. If you aren't seeing linker errors because of `toml::array::insert_at()`,
this release holds nothing of value over v3.0.0.
#### Fixes: #### Fixes:
- fixed erroneous use of `TOML_API` causing ODR issue (#136) (@Azarael) - fixed erroneous use of `TOML_API` causing ODR issue (#136) (@Azarael)

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14)
project( project(
tomlplusplus tomlplusplus
VERSION 3.0.0 VERSION 3.0.1
DESCRIPTION "Header-only TOML config file parser and serializer for C++17" DESCRIPTION "Header-only TOML config file parser and serializer for C++17"
HOMEPAGE_URL "https://marzer.github.io/tomlplusplus/" HOMEPAGE_URL "https://marzer.github.io/tomlplusplus/"
LANGUAGES CXX LANGUAGES CXX

View File

@ -99,13 +99,13 @@ You'll find some more code examples in the `examples` directory, and plenty more
2. `#include <toml++/toml.h>` 2. `#include <toml++/toml.h>`
### Conan ### Conan
Add `tomlplusplus/3.0.0` to your conanfile. Add `tomlplusplus/3.0.1` to your conanfile.
### DDS ### DDS
Add `tomlpp` to your `package.json5`, e.g.: Add `tomlpp` to your `package.json5`, e.g.:
``` ```
depends: [ depends: [
'tomlpp^3.0.0', 'tomlpp^3.0.1',
] ]
``` ```
> &#xFE0F; _[What is DDS?](https://dds.pizza/)_ > &#xFE0F; _[What is DDS?](https://dds.pizza/)_
@ -121,7 +121,7 @@ include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
tomlplusplus tomlplusplus
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
GIT_TAG v3.0.0 GIT_TAG v3.0.1
) )
FetchContent_MakeAvailable(tomlplusplus) FetchContent_MakeAvailable(tomlplusplus)
``` ```

View File

@ -457,7 +457,7 @@
\subsection mainpage-adding-lib-conan Conan \subsection mainpage-adding-lib-conan Conan
Add `tomlplusplus/3.0.0` to your conanfile. Add `tomlplusplus/3.0.1` to your conanfile.
@ -465,7 +465,7 @@
Add `tomlpp` to your `package.json5`, e.g.: Add `tomlpp` to your `package.json5`, e.g.:
\bash \bash
depends: [ depends: [
'tomlpp^3.0.0', 'tomlpp^3.0.1',
] ]
\ebash \ebash
@ -497,7 +497,7 @@
FetchContent_Declare( FetchContent_Declare(
tomlplusplus tomlplusplus
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
GIT_TAG v3.0.0 GIT_TAG v3.0.1
) )
FetchContent_MakeAvailable(tomlplusplus) FetchContent_MakeAvailable(tomlplusplus)
\endcode \endcode

View File

@ -11,12 +11,12 @@ TOML_NAMESPACE_START
/// \brief Returns a view of the node matching a fully-qualified "TOML path". /// \brief Returns a view of the node matching a fully-qualified "TOML path".
/// ///
/// \detail \cpp /// \detail \cpp
/// auto config = R"( /// auto config = toml::parse(R"(
/// ///
/// [foo] /// [foo]
/// bar = [ 0, 1, 2, [ 3 ], { kek = 4 } ] /// bar = [ 0, 1, 2, [ 3 ], { kek = 4 } ]
/// ///
/// )"_toml; /// )"sv);
/// ///
/// std::cout << toml::at_path(config, "foo.bar[2]") << "\n"; /// std::cout << toml::at_path(config, "foo.bar[2]") << "\n";
/// std::cout << toml::at_path(config, "foo.bar[3][0]") << "\n"; /// std::cout << toml::at_path(config, "foo.bar[3][0]") << "\n";

View File

@ -35,12 +35,6 @@ TOML_NAMESPACE_START
source_region source_; source_region source_;
public: public:
/// A const iterator for iterating over the characters in the key.
using const_iterator = const char*;
/// A const iterator for iterating over the characters in the key.
using iterator = const_iterator;
/// \brief Default constructor. /// \brief Default constructor.
TOML_NODISCARD_CTOR TOML_NODISCARD_CTOR
key() noexcept = default; key() noexcept = default;
@ -296,6 +290,12 @@ TOML_NAMESPACE_START
/// \name Iterators /// \name Iterators
/// @{ /// @{
/// A const iterator for iterating over the characters in the key.
using const_iterator = const char*;
/// A const iterator for iterating over the characters in the key.
using iterator = const_iterator;
/// \brief Returns an iterator to the first character in the key's backing string. /// \brief Returns an iterator to the first character in the key's backing string.
TOML_PURE_INLINE_GETTER TOML_PURE_INLINE_GETTER
const_iterator begin() const noexcept const_iterator begin() const noexcept

View File

@ -962,14 +962,48 @@ TOML_NAMESPACE_START
/// \brief Returns a view of the subnode matching a fully-qualified "TOML path". /// \brief Returns a view of the subnode matching a fully-qualified "TOML path".
/// ///
/// \see #toml::at_path(node&, std::string_view) /// \detail \cpp
/// auto config = toml::parse(R"(
///
/// [foo]
/// bar = [ 0, 1, 2, [ 3 ], { kek = 4 } ]
///
/// )"sv);
///
/// std::cout << config.at_path("foo.bar[2]") << "\n";
/// std::cout << config.at_path("foo.bar[3][0]") << "\n";
/// std::cout << config.at_path("foo.bar[4].kek") << "\n";
/// \ecpp
///
/// \out
/// 2
/// 3
/// 4
/// \eout
///
///
/// \note Keys in paths are interpreted literally, so whitespace (or lack thereof) matters:
/// \cpp
/// config.at_path( "foo.bar") // same as node_view{ config }["foo"]["bar"]
/// config.at_path( "foo. bar") // same as node_view{ config }["foo"][" bar"]
/// config.at_path( "foo..bar") // same as node_view{ config }["foo"][""]["bar"]
/// config.at_path( ".foo.bar") // same as node_view{ config }[""]["foo"]["bar"]
/// \ecpp
/// <br>
/// Additionally, TOML allows '.' (period) characters to appear in keys if they are quoted strings.
/// This function makes no allowance for this, instead treating all period characters as sub-table delimiters.
/// If you have periods in your table keys, first consider:
/// 1. Not doing that
/// 2. Using node_view::operator[] instead.
///
/// \param path The "TOML path" to traverse.
TOML_NODISCARD TOML_NODISCARD
TOML_API TOML_API
node_view<node> at_path(std::string_view path) noexcept; node_view<node> at_path(std::string_view path) noexcept;
/// \brief Returns a const view of the subnode matching a fully-qualified "TOML path". /// \brief Returns a const view of the subnode matching a fully-qualified "TOML path".
/// ///
/// \see #toml::at_path(node&, std::string_view) /// \see #at_path(std::string_view)
TOML_NODISCARD TOML_NODISCARD
TOML_API TOML_API
node_view<const node> at_path(std::string_view path) const noexcept; node_view<const node> at_path(std::string_view path) const noexcept;
@ -980,7 +1014,7 @@ TOML_NAMESPACE_START
/// ///
/// \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled. /// \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled.
/// ///
/// \see #toml::at_path(node&, std::string_view) /// \see #at_path(std::string_view)
TOML_NODISCARD TOML_NODISCARD
TOML_API TOML_API
node_view<node> at_path(std::wstring_view path); node_view<node> at_path(std::wstring_view path);
@ -989,7 +1023,7 @@ TOML_NAMESPACE_START
/// ///
/// \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled. /// \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled.
/// ///
/// \see #toml::at_path(node&, std::string_view) /// \see #at_path(std::string_view)
TOML_NODISCARD TOML_NODISCARD
TOML_API TOML_API
node_view<const node> at_path(std::wstring_view path) const; node_view<const node> at_path(std::wstring_view path) const;

View File

@ -708,7 +708,7 @@ TOML_NAMESPACE_START
/// \brief Returns a view of the subnode matching a fully-qualified "TOML path". /// \brief Returns a view of the subnode matching a fully-qualified "TOML path".
/// ///
/// \see #toml::at_path(node&, std::string_view) /// \see #toml::node::at_path(std::string_view)
TOML_NODISCARD TOML_NODISCARD
node_view at_path(std::string_view path) const noexcept node_view at_path(std::string_view path) const noexcept
{ {
@ -737,7 +737,7 @@ TOML_NAMESPACE_START
/// ///
/// \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled. /// \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled.
/// ///
/// \see #toml::at_path(node&, std::string_view) /// \see #toml::node::at_path(std::string_view)
TOML_NODISCARD TOML_NODISCARD
node_view at_path(std::wstring_view path) const node_view at_path(std::wstring_view path) const
{ {

View File

@ -358,7 +358,7 @@ TOML_NAMESPACE_START
/// \brief Returns a view of the subnode matching a fully-qualified "TOML path". /// \brief Returns a view of the subnode matching a fully-qualified "TOML path".
/// ///
/// \see #toml::at_path(node&, std::string_view) /// \see #toml::node::at_path(std::string_view)
TOML_NODISCARD TOML_NODISCARD
node_view<node> at_path(std::string_view path) noexcept node_view<node> at_path(std::string_view path) noexcept
{ {
@ -367,7 +367,7 @@ TOML_NAMESPACE_START
/// \brief Returns a const view of the subnode matching a fully-qualified "TOML path". /// \brief Returns a const view of the subnode matching a fully-qualified "TOML path".
/// ///
/// \see #toml::at_path(node&, std::string_view) /// \see #toml::node::at_path(std::string_view)
TOML_NODISCARD TOML_NODISCARD
node_view<const node> at_path(std::string_view path) const noexcept node_view<const node> at_path(std::string_view path) const noexcept
{ {
@ -412,7 +412,7 @@ TOML_NAMESPACE_START
/// ///
/// \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled. /// \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled.
/// ///
/// \see #toml::at_path(node&, std::string_view) /// \see #toml::node::at_path(std::string_view)
TOML_NODISCARD TOML_NODISCARD
node_view<node> at_path(std::wstring_view path) noexcept node_view<node> at_path(std::wstring_view path) noexcept
{ {
@ -423,7 +423,7 @@ TOML_NAMESPACE_START
/// ///
/// \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled. /// \availability This overload is only available when #TOML_ENABLE_WINDOWS_COMPAT is enabled.
/// ///
/// \see #toml::at_path(node&, std::string_view) /// \see #toml::node::at_path(std::string_view)
TOML_NODISCARD TOML_NODISCARD
node_view<const node> at_path(std::wstring_view path) const noexcept node_view<const node> at_path(std::wstring_view path) const noexcept
{ {

View File

@ -6,7 +6,7 @@
#define TOML_LIB_MAJOR 3 #define TOML_LIB_MAJOR 3
#define TOML_LIB_MINOR 0 #define TOML_LIB_MINOR 0
#define TOML_LIB_PATCH 0 #define TOML_LIB_PATCH 1
#define TOML_LANG_MAJOR 1 #define TOML_LANG_MAJOR 1
#define TOML_LANG_MINOR 0 #define TOML_LANG_MINOR 0

View File

@ -1,7 +1,7 @@
project( project(
'tomlplusplus', 'tomlplusplus',
'cpp', 'cpp',
version: '3.0.0', version: '3.0.1',
meson_version: '>=0.54.0', meson_version: '>=0.54.0',
license: 'MIT', license: 'MIT',
default_options: [ # https://mesonbuild.com/Builtin-options.html default_options: [ # https://mesonbuild.com/Builtin-options.html

View File

@ -166,7 +166,7 @@ foreach cpp20 : cpp20_modes
endforeach # strict endforeach # strict
endforeach # cpp20 endforeach # cpp20
locales = [ test_locales = [
'C', 'C',
'en_US.utf8', 'en_US.utf8',
'ja_JP.utf8', 'ja_JP.utf8',
@ -179,7 +179,7 @@ locales = [
] ]
foreach executable : test_executables foreach executable : test_executables
foreach locale : locales foreach locale : test_locales
test( test(
executable[0] + ' (' + locale + ')', # name executable[0] + ' (' + locale + ')', # name
executable[1], # executable object executable[1], # executable object
@ -194,5 +194,7 @@ endforeach
executable( executable(
'odr_test', 'odr_test',
[ 'odr_test_1.cpp', 'odr_test_2.cpp' ], [ 'odr_test_1.cpp', 'odr_test_2.cpp' ],
include_directories: include_dirs include_directories: include_dirs,
cpp_args: additional_arguments,
override_options: overrides
) )

View File

@ -1,7 +1,10 @@
#define TOML_ENABLE_UNRELEASED_FEATURES 1 #define TOML_ENABLE_UNRELEASED_FEATURES 1
#define TOML_HEADER_ONLY 1 #define TOML_HEADER_ONLY 1
#define TOML_UNDEF_MACROS 0
#include "../toml.hpp" #include "../toml.hpp"
TOML_DISABLE_WARNINGS;
int main() int main()
{ {
return 0; return 0;

View File

@ -42,6 +42,9 @@
#if !(TOML_HEADER_ONLY ^ TOML_EXTERN_TEMPLATES) && !TOML_INTELLISENSE #if !(TOML_HEADER_ONLY ^ TOML_EXTERN_TEMPLATES) && !TOML_INTELLISENSE
#error TOML_EXTERN_TEMPLATES should hold the opposite value to TOML_HEADER_ONLY by default #error TOML_EXTERN_TEMPLATES should hold the opposite value to TOML_HEADER_ONLY by default
#endif #endif
#if TOML_LIB_SINGLE_HEADER ^ USE_SINGLE_HEADER
#error TOML_LIB_SINGLE_HEADER was not set correctly
#endif
#if TOML_ICC #if TOML_ICC
#define UNICODE_LITERALS_OK 0 #define UNICODE_LITERALS_OK 0

View File

@ -1,6 +1,6 @@
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// //
// toml++ v3.0.0 // toml++ v3.0.1
// https://github.com/marzer/tomlplusplus // https://github.com/marzer/tomlplusplus
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// //
@ -810,7 +810,7 @@
#define TOML_LIB_MAJOR 3 #define TOML_LIB_MAJOR 3
#define TOML_LIB_MINOR 0 #define TOML_LIB_MINOR 0
#define TOML_LIB_PATCH 0 #define TOML_LIB_PATCH 1
#define TOML_LANG_MAJOR 1 #define TOML_LANG_MAJOR 1
#define TOML_LANG_MINOR 0 #define TOML_LANG_MINOR 0
@ -5981,10 +5981,6 @@ TOML_NAMESPACE_START
public: public:
using const_iterator = const char*;
using iterator = const_iterator;
TOML_NODISCARD_CTOR TOML_NODISCARD_CTOR
key() noexcept = default; key() noexcept = default;
@ -6184,6 +6180,10 @@ TOML_NAMESPACE_START
return lhs >= rhs.key_; return lhs >= rhs.key_;
} }
using const_iterator = const char*;
using iterator = const_iterator;
TOML_PURE_INLINE_GETTER TOML_PURE_INLINE_GETTER
const_iterator begin() const noexcept const_iterator begin() const noexcept
{ {