Commit graph

369 commits

Author SHA1 Message Date
Isaac Nickaein
6a5db00951 Implement contains() to check existence of a key 2019-02-13 13:21:54 +03:30
Isaac Nickaein
fb5ceb26ac Fix documentation
Remove two instance of duplicate paragraphs.
2019-02-11 17:00:48 +03:30
garethsb-sony
c850e9d82d Add operator/= and operator/ to construct a JSON pointer by appending two JSON pointers, as well as convenience op/= and op= to append a single unescaped token or array index; inspired by std::filesystem::path 2019-01-31 19:15:50 +00:00
past-due
45819dce54 Disable -Wmismatched-tags warning on tuple_size / tuple_element 2019-01-30 12:59:50 -05:00
Isaac Nickaein
372c4d2125
Merge branch 'develop' into iterate-on-destruction 2019-01-28 02:41:22 +03:30
Patrick Boettcher
a06e7f5d80 JSON-pointer: add operator+() returning a new json_pointer 2019-01-24 16:46:51 +01:00
Niels Lohmann
e89c946451
Merge branch 'feature/nodiscard' into develop 2019-01-20 15:41:30 +01:00
Niels Lohmann
6de4df23e4
🐛 fixed integer overflow in dump function #1447
Closes #1447.
2019-01-20 12:26:01 +01:00
Niels Lohmann
e17e0d031f
Merge pull request #1446 from scinart/develop
attempt to fix #1445, flush buffer in serializer::dump_escaped in UTF8_REJECT case.
2019-01-20 12:18:02 +01:00
Niels Lohmann
e36593e960
🔨 trying code from https://godbolt.org/z/-tLO1K 2019-01-20 11:12:20 +01:00
Niels Lohmann
d359fd3a8d
🚧 trying nodiscard attribute #1433 2019-01-19 17:32:23 +01:00
Niels Lohmann
b9a39b38bf
Merge pull request #1434 from pboettch/develop
allow push_back() and pop_back() calls on json_pointer
2019-01-19 17:07:36 +01:00
scinart
899bd94b43 flush buffer in serializer::dump_escaped case UTF8_REJECT
serializer use fixed buffer. Whenever it is nearly full, it is flushed to `output_adapter_t<char> o`
But the code forgets to flush when there is a invalid utf8 code point
So there will be buffer overflow.
2019-01-18 20:35:48 -05:00
Isaac Nickaein
f0883dda8f During destruction, flatten children of objects to avoid recursion 2019-01-15 20:29:51 +03:30
Patrick Boettcher
d0c0d16110 🚨 fixed unused variable warning
Since 6503e83e74 "Improve dump_integer performance by implementing a more efficient int2ascii"
an unused variable and thus a warning existed.
2019-01-15 15:21:02 +01:00
Patrick Boettcher
9225cf2f57 allow push_back() and pop_back() calls on json_pointer
Putting pop_back() to public and creating a trivial push_back()
method allows users of nlohmann::json_pointer to manipulate an
existing json-pointer by adding or removing keys at the end.

This is useful for traversing a JSON-instance and keeping track
of its "absolute path" at any moment.

