This commit is contained in:
Mark Gillard 2023-10-13 16:25:17 +03:00
parent cc1962eac7
commit 30172438ce
11 changed files with 237 additions and 229 deletions

View File

@ -10,9 +10,6 @@ trim_trailing_whitespace = true
charset = utf-8 charset = utf-8
max_line_length = 120 max_line_length = 120
[*.{md,markdown}]
trim_trailing_whitespace = false
[*.{gitattributes,yaml,yml,vcxproj,vcxproj.filters,sln,rc,clang-format,toml,py,cmake}] [*.{gitattributes,yaml,yml,vcxproj,vcxproj.filters,sln,rc,clang-format,toml,py,cmake}]
indent_style = space indent_style = space

View File

@ -21,7 +21,7 @@ template:
--> -->
## Unreleased ## v3.4.0
#### Fixes #### Fixes
@ -37,7 +37,7 @@ template:
#### Additions #### Additions
- improved support for using enums with `value_or()` - added support for using enums with `value_or()`
#### Changes: #### Changes:

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14)
project( project(
tomlplusplus tomlplusplus
VERSION 3.3.0 VERSION 3.4.0
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

@ -68,7 +68,7 @@ cd build-debug && ninja && ninja test \
## Testing with the [toml-test] suite ## Testing with the [toml-test] suite
As an optional extra you may wish to test against the 'official' test TOML test suite, [BurntSushi/toml-test]. See the As an optional extra you may wish to test against the official test TOML test suite, [toml-test]. See the
instructions at [toml-test/README](./toml-test/README.md). Note that the toml++ tests already consume tests from the instructions at [toml-test/README](./toml-test/README.md). Note that the toml++ tests already consume tests from the
offical suite via a C++ code-generation script so you are not expected to take this extra step as part of contributing offical suite via a C++ code-generation script so you are not expected to take this extra step as part of contributing
to the library. to the library.
@ -77,5 +77,4 @@ to the library.
[test adapter for catch2]: https://marketplace.visualstudio.com/items?itemName=JohnnyHendriks.ext01 [test adapter for catch2]: https://marketplace.visualstudio.com/items?itemName=JohnnyHendriks.ext01
[reporting issues]: https://github.com/marzer/tomlplusplus/issues [reporting issues]: https://github.com/marzer/tomlplusplus/issues
[catch2]: https://github.com/catchorg/Catch2 [catch2]: https://github.com/catchorg/Catch2
[toml-test]: https://github.com/BurntSushi/toml-test [toml-test]: https://github.com/toml-lang/toml-test
[burntsushi/toml-test]: https://github.com/BurntSushi/toml-test

View File

@ -113,7 +113,7 @@ You'll find some more code examples in the `examples` directory, and plenty more
### Conan ### Conan
Add `tomlplusplus/3.3.0` to your conanfile. Add `tomlplusplus/3.4.0` to your conanfile.
### DDS ### DDS
@ -121,7 +121,7 @@ Add `tomlpp` to your `package.json5`, e.g.:
```plaintext ```plaintext
depends: [ depends: [
'tomlpp^3.3.0', 'tomlpp^3.4.0',
] ]
``` ```
@ -166,7 +166,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.3.0 GIT_TAG v3.4.0
) )
FetchContent_MakeAvailable(tomlplusplus) FetchContent_MakeAvailable(tomlplusplus)
``` ```

View File

