Commit Graph

45 Commits

Author SHA1 Message Date
Mark Gillard
3f4acc7c32 additonal path work
- re-ordered most of the `.inl` implementations to match the declaration order in the class body
- fixed a few missing cases of `noexcept`
- added additional operator overloads for +=
- added `operator==` and `operator!=` to `path_component`
- changed parse method to "parse into" so it could be re-used in more places without creating a temporary vector
- changed all binary operators to be 'hidden friends'
- moved the "to string" logic to a "print_to" for streams to avoid creating a temporary string in the ostream<< operator
- made the string conversion operators `explicit`
- renamed `string()` to `str()` to be consistent with `toml::key` and `std::stringstream`
- renamed `wstring()` to `wide_str()` to be consistent with `toml::source_region`
- renamed `parent_path()` to `parent()`
- removed the `const (w)char*` operator overloads - these were already sufficiently covered by the `std::(w)string_view` ones
- removed the `operator/` overloads - since we aren't a file path the `/` doesn't have the same meaning (also `operator+` was doing the same thing)
2022-06-05 00:14:50 +03:00
Mark Gillard
27816dbbd1 added meson option use_vendored_libs 2022-05-01 15:09:09 +03:00
Mark Gillard
e47ef8cfb2 removed git submodules to fix various tooling issues (closes #151)
- removed submodules in `external/`
- vendored `Catch2` and `nlohmann/json directly`
- updated conformance test generator to look outside the repo for test sources
2022-05-01 12:20:03 +03:00
Mark Gillard
bf13bbd42e added for_each() for tables and arrays
also:
- refactoring
- documentation fixes
- updated conformance tests
- made submodules shallow
2022-04-24 21:02:55 +03:00
Mark Gillard
db04ac8918 added tests for visit()
Also some minor refactors.
2022-04-23 17:28:25 +03:00
Mark Gillard
2c5580c71d minor meson refactor
Yeah so it turns out meson supports splitting compound boolean logic over multiple lines. Duh. Of course it does.

Also enabled ubsan for CI example builds.
2022-04-22 22:44:52 +03:00
Mark Gillard
6e7942788d minor refactor 2022-04-18 12:27:54 +03:00
Mark Gillard
1c26ce1dcf fixed UB in internal unicode machinery (closes #144)
also:
- updated conformance tests
- added ubsan options to meson.build
2022-02-26 18:07:11 +02:00
Andrea Pappacoda
36030cace8 build(meson): use system deps when avalable
When building tests, Meson will now look for system dependencies and use
them if found. Otherwise, it will check if the submodules are cloned and
create a dependency object wrapping the include path of each external
dependency (this breaks Meson's sandbox, but the previous approach did
too). This also allows passing actual dependencies to the various build
targets instead of include paths (a bit more idiomatic).

I've also made it possible to skip the tl-optional tests when the lib is
not found, so that it is still possible to run tests even from a
tarball (i.e. no git checkout)
2022-02-17 22:45:07 +02:00
Andrea Pappacoda
029160c280 build(meson): add compile_library option 2022-02-12 22:04:16 +02:00
Mark Gillard
8e669aa699 release v3.0.1 2022-01-13 12:09:07 +02:00
Mark Gillard
71b57a3238 added regression test to detect ODR violations 2022-01-13 01:24:09 +02:00
Mark Gillard
3f4a540ca6 fixed inconsistent error messages for overlong ints/floats (closes #133)
also:
- added `at_path()` (closes #118)
- added `node_view::operator==`
- updated conformance tests
2022-01-08 00:08:31 +02:00
Mark Gillard
ad4ae98af0 added ASan to CI (closes #123)
also:
- made all wrapped array and table iterator internal conversions explicit
- minor example code refactoring
2021-11-25 20:20:22 +02:00
Mark Gillard
16d7ba8480 big parser + utf8 handling refactor 2021-11-05 00:43:42 +02:00
Mark Gillard
ff6f184d30 added parse_benchmark example
also:
- internal parser refactoring
2021-11-04 11:56:03 +02:00
Mark Gillard
0ffd23d73f removed final from value, array and table
also:
- renamed `TOML_WINDOWS_COMPAT` to `TOML_ENABLE_WINDOWS_COMPAT`
- renamed `TOML_UNRELEASED_FEATURES` to `TOML_ENABLE_UNRELEASED_FEATURES`
- added additional tests
- fixed minor documentation issues
2021-10-31 17:58:42 +02:00
Mark Gillard
f2fe57d21f fixed inf and nan being formatted incorrectly by the json_formatter
also:
- added `formatter_flags::quote_infinities_and_nans`
- made constructors for dates/times accept any integral types
- lots of internal work on formatter base (laying groundwork for more customization)
2021-10-29 23:59:53 +03:00
Mark Gillard
7da912c45e fixed incorrect clang+GCC flag in meson build script
also:
- renamed `_impl.h` files to `*.inl`
- simplified warning + namespace management boilerplate
- applied clang-format to examples
- bumped minimum required meson version to `0.54.0`
2021-10-26 00:53:57 +03:00
Andrea Pappacoda
73870cef54
build(meson): general improvements and fixes (#115)
Use the / operator instead of join_paths

Use the / operator instead of using "/" in string paths

Use the includedir opt instead of hardcoding "include" in install_subdir

Remove discouraged layout=flat option (mesonbuild/meson#9243)

Remove unneeded Wextra, Wpedantic flags, already added by warning_level

Remove manual -Oz flag when using Clang (mesonbuild/meson#9286)

Make use of : in kwargs consistent
2021-09-22 09:47:15 +03:00
Björn Schäpers
05f8b1f1cc
Make iterators real iterators (#77)
They were missing the iterator_category and thus could not be used with
some standard algorithms.
2020-12-18 18:08:15 +02:00
Mark Gillard
1381240e10 meson refactoring
- renamed options to `snake_case`
- tests, examples and cmake config now explicitly disabled when used as a subproject
- removed small_binaries (it's now implicit when building as release)
- added minimum meson version 0.53
2020-09-05 13:26:12 +03:00
Mark Gillard
40d87de5b5 cleaned up some compiler warning management spam
also:
- removed `std::endl` from example code in documentation
- trimmed some fat from the toml.hpp generator
2020-08-11 18:07:02 +03:00
Mark Gillard
ad6be8e51e minor cleanup
mostly for testing on ICC.
2020-08-08 20:51:33 +03:00
Mark Gillard
6f7f6c6554 moved the unicode function generator stuff to another repo
also:
- updated github templates
2020-08-01 22:37:39 +03:00
Mark Gillard
2efb15bf9e added insert, emplace, push_back etc. compatibility with node_views
In service of satisfying #49.
2020-07-28 01:21:41 +03:00
Mark Gillard
fd07301bae improved support for __fp16, _Float16 and __float128
also:
- fixed a bunch of doxygen parsing issues
- added `#define` leak detection to the single-header script
- renamed `TOML_ALL_INLINE` to `TOML_HEADER_ONLY` (the old one still works too)
- simplified abi namespace definitions
2020-07-25 20:50:24 +03:00
Mark Gillard
9afa43e7c2 fixed leading/trailing newlines with printing to ostreams (fixes #48)
also:
- change internal nan constant to match qNaN bits on x86/ARM
2020-07-21 16:11:32 +03:00
Mark Gillard
ca6f639fb9 fixed narrowing conversion warnings when constructing int values from unsigned
also:
- added ability to construct values from wide strings and u8 strings
- added non-template version of array::is_homogeneous()
- added explicit instantiations for more template types when `!TOML_ALL_INLINE`
- cleaned up abi namespaces
- simplified build and test machinery on windows
- removed TOML_CHAR_8_STRINGS since it no longer makes sense
2020-07-20 00:40:55 +03:00
Mark Gillard
cb791fe0ef expanded allowable conversion semantics of value and value_or
also:
- fixed infinity and NaN-related code breaking when using -ffast-math and friends
- added much more detail to many static_assert error messages
- added more test permutations of various compiler flags
- added many more static checks to test code
2020-07-17 16:33:56 +03:00
Mark Gillard
de07ba7187 string value serialization now emits literals where possible (closes #43)
also added support for wide strings on Windows (closes #42):
- added wide-string path arg overloads of `parse()` and `parse_file()`
- added wide-string support to all relevant `table` and `array` ops
- added `std::wstring` support to `node::value()` and `node::value_or()`
- added `std::wstring` support to `node_view::value()` and `node_view::value_or()`
- added wide-string overloads of `table::operator[]`
- added wide-string overloads of `node_view::operator[]`
- added `source_region::wide_path()`
- added `TOML_WINDOWS_COMPAT` switch for explicitly enabling/disabling this stuff

also:
- fixed internal macro `assert_or_assume` leaking out of `toml_parser.hpp`
- deprecated `node_view::get()` in favour of `node_view::node()`
- minor documentation fixes
- minor cleanup
2020-07-14 20:50:24 +03:00
Mark Gillard
8d958fcc54 documentation improvements and minor cleanup
- split conformance tests into multiple TU's
- added "Try this code on Compiler Explorer" links to the main page
- minor preprocessor cleanup
2020-07-06 01:03:07 +03:00
Mark Gillard
761690d4a6 fixed BOM check causing EOF on very short iostream inputs
also fixed a number of small parsing conformance issues
2020-06-25 17:33:01 +03:00
Mark Gillard
a122b3b9b4 more preprocessor cleanup
- fixing 'unknown pragma' warnings in GCC
- cleaning up test structure
2020-06-24 21:05:23 +03:00
Mark Gillard
5e683e9a73 fixed is_unicode_XXXXXX functions being wrong in some cases
also:
- added tests for unicode functions
- changed `TOML_LIKELY` semantics to work with gcc-style intrinsics
- greatly improved unicode-related codegen
- parser refactoring
2020-04-18 23:42:33 +03:00
Mark Gillard
f3990256ce moved preprocessor machinery to a separate header
- added doxygen page for the configuration options
- added SPDX-License-Identifiers around the place
- changed TOML_UNRELEASED_FEATURES default to 0
- simplified ABI namespace machinery
- fixed a number of doxygen bugs
2020-04-10 19:46:00 +03:00
Mark Gillard
5ca6b29cb9 added support for implementations without <charconv> (fixes #21)
also:
- fixed some parsing and printing ops being locale-dependent (fixes #19)
- fixed pkgconfig subdir being wrong (fixes #23)
- fixed some parsing errors at EOF when `TOML_EXCEPTIONS = 0`
- fixed some unreferenced variable warnings on older compilers
- fixed some 'maybe-uninitialized' false-positives on GCC9
- added debug/release awareness to CI tests
- added locale awareness to catch test runner
2020-04-07 18:01:22 +03:00
Mark Gillard
cb000809b0 support for upcoming TOML v1.0.0 release
see https://github.com/toml-lang/toml/issues/698 for info about TOML v1.0.0

also:
- fixed some parser error-paths not returning early enough when exceptions were disabled
- added more specific error messages for parsing errors relating to prohibited codepoints
- added compilation speed improvements (particularly for platforms lacking floating-point `std::to_chars`)
- added many minor documentation improvements
- added additional tests
2020-04-03 00:39:21 +03:00
Mark Gillard
ee9b30c774 fixed compilation on older implementations without std::launder
also:
- fixed `json_formatter` type deduction on older compilers
- added build configuration option for compiling examples
2020-03-18 15:28:00 +02:00
Mark Gillard
74e7209cca fixed parse_file for string literals (closes #12)
also:
- decoupled `TOML_EXCEPTION` from ex. mode (closes #13)
- added `TOML_OPTIONAL_TYPE` customization point
- added tests for a custom optional type
- ci refactoring
2020-03-03 23:28:24 +02:00
Mark Gillard
14249f4e66 minor refactoring to better enable explicit instantiations 2020-03-03 10:10:07 +02:00
Mark Gillard
9ed295f21c fixed source of UB when using char8 strings
also:
- documentation improvements
- minor test restructuring
2020-02-27 01:28:20 +02:00
Mark Gillard
c7483cb92c added insertion operations for tables and arrays
also:
- fixed column numbers being wrong when a value ended at EOF
- fixed some `print_to_stream` overloads for `char8_t`
- fixed a minor preprocessor snafu on MSVC
- fixed '\' not being escaped when printing string values
- added an initializer list constructor for tables
- added `array::flatten`
- added `table::find`
- added `table::is_inline` setter
- added `TOML_SMALL_INT_TYPE`
- added `parse_file`
- added stream operator for source_region
- added proper license notice for the utf8 decoder
- added lots more documentation and tests
2020-02-13 20:34:45 +02:00
Mark Gillard
40ffee43fb added json_formatter
also:
- added `toml_version.h`
- added version number to toml.hpp
- added `node::visit()`
- added `table::empty()`
- added `array::empty()`
- added version number to `toml.hpp`
- added ostream operator overload for `source_position`
- added tests for string escape sequences
- added tests for + in bare keys (toml/issues/687)
- added tests for hexfloat literals (toml/issues/562)
- added c++20 char8_t detection to meson
- moved third party submodules to `/extern`
- refactored noexcept version of `parse_result` to be more useful
- refactored all code to 'mostly' stick to a 120 column limit
- fixed some minor stuff picked up by gcc9
2020-01-06 22:24:53 +02:00
Mark Gillard
930bf0ad58 new file: .circleci/config.yml
new file:   .editorconfig
new file:   .gitattributes
new file:   .gitignore
new file:   .gitmodules
new file:   LICENSE
new file:   README.md
new file:   examples/example.cpp
new file:   examples/example.toml
new file:   examples/meson.build
new file:   include/toml++/toml.h
new file:   include/toml++/toml_array.h
new file:   include/toml++/toml_common.h
new file:   include/toml++/toml_formatter.h
new file:   include/toml++/toml_node.h
new file:   include/toml++/toml_node_view.h
new file:   include/toml++/toml_parser.h
new file:   include/toml++/toml_table.h
new file:   include/toml++/toml_utf8.h
new file:   include/toml++/toml_utf8_generated.h
new file:   include/toml++/toml_value.h
new file:   meson.build
new file:   python/ci_single_header_check.py
new file:   python/generate_single_header.py
new file:   python/generate_unicode_functions.py
new file:   tests/catch2
new file:   tests/catch2.h
new file:   tests/lifetimes.cpp
new file:   tests/main.cpp
new file:   tests/meson.build
new file:   tests/parsing_arrays.cpp
new file:   tests/parsing_booleans.cpp
new file:   tests/parsing_comments.cpp
new file:   tests/parsing_dates_and_times.cpp
new file:   tests/parsing_floats.cpp
new file:   tests/parsing_integers.cpp
new file:   tests/parsing_key_value_pairs.cpp
new file:   tests/parsing_spec_example.cpp
new file:   tests/parsing_strings.cpp
new file:   tests/parsing_tables.cpp
new file:   tests/tests.cpp
new file:   tests/tests.h
new file:   toml.hpp
new file:   vs/.runsettings
new file:   vs/example.vcxproj
new file:   vs/test_char.vcxproj
new file:   vs/test_char8.vcxproj
new file:   vs/test_char8_noexcept.vcxproj
new file:   vs/test_char_noexcept.vcxproj
new file:   vs/test_strict_char.vcxproj
new file:   vs/test_strict_char8.vcxproj
new file:   vs/test_strict_char8_noexcept.vcxproj
new file:   vs/test_strict_char_noexcept.vcxproj
new file:   vs/toml++.natvis
new file:   vs/toml++.props
new file:   vs/toml++.sln
new file:   vs/toml++.vcxproj
new file:   vs/toml++.vcxproj.filters
2020-01-04 16:21:38 +02:00