In my case for a schema-validator error-handler.
2019-01-15 14:43:46 +01:00
Niels Lohmann
e5753b14a8
🚨 fixed another linter warning #1400
Closes #1400.
2019-01-13 15:40:49 +01:00
Niels Lohmann
5c04cc1009
🔨 fixed includes 2019-01-13 15:31:22 +01:00
Niels Lohmann
8e9ad346d9
🚨 fixed another linter warning 2019-01-13 13:00:54 +01:00
Niels Lohmann
ad01736d55
💡 improved documentation for parsing without exceptions #1405
Closes #1405
2019-01-13 11:46:05 +01:00
Isaac Nickaein
6503e83e74 Improve dump_integer performance by implementing a more efficient int2ascii
This commits implements a faster int2ascii inspired by "Fastware" talk given
by Andrei Alexandrescu.
See: https://www.youtube.com/watch?v=o4-CwDo2zpg
2019-01-12 08:58:30 -08:00
Niels Lohmann
c682b9879b
🚨 fixed PVS V567 warning
"V567 The modification of the 'position.chars_read_current_line' variable is unsequenced relative to another operation on the same variable. This may lead to undefined behavior."
2018-12-30 23:00:15 +01:00
Niels Lohmann
6f89613acd
🚨 fixed some warnings 2018-12-23 13:56:18 +01:00
Niels Lohmann
78348afeb6
🔖 set version to 3.5.0 2018-12-21 23:52:29 +01:00
Niels Lohmann
1107f8cd82
📝 updated documentation for items() function 2018-12-21 22:51:12 +01:00
Niels Lohmann
45f5611d9b
🚨 fixed two warnings 2018-12-20 22:41:48 +01:00
Niels Lohmann
85849940ba
Merge pull request #1391 from pratikpc/develop
Added Support for Structured Bindings
2018-12-20 08:58:08 +01:00
Pratik Chowdhury
ebd3f45808 Added Support for Structured Bindings
For further details, read https://github.com/nlohmann/json/issues/1388 and https://blog.tartanllama.xyz/structured-bindings/
2018-12-19 20:17:52 +05:30
Niels Lohmann
4f270e38cc
Merge pull request #1342 from davedissian/bugfix/sfinae-iterator-traits
Add a SFINAE friendly iterator_traits and use that instead.
2018-12-19 08:24:18 +01:00
David Avedissian
f1080d7c39 Code review. 2018-12-18 20:44:37 +00:00
Niels Lohmann
5d390e91ff
Merge pull request #1392 from mtalliance/feature/addFileInputAdapter
Feature/add file input adapter
2018-12-16 22:10:03 +01:00
Jonathan Dumaresq
c1c85b025c Forget one std::FILE 2018-12-14 07:33:28 -05:00
Jonathan Dumaresq
635a4fc344 use namespace std when possible. Change the name of private variable. 2018-12-12 16:33:25 -05:00
Jonathan Dumaresq
cf31193de2 create single json.hpp file 2018-12-12 14:46:52 -05:00
Jonathan Dumaresq
fa7f1a524e new unified json.hpp generated with make amalgamate 2018-12-12 10:19:22 -05:00
Jonathan Dumaresq
3335da622a remove non usefull code. 2018-12-12 09:32:52 -05:00
Jonathan Dumaresq
67b0daf27b Add the possibility of using FILE * from cstdio library to read a file. This enable the possibility of using low eand device with this library. 2018-12-11 09:33:30 -05:00
David Avedissian
2c23f0a346 Changes requested from code review. 2018-12-08 15:46:33 +00:00
Niels Lohmann
ef90d62ddf
🚨 fixed warning #1364 2018-11-21 21:17:38 +01:00
Niels Lohmann
da81e7be22
🏁 adding parentheses around std::snprintf calls #1337 2018-11-09 21:18:02 +01:00
Niels Lohmann
f80efd3954
💄 cleanup 2018-11-09 21:10:32 +01:00
Niels Lohmann
35829928da
Merge pull request #1343 from mefyl/develop
Set eofbit on exhausted input stream.
2018-11-09 21:07:36 +01:00
mefyl
aa10382629 Set eofbit on exhausted input stream.
Fix issue #1340.

        The eofbit is set manually since we don't go through the
	stream interface. We could maybe use the stream interface
	instead, but there are some assumptions regarding which
	exception go through, so this seems to be the most prudent
	approach for now.
