fixed gnu symbol visibility for static lib builds (fixes #201)

also:
- renamed header files to .hpp
- updated conformance tests
- minor documentation fixes
This commit is contained in:
Mark Gillard 2023-08-26 17:25:35 +03:00
parent dbc4bcecf2
commit 882d9d1c34
149 changed files with 1162 additions and 1118 deletions

View File

@ -30,6 +30,14 @@ template:
- fixed error in README (#195) (@andrewkcorcoran)
- fixed compiler error when using NVCC (#198) (@thompsonnoahe)
#### Changes:
- renamed header files to have `.hpp` extension (`toml.h` is still present for backwards-compatibility)
#### Build system:
- fixed meson builds with `-Ddefault_library=static` having hidden symbols on GNU compilers (#201) (@vlad0x00)
<br><br>
## v3.3.0

View File

@ -3,21 +3,21 @@
Contributions are very welcome! Either by [reporting issues] or submitting pull requests.
If you wish to submit a PR, please be aware that:
- The single-header file `toml.hpp` is generated by a script; make your changes in the files in
`include`, **not** in `toml.hpp`.
- The single-header `toml.hpp` at the repository root is generated by a script, so don't change it directly; make your
changes in the files in `include`.
- Your changes should compile warning-free on at least one of:
- GCC 8 or higher
- Clang 8 or higher
- MSVC 19.2X (Visual Studio 2019) or higher
- You should regenerate the single-header file as part of your PR (a CI check will fail if you don't).
- You should regenerate the single-header version of `toml.hpp` as part of your PR (a CI check will fail if you don't).
<br>
## Regenerating toml.hpp
## Regenerating the single-header toml.hpp
1. Make your changes as necessary
- If you've added a new header file that isn't going to be transitively included by one of the
others, add an include directive to `include/toml++/toml.h`
others, add an include directive to `include/toml++/toml.hpp`
2. Install the prerequisite python packages: `pip3 install -r tools/requirements.txt`
3. Run `tools/generate_single_header.py`

156
README.md
View File

@ -19,23 +19,23 @@
## Library features
- Header-only (optional!)
- Supports the latest [TOML] release ([v1.0.0]), plus optional support for some unreleased TOML features
- Passes all tests in the [toml-test](https://github.com/BurntSushi/toml-test) suite
- Supports serializing to JSON and YAML
- Proper UTF-8 handling (incl. BOM)
- C++17 (plus some C++20 features where available, e.g. experimental support for [char8_t] strings)
- Doesn't require RTTI
- Works with or without exceptions
- Tested on Clang (6+), GCC (7+) and MSVC (VS2019)
- Tested on x64, x86 and ARM
- Header-only (optional!)
- Supports the latest [TOML] release ([v1.0.0]), plus optional support for some unreleased TOML features
- Passes all tests in the [toml-test](https://github.com/BurntSushi/toml-test) suite
- Supports serializing to JSON and YAML
- Proper UTF-8 handling (incl. BOM)
- C++17 (plus some C++20 features where available, e.g. experimental support for [char8_t] strings)
- Doesn't require RTTI
- Works with or without exceptions
- Tested on Clang (6+), GCC (7+) and MSVC (VS2019)
- Tested on x64, x86 and ARM
<br>
## Basic usage
> &#xFE0F; _The following example favours brevity. If you'd prefer full API documentation and lots of specific code snippets
instead, visit the project [homepage]_
> &#xFE0F; _The following example favours brevity. If you'd prefer full API documentation and lots of specific code
> snippets instead, visit the project [homepage]_
Given a [TOML] file `configuration.toml` containing the following:
@ -98,7 +98,7 @@ You'll find some more code examples in the `examples` directory, and plenty more
## Adding toml++ to your project
`toml++` comes in two flavours: Single-header and Regular. The API is the same for both.
`toml++` comes in two flavours: Single-header and Regular. The API is the same for both.
### 🍦&#xFE0F; Single-header flavour
@ -109,7 +109,7 @@ You'll find some more code examples in the `examples` directory, and plenty more
1. Clone the repository
2. Add `tomlplusplus/include` to your include paths
3. `#include <toml++/toml.h>`
3. `#include <toml++/toml.hpp>`
### Conan
@ -133,7 +133,7 @@ depends: [
```json
{
"marzer/tomlplusplus": { }
"marzer/tomlplusplus": {}
}
```
@ -199,29 +199,29 @@ See [CONTRIBUTING] for information.
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 | Description | Default |
|-----------------------------------|:--------------:|----------------------------------------------------------------------------------------------------------|------------------------|
| `TOML_ASSERT(expr)` | function macro | Sets the assert function used by the library. | `assert()` |
| `TOML_CALLCONV` | define | Calling convention to apply to exported free/static functions. | undefined |
| `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` |
| `TOML_ENABLE_FLOAT16` | boolean | Enables support for the built-in `_Float16` type. | per compiler settings |
| `TOML_ENABLE_PARSER` | boolean | Enables the parser. Set to `0` if you don't need it to improve compile times and binary size. | `1` |
| `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 |
| `TOML_SMALL_FLOAT_TYPE` | type name | If your codebase has a custom 'small float' type (e.g. half-precision), this tells toml++ about it. | undefined |
| `TOML_SMALL_INT_TYPE` | type name | If your codebase has a custom 'small integer' type (e.g. 24-bits), this tells toml++ about it. | undefined |
| Option | Type | Description | Default |
| --------------------------------- | :------------: | --------------------------------------------------------------------------------------------------------- | --------------------- |
| `TOML_ASSERT(expr)` | function macro | Sets the assert function used by the library. | `assert()` |
| `TOML_CALLCONV` | define | Calling convention to apply to exported free/static functions. | undefined |
| `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` |
| `TOML_ENABLE_FLOAT16` | boolean | Enables support for the built-in `_Float16` type. | per compiler settings |
| `TOML_ENABLE_PARSER` | boolean | Enables the parser. Set to `0` if you don't need it to improve compile times and binary size. | `1` |
| `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 |
| `TOML_SMALL_FLOAT_TYPE` | type name | If your codebase has a custom 'small float' type (e.g. half-precision), this tells toml++ about it. | undefined |
| `TOML_SMALL_INT_TYPE` | type name | If your codebase has a custom 'small integer' type (e.g. 24-bits), this tells toml++ about it. | undefined |
> &#xFE0F; _A number of these have ABI implications; the library uses inline namespaces to prevent you from accidentally
linking incompatible combinations together._
> linking incompatible combinations together._
<br>
@ -236,14 +236,14 @@ defines `TOML_LANG_MAJOR`, `TOML_LANG_MINOR` and `TOML_LANG_PATCH`.
### **Unreleased language features:**
- [#516]: Allow newlines and trailing commas in inline tables
- [#562]: Allow hex floating-point values
- [#644]: Support `+` in key names
- [#671]: Local time of day format should support `09:30` as opposed to `09:30:00`
- [#687]: Relax bare key restrictions to allow additional unicode characters
- [#790]: Include an `\e` escape code sequence (shorthand for `\u001B`)
- [#796]: Include an `\xHH` escape code sequence
- [#891]: Allow non-English scripts for unquoted keys
- [#516]: Allow newlines and trailing commas in inline tables
- [#562]: Allow hex floating-point values
- [#644]: Support `+` in key names
- [#671]: Local time of day format should support `09:30` as opposed to `09:30:00`
- [#687]: Relax bare key restrictions to allow additional unicode characters
- [#790]: Include an `\e` escape code sequence (shorthand for `\u001B`)
- [#796]: Include an `\xHH` escape code sequence
- [#891]: Allow non-English scripts for unquoted keys
> &#xFE0F; _`#define TOML_ENABLE_UNRELEASED_FEATURES 1` to enable these features (see [Configuration](#Configuration))._
@ -251,11 +251,11 @@ defines `TOML_LANG_MAJOR`, `TOML_LANG_MINOR` and `TOML_LANG_PATCH`.
All features supported, including:
- [#356]: Allow leading zeros in the exponent part of a float
- [#567]: Control characters are not permitted in comments
- [#571]: Allow raw tabs inside strings
- [#665]: Make arrays heterogeneous
- [#766]: Allow comments before commas in arrays
- [#356]: Allow leading zeros in the exponent part of a float
- [#567]: Control characters are not permitted in comments
- [#571]: Allow raw tabs inside strings
- [#665]: Make arrays heterogeneous
- [#766]: Allow comments before commas in arrays
### 🔹&#xFE0F; **TOML v0.5.0:**
@ -278,30 +278,30 @@ UTF-8 decoding is performed using a state machine based on Bjoern Hoehrmann's '[
### With thanks to:
- **[@beastle9end](https://github.com/beastle9end)** - Made Windows.h include bypass
- **[@bjadamson](https://github.com/bjadamson)** - Reported some bugs and helped design a new feature
- **[@bobfang1992](https://github.com/bobfang1992)** - Reported a bug and created a [wrapper in python](https://github.com/bobfang1992/pytomlpp)
- **[@GiulioRomualdi](https://github.com/GiulioRomualdi)** - Added cmake+meson support
- **[@jonestristand](https://github.com/jonestristand)** - Designed and implemented the `toml::path`s feature
- **[@kcsaul](https://github.com/kcsaul)** - Fixed a bug
- **[@levicki](https://github.com/levicki)** - Helped design some new features
- **[@moorereason](https://github.com/moorereason)** - Reported a whole bunch of bugs
- **[@mosra](https://github.com/mosra)** - Created the awesome [m.css] used to generate the API docs
- **[@ned14](https://github.com/ned14)** - Reported a bunch of bugs and helped design some new features
- **[@okureta](https://github.com/okureta)** - Reported a bug
- **[@prince-chrismc](https://github.com/prince-chrismc)** - Added toml++ to ConanCenter, and fixed some typos
- **[@rbrugo](https://github.com/rbrugo)** - Helped design a new feature
- **[@Reedbeta](https://github.com/Reedbeta)** - Fixed a bug and added additional Visual Studio debugger native visualizers
- **[@Ryan-rsm-McKenzie](https://github.com/Ryan-rsm-McKenzie)** - Add natvis file to cmake install script
- **[@shdnx](https://github.com/shdnx)** - Fixed a bug on GCC 8.2.0 and some meson config issues
- **[@sneves](https://github.com/sneves)** - Helped fix a number of parser bugs
- **[@sobczyk](https://github.com/sobczyk)** - Reported some bugs
- **[@std-any-emplace](https://github.com/std-any-emplace)** - Reported some bugs
- **[@Tachi107](https://github.com/Tachi107)** - Made some tweaks to meson.build, added compile_library build option
- **[@traversaro](https://github.com/traversaro)** - Added vcpkg support and reported a bunch of bugs
- **[@whiterabbit963](https://github.com/whiterabbit963)** - Fixed a bug with value_or conversions
- **[@ximion](https://github.com/ximion)** - Added support for installation with meson
- **[@a-is](https://github.com/a-is)** - Fixed a bug
- **[@beastle9end](https://github.com/beastle9end)** - Made Windows.h include bypass
- **[@bjadamson](https://github.com/bjadamson)** - Reported some bugs and helped design a new feature
- **[@bobfang1992](https://github.com/bobfang1992)** - Reported a bug and created a [wrapper in python](https://github.com/bobfang1992/pytomlpp)
- **[@GiulioRomualdi](https://github.com/GiulioRomualdi)** - Added cmake+meson support
- **[@jonestristand](https://github.com/jonestristand)** - Designed and implemented the `toml::path`s feature
- **[@kcsaul](https://github.com/kcsaul)** - Fixed a bug
- **[@levicki](https://github.com/levicki)** - Helped design some new features
- **[@moorereason](https://github.com/moorereason)** - Reported a whole bunch of bugs
- **[@mosra](https://github.com/mosra)** - Created the awesome [m.css] used to generate the API docs
- **[@ned14](https://github.com/ned14)** - Reported a bunch of bugs and helped design some new features
- **[@okureta](https://github.com/okureta)** - Reported a bug
- **[@prince-chrismc](https://github.com/prince-chrismc)** - Added toml++ to ConanCenter, and fixed some typos
- **[@rbrugo](https://github.com/rbrugo)** - Helped design a new feature
- **[@Reedbeta](https://github.com/Reedbeta)** - Fixed a bug and added additional Visual Studio debugger native visualizers
- **[@Ryan-rsm-McKenzie](https://github.com/Ryan-rsm-McKenzie)** - Add natvis file to cmake install script
- **[@shdnx](https://github.com/shdnx)** - Fixed a bug on GCC 8.2.0 and some meson config issues
- **[@sneves](https://github.com/sneves)** - Helped fix a number of parser bugs
- **[@sobczyk](https://github.com/sobczyk)** - Reported some bugs
- **[@std-any-emplace](https://github.com/std-any-emplace)** - Reported some bugs
- **[@Tachi107](https://github.com/Tachi107)** - Made some tweaks to meson.build, added compile_library build option
- **[@traversaro](https://github.com/traversaro)** - Added vcpkg support and reported a bunch of bugs
- **[@whiterabbit963](https://github.com/whiterabbit963)** - Fixed a bug with value_or conversions
- **[@ximion](https://github.com/ximion)** - Added support for installation with meson
- **[@a-is](https://github.com/a-is)** - Fixed a bug
<br>
@ -310,11 +310,11 @@ UTF-8 decoding is performed using a state machine based on Bjoern Hoehrmann's '[
For bug reports and feature requests please consider using the [issues] system here on GitHub. For anything else
though you're welcome to reach out via other means. In order of likely response time:
- Gitter: [marzer/tomlplusplus](https://gitter.im/marzer/tomlplusplus) ("Discord for repos")
- Twitter: [marzer8789](https://twitter.com/marzer8789)
- Email: [mark.gillard@outlook.com.au](mailto:mark.gillard@outlook.com.au)
- Facebook: [marzer](https://www.facebook.com/marzer)
- LinkedIn: [marzer](https://www.linkedin.com/in/marzer/)
- Gitter: [marzer/tomlplusplus](https://gitter.im/marzer/tomlplusplus) ("Discord for repos")
- Twitter: [marzer8789](https://twitter.com/marzer8789)
- Email: [mark.gillard@outlook.com.au](mailto:mark.gillard@outlook.com.au)
- Facebook: [marzer](https://www.facebook.com/marzer)
- LinkedIn: [marzer](https://www.linkedin.com/in/marzer/)
[API documentation]: https://marzer.github.io/tomlplusplus/
[homepage]: https://marzer.github.io/tomlplusplus/

View File

@ -1,12 +1,11 @@
/*!
@mainpage toml++
@image html banner.svg width=1280px
@tableofcontents
\mainpage toml++
\image html banner.svg width=1280px
\tableofcontents
<!-- --------------------------------------------------------------------------------------------------------------- -->
@section mainpage-features Features
\section mainpage-features Features
- Header-only (optional!)
- Supports the latest [TOML](https://toml.io/) release ([v1.0.0](https://toml.io/en/v1.0.0)), plus
optional support for some unreleased TOML features
@ -19,24 +18,25 @@
- Tested on Clang (6+), GCC (7+) and MSVC (VS2019)
- Tested on x64, x86 and ARM
<!-- --------------------------------------------------------------------------------------------------------------- -->
@section mainpage-api-documentation API documentation
\section mainpage-api-documentation API documentation
You're looking at it! Browse the docs using the links at the top of the page.
You can search from anywhere by pressing the TAB key.
<!-- --------------------------------------------------------------------------------------------------------------- -->
@section mainpage-example Basic examples
\section mainpage-example Basic examples
<!-- --------------------------------------------------------------------------------------------------------------- -->
\subsection mainpage-example-parsing-files Parsing files
@subsection mainpage-example-parsing-files Parsing files
Call toml::parse_file() and work with the toml::table you get back, or handle any toml::parse_error that gets thrown:
\cpp
@cpp
#include <iostream>
#include <toml++/toml.h>
#include <toml++/toml.hpp>
int main(int argc, char** argv)
{
@ -55,25 +55,25 @@ int main(int argc, char** argv)
return 0;
}
\endcpp
@endcpp
\see
@see
- toml::parse_file()
- toml::table
- toml::parse_error
<!-- --------------------------------------------------------------------------------------------------------------- -->
\subsection mainpage-example-parsing-strings Parsing strings and iostreams
@subsection mainpage-example-parsing-strings Parsing strings and iostreams
Call toml::parse() and work with the toml::table you get back, or handle any toml::parse_error that gets thrown:
\godbolt{NsR-xf}
@godbolt{NsR-xf}
\cpp
@cpp
#include <iostream>
#include <sstream>
#include <toml++/toml.h>
#include <toml++/toml.hpp>
using namespace std::string_view_literals;
int main()
@ -108,9 +108,9 @@ int main()
return 0;
}
\endcpp
@endcpp
\out
@out
[library]
authors = [ 'Mark Gillard <mark.gillard@outlook.com.au>' ]
cpp = 17
@ -120,25 +120,26 @@ name = 'toml++'
authors = [ 'Mark Gillard <mark.gillard@outlook.com.au>' ]
cpp = 17
name = 'toml++'
\endout
@endout
\see
@see
- toml::parse_file()
- toml::table
- toml::parse_error
<!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-example-parsing-without-exceptions Handling errors without exceptions
\subsection mainpage-example-parsing-without-exceptions Handling errors without exceptions
Can't (or won't) use exceptions? That's fine too. You can disable exceptions in your compiler flags and/or
explicitly disable the library's use of them by setting the option #TOML_EXCEPTIONS to `0`. In either case,
the parsing functions return a toml::parse_result instead of a toml::table:
\cpp
@cpp
#include <iostream>
#define TOML_EXCEPTIONS 0 // only necessary if you've left them enabled in your compiler
#include <toml++/toml.h>
#include <toml++/toml.hpp>
int main()
{
@ -152,22 +153,23 @@ int main()
do_stuff_with_your_config(std::move(result).table()); // 'steal' the table from the result
return 0;
}
\endcpp
@endcpp
<!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-example-custom-error-formatting Custom error formatting
\subsection mainpage-example-custom-error-formatting Custom error formatting
The examples above use an overloaded `operator<<` with ostreams to print basic error messages, and look like this:
\out
@out
Error while parsing key: expected bare key starting character or string delimiter, saw '?'
(error occurred at line 2, column 5)
\endout
@endout
The library doesn't natively support error colouring in TTY environments, but instead provides the requisite information
for you to build that and any other custom error handling yourself if necessary via toml::parse_error's source()
and description() members:
\cpp
@cpp
toml::table tbl;
try
{
@ -181,25 +183,26 @@ catch (const toml::parse_error& err)
<< "\n (" << err.source().begin << ")\n";
return 1;
}
\endcpp
@endcpp
\see
@see
- toml::parse_error
- toml::source_region
- toml::source_position
<!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-example-manipulations Working with TOML data
\subsection mainpage-example-manipulations Working with TOML data
A TOML document is a tree of values, arrays and tables, represented as the toml::value, toml::array
and toml::table, respectively. All three inherit from toml::node, and can be easily accessed via
the toml::node_view:
\godbolt{TnevafTKd}
@godbolt{TnevafTKd}
\cpp
@cpp
#include <iostream>
#include <toml++/toml.h>
#include <toml++/toml.hpp>
using namespace std::string_view_literals;
int main()
@ -267,9 +270,9 @@ int main()
return 0;
}
\endcpp
@endcpp
\out
@out
hello world
hello world
hello world
@ -281,27 +284,28 @@ numbers: [ 2, 3, 4, 'five', 6.0, 7, [ 8, 9 ] ]
cats: [ 'tiger', 'lion', 'puma' ]
fish[1]: 'trout'
dinosaurs:
\endout
@endout
\see
@see
- toml::node
- toml::node_view
- toml::value
- toml::array
- toml::table
<!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-example-serialization Serializing as TOML, JSON and YAML
\subsection mainpage-example-serialization Serializing as TOML, JSON and YAML
All toml++ data types have overloaded `operator<<` for ostreams, so 'serializing' a set of TOML data to actual
TOML is done just by printing it to an ostream. Converting it to JSON and YAML is done in much the same way,
but via a toml::json_formatter and toml::yaml_formatter.
\godbolt{srdfoWMq6}
@godbolt{srdfoWMq6}
\cpp
@cpp
#include <iostream>
#include <toml++/toml.h>
#include <toml++/toml.hpp>
int main()
{
@ -332,9 +336,9 @@ int main()
return 0;
}
\endcpp
@endcpp
\out
@out
###### TOML ######
cpp = [ 17, 20, 'and beyond' ]
@ -383,16 +387,17 @@ repo: 'https://github.com/marzer/tomlplusplus/'
toml:
- '1.0.0'
- 'and beyond'
\endout
@endout
\see
@see
- toml::toml_formatter
- toml::json_formatter
- toml::yaml_formatter
<!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-example-speed-up-compilation Speeding up compilation
\subsection mainpage-example-speed-up-compilation Speeding up compilation
Because toml++ is a header-only library of nontrivial size you might find that compilation times noticeably
increase after you add it to your project, especially if you add the library's header somewhere that's visible from
a large number of translation units. You can counter this by disabling header-only mode and explicitly controlling
@ -402,21 +407,21 @@ where the library's implementation is compiled.
This must be the same everywhere, so either set it as a global `#define` in your build system, or
do it manually before including toml++ in some global header that's used everywhere in your project:
\cpp
@cpp
// global_header_that_includes_toml++.h
#define TOML_HEADER_ONLY 0
#include <toml.hpp>
\endcpp
@endcpp
<strong>Step 2: Define #TOML_IMPLEMENTATION before including toml++ in one specific translation unit</strong>
\cpp
@cpp
// some_code_file.cpp
#define TOML_IMPLEMENTATION
#include "global_header_that_includes_toml++.h"
\endcpp
@endcpp
<strong>Bonus Step: Disable any library features you don't need</strong>
@ -425,22 +430,21 @@ For example, if all you need to do is serialize some code-generated TOML and don
set #TOML_ENABLE_PARSER to `0` to disable the parser altogether. This can yield fairly significant compilation
speedups since the parser accounts for a good chunk of the library's code.
@see @ref configuration
\see \ref configuration
<!-- --------------------------------------------------------------------------------------------------------------- -->
@section mainpage-adding-lib Adding toml++ to your project
<!-- --------------------------------------------------------------------------------------------------------------- -->
\section mainpage-adding-lib Adding toml++ to your project
@subsection mainpage-adding-lib-old-school "The old fashioned way"
\m_class{m-note m-default}
@m_class{m-note m-default}
The library comes in two flavours, [emoji icecream] Single-header
and [emoji sundae] Regular. The API is the same for both.
\subsection mainpage-adding-lib-old-school "The old fashioned way"
<h3>[emoji icecream] Single-header flavour</h3>
1. Drop [toml.hpp](https://raw.githubusercontent.com/marzer/tomlplusplus/master/toml.hpp) wherever you like in your source tree
2. There is no step two
@ -448,61 +452,70 @@ and [emoji sundae] Regular. The API is the same for both.
<h3>[emoji sundae] Regular flavour</h3>
1. Clone \github{marzer/tomlplusplus, the repository} from GitHub
2. Add `tomlplusplus/include` to your include paths
3. `#include <toml++/toml.h>`
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.
<!-- --------------------------------------------------------------------------------------------------------------- -->
\subsection mainpage-adding-lib-dds DDS
@subsection mainpage-adding-lib-dds DDS
Add `tomlpp` to your `package.json5`, e.g.:
\json
@json
depends: [
'tomlpp^3.3.0',
]
\endjson
@endjson
\see [What is DDS?](https://dds.pizza/)
@see [What is DDS?](https://dds.pizza/)
<!-- --------------------------------------------------------------------------------------------------------------- -->
\subsection mainpage-adding-lib-meson Meson
@subsection mainpage-adding-lib-meson Meson
You can install the wrap with:
\shell
@shell
meson wrap install tomlplusplus
\endshell
@endshell
After that, you can use it like a regular dependency:
\meson
@meson
tomlplusplus_dep = dependency('tomlplusplus')
\endmeson
@endmeson
You can also add it as a subproject directly.
\subsection mainpage-adding-lib-tipi Tipi.build
<!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-adding-lib-tipi Tipi.build
`tomlplusplus` can be easily used in [tipi.build](https://tipi.build) projects by adding the following entry to your `.tipi/deps`:
\json
@json
{
"marzer/tomlplusplus": { }
}
\endjson
@endjson
\subsection mainpage-adding-lib-vcpkg Vcpkg
\shell
<!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-adding-lib-vcpkg Vcpkg
@shell
vcpkg install tomlplusplus
\endshell
@endshell
<!-- --------------------------------------------------------------------------------------------------------------- -->
\subsection mainpage-adding-lib-cmake-fetch-content CMake FetchContent
\cmake
@subsection mainpage-adding-lib-cmake-fetch-content CMake FetchContent
@cmake
include(FetchContent)
FetchContent_Declare(
tomlplusplus
@ -510,32 +523,34 @@ FetchContent_Declare(
GIT_TAG v3.3.0
)
FetchContent_MakeAvailable(tomlplusplus)
\endcmake
@endcmake
\see [What is FetchContent?](https://cmake.org/cmake/help/latest/module/FetchContent.html)
@see [What is FetchContent?](https://cmake.org/cmake/help/latest/module/FetchContent.html)
<!-- --------------------------------------------------------------------------------------------------------------- -->
\subsection mainpage-adding-lib-git-submodules Git submodules
\shell
@subsection mainpage-adding-lib-git-submodules Git submodules
@shell
git submodule add --depth 1 https://github.com/marzer/tomlplusplus.git tomlplusplus
\endshell
@endshell
<!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-adding-lib-other Other environments and package managers
\subsection mainpage-adding-lib-other Other environments and package managers
The C++ tooling ecosystem is a fractal nightmare of unbridled chaos so naturally I'm not up-to-speed with all of the
available packaging and integration options. I'm always happy to see new ones supported, though! If there's some
integration you'd like to see and have the technical know-how to make it happen, feel free to make a pull request.
<!-- --------------------------------------------------------------------------------------------------------------- -->
@subsection mainpage-adding-lib-python Special mention: Python
\subsection mainpage-adding-lib-python Special mention: Python
There exists a python wrapper library built around toml++ called
\github{bobfang1992/pytomlpp, pytomlpp} which is, at the time of writing, one of only two natively-compiled
TOML libraries available for python, and thus one of the fastest options available:
\out
@out
Parsing data.toml 5000 times:
pytomlpp: 0.694 s
rtoml: 0.871 s ( 1.25x)
@ -543,53 +558,54 @@ Parsing data.toml 5000 times:
toml: 5.642 s ( 8.12x)
qtoml: 7.760 s (11.17x)
tomlkit: 32.708 s (47.09x)
\endout
@endout
Install it using `pip`:
\shell
@shell
pip install pytomlpp
\endshell
@endshell
Note that I'm not the owner of that project, so if you wish to report a bug relating to the python
implementation please do so at their repository, not on the main toml++ one.
<!-- --------------------------------------------------------------------------------------------------------------- -->
@section mainpage-configuration Library configuration options
\section mainpage-configuration Library configuration options
The library exposes a number of configuration options in the form of compiler `#defines`. Things like
changing the `optional<T>` type, disabling header-only mode, et cetera. The full list of
configurables can be found on the \ref configuration page.
configurables can be found on the @ref configuration page.
\see \ref configuration
@see @ref configuration
<!-- --------------------------------------------------------------------------------------------------------------- -->
@section mainpage-contributing Contributing
\section mainpage-contributing Contributing
Contributions are very welcome! Either by \github{marzer/tomlplusplus/issues, reporting issues}
or submitting pull requests. If you wish to submit a pull request,
please see \github{marzer/tomlplusplus/blob/master/CONTRIBUTING.md, CONTRIBUTING}
for all the details you need to get going.
<!-- --------------------------------------------------------------------------------------------------------------- -->
\section mainpage-license License
@section mainpage-license License
toml++ is licensed under the terms of the MIT license - see
[LICENSE](https://github.com/marzer/tomlplusplus/blob/master/LICENSE).
\m_class{m-note m-default}
@m_class{m-note m-default}
If you're using the single-header version of the library you don't need to explicitly distribute the license file;
it is embedded in the preamble at the top of the header.
<!-- --------------------------------------------------------------------------------------------------------------- -->
@section mainpage-contact Contacting the author
\section mainpage-contact Contacting the author
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:
- Twitter: [marzer8789](https://twitter.com/marzer8789)
- Gitter: [marzer/tomlplusplus](https://gitter.im/marzer/tomlplusplus) ("Discord for repos")
- Email: [mark.gillard@outlook.com.au](mailto:mark.gillard@outlook.com.au)
*/

View File

@ -35,8 +35,8 @@ undocumented = true
[sources]
paths = [ 'pages' ]
recursive_paths = [ '../include' ]
patterns = [ '*.h', '*.dox' ]
strip_paths = [ '../include' ]
patterns = [ '*.h', '*.hpp', '*.dox', '*.md' ]
strip_paths = [ '../include', 'pages' ]

View File

@ -6,8 +6,8 @@
// This example shows the error messages the library produces by forcing a set of specific parsing
// failures and printing their results.
#include "examples.h"
#include <toml++/toml.h>
#include "examples.hpp"
#include <toml++/toml.hpp>
using namespace std::string_view_literals;

View File

@ -55,7 +55,7 @@
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="examples.h" />
<ClInclude Include="examples.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -5,8 +5,8 @@
// This example is just a short-n-shiny benchmark.
#include "examples.h"
#include <toml++/toml.h>
#include "examples.hpp"
#include <toml++/toml.hpp>
using namespace std::string_view_literals;

View File

@ -56,7 +56,7 @@
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="examples.h" />
<ClInclude Include="examples.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
</Project>

View File

@ -5,8 +5,8 @@
// This example demonstrates how to parse TOML from a file or stdin and re-serialize it (print it out) to stdout.
#include "examples.h"
#include <toml++/toml.h>
#include "examples.hpp"
#include <toml++/toml.hpp>
using namespace std::string_view_literals;

View File

@ -56,7 +56,7 @@
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="examples.h" />
<ClInclude Include="examples.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
</Project>

View File

@ -5,8 +5,8 @@
// This example demonstrates the use of some more advanced features to generate a tree of random TOML data.
#include "examples.h"
#include <toml++/toml.h>
#include "examples.hpp"
#include <toml++/toml.hpp>
using namespace std::string_view_literals;

View File

@ -56,7 +56,7 @@
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="examples.h" />
<ClInclude Include="examples.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
</Project>

View File

@ -5,8 +5,8 @@
// This example demonstrates a method of merging one TOML data tree into another.
#include "examples.h"
#include <toml++/toml.h>
#include "examples.hpp"
#include <toml++/toml.hpp>
using namespace std::string_view_literals;

View File

@ -57,7 +57,7 @@
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="examples.h" />
<ClInclude Include="examples.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
</Project>

View File

@ -5,8 +5,8 @@
// This example demonstrates how to use the toml::json_formatter to re-serialize TOML data as JSON.
#include "examples.h"
#include <toml++/toml.h>
#include "examples.hpp"
#include <toml++/toml.hpp>
using namespace std::string_view_literals;

View File

@ -56,7 +56,7 @@
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="examples.h" />
<ClInclude Include="examples.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
</Project>

View File

@ -4,12 +4,12 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "std_utility.h"
#include "std_vector.h"
#include "std_initializer_list.h"
#include "value.h"
#include "make_node.h"
#include "header_start.h"
#include "std_utility.hpp"
#include "std_vector.hpp"
#include "std_initializer_list.hpp"
#include "value.hpp"
#include "make_node.hpp"
#include "header_start.hpp"
/// \cond
TOML_IMPL_NAMESPACE_START
@ -1724,4 +1724,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -5,14 +5,14 @@
#pragma once
//# {{
#include "preprocessor.h"
#include "preprocessor.hpp"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
//# }}
#include "array.h"
#include "header_start.h"
#include "array.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -379,4 +379,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "forward_declarations.h"
#include "forward_declarations.hpp"
/// \cond
TOML_IMPL_NAMESPACE_START

View File

@ -5,15 +5,15 @@
#pragma once
//# {{
#include "preprocessor.h"
#include "preprocessor.hpp"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
//# }}
#include "at_path.h"
#include "array.h"
#include "table.h"
#include "at_path.hpp"
#include "array.hpp"
#include "table.hpp"
TOML_DISABLE_WARNINGS;
#if TOML_INT_CHARCONV
#include <charconv>
@ -21,7 +21,7 @@ TOML_DISABLE_WARNINGS;
#include <sstream>
#endif
TOML_ENABLE_WARNINGS;
#include "header_start.h"
#include "header_start.hpp"
TOML_IMPL_NAMESPACE_START
{
@ -287,4 +287,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,9 +4,9 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "forward_declarations.h"
#include "print_to_stream.h"
#include "header_start.h"
#include "forward_declarations.hpp"
#include "print_to_stream.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -465,4 +465,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,12 +4,12 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
#if TOML_ENABLE_FORMATTERS
#include "forward_declarations.h"
#include "print_to_stream.h"
#include "header_start.h"
#include "forward_declarations.hpp"
#include "print_to_stream.hpp"
#include "header_start.hpp"
/// \cond
TOML_IMPL_NAMESPACE_START
@ -187,5 +187,5 @@ TOML_IMPL_NAMESPACE_START
TOML_IMPL_NAMESPACE_END;
/// \endcond
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_FORMATTERS

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
//# {{
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
@ -12,14 +12,14 @@
//# }}
#if TOML_ENABLE_FORMATTERS
#include "formatter.h"
#include "print_to_stream.h"
#include "value.h"
#include "table.h"
#include "array.h"
#include "unicode.h"
#include "parse_result.h"
#include "header_start.h"
#include "formatter.hpp"
#include "print_to_stream.hpp"
#include "value.hpp"
#include "table.hpp"
#include "array.hpp"
#include "unicode.hpp"
#include "parse_result.hpp"
#include "header_start.hpp"
TOML_IMPL_NAMESPACE_START
{
@ -509,5 +509,5 @@ TOML_IMPL_NAMESPACE_START
}
TOML_IMPL_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_FORMATTERS

View File

@ -4,8 +4,8 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "std_string.h"
#include "std_new.h"
#include "std_string.hpp"
#include "std_new.hpp"
TOML_DISABLE_WARNINGS;
#include <cstdint>
#include <cstddef>
@ -18,7 +18,7 @@ TOML_DISABLE_WARNINGS;
#include <iosfwd>
#include <type_traits>
TOML_ENABLE_WARNINGS;
#include "header_start.h"
#include "header_start.hpp"
//#---------------------------------------------------------------------------------------------------------------------
//# ENVIRONMENT GROUND-TRUTHS
@ -119,7 +119,7 @@ TOML_IMPL_NAMESPACE_START
class parser;
TOML_ABI_NAMESPACE_END; // TOML_EXCEPTIONS
// clang-format off
// clang-format off
inline constexpr std::string_view control_char_escapes[] =
{
@ -203,7 +203,7 @@ TOML_NAMESPACE_START // abi namespace
/// \detail This namespace exists so you can safely hoist the toml++ literal operators into another scope
/// without dragging in everything from the toml namespace: \cpp
///
/// #include <toml++/toml.h>
/// #include <toml++/toml.hpp>
/// using namespace toml::literals;
///
/// int main()
@ -620,8 +620,8 @@ TOML_IMPL_NAMESPACE_START
&& digits <= 53 // DBL_MANT_DIG
&& digits10 <= 15; // DBL_DIG
static constexpr bool can_represent_native = digits >= 53 // DBL_MANT_DIG
&& digits10 >= 15; // DBL_DIG
static constexpr bool can_represent_native = digits >= 53 // DBL_MANT_DIG
&& digits10 >= 15; // DBL_DIG
static constexpr bool can_partially_represent_native = digits > 0 && digits10 > 0;
};
@ -1055,4 +1055,4 @@ TOML_IMPL_NAMESPACE_START
TOML_IMPL_NAMESPACE_END;
/// \endcond
#include "header_end.h"
#include "header_end.hpp"

View File

@ -1,6 +1,6 @@
//# {{
#ifdef __INTELLISENSE__
#include "preprocessor.h"
#include "preprocessor.hpp"
#endif
//# }}
#ifdef _MSC_VER

View File

@ -1,6 +1,6 @@
//# {{
#ifdef __INTELLISENSE__
#include "preprocessor.h"
#include "preprocessor.hpp"
#endif
//# }}
TOML_PUSH_WARNINGS;

View File

@ -4,11 +4,11 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
#if TOML_ENABLE_FORMATTERS
#include "formatter.h"
#include "header_start.h"
#include "formatter.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -138,5 +138,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_FORMATTERS

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
//# {{
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
@ -12,11 +12,11 @@
//# }}
#if TOML_ENABLE_FORMATTERS
#include "json_formatter.h"
#include "print_to_stream.h"
#include "table.h"
#include "array.h"
#include "header_start.h"
#include "json_formatter.hpp"
#include "print_to_stream.hpp"
#include "table.hpp"
#include "array.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -117,5 +117,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_FORMATTERS

View File

@ -4,10 +4,10 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "source_region.h"
#include "std_utility.h"
#include "print_to_stream.h"
#include "header_start.h"
#include "source_region.hpp"
#include "std_utility.hpp"
#include "print_to_stream.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -332,4 +332,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,8 +4,8 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "forward_declarations.h"
#include "header_start.h"
#include "forward_declarations.hpp"
#include "header_start.hpp"
/// \cond
TOML_IMPL_NAMESPACE_START
@ -179,4 +179,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,10 +4,10 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "std_utility.h"
#include "forward_declarations.h"
#include "source_region.h"
#include "header_start.h"
#include "std_utility.hpp"
#include "forward_declarations.hpp"
#include "source_region.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -1112,4 +1112,4 @@ TOML_IMPL_NAMESPACE_START
TOML_IMPL_NAMESPACE_END;
/// \endcond
#include "header_end.h"
#include "header_end.hpp"

View File

@ -5,19 +5,19 @@
#pragma once
//# {{
#include "preprocessor.h"
#include "preprocessor.hpp"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
//# }}
#include "node.h"
#include "node_view.h"
#include "at_path.h"
#include "table.h"
#include "array.h"
#include "value.h"
#include "header_start.h"
#include "node.hpp"
#include "node_view.hpp"
#include "at_path.hpp"
#include "table.hpp"
#include "array.hpp"
#include "value.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -138,4 +138,4 @@ TOML_IMPL_NAMESPACE_START
}
TOML_IMPL_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,11 +4,11 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "std_vector.h"
#include "std_initializer_list.h"
#include "print_to_stream.h"
#include "node.h"
#include "header_start.h"
#include "std_vector.hpp"
#include "std_initializer_list.hpp"
#include "print_to_stream.hpp"
#include "node.hpp"
#include "header_start.hpp"
TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_NAMESPACE_START
@ -836,4 +836,4 @@ TOML_NAMESPACE_START
TOML_NAMESPACE_END;
/// \endcond
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,13 +4,13 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
#if TOML_ENABLE_PARSER
#include "std_except.h"
#include "source_region.h"
#include "print_to_stream.h"
#include "header_start.h"
#include "std_except.hpp"
#include "source_region.hpp"
#include "print_to_stream.hpp"
#include "header_start.hpp"
#if TOML_DOXYGEN || !TOML_EXCEPTIONS
#define TOML_PARSE_ERROR_BASE
@ -135,5 +135,5 @@ TOML_NAMESPACE_END;
#undef TOML_PARSE_ERROR_BASE
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_PARSER

View File

@ -4,12 +4,12 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
#if TOML_DOXYGEN || (TOML_ENABLE_PARSER && !TOML_EXCEPTIONS)
#include "table.h"
#include "parse_error.h"
#include "header_start.h"
#include "table.hpp"
#include "parse_error.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -495,5 +495,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_PARSER && !TOML_EXCEPTIONS

View File

@ -4,12 +4,12 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
#if TOML_ENABLE_PARSER
#include "table.h"
#include "parse_result.h"
#include "header_start.h"
#include "table.hpp"
#include "parse_result.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -386,5 +386,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_PARSER

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
//# {{
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
@ -12,15 +12,15 @@
//# }}
#if TOML_ENABLE_PARSER
#include "parser.h"
#include "std_optional.h"
#include "source_region.h"
#include "parse_error.h"
#include "date_time.h"
#include "value.h"
#include "array.h"
#include "table.h"
#include "unicode.h"
#include "parser.hpp"
#include "std_optional.hpp"
#include "source_region.hpp"
#include "parse_error.hpp"
#include "date_time.hpp"
#include "value.hpp"
#include "array.hpp"
#include "table.hpp"
#include "unicode.hpp"
TOML_DISABLE_WARNINGS;
#include <istream>
#include <fstream>
@ -34,7 +34,7 @@ TOML_DISABLE_WARNINGS;
#include <iomanip>
#endif
TOML_ENABLE_WARNINGS;
#include "header_start.h"
#include "header_start.hpp"
//#---------------------------------------------------------------------------------------------------------------------
//# UTF8 STREAMS
@ -3913,5 +3913,5 @@ TOML_NAMESPACE_START
TOML_NAMESPACE_END;
#undef TOML_OVERALIGNED
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_PARSER

View File

@ -4,9 +4,9 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "forward_declarations.h"
#include "std_vector.h"
#include "header_start.h"
#include "forward_declarations.hpp"
#include "std_vector.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -848,4 +848,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -5,22 +5,22 @@
#pragma once
//# {{
#include "preprocessor.h"
#include "preprocessor.hpp"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
//# }}
#include "path.h"
#include "at_path.h"
#include "print_to_stream.h"
#include "path.hpp"
#include "at_path.hpp"
#include "print_to_stream.hpp"
TOML_DISABLE_WARNINGS;
#if TOML_INT_CHARCONV
#include <charconv>
#endif
#include <sstream>
TOML_ENABLE_WARNINGS;
#include "header_start.h"
#include "header_start.hpp"
//#=====================================================================================================================
//# toml::path_component
@ -520,4 +520,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -1131,7 +1131,7 @@ TOML_ENABLE_WARNINGS;
//#====================================================================================================================
// clang-format off
#include "version.h"
#include "version.hpp"
#define TOML_LIB_SINGLE_HEADER 0

View File

@ -4,9 +4,9 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "std_string.h"
#include "forward_declarations.h"
#include "header_start.h"
#include "std_string.hpp"
#include "forward_declarations.hpp"
#include "header_start.hpp"
TOML_IMPL_NAMESPACE_START
{
@ -126,4 +126,4 @@ TOML_IMPL_NAMESPACE_START
}
TOML_IMPL_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -5,19 +5,19 @@
#pragma once
//# {{
#include "preprocessor.h"
#include "preprocessor.hpp"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
//# }}
#include "print_to_stream.h"
#include "source_region.h"
#include "date_time.h"
#include "toml_formatter.h"
#include "value.h"
#include "array.h"
#include "table.h"
#include "print_to_stream.hpp"
#include "source_region.hpp"
#include "date_time.hpp"
#include "toml_formatter.hpp"
#include "value.hpp"
#include "array.hpp"
#include "table.hpp"
TOML_DISABLE_WARNINGS;
#include <ostream>
#if TOML_INT_CHARCONV || TOML_FLOAT_CHARCONV
@ -30,7 +30,7 @@ TOML_DISABLE_WARNINGS;
#include <iomanip>
#endif
TOML_ENABLE_WARNINGS;
#include "header_start.h"
#include "header_start.hpp"
TOML_ANON_NAMESPACE_START
{
@ -487,4 +487,4 @@ TOML_IMPL_NAMESPACE_START
}
TOML_IMPL_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
#if TOML_ENABLE_SIMD
#if defined(__SSE2__) \

View File

@ -4,11 +4,11 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "std_optional.h"
#include "std_string.h"
#include "forward_declarations.h"
#include "print_to_stream.h"
#include "header_start.h"
#include "std_optional.hpp"
#include "std_string.hpp"
#include "forward_declarations.hpp"
#include "print_to_stream.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -220,4 +220,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
TOML_DISABLE_WARNINGS;
#if TOML_EXCEPTIONS
#include <stdexcept>

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
TOML_DISABLE_WARNINGS;
#include <initializer_list>
TOML_ENABLE_WARNINGS;

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
TOML_DISABLE_WARNINGS;
#include <map>
#include <iterator>

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
TOML_DISABLE_WARNINGS;
#include <new>
TOML_ENABLE_WARNINGS;

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
TOML_DISABLE_WARNINGS;
#if !TOML_HAS_CUSTOM_OPTIONAL_TYPE
#include <optional>

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
TOML_DISABLE_WARNINGS;
#include <string_view>
#include <string>

View File

@ -5,14 +5,14 @@
#pragma once
//# {{
#include "preprocessor.h"
#include "preprocessor.hpp"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
//# }}
#if TOML_WINDOWS
#include "std_string.h"
#include "std_string.hpp"
#ifndef _WINDOWS_
#if TOML_INCLUDE_WINDOWS_H
#include <Windows.h>
@ -36,7 +36,7 @@ extern "C" __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int
#endif // TOML_INCLUDE_WINDOWS_H
#endif // _WINDOWS_
#include "header_start.h"
#include "header_start.hpp"
TOML_IMPL_NAMESPACE_START
{
@ -95,5 +95,5 @@ TOML_IMPL_NAMESPACE_START
}
TOML_IMPL_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_WINDOWS

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
TOML_DISABLE_WARNINGS;
#include <utility>
TOML_ENABLE_WARNINGS;

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
TOML_DISABLE_WARNINGS;
#include <variant>
TOML_ENABLE_WARNINGS;

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
TOML_DISABLE_WARNINGS;
#include <vector>
#include <iterator>

View File

@ -4,14 +4,14 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "forward_declarations.h"
#include "std_map.h"
#include "std_initializer_list.h"
#include "array.h"
#include "make_node.h"
#include "node_view.h"
#include "key.h"
#include "header_start.h"
#include "forward_declarations.hpp"
#include "std_map.hpp"
#include "std_initializer_list.hpp"
#include "array.hpp"
#include "make_node.hpp"
#include "node_view.hpp"
#include "key.hpp"
#include "header_start.hpp"
/// \cond
TOML_IMPL_NAMESPACE_START
@ -1958,4 +1958,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -5,15 +5,15 @@
#pragma once
//# {{
#include "preprocessor.h"
#include "preprocessor.hpp"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
//# }}
#include "table.h"
#include "node_view.h"
#include "header_start.h"
#include "table.hpp"
#include "node_view.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -315,4 +315,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,12 +4,12 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
#if TOML_ENABLE_FORMATTERS
#include "std_vector.h"
#include "formatter.h"
#include "header_start.h"
#include "std_vector.hpp"
#include "formatter.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -149,5 +149,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_FORMATTERS

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
//# {{
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
@ -12,13 +12,13 @@
//# }}
#if TOML_ENABLE_FORMATTERS
#include "toml_formatter.h"
#include "print_to_stream.h"
#include "value.h"
#include "table.h"
#include "array.h"
#include "unicode.h"
#include "header_start.h"
#include "toml_formatter.hpp"
#include "print_to_stream.hpp"
#include "value.hpp"
#include "table.hpp"
#include "array.hpp"
#include "unicode.hpp"
#include "header_start.hpp"
TOML_DISABLE_ARITHMETIC_WARNINGS;
TOML_ANON_NAMESPACE_START
@ -401,5 +401,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_FORMATTERS

View File

@ -4,8 +4,8 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "unicode_autogenerated.h"
#include "header_start.h"
#include "unicode_autogenerated.hpp"
#include "header_start.hpp"
/// \cond
TOML_IMPL_NAMESPACE_START
@ -194,4 +194,4 @@ TOML_IMPL_NAMESPACE_START
TOML_IMPL_NAMESPACE_END;
/// \endcond
#include "header_end.h"
#include "header_end.hpp"

View File

@ -5,15 +5,15 @@
#pragma once
//# {{
#include "preprocessor.h"
#include "preprocessor.hpp"
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
#endif
//# }}
#include "unicode.h"
#include "simd.h"
#include "header_start.h"
#include "unicode.hpp"
#include "simd.hpp"
#include "header_start.hpp"
TOML_IMPL_NAMESPACE_START
{
@ -57,4 +57,4 @@ TOML_IMPL_NAMESPACE_START
}
TOML_IMPL_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,8 +4,8 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "header_start.h"
#include "preprocessor.hpp"
#include "header_start.hpp"
/// \cond
#if TOML_GCC && TOML_GCC < 9
@ -179,4 +179,4 @@ TOML_IMPL_NAMESPACE_END;
#endif
/// \endcond
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,11 +4,11 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "date_time.h"
#include "node.h"
#include "print_to_stream.h"
#include "std_utility.h"
#include "header_start.h"
#include "date_time.hpp"
#include "node.hpp"
#include "print_to_stream.hpp"
#include "std_utility.hpp"
#include "header_start.hpp"
TOML_DISABLE_ARITHMETIC_WARNINGS;
/// \cond
@ -1267,4 +1267,4 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"

View File

@ -4,11 +4,11 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
#if TOML_ENABLE_FORMATTERS
#include "formatter.h"
#include "header_start.h"
#include "formatter.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -135,5 +135,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_FORMATTERS

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "preprocessor.h"
#include "preprocessor.hpp"
//# {{
#if !TOML_IMPLEMENTATION
#error This is an implementation-only header.
@ -12,11 +12,11 @@
//# }}
#if TOML_ENABLE_FORMATTERS
#include "yaml_formatter.h"
#include "print_to_stream.h"
#include "table.h"
#include "array.h"
#include "header_start.h"
#include "yaml_formatter.hpp"
#include "print_to_stream.hpp"
#include "table.hpp"
#include "array.hpp"
#include "header_start.hpp"
TOML_NAMESPACE_START
{
@ -161,5 +161,5 @@ TOML_NAMESPACE_START
}
TOML_NAMESPACE_END;
#include "header_end.h"
#include "header_end.hpp"
#endif // TOML_ENABLE_FORMATTERS

View File

@ -1,220 +1,7 @@
//# 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
// this file is just for backwards compatibility.
#ifndef TOMLPLUSPLUS_H
#define TOMLPLUSPLUS_H
#define INCLUDE_TOMLPLUSPLUS_H // old guard name used pre-v3
#include "toml.hpp"
#include "impl/preprocessor.h"
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_SUGGEST_ATTR_WARNINGS;
// misc warning false-positives
#if TOML_MSVC
#pragma warning(disable : 5031) // #pragma warning(pop): likely mismatch
#if TOML_SHARED_LIB
#pragma warning(disable : 4251) // dll exports for std lib types
#endif
#elif TOML_CLANG
TOML_PRAGMA_CLANG(diagnostic ignored "-Wheader-hygiene")
#if TOML_CLANG >= 12
TOML_PRAGMA_CLANG(diagnostic ignored "-Wc++20-extensions")
#endif
#if TOML_CLANG == 13
TOML_PRAGMA_CLANG(diagnostic ignored "-Wreserved-identifier")
#endif
#endif
#include "impl/std_new.h"
#include "impl/std_string.h"
#include "impl/std_optional.h"
#include "impl/forward_declarations.h"
#include "impl/print_to_stream.h"
#include "impl/source_region.h"
#include "impl/date_time.h"
#include "impl/at_path.h"
#include "impl/path.h"
#include "impl/node.h"
#include "impl/node_view.h"
#include "impl/value.h"
#include "impl/make_node.h"
#include "impl/array.h"
#include "impl/key.h"
#include "impl/table.h"
#include "impl/unicode_autogenerated.h"
#include "impl/unicode.h"
#include "impl/parse_error.h"
#include "impl/parse_result.h"
#include "impl/parser.h"
#include "impl/formatter.h"
#include "impl/toml_formatter.h"
#include "impl/json_formatter.h"
#include "impl/yaml_formatter.h"
#if TOML_IMPLEMENTATION
#include "impl/std_string.inl"
#include "impl/print_to_stream.inl"
#include "impl/node.inl"
#include "impl/at_path.inl"
#include "impl/path.inl"
#include "impl/array.inl"
#include "impl/table.inl"
#include "impl/unicode.inl"
#include "impl/parser.inl"
#include "impl/formatter.inl"
#include "impl/toml_formatter.inl"
#include "impl/json_formatter.inl"
#include "impl/yaml_formatter.inl"
#endif // TOML_IMPLEMENTATION
TOML_POP_WARNINGS;
// macro hygiene
#if TOML_UNDEF_MACROS
#undef TOML_ABI_NAMESPACE_BOOL
#undef TOML_ABI_NAMESPACE_END
#undef TOML_ABI_NAMESPACE_START
#undef TOML_ABI_NAMESPACES
#undef TOML_ABSTRACT_INTERFACE
#undef TOML_ALWAYS_INLINE
#undef TOML_ANON_NAMESPACE
#undef TOML_ANON_NAMESPACE_END
#undef TOML_ANON_NAMESPACE_START
#undef TOML_ARCH_AMD64
#undef TOML_ARCH_ARM
#undef TOML_ARCH_ARM32
#undef TOML_ARCH_ARM64
#undef TOML_ARCH_ITANIUM
#undef TOML_ARCH_X86
#undef TOML_ASSERT
#undef TOML_ASSERT_ASSUME
#undef TOML_ASSUME
#undef TOML_ASYMMETRICAL_EQUALITY_OPS
#undef TOML_ATTR
#undef TOML_CLANG
#undef TOML_CLANG_VERSION
#undef TOML_CLOSED_ENUM
#undef TOML_CLOSED_FLAGS_ENUM
#undef TOML_COMPILER_HAS_EXCEPTIONS
#undef TOML_COMPILER_HAS_RTTI
#undef TOML_CONST
#undef TOML_CONST_GETTER
#undef TOML_CONST_INLINE_GETTER
#undef TOML_CONSTRAINED_TEMPLATE
#undef TOML_CPP
#undef TOML_DECLSPEC
#undef TOML_DELETE_DEFAULTS
#undef TOML_DISABLE_ARITHMETIC_WARNINGS
#undef TOML_DISABLE_CODE_ANALYSIS_WARNINGS
#undef TOML_DISABLE_SPAM_WARNINGS
#undef TOML_DISABLE_SPAM_WARNINGS_CLANG_10
#undef TOML_DISABLE_SPAM_WARNINGS_CLANG_11
#undef TOML_DISABLE_SUGGEST_ATTR_WARNINGS
#undef TOML_DISABLE_SWITCH_WARNINGS
#undef TOML_DISABLE_WARNINGS
#undef TOML_DOXYGEN
#undef TOML_EMPTY_BASES
#undef TOML_ENABLE_IF
#undef TOML_ENABLE_WARNINGS
#undef TOML_EVAL_BOOL_0
#undef TOML_EVAL_BOOL_1
#undef TOML_EXTERNAL_LINKAGE
#undef TOML_FLAGS_ENUM
#undef TOML_FLOAT_CHARCONV
#undef TOML_FLOAT128
#undef TOML_FLOAT16_DIG
#undef TOML_FLOAT16_LIMITS_SET
#undef TOML_FLOAT16_MANT_DIG
#undef TOML_FLOAT16_MAX_10_EXP
#undef TOML_FLOAT16_MAX_EXP
#undef TOML_FLOAT16_MIN_10_EXP
#undef TOML_FLOAT16_MIN_EXP
#undef TOML_GCC
#undef TOML_HAS_ATTR
#undef TOML_HAS_BUILTIN
#undef TOML_HAS_CHAR8
#undef TOML_HAS_CPP_ATTR
#undef TOML_HAS_CUSTOM_OPTIONAL_TYPE
#undef TOML_HAS_FEATURE
#undef TOML_HAS_INCLUDE
#undef TOML_HAS_SSE2
#undef TOML_HAS_SSE4_1
#undef TOML_HIDDEN_CONSTRAINT
#undef TOML_ICC
#undef TOML_ICC_CL
#undef TOML_IMPL_NAMESPACE_END
#undef TOML_IMPL_NAMESPACE_START
#undef TOML_IMPLEMENTATION
#undef TOML_INCLUDE_WINDOWS_H
#undef TOML_INT_CHARCONV
#undef TOML_INT128
#undef TOML_INTELLISENSE
#undef TOML_INTERNAL_LINKAGE
#undef TOML_LANG_AT_LEAST
#undef TOML_LANG_EFFECTIVE_VERSION
#undef TOML_LANG_HIGHER_THAN
#undef TOML_LANG_UNRELEASED
#undef TOML_LAUNDER
#undef TOML_LIFETIME_HOOKS
#undef TOML_LIKELY
#undef TOML_LIKELY_CASE
#undef TOML_MAKE_FLAGS
#undef TOML_MAKE_FLAGS_
#undef TOML_MAKE_FLAGS_1
#undef TOML_MAKE_FLAGS_2
#undef TOML_MAKE_STRING
#undef TOML_MAKE_STRING_1
#undef TOML_MAKE_VERSION
#undef TOML_MSVC
#undef TOML_NAMESPACE
#undef TOML_NEVER_INLINE
#undef TOML_NODISCARD
#undef TOML_NODISCARD_CTOR
#undef TOML_OPEN_ENUM
#undef TOML_OPEN_FLAGS_ENUM
#undef TOML_PARSER_TYPENAME
#undef TOML_POP_WARNINGS
#undef TOML_PRAGMA_CLANG
#undef TOML_PRAGMA_CLANG_GE_10
#undef TOML_PRAGMA_CLANG_GE_11
#undef TOML_PRAGMA_CLANG_GE_9
#undef TOML_PRAGMA_GCC
#undef TOML_PRAGMA_ICC
#undef TOML_PRAGMA_MSVC
#undef TOML_PURE
#undef TOML_PURE_GETTER
#undef TOML_PURE_INLINE_GETTER
#undef TOML_PUSH_WARNINGS
#undef TOML_REQUIRES
#undef TOML_SA_LIST_BEG
#undef TOML_SA_LIST_END
#undef TOML_SA_LIST_NEW
#undef TOML_SA_LIST_NXT
#undef TOML_SA_LIST_SEP
#undef TOML_SA_NATIVE_VALUE_TYPE_LIST
#undef TOML_SA_NEWLINE
#undef TOML_SA_NODE_TYPE_LIST
#undef TOML_SA_UNWRAPPED_NODE_TYPE_LIST
#undef TOML_SA_VALUE_EXACT_FUNC_MESSAGE
#undef TOML_SA_VALUE_FUNC_MESSAGE
#undef TOML_SA_VALUE_MESSAGE_CONST_CHAR8
#undef TOML_SA_VALUE_MESSAGE_U8STRING_VIEW
#undef TOML_SA_VALUE_MESSAGE_WSTRING
#undef TOML_SIMPLE_STATIC_ASSERT_MESSAGES
#undef TOML_TRIVIAL_ABI
#undef TOML_UINT128
#undef TOML_UNLIKELY
#undef TOML_UNLIKELY_CASE
#undef TOML_UNREACHABLE
#undef TOML_UNUSED
#undef TOML_WINDOWS
#endif
#endif // TOMLPLUSPLUS_H

221
include/toml++/toml.hpp Normal file
View File

@ -0,0 +1,221 @@
//# 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
#ifndef TOMLPLUSPLUS_HPP
#define TOMLPLUSPLUS_HPP
#define INCLUDE_TOMLPLUSPLUS_H // old guard name used pre-v3
#define TOMLPLUSPLUS_H // guard name used in the legacy toml.h
#include "impl/preprocessor.hpp"
TOML_PUSH_WARNINGS;
TOML_DISABLE_SPAM_WARNINGS;
TOML_DISABLE_SWITCH_WARNINGS;
TOML_DISABLE_SUGGEST_ATTR_WARNINGS;
// misc warning false-positives
#if TOML_MSVC
#pragma warning(disable : 5031) // #pragma warning(pop): likely mismatch
#if TOML_SHARED_LIB
#pragma warning(disable : 4251) // dll exports for std lib types
#endif
#elif TOML_CLANG
TOML_PRAGMA_CLANG(diagnostic ignored "-Wheader-hygiene")
#if TOML_CLANG >= 12
TOML_PRAGMA_CLANG(diagnostic ignored "-Wc++20-extensions")
#endif
#if TOML_CLANG == 13
TOML_PRAGMA_CLANG(diagnostic ignored "-Wreserved-identifier")
#endif
#endif
#include "impl/std_new.hpp"
#include "impl/std_string.hpp"
#include "impl/std_optional.hpp"
#include "impl/forward_declarations.hpp"
#include "impl/print_to_stream.hpp"
#include "impl/source_region.hpp"
#include "impl/date_time.hpp"
#include "impl/at_path.hpp"
#include "impl/path.hpp"
#include "impl/node.hpp"
#include "impl/node_view.hpp"
#include "impl/value.hpp"
#include "impl/make_node.hpp"
#include "impl/array.hpp"
#include "impl/key.hpp"
#include "impl/table.hpp"
#include "impl/unicode_autogenerated.hpp"
#include "impl/unicode.hpp"
#include "impl/parse_error.hpp"
#include "impl/parse_result.hpp"
#include "impl/parser.hpp"
#include "impl/formatter.hpp"
#include "impl/toml_formatter.hpp"
#include "impl/json_formatter.hpp"
#include "impl/yaml_formatter.hpp"
#if TOML_IMPLEMENTATION
#include "impl/std_string.inl"
#include "impl/print_to_stream.inl"
#include "impl/node.inl"
#include "impl/at_path.inl"
#include "impl/path.inl"
#include "impl/array.inl"
#include "impl/table.inl"
#include "impl/unicode.inl"
#include "impl/parser.inl"
#include "impl/formatter.inl"
#include "impl/toml_formatter.inl"
#include "impl/json_formatter.inl"
#include "impl/yaml_formatter.inl"
#endif // TOML_IMPLEMENTATION
TOML_POP_WARNINGS;
// macro hygiene
#if TOML_UNDEF_MACROS
#undef TOML_ABI_NAMESPACE_BOOL
#undef TOML_ABI_NAMESPACE_END
#undef TOML_ABI_NAMESPACE_START
#undef TOML_ABI_NAMESPACES
#undef TOML_ABSTRACT_INTERFACE
#undef TOML_ALWAYS_INLINE
#undef TOML_ANON_NAMESPACE
#undef TOML_ANON_NAMESPACE_END
#undef TOML_ANON_NAMESPACE_START
#undef TOML_ARCH_AMD64
#undef TOML_ARCH_ARM
#undef TOML_ARCH_ARM32
#undef TOML_ARCH_ARM64
#undef TOML_ARCH_ITANIUM
#undef TOML_ARCH_X86
#undef TOML_ASSERT
#undef TOML_ASSERT_ASSUME
#undef TOML_ASSUME
#undef TOML_ASYMMETRICAL_EQUALITY_OPS
#undef TOML_ATTR
#undef TOML_CLANG
#undef TOML_CLANG_VERSION
#undef TOML_CLOSED_ENUM
#undef TOML_CLOSED_FLAGS_ENUM
#undef TOML_COMPILER_HAS_EXCEPTIONS
#undef TOML_COMPILER_HAS_RTTI
#undef TOML_CONST
#undef TOML_CONST_GETTER
#undef TOML_CONST_INLINE_GETTER
#undef TOML_CONSTRAINED_TEMPLATE
#undef TOML_CPP
#undef TOML_DECLSPEC
#undef TOML_DELETE_DEFAULTS
#undef TOML_DISABLE_ARITHMETIC_WARNINGS
#undef TOML_DISABLE_CODE_ANALYSIS_WARNINGS
#undef TOML_DISABLE_SPAM_WARNINGS
#undef TOML_DISABLE_SPAM_WARNINGS_CLANG_10
#undef TOML_DISABLE_SPAM_WARNINGS_CLANG_11
#undef TOML_DISABLE_SUGGEST_ATTR_WARNINGS
#undef TOML_DISABLE_SWITCH_WARNINGS
#undef TOML_DISABLE_WARNINGS
#undef TOML_DOXYGEN
#undef TOML_EMPTY_BASES
#undef TOML_ENABLE_IF
#undef TOML_ENABLE_WARNINGS
#undef TOML_EVAL_BOOL_0
#undef TOML_EVAL_BOOL_1
#undef TOML_EXTERNAL_LINKAGE
#undef TOML_FLAGS_ENUM
#undef TOML_FLOAT_CHARCONV
#undef TOML_FLOAT128
#undef TOML_FLOAT16_DIG
#undef TOML_FLOAT16_LIMITS_SET
#undef TOML_FLOAT16_MANT_DIG
#undef TOML_FLOAT16_MAX_10_EXP
#undef TOML_FLOAT16_MAX_EXP
#undef TOML_FLOAT16_MIN_10_EXP
#undef TOML_FLOAT16_MIN_EXP
#undef TOML_GCC
#undef TOML_HAS_ATTR
#undef TOML_HAS_BUILTIN
#undef TOML_HAS_CHAR8
#undef TOML_HAS_CPP_ATTR
#undef TOML_HAS_CUSTOM_OPTIONAL_TYPE
#undef TOML_HAS_FEATURE
#undef TOML_HAS_INCLUDE
#undef TOML_HAS_SSE2
#undef TOML_HAS_SSE4_1
#undef TOML_HIDDEN_CONSTRAINT
#undef TOML_ICC
#undef TOML_ICC_CL
#undef TOML_IMPL_NAMESPACE_END
#undef TOML_IMPL_NAMESPACE_START
#undef TOML_IMPLEMENTATION
#undef TOML_INCLUDE_WINDOWS_H
#undef TOML_INT_CHARCONV
#undef TOML_INT128
#undef TOML_INTELLISENSE
#undef TOML_INTERNAL_LINKAGE
#undef TOML_LANG_AT_LEAST
#undef TOML_LANG_EFFECTIVE_VERSION
#undef TOML_LANG_HIGHER_THAN
#undef TOML_LANG_UNRELEASED
#undef TOML_LAUNDER
#undef TOML_LIFETIME_HOOKS
#undef TOML_LIKELY
#undef TOML_LIKELY_CASE
#undef TOML_MAKE_FLAGS
#undef TOML_MAKE_FLAGS_
#undef TOML_MAKE_FLAGS_1
#undef TOML_MAKE_FLAGS_2
#undef TOML_MAKE_STRING
#undef TOML_MAKE_STRING_1
#undef TOML_MAKE_VERSION
#undef TOML_MSVC
#undef TOML_NAMESPACE
#undef TOML_NEVER_INLINE
#undef TOML_NODISCARD
#undef TOML_NODISCARD_CTOR
#undef TOML_OPEN_ENUM
#undef TOML_OPEN_FLAGS_ENUM
#undef TOML_PARSER_TYPENAME
#undef TOML_POP_WARNINGS
#undef TOML_PRAGMA_CLANG
#undef TOML_PRAGMA_CLANG_GE_10
#undef TOML_PRAGMA_CLANG_GE_11
#undef TOML_PRAGMA_CLANG_GE_9
#undef TOML_PRAGMA_GCC
#undef TOML_PRAGMA_ICC
#undef TOML_PRAGMA_MSVC
#undef TOML_PURE
#undef TOML_PURE_GETTER
#undef TOML_PURE_INLINE_GETTER
#undef TOML_PUSH_WARNINGS
#undef TOML_REQUIRES
#undef TOML_SA_LIST_BEG
#undef TOML_SA_LIST_END
#undef TOML_SA_LIST_NEW
#undef TOML_SA_LIST_NXT
#undef TOML_SA_LIST_SEP
#undef TOML_SA_NATIVE_VALUE_TYPE_LIST
#undef TOML_SA_NEWLINE
#undef TOML_SA_NODE_TYPE_LIST
#undef TOML_SA_UNWRAPPED_NODE_TYPE_LIST
#undef TOML_SA_VALUE_EXACT_FUNC_MESSAGE
#undef TOML_SA_VALUE_FUNC_MESSAGE
#undef TOML_SA_VALUE_MESSAGE_CONST_CHAR8
#undef TOML_SA_VALUE_MESSAGE_U8STRING_VIEW
#undef TOML_SA_VALUE_MESSAGE_WSTRING
#undef TOML_SIMPLE_STATIC_ASSERT_MESSAGES
#undef TOML_TRIVIAL_ABI
#undef TOML_UINT128
#undef TOML_UNLIKELY
#undef TOML_UNLIKELY_CASE
#undef TOML_UNREACHABLE
#undef TOML_UNUSED
#undef TOML_WINDOWS
#endif
#endif // TOMLPLUSPLUS_HPP

View File

@ -30,7 +30,7 @@ tomlplusplus_lib = library(
meson.project_name(),
files('toml.cpp'),
cpp_args: lib_internal_args,
gnu_symbol_visibility: 'hidden',
gnu_symbol_visibility: get_option('default_library') == 'static' ? '' : 'hidden',
include_directories: include_dir,
install: not is_subproject,
version: meson.project_version(),

View File

@ -10,4 +10,4 @@
#define TOML_HEADER_ONLY 0
#endif
#include <toml++/toml.h>
#include <toml++/toml.hpp>

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TOML_DISABLE_SPAM_WARNINGS;
TEST_CASE("at_path")

View File

@ -5,7 +5,7 @@
//-----
// this file was generated by generate_conformance_tests.py - do not modify it directly
#include "tests.h"
#include "tests.hpp"
namespace
{
@ -507,16 +507,16 @@ zyx = 42)"sv;
zyx = 42)"sv;
static constexpr auto table_quoted_no_close = R"(["where will it end]
name = value)"sv;
static constexpr auto table_redefine = R"(# Define b as int, and try to use it as a table: error
static constexpr auto table_redefine = R"(# Define b as int, and try to use it as a table: error
[a]
b = 1
[a.b]
c = 2)"sv;
static constexpr auto table_rrbrace = R"([[table] ])"sv;
static constexpr auto table_text_after_table = R"([error] this shouldn't be here)"sv;
static constexpr auto table_whitespace = R"([invalid key])"sv;
static constexpr auto table_with_pound = R"([key#group]
static constexpr auto table_rrbrace = R"([[table] ])"sv;
static constexpr auto table_text_after_table = R"([error] this shouldn't be here)"sv;
static constexpr auto table_whitespace = R"([invalid key])"sv;
static constexpr auto table_with_pound = R"([key#group]
answer = 42)"sv;
}

View File

@ -5,7 +5,7 @@
//-----
// this file was generated by generate_conformance_tests.py - do not modify it directly
#include "tests.h"
#include "tests.hpp"
namespace
{
@ -51,6 +51,11 @@ mixed = [{k="a"}, "b", 1])"sv;
static constexpr auto array_string_quote_comma = R"(title = [
"Client: \"XXXX\", Job: XXXX",
"Code: XXXX"
])"sv;
static constexpr auto array_string_with_comma_2 = R"(title = [
"""Client: XXXX,
Job: XXXX""",
"Code: XXXX"
])"sv;
static constexpr auto array_string_with_comma = R"(title = [
"Client: XXXX, Job: XXXX",
@ -139,9 +144,9 @@ milliseconds = 10:32:00.555)"sv;
static constexpr auto datetime_local = R"(local = 1987-07-05T17:45:00
milli = 1977-12-21T10:32:00.555
space = 1987-07-05 17:45:00)"sv;
static constexpr auto datetime_milliseconds = R"(utc1 = 1987-07-05T17:45:56.1234Z
static constexpr auto datetime_milliseconds = R"(utc1 = 1987-07-05T17:45:56.123Z
utc2 = 1987-07-05T17:45:56.6Z
wita1 = 1987-07-05T17:45:56.1234+08:00
wita1 = 1987-07-05T17:45:56.123+08:00
wita2 = 1987-07-05T17:45:56.6+08:00)"sv;
static constexpr auto datetime_timezone = R"(utc = 1987-07-05T17:45:56Z
pdt = 1987-07-05T17:45:56-05:00
@ -1400,6 +1405,24 @@ TEST_CASE("conformance - burntsushi/valid")
});
}
SECTION("array-string-with-comma-2")
{
parsing_should_succeed(FILE_LINE_ARGS,
array_string_with_comma_2,
[](toml::table&& tbl) // array-string-with-comma-2
{
const auto expected = toml::table{
{ R"(title)"sv,
toml::array{
R"(Client: XXXX,
Job: XXXX)"sv,
R"(Code: XXXX)"sv,
} },
};
REQUIRE(tbl == expected);
});
}
SECTION("array-string-with-comma")
{
parsing_should_succeed(FILE_LINE_ARGS,
@ -1667,9 +1690,9 @@ TEST_CASE("conformance - burntsushi/valid")
[](toml::table&& tbl) // datetime-milliseconds
{
const auto expected = toml::table{
{ R"(utc1)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56, 123400000 }, { 0, 0 } } },
{ R"(utc1)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56, 123000000 }, { 0, 0 } } },
{ R"(utc2)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56, 600000000 }, { 0, 0 } } },
{ R"(wita1)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56, 123400000 }, { 8, 0 } } },
{ R"(wita1)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56, 123000000 }, { 8, 0 } } },
{ R"(wita2)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56, 600000000 }, { 8, 0 } } },
};
REQUIRE(tbl == expected);

View File

@ -5,7 +5,7 @@
//-----
// this file was generated by generate_conformance_tests.py - do not modify it directly
#include "tests.h"
#include "tests.hpp"
namespace
{

View File

@ -5,7 +5,7 @@
//-----
// this file was generated by generate_conformance_tests.py - do not modify it directly
#include "tests.h"
#include "tests.hpp"
namespace
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TOML_DISABLE_SPAM_WARNINGS;
TEST_CASE("array::for_each")

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
namespace
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "settings.h"
#include "settings.hpp"
#if !TOML_HEADER_ONLY && !TOML_SHARED_LIB
#define TOML_IMPLEMENTATION
#endif
@ -11,7 +11,7 @@
#if USE_SINGLE_HEADER
#include "../toml.hpp"
#else
#include "../include/toml++/toml.h"
#include "../include/toml++/toml.hpp"
#endif
namespace toml

View File

@ -4,7 +4,7 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "settings.h"
#include "settings.hpp"
#ifdef __clang__
#pragma clang diagnostic push

View File

@ -10,7 +10,7 @@
#endif
#define CATCH_CONFIG_RUNNER
#include "lib_catch2.h"
#include "lib_catch2.hpp"
#include <clocale>
#if LEAK_TESTS
@ -18,7 +18,7 @@
#include <iostream>
#include <iomanip>
#include <atomic>
#include "leakproof.h"
#include "leakproof.hpp"
using namespace std::string_view_literals;
namespace leakproof

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TEST_CASE("arrays - moving")
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
#if !TOML_EXCEPTIONS

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TEST_CASE("tables - moving")
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
#ifdef _WIN32
TOML_DISABLE_WARNINGS;

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TEST_CASE("parsing - arrays")
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TEST_CASE("parsing - booleans")
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TEST_CASE("parsing - comments")
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TOML_DISABLE_SPAM_WARNINGS;
TEST_CASE("parsing - dates and times")

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TEST_CASE("parsing - floats")
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TEST_CASE("parsing - integers (decimal)")
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TEST_CASE("parsing - key-value pairs")
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TOML_DISABLE_SPAM_WARNINGS;
TEST_CASE("parsing - TOML spec example")

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TEST_CASE("parsing - strings")
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TEST_CASE("parsing - tables")
{

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
TOML_DISABLE_SPAM_WARNINGS;
TEST_CASE("path - parsing")

View File

@ -3,7 +3,7 @@
// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
// SPDX-License-Identifier: MIT
#include "tests.h"
#include "tests.hpp"
bool parsing_should_succeed(std::string_view test_file,
uint32_t test_line,

View File

@ -4,8 +4,8 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "settings.h"
#include <toml++/toml.h>
#include "settings.hpp"
#include <toml++/toml.hpp>
#if TOML_COMPILER_HAS_EXCEPTIONS ^ SHOULD_HAVE_EXCEPTIONS
#error TOML_COMPILER_HAS_EXCEPTIONS was not deduced correctly
@ -33,7 +33,7 @@ TOML_DISABLE_ARITHMETIC_WARNINGS;
#endif
TOML_DISABLE_WARNINGS;
#include "lib_catch2.h"
#include "lib_catch2.hpp"
#include <sstream>
namespace toml
{

Some files were not shown because too many files have changed in this diff Show More