Commit Graph

142 Commits

Author SHA1 Message Date
Mark Gillard
81d74663e8 fixed _Float16 erroneously supported on g++ (closes #57) 2020-09-01 14:47:21 +03:00
Mark Gillard
977cfbbf4e fixes for VS2017 (closes #55) 2020-08-26 14:51:12 +03:00
Mark Gillard
11a0e84ced added additional node_view constructors
also made node conversion operators explicit
2020-08-13 14:53:55 +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
2ac735054a updated TOML version to v1.0.0-rc.2
also:
- simplified warning handling macros
- minor version bump
2020-08-09 12:32:17 +03:00
Nathan Reed
3b44bd504b
Add implicit conversion operator from node to node_view (#52)
- Creates a node_view pointing to that node. This is similar to how std::string has a conversion operator creating a string_view of the string.
- Also, enabled the move assignment operator for node_view, but made both copy and move assignment operators lvalue-only to avoid the "misleading assignment" issue (see https://github.com/marzer/tomlplusplus/issues/49#issuecomment-664432777)
2020-08-09 02:12:17 +03:00
Mark Gillard
ad6be8e51e minor cleanup
mostly for testing on ICC.
2020-08-08 20:51:33 +03:00
Mark Gillard
b8fc830f9c regenerated unicode functions 2020-08-03 19:05:39 +03:00
Mark Gillard
82616e734c fix some issues handling infinities and NaNs
fixes #51
2020-08-03 09:10:06 +03:00
Mark Gillard
f6450f6ff9 moved is_homogenous to toml::node
also:
- added is_homogenous overload for identifying failure-causing element (to assist with implementing #45)
- added table::is_homogenous
- added value::is_homogenous (just for generic code's sake)
2020-08-02 17:02:10 +03:00
Mark Gillard
b024ee6dc2 added tests for copying and insertion (closes #49)
also:
- added tests to catch any regressions of pull/50
- moved UTF-8 decoder copyright notice
- cleaned up static assert messages
2020-08-02 12:20:41 +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
6b8fa1bef5 fixed source information being copied when copying nodes
also:
- many minor documentation fixes
- added pull request template
2020-07-30 23:31:08 +03:00
whiterabbit963
52736559d2
fix node::value_or() to act like node::value() (#50)
auto table = toml::table{{{"value", 10}}};
const toml::node *value = table.get("value");
if(value && value->is_number())
{
    double number = value->value_or<double>(0);
    cout << number << endl;
}
The original output was 0. This change will output 10.0.
The old way would see that it was an integer (a native type),
then use the integer conversion, but since the type being requested
was a double, it would return the default value.
2020-07-30 20:41:28 +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
17d1876529 added copy construction/assignment for arrays. tables and values
In service of satisfying #49.
2020-07-27 13:38:01 +03:00
Mark Gillard
539aad89f4 fixed array::insert not working correctly in some cases
also:
- improved the documentation for table and array
- fixed documentation font on mobile
2020-07-26 15:03:33 +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
cb113ae65e fixed Wcast-align warning spam on ARM 2020-07-22 21:47:27 +01: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
7314fbf8c2 deprecated parse_result::get() in favour of parse_result::table()
also:
- fixed static assert messages being badly formatted on clang
- minor documentation fixes
- updated version numbers
2020-07-20 17:26:36 +03:00
Mark Gillard
d84bd8bc78 renamed date_time::time_offset to just 'offset'
also:
- fixed natvis for date, time, time_offset, date_time
2020-07-20 02:09:03 +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
51f64fd08d documentation improvements
- moved the main page to a separate dox file
- added integration section to homepage
- improved some of the examples
- formatting fixes
- added note about python wrapper (closes #36)
2020-07-02 20:17:23 +03:00
Mark Gillard
f52949a481 refactoring parser to reduce binary sizes
Basically boils down to eliminating excessive template instantiations.
2020-06-29 17:49:48 +03:00
Mark Gillard
25c020bb43 fixed streamsize conversion warning on ARM 2020-06-28 15:46:04 +01:00
Mark Gillard
0b334fd7d2 added rvalue overload of array::flatten
also:
- made array::flatten return a reference to the array
- minor documentation fixes
2020-06-28 15:26:18 +03:00
Mark Gillard
b8438b3258 fixed ML strings not allowing whitespace after line-ending backslashes
also:
- fixed value comparison with special floats
- added all the remaining conformance tests from BurntSushi/toml-test and iarna/toml-spec-tests
- added toml::inserter
- added license boilerplate to test files
2020-06-27 15:55:15 +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
464d3d13cc documentation improvements
- updated TOML links to new toml.io website
- refactored the main page
2020-06-24 14:28:20 +03:00
Mark Gillard
00a8d14a49 minor preprocessor/doxygen cleanup 2020-06-23 13:04:05 +03:00
Mark Gillard
965a707fe2 deleted some duplicated preprocessor handling
also:
- updated test and dox submodules
- updated README
2020-06-23 00:35:02 +03:00
Mark Gillard
7fb4dbbb6d fixed std::numeric_limits::max() getting broken by macros in some environments 2020-06-21 00:02:59 +03:00
Mark Gillard
ab85988d59 fixed single-digit negative integer parsing bug (closes #39)
also:
- fixed overflow for very long binary integer literals
- added optimization for parsing string views containing trailing null characters
- added more tests
2020-06-19 14:17:52 +03:00
Mark Gillard
83315a3912 fixed multi-line strings being allowed in keys
also:
- significantly improved the performance of toml::parse_file
- improved the performance of printing to streams for deepy-nested TOML data
- simplified some of the examples
- added more tests
- cleaned up some of the test code
2020-06-08 18:31:23 +03:00
Mark Gillard
da024510c5 fixed parse failure when parsing an empty file
Blank files are in fact totally valid TOML and should not cause a parse failure (fixes #35).
2020-06-07 16:28:08 +03:00
Mark Gillard
d8fdf4e1e5 fixed weird overflow with BOMs in char8 mode 2020-05-24 13:42:15 +03:00
Mark Gillard
289c95cb51 renamed table proxy pair members to first and second to match STL (closes #30)
also:
- implemented `table_iterator::operator -> ()` (closes #29)
- added `array::resize()` and `array::truncate()` (closes #33)
- refactored BOM handling to make static analyzer happy (closes #34)
- added `array::capacity()`, `array::shrink_to_fit()`, `array::max_size()`
- implemented non-const -> const conversion for table and array iterators
2020-05-23 17:35:47 +03:00
Mark Gillard
983e22978e fixed formatter::print_inline causing compilation failures in windows DLL builds 2020-05-20 13:27:06 +03:00
Mark Gillard
aa37852f53 minor code cleanup 2020-04-21 16:40:03 +03:00
Mark Gillard
61106ab9f3 minor improvements to codegen of unicode functions 2020-04-19 23:08:51 +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
0c2279d15a minor improvements to the wording of some error messages
also:
- added 'error_printer' example
2020-04-14 12:45:32 +03:00
Mark Gillard
cd9b3d2198 fixed some multi-line string parsing issues
also:
- fixed pedantic warnings on gcc 10 and clang 11
2020-04-13 23:23:11 +03:00
Mark Gillard
42af364887 refactored parser
Mainly to simplify a the error handling code (it had gotten a bit verbose), but also to reduce compiled binary sizes.

also:
- moved windows terminal code page stuff in examples to a separate file
2020-04-11 19:43:38 +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
682436aa2e fixed printing of inf and nan
also:
- fixed parser not handling floats with leading '.' characters
- added `TOML_PARSER` configuration option
- added `TOML_LIB_SINGLE_HEADER` indicator
- moved parse_error and the utf8 stream machinery to separate headers
- updated catch2
2020-04-09 16:49:16 +03:00
Mark Gillard
104b2741d1 minor refactoring in the parser to reduce binary sizes
also:
- fixed pedantic vtable warnings on clang with -Weverything
- renamed `_impl.h` headers to `.hpp`
- build system and CI config tweaks
2020-04-08 16:33:57 +03:00
Mark Gillard
45c0fe26c0 added build option GENERATE_CMAKE_CONFIG [skip ci]
also:
- minor cleanup
2020-04-07 22:34:54 +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
358ac66669 added operator[], begin(), end() to parse_result in noexcept-mode
also:
- added note about `#include <fstream>` requirements README
- added tests for parse_result
- added array and table iterators to the toml namespace
2020-04-03 16:33:02 +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
e260f2df79 minor compilation speed and binary size improvements
also:
- minor documentation fixes
2020-04-01 15:53:10 +03:00
Mark Gillard
41d05792a5 narrowed scope of abi namespacing
also
- simplified `noexcept` specifiers (removed `TOML_MAY_THROW_UNLESS`)
- minor documentation fixes
2020-03-28 18:56:59 +02:00
Mark Gillard
7fca8822aa documentation fixes 2020-03-24 15:47:49 +02:00
Mark Gillard
b2f36e38f1 added trivial abi attribute to date, time, time_offset
also:
- included <cassert> directly in 'debug' builds when TOML_ASSERT isn't defined
- minor preprocessor cleanup
- minor documentation fixes
2020-03-23 17:55:32 +02:00
Mark Gillard
60853e27db TOML_GCC_ATTR => TOML_GNU_ATTR 2020-03-22 12:02:56 +02:00
Mark Gillard
f1664fa068 minor preprocessor cleanup 2020-03-19 17:51:43 +02: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
Gábor Kozár
fe0ef67e52
Fix build with GCC 8.2.0 (#15)
Fix build with GCC 8.2.0

Co-authored-by: Gábor Kozár <kozar@davinciderivatives.com>
2020-03-16 15:45:55 +02:00
Mark Gillard
2ee27d3df7 added support for Unicode 13.0 2020-03-12 22:53:08 +02:00
Mark Gillard
438970b412 added support for \xHH escape sequences (unreleased)
also:
- fixed EOF bug in string parsing when exceptions are disabled
- fixed exception mode detection sometimes being incorrect on MSVC
- added short-form license preamble to all source files
- simplified license files
2020-03-12 17:23:25 +02:00
Mark Gillard
45bfff536b fix some attribute warnings in GCC 2020-03-11 14:38:18 +02:00
Mark Gillard
3ac8c2c8cb fixed ICE in VS2019 when using /std:c++17 instead of /std:c++latest 2020-03-10 08:59:36 +02:00
Mark Gillard
f0e91716a3 added error when TOML_EXCEPTIONS is 1 but compiler exceptions were disabled 2020-03-08 23:54:57 +02:00
Mark Gillard
64e3503a8e minor parsing performance improvements
also improved codegen for the utf8_generated functions
2020-03-08 01:06:53 +02:00
Mark Gillard
4bbca20fc1 added node::ref() and node_view::ref() (resolves #10)
also:
- simplified `const` handling in `node_view`
2020-03-05 13:07:26 +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
d874264432 added support for compiling into DLLs on windows (TOML_API) 2020-03-02 12:14:54 +02:00
Mark Gillard
946a912cee added node::value() and node::value_or()
also:
- added `node_view::value`
- added relops for the date/time classes
- added `TOML_ALL_INLINE` and `TOML_IMPLEMENTATION` options
- fixed documentation header overflowing on narrow devices
2020-03-01 16:56:40 +02:00
Mark Gillard
98c599ec2c removed <cmath> dependency
also:
- fixed some pedantic clang warnings
- added preliminary support for ICC
- documentation fixes
2020-02-29 22:34:08 +02:00
Mark Gillard
36df648407 documentation improvements 2020-02-27 20:12:14 +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
44e5b1b1e2 added missing operator<< for parse_error
also:
- fixed printing bug in operator << for source_position
- improved quality of error messages for boolean and inf/nan parsing
- documentation fixes
2020-02-25 23:11:40 +02:00
Mark Gillard
506a68fa24 renamed value::value_arg_t to value_arg for consistency
also:
- added major version number to the hidden inline namespace
- documentation fixes
2020-02-23 13:13:18 +02:00
Mark Gillard
3d653de7c9 fixed potential ODR issues relating to exception mode handling (fixes #6)
also:
- fixed truncation of floating-point values when using ostreams
- fixed some minor documentation issues (fixes #8)
- fixed missing value deduction guides for dates and times
- added serialization round-trip tests (closes #9)
- added node::is_number()
- added node_view::is_number()
- added node_view::value_or() (closes #7)
- added hexfloat parsing support for all implementations, not just <charconv> ones
2020-02-22 16:10:32 +02:00
Mark Gillard
2219fd22bb release 0.1.0
- added `toml::is_number<>`
- added `toml::node_type::none`
- added initializer_list and vector relops to `toml::array`
- added constructors for `time_offset` and `date_time`
- added much to `node_view`
- added tests for `node_view` value relops
- added lots more documentation
- removed `time_offset::from_hh_mm`
- removed the handling of `\s` literals (looks like it's not going be accepted as-is)
2020-02-20 23:33:32 +02:00
Mark Gillard
0b4eca301c added value assignment operators
also:
- added value::value_type
- removed format_flags::always_print_as_inline
- significantly improved documentation
2020-02-18 23:29:59 +02:00
Mark Gillard
1f8f3c7baa added array::get
also:
- moved node_of to impl namespace
- added a lot more documentation
- fixed some bugs in the documentation generator
- fixed the license ID breaking github's license recognition
2020-02-16 15:11:57 +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
c4f30c2ffa added relops for values, arrays and tables
also:
 - fixed stream operator for node_type
 - implemented node::visit() noexcept propagation
 - removed some unnecessary overloads of string-based accessors
2020-01-30 22:17:03 +02:00
Mark Gillard
abdd4f9993 added proper non-exhaustive visitor support to node::visit
also:
- fixed preprocessor snafu
- fixed bool `print_to_stream` overload not being selected
- added `TOML_SMALL_FLOAT_TYPE`
- added is_XXXXX node type metafunctions
- added additional API documentation
2020-01-19 21:49:05 +02:00
Mark Gillard
635dec5c8e added printing for arrays
also
- added many member functions to `array`
- added more documentation
- added format_flags
- added some additional cleaning steps to `generate_single_header.py`
- made formatters work for any node type, not just tables
- fixed documentation header obscuring content during jumps
2020-01-12 23:23:35 +02:00
Mark Gillard
ab5ffa5a3c moved date and time stuff to separate header
also:
- merged all the separate integer parsing functions
- renamed the member functions of parse_error for clarity
- added the beginnings of a doxygen pipeline
2020-01-11 23:15:24 +02:00
Mark Gillard
537eb30080 added iterators for tables and arrays
also:
- fixed parsing table headers allowing invalid characters
- fixed implicit fallthrough warnings
- fixed some issues parsing dates and times
- added `table::erase`
- added `array::operator[]`
- added `value::operator*`
- added stream operators for date, time and date_time
- added `impl::print_to_stream`
- added more parsing diagnostics
- added many tests
2020-01-10 19:33:58 +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