2018-11-08 11:41:17 +01:00
Axel Huebl
798754dfb6
Amalgamate Headers 2018-11-08 10:35:45 +01:00
David Avedissian
f665a92330 Implement SFINAE friendly iterator_traits and use that instead. 2018-11-07 18:39:25 +00:00
Niels Lohmann
2f73a4d1f3
🚨 fixed a linter warning 2018-10-31 20:30:24 +01:00
Niels Lohmann
7b2f8cce03
🔖 set version to 3.4.0 2018-10-30 21:30:20 +01:00
Niels Lohmann
8cee0e38d9
🚑 fixed #1319 2018-10-30 17:29:05 +01:00
Niels Lohmann
856fc31d0a
💄 fixed indentation 2018-10-29 19:44:19 +01:00
Niels Lohmann
d2e4f0b0d9
✏️ fixed some typos 2018-10-28 14:20:20 +01:00
Niels Lohmann
f0c1459554
🐛 fixed a bug parsing BSON strings #1320 2018-10-28 09:16:40 +01:00
Niels Lohmann
24946f67f1
🚨 fixed some more linter warnings 2018-10-28 09:15:41 +01:00
Niels Lohmann
7d0dc10169
🚨 fixed a linter warning 2018-10-27 18:34:35 +02:00
Niels Lohmann
45a761bd60
Merge branch 'develop' of https://github.com/nlohmann/json into develop 2018-10-27 18:31:06 +02:00
Niels Lohmann
4e765596f7
🔨 small improvements 2018-10-27 18:31:03 +02:00
Niels Lohmann
1308ea055d
Merge pull request #1315 from nlohmann/feature/convert_char
Properly convert constants to CharType
2018-10-27 16:56:00 +02:00
Niels Lohmann
85aaf91b85
Merge branch 'develop' into feature/enum_json_mapping 2018-10-27 16:52:59 +02:00
Niels Lohmann
5a6bdf5934
Merge branch 'develop' into feature/convert_char 2018-10-27 16:48:48 +02:00
Niels Lohmann
9f48bb6937
replaced vector by array #1323 2018-10-27 09:58:23 +02:00
Niels Lohmann
6384fe28db
🚨 fixed another linter warning 2018-10-26 23:12:41 +02:00
Niels Lohmann
ad639ad5e6
added NLOHMANN_JSON_SERIALIZE_ENUM marco #1208 2018-10-26 14:48:20 +02:00
Niels Lohmann
544150d5a5
🚨 fixed another linter warning 2018-10-26 11:10:49 +02:00
Niels Lohmann
c2e175763c
👌 added another conversion function #1315 2018-10-25 22:47:08 +02:00
Niels Lohmann
7ce720b700
🚨 fixed coverage 2018-10-25 18:21:50 +02:00
Niels Lohmann
19647e083c
🚨 fixed compiler warnings 2018-10-25 14:27:55 +02:00
Niels Lohmann
62126278a6
🔨 added fix for arrays 2018-10-25 13:01:18 +02:00
Niels Lohmann
1968e5c793
🎨 clean up binary formats 2018-10-24 23:39:30 +02:00
Niels Lohmann
e2c5913a50
🚧 some changes to the BSON code
- added fuzz testers
- added some reference files
- made an exception text more clear
2018-10-24 15:43:37 +02:00
Niels Lohmann
bba159121f
Merge branch 'feature/bson' of https://github.com/julian-becker/json into julian-becker-feature/bson 2018-10-24 15:03:15 +02:00
Niels Lohmann
7b501de054
Merge pull request #1314 from nlohmann/feature/codec_errors
Allow to set error handler for decoding errors
2018-10-24 08:40:58 +02:00
Niels Lohmann
20038e2703
📝 added a note to the discussion #1286 2018-10-23 23:00:43 +02:00
Niels Lohmann
87ef3f25f2
✏️ fixed a typo #1314 2018-10-23 22:56:10 +02:00
Niels Lohmann
b49f76931f
👌 replaced static_cast to CharType by conversion function #1286 2018-10-23 17:49:04 +02:00
Niels Lohmann
c51b1e6fab
🚧 fixed an issue with ensure_ascii #1198 2018-10-22 15:53:36 +02:00
Niels Lohmann
c7af027cbb
🚧 respect ensure_ascii parameter #1198 2018-10-22 09:18:16 +02:00
Niels Lohmann
e5dce64115
💚 added tests #1198
Test every prefix of Unicode sequences against the different dump functions.
2018-10-21 23:26:25 +02:00
Niels Lohmann
c5821d91e5
🚧 overworked error handlers #1198 2018-10-21 11:49:37 +02:00
Julian Becker
ad11b6c35e BSON: Improved exception-related tests and report location of U+0000 in the key-string as part of out_of_range.409-message 2018-10-18 20:05:46 +02:00
Niels Lohmann
9294e25c98
Merge pull request #1301 from theodelrieu/fix/1299
add new is_constructible_* traits used in from_json
2018-10-18 19:18:48 +02:00
Julian Becker
8de10c518b BSON: Hopefully fixing ambiguity (on some compilers) to call to string::find() 2018-10-17 21:47:01 +02:00
Julian Becker
2a63869159 Merge branch 'develop' of https://github.com/nlohmann/json into feature/bson
Conflicts:
	include/nlohmann/detail/input/binary_reader.hpp
	single_include/nlohmann/json.hpp
	src/unit-bson.cpp
