2
0
mirror of https://github.com/boostorg/json.git synced 2026-02-09 11:12:37 +00:00
Commit Graph

467 Commits

Author SHA1 Message Date
Dmitry Arkhipov
71a6521203 extend parse_into API, document it 2023-10-09 16:59:39 +03:00
Dmitry Arkhipov
7133184252 parse_into supports optionals 2023-10-09 16:59:39 +03:00
Dmitry Arkhipov
ef6e310141 parse_into supports described enums 2023-10-09 16:59:39 +03:00
Peter Dimov
4c628ae36a Add null_handler 2023-10-09 16:59:39 +03:00
Peter Dimov
7761788417 Add parse_into 2023-10-09 16:59:39 +03:00
Dmitry Arkhipov
07efc5e83b better document building without exceptions
Also, a test for building without exceptions.
2023-10-06 22:56:17 +03:00
Dmitry Arkhipov
66d9251167 more init-list value construction tests 2023-09-11 16:59:10 +03:00
Dmitry Arkhipov
a07e38be41 is_variant_like 2023-09-09 13:09:07 +03:00
Peter Dimov
557676b68c Add a variant2 test to value_to.cpp, extracted from #925 2023-09-03 23:57:11 +03:00
Dmitry Arkhipov
25e740d7ba fix inconsistent choice of init list constructor
On some compilers value{x} invokes initializer_list constructor, on
others it is equivalent to value(x). This is very problematic, but this
isn't something we can fix. On the other hand, we CAN make init list
construction to be equivalent to value(x), if the size of init list is
one. This commit does exactly that.
2023-08-25 20:27:46 +03:00
Dmitry Arkhipov
2acdb29a32 fix reading beyond input buffer
This fixes a rare case when the parser first suspends inside a comment,
then is given input exactly up to the newline character. Before the fix
it proceeded to read past the end of the buffer or hit an assert.
2023-08-25 19:50:20 +03:00
Dmitry Arkhipov
c3d6757ab9 allow exception propagation from nested conversions
Specifically, when user invokes throwing value_to, when it goes to
non-throwing conversion, then back to throwing conversion, exceptions
will be able to propogate still.
2023-07-03 17:59:14 +03:00
Dmitry Arkhipov
3d751ad9e5 handle bias overflow 2023-06-28 13:22:49 +03:00
Dmitry Arkhipov
dd5494b202 accept numbers with large exponent 2023-06-26 21:38:25 +03:00
Dmitry Arkhipov
285c3aa5a2 mode to not parse numbers 2023-06-23 18:12:08 +03:00
Dmitry Arkhipov
8957955af4 restore object storage on failed range insert 2023-06-14 09:53:18 +03:00
Dmitry Arkhipov
c4329519cd do not reserve preemptively in object 2023-06-14 09:36:09 +03:00
Dmitry Arkhipov
4700500920 use Charconv for precise parsing 2023-06-13 16:50:11 +03:00
Dmitry Arkhipov
3956bdbb78 fix asan failures
Changes to array sizes in tests are due to asan bug.
2023-06-07 14:12:57 +03:00
Dmitry Arkhipov
be759c5051 only throw system_error 2023-06-02 16:23:08 +03:00
Dmitry Arkhipov
51d86cdd12 option to allow Infinity and NaN literals 2023-06-02 11:53:40 +03:00
Dmitry Arkhipov
35dc1b964e support parse options in stream operator 2023-06-02 07:30:47 +03:00
Dmitry Arkhipov
b9e8b2edfe contextual conversions 2023-06-01 21:45:56 +03:00
Dmitry Arkhipov
6a12c32218 support serialization options in stream operator 2023-05-27 12:18:11 +03:00
Dmitry Arkhipov
e4fb714746 option for serialization of special numbers 2023-05-27 11:42:24 +03:00
Dmitry Arkhipov
642a9ee8ff option for precise number parsing 2023-05-22 17:57:48 +03:00
Dmitry Arkhipov
33088c958a example of using string::grow 2023-04-02 21:24:19 +03:00
Dmitry Arkhipov
aa77d90639 provide example of parsing several values from several buffers 2023-03-27 13:00:59 +03:00
Dmitry Arkhipov
7cf7f107f6 mention RFC in overview and README 2023-03-27 13:00:59 +03:00
Dmitry Arkhipov
9b06d4a410 fix suspend inside escape 2023-03-25 16:24:47 +03:00
Matt Borland
d79336bbb7 Fix -Wdeprecated-declarations for sprintf 2023-03-20 18:47:33 -07:00
Dmitry Arkhipov
33d733d13c replace Bool with T
X defines the macro Bool and this breaks a build if JSON headers are
included afterwards
2023-02-12 17:42:49 +03:00
Vinnie Falco
466202d3aa rename external macro test CMake target 2023-02-03 13:58:17 +03:00
Vinnie Falco
22c1b391d4 use alignment facilities from Core and Align 2023-01-28 15:15:10 +03:00
Vinnie Falco
c06b17aab8 caller provided serializer storage 2023-01-27 20:41:15 +03:00
Dmitry Arkhipov
36552f0c94 remove namespace macros 2023-01-02 18:41:01 +03:00
Dmitry Arkhipov
8659e7d694 value_to supports missing elements for std::optional 2023-01-02 14:09:40 +03:00
Dmitry Arkhipov
a210032263 set_at_pointer 2023-01-02 13:22:28 +03:00
Dmitry Arkhipov
c6508328c8 implement std::hash support via boost::hash 2023-01-02 12:37:41 +03:00
Dmitry Arkhipov
73946424a3 add boost::hash support 2023-01-02 12:37:41 +03:00
Dmitry Arkhipov
dc5d44d9dc remove useless tests 2023-01-02 12:37:41 +03:00
Max Kellermann
0f987f07d7 basic_parser: make sentinel() return a unique pointer
Right now, sentinel() casts the `basic_parser` pointer (`this`) to
`const char *`, but that pointer is not unique if the input buffer
happens to be placed right before the `basic_parser_impl` instance -
the end of that buffer then has the same address as `basic_parser`.