@ -38,7 +38,7 @@ Call toml::parse_file() and work with the toml::table you get back, or handle an
#include <iostream> #include <iostream>
#include <toml++/toml.hpp> #include <toml++/toml.hpp>
int main(int argc, char** argv) int main(int argc, char\*\* argv)
{ {
toml::table tbl; toml::table tbl;
try try
@ -53,11 +53,13 @@ int main(int argc, char** argv)
} }
return 0; return 0;
} }
@endcpp @endcpp
@see @see
- toml::parse_file() - toml::parse_file()
- toml::table - toml::table
- toml::parse_error - toml::parse_error
@ -87,6 +89,7 @@ int main()
try try
{ {
// parse directly from a string view: // parse directly from a string view:
{ {
toml::table tbl = toml::parse(some_toml); toml::table tbl = toml::parse(some_toml);
@ -107,6 +110,7 @@ int main()
} }
return 0; return 0;
} }
@endcpp @endcpp
@ -123,6 +127,7 @@ name = 'toml++'
@endout @endout
@see @see
- toml::parse_file() - toml::parse_file()
- toml::table - toml::table
- toml::parse_error - toml::parse_error
@ -152,6 +157,7 @@ int main()
do_stuff_with_your_config(std::move(result).table()); // 'steal' the table from the result do_stuff_with_your_config(std::move(result).table()); // 'steal' the table from the result
return 0; return 0;
} }
@endcpp @endcpp
@ -178,7 +184,7 @@ try
catch (const toml::parse_error& err) catch (const toml::parse_error& err)
{ {
std::cerr std::cerr
<< "Error parsing file '" << *err.source().path << "Error parsing file '" << \*err.source().path
<< "':\n" << err.description() << "':\n" << err.description()
<< "\n (" << err.source().begin << ")\n"; << "\n (" << err.source().begin << ")\n";
return 1; return 1;
@ -186,6 +192,7 @@ catch (const toml::parse_error& err)
@endcpp @endcpp
@see @see
- toml::parse_error - toml::parse_error
- toml::source_region - toml::source_region
- toml::source_position - toml::source_position
@ -269,6 +276,7 @@ int main()
std::cout << "dinosaurs: " << tbl["animals"]["dinosaurs"] << "\n"; //no dinosaurs :( std::cout << "dinosaurs: " << tbl["animals"]["dinosaurs"] << "\n"; //no dinosaurs :(
return 0; return 0;
} }
@endcpp @endcpp
@ -287,6 +295,7 @@ dinosaurs:
@endout @endout
@see @see
- toml::node - toml::node
- toml::node_view - toml::node_view
- toml::value - toml::value
@ -335,11 +344,13 @@ int main()
std::cout << toml::yaml_formatter{ tbl } << "\n\n"; std::cout << toml::yaml_formatter{ tbl } << "\n\n";
return 0; return 0;
} }
@endcpp @endcpp
@out @out
###### TOML ######
###### TOML
cpp = [ 17, 20, 'and beyond' ] cpp = [ 17, 20, 'and beyond' ]
lib = 'toml++' lib = 'toml++'
@ -351,7 +362,7 @@ github = 'https://github.com/marzer'
name = 'Mark Gillard' name = 'Mark Gillard'
twitter = 'https://twitter.com/marzer8789' twitter = 'https://twitter.com/marzer8789'
###### JSON ###### ###### JSON
{ {
"author" : { "author" : {
@ -372,13 +383,14 @@ twitter = 'https://twitter.com/marzer8789'
] ]
} }
###### YAML ###### ###### YAML
author: author:
github: 'https://github.com/marzer' github: 'https://github.com/marzer'
name: 'Mark Gillard' name: 'Mark Gillard'
twitter: 'https://twitter.com/marzer8789' twitter: 'https://twitter.com/marzer8789'
cpp: cpp:
- 17 - 17
- 20 - 20
- 'and beyond' - 'and beyond'
@ -390,6 +402,7 @@ toml:
@endout @endout
@see @see
- toml::toml_formatter - toml::toml_formatter
- toml::json_formatter - toml::json_formatter
- toml::yaml_formatter - toml::yaml_formatter
@ -420,7 +433,7 @@ do it manually before including toml++ in some global header that's used everywh
// some_code_file.cpp // some_code_file.cpp
#define TOML_IMPLEMENTATION #define TOML_IMPLEMENTATION
#include "global_header_that_includes_toml++.h" #include "global_header_that_includes_toml++.hpp"
@endcpp @endcpp
<strong>Bonus Step: Disable any library features you don't need</strong> <strong>Bonus Step: Disable any library features you don't need</strong>
@ -454,12 +467,11 @@ and [emoji sundae] Regular. The API is the same for both.
2. Add `tomlplusplus/include` to your include paths 2. Add `tomlplusplus/include` to your include paths
3. `#include <toml++/toml.hpp>` 3. `#include <toml++/toml.hpp>`
<!-- --------------------------------------------------------------------------------------------------------------- --> <!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-adding-lib-conan Conan @subsection mainpage-adding-lib-conan Conan
Add `tomlplusplus/3.3.0` to your conanfile. Add `tomlplusplus/3.4.0` to your conanfile.
<!-- --------------------------------------------------------------------------------------------------------------- --> <!-- --------------------------------------------------------------------------------------------------------------- -->
@ -467,7 +479,7 @@ Add `tomlplusplus/3.3.0` to your conanfile.
Add `tomlpp` to your `package.json5`, e.g.: Add `tomlpp` to your `package.json5`, e.g.:
@json @json
depends: [ depends: [
'tomlpp^3.3.0', 'tomlpp^3.4.0',
] ]
@endjson @endjson
@ -510,7 +522,6 @@ You can also add it as a subproject directly.
vcpkg install tomlplusplus vcpkg install tomlplusplus
@endshell @endshell
<!-- --------------------------------------------------------------------------------------------------------------- --> <!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-adding-lib-cmake-fetch-content CMake FetchContent @subsection mainpage-adding-lib-cmake-fetch-content CMake FetchContent
@ -520,7 +531,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.3.0 GIT_TAG v3.4.0
) )
FetchContent_MakeAvailable(tomlplusplus) FetchContent_MakeAvailable(tomlplusplus)
@endcmake @endcmake
@ -606,6 +617,7 @@ it is embedded in the preamble at the top of the header.
For bug reports and feature requests please use the \github{marzer/tomlplusplus/issues, Github Issues} For bug reports and feature requests please use the \github{marzer/tomlplusplus/issues, Github Issues}
system. For anything else you're welcome to reach out via other means. In order of likely response speed: system. For anything else you're welcome to reach out via other means. In order of likely response speed:
- Twitter: [marzer8789](https://twitter.com/marzer8789) - Twitter: [marzer8789](https://twitter.com/marzer8789)
- Gitter: [marzer/tomlplusplus](https://gitter.im/marzer/tomlplusplus) ("Discord for repos") - Gitter: [marzer/tomlplusplus](https://gitter.im/marzer/tomlplusplus) ("Discord for repos")
- Email: [mark.gillard@outlook.com.au](mailto:mark.gillard@outlook.com.au) - Email: [mark.gillard@outlook.com.au](mailto:mark.gillard@outlook.com.au)

View File

@ -5,7 +5,7 @@
#pragma once #pragma once
#define TOML_LIB_MAJOR 3 #define TOML_LIB_MAJOR 3
#define TOML_LIB_MINOR 3 #define TOML_LIB_MINOR 4
#define TOML_LIB_PATCH 0 #define TOML_LIB_PATCH 0
#define TOML_LANG_MAJOR 1 #define TOML_LANG_MAJOR 1

View File

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

View File

@ -47,6 +47,6 @@ ninja && toml-test ./toml-test/tt_decoder && toml-test ./toml-test/tt_encoder --
> &#xFE0F; Pass `-Duse_vendored_libs=false` to meson if you wish to use the system-installed version > &#xFE0F; Pass `-Duse_vendored_libs=false` to meson if you wish to use the system-installed version
> of nlohmann/json rather than the vendored one. > of nlohmann/json rather than the vendored one.
[toml-test]: https://github.com/BurntSushi/toml-test [toml-test]: https://github.com/toml-lang/toml-test
[contributing]: ../CONTRIBUTING.md [contributing]: ./../CONTRIBUTING.md
[meson]: https://mesonbuild.com/ [meson]: https://mesonbuild.com/

View File

@ -1,6 +1,6 @@
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// //
// toml++ v3.3.0 // toml++ v3.4.0
// https://github.com/marzer/tomlplusplus // https://github.com/marzer/tomlplusplus
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// //
@ -1152,7 +1152,7 @@ TOML_ENABLE_WARNINGS;
//******** impl/version.hpp ****************************************************************************************** //******** impl/version.hpp ******************************************************************************************
#define TOML_LIB_MAJOR 3 #define TOML_LIB_MAJOR 3
#define TOML_LIB_MINOR 3 #define TOML_LIB_MINOR 4
#define TOML_LIB_PATCH 0 #define TOML_LIB_PATCH 0
#define TOML_LANG_MAJOR 1 #define TOML_LANG_MAJOR 1

View File

@ -31,7 +31,7 @@ if __name__ == '__main__':
args.add_argument(r'version', type=str) args.add_argument(r'version', type=str)
args = args.parse_args() args = args.parse_args()
version = re.fullmatch(r'\s*([0-9]+)\s*[.,;]\s*([0-9]+)\s*[.,;]\s*([0-9]+)\s*', args.version) version = re.fullmatch(r'\s*[vV]?\s*([0-9]+)\s*[.,;]+\s*([0-9]+)\s*[.,;]+\s*([0-9]+)\s*', args.version)
if not version: if not version:
print(rf"Couldn't parse version triplet from '{args.version}'", file=sys.stderr) print(rf"Couldn't parse version triplet from '{args.version}'", file=sys.stderr)
sys.exit(1) sys.exit(1)
@ -51,7 +51,7 @@ if __name__ == '__main__':
text = re.sub(r'''(\s|^)VERSION\s+[0-9](?:[.][0-9]){2}''', rf"\1VERSION {version_str}", text, count=1, flags=re.I) text = re.sub(r'''(\s|^)VERSION\s+[0-9](?:[.][0-9]){2}''', rf"\1VERSION {version_str}", text, count=1, flags=re.I)
write_text_file(path, text) write_text_file(path, text)
path = root / r'include/toml++/impl/version.h' for path in (root / r'include/toml++/impl/version.hpp', root / r'toml.hpp'):
text = read_text_file(path) text = read_text_file(path)
text = re.sub(r'''(\s*#\s*define\s+TOML_LIB_MAJOR)\s+[0-9]+''', rf"\1 {version[0]}", text) text = re.sub(r'''(\s*#\s*define\s+TOML_LIB_MAJOR)\s+[0-9]+''', rf"\1 {version[0]}", text)
text = re.sub(r'''(\s*#\s*define\s+TOML_LIB_MINOR)\s+[0-9]+''', rf"\1 {version[1]}", text) text = re.sub(r'''(\s*#\s*define\s+TOML_LIB_MINOR)\s+[0-9]+''', rf"\1 {version[1]}", text)
@ -59,7 +59,7 @@ if __name__ == '__main__':
write_text_file(path, text) write_text_file(path, text)
noop_sub = r'#$%^nbsp^%$#' noop_sub = r'#$%^nbsp^%$#'
for file in (r'README.md', r'docs/pages/main_page.dox'): for file in (r'README.md', r'docs/pages/main_page.md'):
path = root / file path = root / file
text = read_text_file(path) text = read_text_file(path)
text = re.sub(r'''(toml(?:plusplus|\+\+|pp)\s*[/:^]\s*)[0-9](?:[.][0-9]){2}''', rf"\1{noop_sub}{version_str}", text, flags=re.I) text = re.sub(r'''(toml(?:plusplus|\+\+|pp)\s*[/:^]\s*)[0-9](?:[.][0-9]){2}''', rf"\1{noop_sub}{version_str}", text, flags=re.I)