Commit graph

653 commits

Author SHA1 Message Date
Julian Becker
df0f612d1b BSON: allow and discard values and object entries of type value_t::discarded 2018-10-07 20:08:05 +02:00
Julian Becker
062aeaf7b6 BSON: Reworked the binary_writer such that it precomputes the size of the BSON-output.
This way, the output_adapter can work on simple output iterators and no longer requires random access iterators.
2018-10-07 18:02:51 +02:00
Niels Lohmann
6d09cdec34
🐛 fixed a bug in the unget function 2018-10-07 16:48:45 +02:00
Niels Lohmann
011b15dd08
added line positions to error messages
This is a follow-up to #1210.
2018-10-07 12:27:24 +02:00
Julian Becker
81f4b34e06 BSON: Improved documentation and error handling/reporting 2018-10-07 09:57:55 +02:00
Niels Lohmann
b968faa882
🔖 set version to 3.3.0 2018-10-05 10:59:33 +02:00
Niels Lohmann
1fae82b7a7
Merge branch 'develop' into fix/1237 2018-09-29 14:50:36 +02:00
Niels Lohmann
d26f39466e
Merge pull request #1231 from theodelrieu/feature/get_with_parameter
Add a get overload taking a parameter.
2018-09-29 14:30:04 +02:00
knilch
8c1387cfb3
unit-testsuites.cpp: fix hangup if file not found
If run from the wrong directory, std::ifstream f("test/data/big-list-of-naughty-strings/blns.json"); will not find the file and thus f.eof() will never return true.
Use canonical C++ file reading loop from https://gehrcke.de/2011/06/reading-files-in-c-using-ifstream-dealing-correctly-with-badbit-failbit-eofbit-and-perror/ instead.
2018-09-28 11:33:23 +02:00
Théo DELRIEU
521fe49fec
Add basic_json::get_to function.
Takes an lvalue reference, and returns the same reference.

This allows non-default constructible types to be converted without
specializing adl_serializer.
This overload does not require CopyConstructible either.

Implements #1227
2018-09-28 11:25:23 +02:00
Henry Fredrick Schreiner
7a37ba0c02 Adding 4.8 test to travis 2018-09-27 22:31:39 +02:00
Julian Becker
ef358ae695 BSON: Fixed hangup in case of incomplete bson input and improved test coverage 2018-09-25 20:34:25 +02:00
Julian Becker
bce4816275 BSON: Added test case for the different input/output_adapters 2018-09-24 23:35:19 +02:00
Julian Becker
763705c2a7 Fix: Add missing begin() and end() member functions to alt_string 2018-09-24 19:50:28 +02:00
Théo DELRIEU
4e52277b70
Fix issue #1237
* Make the conversion operator SFINAE correct.
* Workaround a GCC bug with some traits in type_traits.hpp