Example code:

```
  struct {
    char buffer[8]{"{\"12345\""};
    boost::json::stream_parser p;
  } s;
  s.p.write(s.buffer, sizeof(s.buffer));
  s.p.write(":0}", 3);
```

This stops parsing at the end of the buffer, and then the
`incomplete()` check in `parse_string()` will return true; the second
`write()` call will crash with assertion failure:

> boost/json/basic_parser_impl.hpp:1016: const char* boost::json::basic_parser<Handler>::parse_unescaped(const char*, std::integral_constant<bool, StackEmpty_>, std::integral_constant<bool, AllowComments_>, bool) [with bool StackEmpty_ = true; bool IsKey_ = true; Handler = boost::json::detail::handler]: Assertion `*cs == '\x22'' failed.

This changes `sentinel()` by adding 1 to guaranteed that the sentinel
pointer is unique even if the input buffers borders on this object.
2022-12-30 15:18:00 +01:00
Dmitry Arkhipov
6af3a5e05c guard std::min from windows.h 2022-12-19 22:58:47 +03:00
Dmitry Arkhipov
212c0f2fd3 rewrite conversion docs 2022-11-28 17:46:24 +03:00
Dmitry Arkhipov
893df142b6 fix value_from support for proxy iterators 2022-11-20 19:25:35 +03:00
Dmitry Arkhipov
f993635f4d fix pedantic warnings 2022-11-16 22:05:16 +03:00
Dmitry Arkhipov
4d224096ce refactor operator>>(istream&, value&) 2022-11-06 12:21:56 +03:00
Dmitry Arkhipov
340442779f parse overload for std::istream 2022-11-05 16:38:29 +03:00
Dmitry Arkhipov
9f20452e05 operator>> for value 2022-11-05 16:37:27 +03:00
Dmitry Arkhipov
d88c48c892 add missing header 2022-10-28 14:46:36 +03:00