2018-10-17 20:26:00 +02:00
Niels Lohmann
dbb0b63187
improved error messages for binary formats #1288
This commit is the equivalent of #1282 for CBOR, MessagePack, and UBJSON.
2018-10-17 12:15:58 +02:00
Théo DELRIEU
a946dfc19c
add a note to maintainers in type_traits.hpp 2018-10-17 12:03:10 +02:00
Julian Becker
978c3c4116 BSON: throw json.exception.out_of_range.409 in case a key to be serialized to BSON contains a U+0000 2018-10-16 20:42:00 +02:00
Niels Lohmann
0671e92ced
🚧 proposal for different error handlers #1198
Proof of concept; currently only as parameter to the internal dump_escaped function; that is, not yet exposed to the dump function.
2018-10-16 20:38:50 +02:00
Julian Becker
daa3ca8a2e BSON: Adjusted documentation of binary_writer::to_bson() 2018-10-16 19:29:42 +02:00
Julian Becker
5bccacda30 BSON: throw json.exception.out_of_range.407 in case a value of type std::uint64_t is serialized to BSON. Also, added a missing EOF-check to binary_reader. 2018-10-16 19:13:07 +02:00
Théo DELRIEU
45c8af2c46
add new is_constructible_* traits used in from_json
is_compatible_* traits were used in from_json, but it made no sense
whatsoever.

It used to work because of non-SFINAE correctness + json_ref
unconstrained variadic template constructor.

SFINAE checks are becoming quite complex, we need a specification of
some sort describing:

* which concepts the library uses
* how the conversion to/from json works in detail

Having such a specification would really help simplifying the current
code (as well as having meaningful checks).