The first bullet-point implies that every `get`/`get_ptr` be SFINAE
correct as well.
2018-09-20 10:33:14 +02:00
Ben Berman
8f07ab6392 Replace "key-style argument" with "string argument" 2018-09-17 15:36:38 -04:00
Julian Becker
df33a90774 BSON: Bugfix for non-empty arrays 2018-09-15 14:08:38 +02:00
Julian Becker
cf485c2907 BSON: Support for arrays 2018-09-15 13:54:08 +02:00
Julian Becker
120d1d77d4 BSON: test case for a more complex document 2018-09-15 13:41:05 +02:00
Julian Becker
5ce7d6bdd7 BSON: support objects with objects as members 2018-09-15 13:03:42 +02:00
Julian Becker
83b427ad67 BSON: unsigned integers 2018-09-15 12:20:30 +02:00
Julian Becker
c0d8921a67 BSON: support objects with int64 members 2018-09-15 12:00:53 +02:00
Julian Becker
7ee361f7ad BSON: support objects with int32 members 2018-09-15 11:54:17 +02:00
Julian Becker
c5ef023171 BSON: support objects with null members 2018-09-15 11:39:12 +02:00
Julian Becker
6c447de076 BSON: Support objects with string members 2018-09-15 11:33:24 +02:00
Julian Becker
0c0f2e44b5 BSON: support doubles 2018-09-15 10:32:03 +02:00
Julian Becker
9a0dddc5d2 BSON: Object with single boolean 2018-09-15 03:08:50 +02:00
Julian Becker
5f5836ce1c BSON: Support empty objects 2018-09-15 00:43:39 +02:00
Julian Becker
f06c8fd8e3 BSON: serialization of non-objects is not supported 2018-09-15 00:20:03 +02:00
Niels Lohmann
ebb3c03293
🎨 cleanup after #1228 2018-09-09 18:19:33 +02:00
Théo DELRIEU
4b4bbceebf
make from_json SFINAE-correct 2018-09-07 14:10:37 +02:00
Ben Berman
ad053ef09c Fix tests for improved error 305(hopefully) 2018-08-30 13:21:55 -04:00
Niels Lohmann
9f3857ef6f
🔖 set version to 3.2.0 2018-08-18 18:46:15 +02:00
Niels Lohmann
57faaf42ca
🚨 fixed a compiler warning 2018-08-18 08:15:03 +02:00
Niels Lohmann
e33b31e6aa
🐛 fixed callback-related issue (https://github.com/nlohmann/json/issues/971#issuecomment-413678360) 2018-08-17 23:09:45 +02:00
Niels Lohmann
07494e06d7
🚨 fixed some compiler warnings 2018-08-16 18:20:30 +02:00
Théo DELRIEU
38f8a51a8f
use abstract sax class in parser tests 2018-08-16 11:59:49 +02:00
Théo DELRIEU
9bbb133094
remove no_limit constant and default values 2018-08-16 11:59:05 +02:00
Théo DELRIEU
442886d040
use templates in the sax interface instead of virtuals 2018-08-16 11:58:52 +02:00
Théo DELRIEU
f6febbe359
split meta.hpp, add detected_t (used to define concepts) 2018-08-16 11:58:42 +02:00
Niels Lohmann
fed70f6bff
🎨 reindented code 2018-08-14 22:11:08 +02:00
Michael Gmelin
05b27e83b7 Exclude bytewise comparison in certain tests.
These tests never worked - they weren't run before
d5aaeb4.

Note that these tests would fail because of this library
ordering dictionary keys (which is legal). So changing the
input files (or modifying stored cbor/msgpack/ubjson files)
would make the tests work and they could get removed from
"exclude_packaged".

Also move parsing of files in these unit tests to within
the inner sections, so that they're only parsed
number_of_files * number_of_sections instead of
number_of_files * number_of_files * number_of_sections
(so, instead of close to 100k parses about 700).
2018-07-29 14:52:52 +02:00
Michael Gmelin
d5aaeb4cce Make section names unique in loops, as catch doesn't support duplicate
sections, see also https://github.com/catchorg/Catch2/issues/816#issuecomment-278268122

As a result, when built with gcc, loop iterations were skipped. When
built with clang, the test aborted with an assertion in catch.hpp
line 6222.

This also addresses the issues discussed here:
https://github.com/nlohmann/json/issues/1032#issuecomment-378707696

and here:
https://github.com/catchorg/Catch2/issues/1241

Please note that this introduces new problems, as some of
the unit tests fail now - the library stores keys in
lexographical order, while the cbor/msgpack/ubjson examples
store them in original order.
2018-07-29 10:44:36 +02:00
Niels Lohmann
3760a38b7e
🏁 implicit conversion is not allowed with MSVC 2018-07-21 11:47:05 +02:00
Niels Lohmann
5b14411669
🏁 trying to fix C2440 error
Error in AppVeyor:

unit-conversions.cpp(441): error C2440: 'initializing': cannot convert from 'nlohmann::json' to 'std::nullptr_t'

(https://ci.appveyor.com/project/nlohmann/json/build/2838/job/wo7im01sq6tvhe9m)
2018-07-21 10:59:00 +02:00
Niels Lohmann
347e77bdc1
🚑 fix for #1169 2018-07-21 10:31:55 +02:00
Niels Lohmann
86a96b059d
Merge pull request #1134 from Daniel599/feature/items_iterator
fixed compile error for #1045
2018-06-28 21:21:17 +02:00
Julius Rakow
9f00db48d9 📝 link to cppreference via HTTPS 2018-06-24 22:34:47 +02:00
Niels Lohmann
7fa4ddf93e
💄 fixed indentation 2018-06-23 17:27:40 +02:00
Niels Lohmann
bf348ca8a4
Merge pull request #1028 from gracicot/develop
Added support for string_view in C++17
2018-06-23 17:10:04 +02:00
Niels Lohmann
850922269d
🚨 removed compiler warnings 2018-06-23 10:28:04 +02:00
Niels Lohmann
e7c1638d11
💄 cleanup 2018-06-18 22:03:46 +02:00
Niels Lohmann
1c81e9f5ae
Merge pull request #1130 from agrianius/develop
test (non)equality for alt_string implementation
2018-06-18 22:01:53 +02:00
Théo DELRIEU
2c920a1032
run make amalgamate 2018-06-18 15:14:10 +02:00
Théo DELRIEU
2b37d7ed86
from_json: add overload for std::unordered_map
Fixes #1133
2018-06-18 15:14:10 +02:00
Danielc
1566ad4053 fixed compile error for #1045; to_json for iternation_proxy_internal was needed 2018-06-16 12:01:49 +03:00
Vitaliy
f574d7e084 simplify templates for operators, add more checks 2018-06-14 15:07:06 +03:00
Vitaliy
cd28d872e7 forward declarations to make new compilers happy 2018-06-11 20:50:39 +03:00
Vitaliy
3d3055909c define global operator< for const char* and alt_string 2018-06-11 19:09:57 +03:00
Vitaliy
4feb8211ca test (non)equality for alt_string implementation 2018-06-11 18:03:46 +03:00
Guillaume Racicot
714c592680 Disabled implicit conversion to string_view on MSVC 15.13 and older 2018-06-01 14:22:57 -04:00
Niels Lohmann
e5a67fc3f8
Merge branch 'develop' of https://github.com/nlohmann/json into develop 2018-05-28 17:57:46 +02:00
Niels Lohmann
a49644ab74
🚑 adjusted Fuzzer to new parser
out_of_range exceptions where unexpected before - the parser used to crash in these situations...
2018-05-28 17:57:22 +02:00
Niels Lohmann
0efaf891e5
Merge pull request #1089 from theodelrieu/feature/map_conversion
Provide a from_json overload for std::map
2018-05-28 14:53:23 +02:00
Théo DELRIEU
c5e63fd684
Provide a from_json overload for std::map
This overload is chosen only when BasicJsonType::string_t
is not constructible from std::map::key_type.

Currently, converting a map to json treats it as an array of pairs.

fixes #1079
2018-05-28 11:06:24 +02:00
Niels Lohmann
1f84cc2c88
adjusted test cases 2018-05-17 16:50:37 +02:00
Niels Lohmann
717301d1bc
Merge branch 'testsuite' into feature/sax2 2018-05-17 16:36:43 +02:00
Niels Lohmann
4639bb2c8f
added more tests from recent nst's JSONTestSuite 2018-05-17 10:10:01 +02:00
Niels Lohmann
5ff2abb90d
Merge branch 'develop' into feature/sax2 2018-05-06 13:29:23 +02:00
Niels Lohmann
ed69e50ad2
📄 added SPDX-License-Identifier 2018-05-03 17:41:45 +02:00
Niels Lohmann
fa3e42f826
Merge branch 'develop' into feature/wstring 2018-04-29 13:16:12 +02:00
Niels Lohmann
b5d1755dfb
🔥 removed commented-out test cases #1060 2018-04-22 15:41:42 +02:00
Niels Lohmann
8d8f890771
💩 first try on #1045 2018-04-10 08:29:07 +02:00
Guillaume Racicot
aaee18ce90 Added test for string conversion with string_view 2018-04-09 11:15:33 -04:00
Niels Lohmann
cf91b4f2bb
Merge branch 'develop' into feature/wstring 2018-04-08 11:36:58 +02:00
Niels Lohmann
e1ea8369ad
Merge branch 'develop' into feature/sax2 2018-04-08 09:31:59 +02:00
Niels Lohmann
aa89c5e048
🔨 removing unget_character() function from input adapters #834 2018-04-02 21:10:48 +02:00
Niels Lohmann
6678eb2b4a
improved test coverage #1031 2018-04-02 15:38:49 +02:00
Niels Lohmann
727dd4664b
🔨 trying to make tests run with MSVC #1031 2018-04-02 12:27:07 +02:00
Niels Lohmann
ab89ae4e50
🔨 trying to make tests run with MSVC #1031 2018-04-02 11:34:36 +02:00
Niels Lohmann
eb06d0531a
🚧 added input adapter for wide strings #1031 2018-04-01 19:12:36 +02:00
Guillaume Racicot
c78dbc366c Added test for conversion to string_view 2018-03-29 01:03:57 -04:00
Niels Lohmann
5f723bbec6
🔨 realized callback parser wirh SAX interface #971 2018-03-28 23:39:39 +02:00
Niels Lohmann
896a9db461
🔨 improved code #1021 2018-03-28 19:37:21 +02:00
Niels Lohmann
a9baab76c2
🚑 fix for #1021 2018-03-28 18:20:55 +02:00
Niels Lohmann
4f6b2b6429
🔨 changed SAX interface 2018-03-21 20:12:06 +01:00
Niels Lohmann
2537677e4c
improved test coverage 2018-03-20 23:40:01 +01:00
Niels Lohmann
9e1abb4842
improved coverage 2018-03-20 22:39:08 +01:00
Niels Lohmann
1e38ffc014
more tests 2018-03-20 20:04:11 +01:00
Niels Lohmann
99ecca55c4
improved test coverage 2018-03-20 18:49:10 +01:00
Niels Lohmann
9e07e9b4ec
implemented non-throwing binary reader 2018-03-19 22:48:13 +01:00
Niels Lohmann
606a25195f
improved test coverage 2018-03-17 19:15:59 +01:00
Niels Lohmann
27cf05af8d
Merge branch 'develop' into feature/sax2 2018-03-14 22:02:19 +01:00
Niels Lohmann
afef474c0d
🔖 set version to 3.1.2 2018-03-14 21:09:27 +01:00
Niels Lohmann
1262d474eb
🏁 fixed an MSVC warning 2018-03-14 07:32:28 +01:00
Niels Lohmann
abac6a0e84
Merge branch 'develop' into feature/sax2 2018-03-13 23:58:17 +01:00
Niels Lohmann
8557151d90
♻️ adjusting lexer/parser in symmetry to #1006 2018-03-12 19:15:11 +01:00
Niels Lohmann
3d4f6a2940
🔨 cleaner exception interface 2018-03-11 22:47:25 +01:00
Niels Lohmann
ad47b0fbde
♻️ refactored binary readers to use a SAX parser 2018-03-11 18:47:38 +01:00
Vitaliy Manushkin
392c033805 test refactoring 2018-03-11 00:29:04 +03:00