Fixes !1299
2018-10-16 14:00:34 +02:00
Théo DELRIEU
11fecc25af
add constraints for variadic json_ref constructors
Fixes #1292
2018-10-12 10:54:58 +02:00
Niels Lohmann
e426219256
Merge pull request #1282 from nlohmann/feature/lines_columns
Improve diagnostic messages
2018-10-08 22:17:33 +02:00
Niels Lohmann
6d34d64bfd
🚑 fixed compilation error 2018-10-08 06:54:51 +02:00
Niels Lohmann
74a31075e3
improved parse error messages 2018-10-07 22:39:17 +02:00
Niels Lohmann
6e49d9f5ff
🚑 fixed compilation error 2018-10-07 21:34:40 +02:00
Niels Lohmann
f8158997b5
📝 fixed documentation 2018-10-07 21:30:58 +02:00
Julian Becker
df0f612d1b BSON: allow and discard values and object entries of type value_t::discarded 2018-10-07 20:08:05 +02:00
Niels Lohmann
3abb788139
🚨 fixed some more clang-tidy warnings 2018-10-07 19:07:58 +02:00
Niels Lohmann
858e75c4df
🚨 fixed some clang-tidy warnings 2018-10-07 18:39:18 +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
fa722d5ac3
🚨 fixed another linter warning 2018-10-06 16:26:47 +02:00
Niels Lohmann
ec95438a59
🚨 fixed some linter warnings 2018-10-06 13:49:02 +02:00
Niels Lohmann
b968faa882
🔖 set version to 3.3.0 2018-10-05 10:59:33 +02:00
Niels Lohmann
bb55885215
💄 cleaned code 2018-10-04 20:42:19 +02:00
Antonio Borondo
b6fdad9acd Remove anonymous namespace 2018-10-03 13:51:49 +01:00
Antonio Borondo
7c385a4844 Fix error: 'wide_string_input_helper' was not declared in this scope 2018-10-03 12:41:34 +01:00
Antonio Borondo
9ba3f79667 Fix error: explicit specialization in non-namespace scope 2018-10-03 12:26:24 +01:00
Antonio Borondo
8d1585f065 Change implementation to use templates 2018-10-03 11:44:02 +01:00
Antonio Borondo
ad3c216bb5 Generate header 2018-10-03 11:27:53 +01: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
Julian Becker
e8730e5e82 BSON: Reworked binary_reader::get_bson_cstr() 2018-09-29 11:50:01 +02:00
Niels Lohmann
4e54c9a13d
🚨 fixed a compilation issue with ICPC #755
Closes #1222
2018-09-29 11:48:49 +02:00
Julian Becker
0a09db9cc2 BSON: Extend binary_reader::get_number to be able to hanlde little endian input to get rid of binary_reader::get_number_little_endian 2018-09-29 11:33:01 +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
Chris Harris
99b7c7c8ef Patch nlohmann/json for GCC 4.8
See https://github.com/nlohmann/json/pull/212 for details
2018-09-25 18:10:20 +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
David Guthrie
4d780b091b Reordered the code. It seems to stop clang 3.4.2 in RHEL 7 from crashing intermittently. 2018-09-18 16:38:59 -04:00
Niels Lohmann
7fa3b8865c
Merge pull request #1221 from rivertam/better-error-305
Better error 305
2018-09-18 12:49:07 +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
mandreyel
6b5334c167 Move lambda out of unevaluated context 2018-09-10 13:34:59 +02:00
Niels Lohmann
ebb3c03293
🎨 cleanup after #1228 2018-09-09 18:19:33 +02:00
Théo DELRIEU
aea648bb7a
remove now-useless traits. check for is_basic_json where needed 2018-09-07 14:10:39 +02:00
Théo DELRIEU
4b4bbceebf
make from_json SFINAE-correct 2018-09-07 14:10:37 +02:00
Théo DELRIEU
f7971f04a5
make to_json SFINAE-correct 2018-09-07 12:18:04 +02:00
Théo DELRIEU
f7c8a2145a
refactor from/to_json(CompatibleArrayType) 2018-09-07 12:18:04 +02:00
Théo DELRIEU
628f76729e
do not check for compatible_object_type in compatible_array_type 2018-09-07 12:18:03 +02:00
Théo DELRIEU
29f72966c3
refactor is_compatible_type, remove conjunction & co 2018-09-07 12:18:03 +02:00
Théo DELRIEU
77967e6548
refactor is_compatible_integer_type 2018-09-07 12:18:03 +02:00
Théo DELRIEU
13760857ff
refactor is_compatible_array_type 2018-09-07 12:18:02 +02:00
Théo DELRIEU
924e95c6e8
refactor is_compatible_string_type 2018-09-07 12:18:02 +02:00
Théo DELRIEU
e84195ab7b
refactor is_compatible_object_type 2018-09-07 12:18:02 +02:00
Théo DELRIEU
b59c3367c9
use detected instead of has_* traits 2018-09-07 12:17:59 +02:00
Théo DELRIEU
1ea8cd128c
fix void_t for older compilers 2018-09-07 12:17:33 +02:00