1106 Commits

Author SHA1 Message Date
agate-pris
79d7a448e9 Allow the macro RAPIDJSON_DEFAULT_STACK_ALLOCATOR to be used in any namespace
RAPIDJSON_DEFAULT_STACK_ALLOCATOR uses names in the namespace
`RAPIDJSON_NAMESPACE`. Replace this with a name starting in the global
namespace.
2022-03-18 19:32:01 +09:00
agate-pris
9965ab37f6 Allow the macro RAPIDJSON_DEFAULT_ALLOCATOR to be used in any namespace
`RAPIDJSON_DEFAULT_ALLOCATOR` uses names in the namespace
`RAPIDJSON_NAMESPACE`. Replace this with a name starting in the global
namespace.
2022-03-18 19:22:19 +09:00
Milo Yip
8261c1ddf4
Merge pull request #1969 from MalcolmTyrrell/MalcolmTyrrell/sanitizeSchemaCode
Sanitize the code in schema.h
2022-03-09 12:15:45 +08:00
Adam Calhoon
1dff2abff7 Fix the alignment of placement new buffer for GenericValue.
When using operator[] on a GenericValue type clang-tidy complains,
appropriately, about the alignment of the buffer used for placement-new
of the "dummy" GenericValue.
2022-02-08 22:29:15 -05:00
Malcolm Tyrrell
53602ec6bb Sanitize the code in schema.h 2021-11-17 09:31:22 +00:00
jedwards
060c348ea0 use softintrin on arm64ec 2021-10-29 15:31:10 -07:00
ardb-uk
14f1e37f85
Resolve issue 1948
Correct instances of >> as they failed compilation.
2021-10-12 16:22:22 +01:00
Steve Hanson
9ea3f45dbd fix the warning 2021-09-24 08:51:03 +01:00
Milo Yip
00dbcf2c6e
Merge pull request #1926 from Kyrega/master
Fix RawNumber for characters with sizeof(Ch) > sizeof(char)
2021-08-13 12:25:41 +08:00
Kyrega
a3d52c75b7 No default template parameter for older compilers 2021-08-10 17:38:41 +02:00
Kyrega
19b55c9049 No default template parameter for older compilers 2021-08-10 17:38:23 +02:00
Kyrega
128b1031b0 Use rapidjson internal::SelectIf 2021-08-10 17:38:09 +02:00
Kyrega
8710d7e989 Do not depend on c++11 conditional 2021-08-10 17:37:35 +02:00
Kyrega
7fac34f7bb Added typename 2021-08-10 17:35:49 +02:00
Kyrega
b952a592a4 Fix RawNumber for longer char types 2021-08-10 17:35:07 +02:00
jack_perisich
bb06211088 Fix small errors in dtoa output for certain doubles 2021-07-27 19:50:51 -04:00
Milo Yip
48fbd8cd20
Merge pull request #1848 from smhdfdl/id-and-ref
Fix issue 1843 - support Id keyword
2021-07-09 10:57:40 +08:00
Steve Hanson
8d16abd980 Uri Parse improvements 2021-06-30 17:09:52 +01:00
Steve Hanson
a21cf9f7b8 equiv fix for issue 1899 2021-06-14 11:35:00 +01:00
Milo Yip
8c29a7b493 Fix Pointer::Append() crash for custom allocator on Windows
Fix #1899
2021-06-11 11:49:14 +08:00
Steve Hanson
12b88efa6f fix coverage again 2021-06-09 18:11:04 +01:00
Steve Hanson
f6ebcb2008 fix Uri.Match optional arg 2021-06-09 16:38:40 +01:00
Steve Hanson
3df804c128 fix coverage, unit test allocators and equality 2021-06-09 10:31:09 +01:00
Steve Hanson
18ab3b16bc remove temp debug statements 2021-06-08 17:11:42 +01:00
Steve Hanson
28bcbd3f35 make std::string optional 2021-06-08 10:53:10 +01:00
Steve Hanson
494447b731 remove copyright & debug statements 2021-05-21 15:55:11 +01:00
Steve Hanson
3987d82f41 Merge branch 'master' of https://github.com/Tencent/rapidjson into id-and-ref 2021-05-20 12:20:12 +01:00
N. Kolotov
3aa8d04b74 Fixed -Wshadow warning. 2021-05-03 01:56:41 +03:00
Hendrik Muhs
d179facf90 don't let the GetObject macro rewrite the GetObject method, add a GetObj alias 2021-04-19 12:29:11 -07:00
ylavic
71f0fa7eb3 Set RAPIDJSON_USE_MEMBERSMAP to use a (std::multi)map for object members.
When RAPIDJSON_USE_MEMBERSMAP is defined, an object Value will store
its members in an (re)allocated array of Members like before, but also
in an std::multimap<GenericValue::Data,SizeType> where the key and value
reference the corresponding Member by its Data and index in the array,
respectively, and in a relocatable manner.

The layout of the members map/array is now:
 {multimap*}<>{capacity}<>{Member[capacity]}<>{multimap::iterator[capacity]}
where <> stands for the RAPIDJSON_ALIGN-ment of each part, if needed.

This layout needs to be reallocated when the current capacity is
exhausted, which requires to take care of the multimap and its iterators
explicitely. The multimap is allocated separately and only its pointer is
saved in this layout, so it can easily be restored in its new position.
As for the old/alive iterators, they must move to their new offset according
to the new capacity.

With this in place, it's immediate to get the multimap::iterator from a
MemberIterator and vice versa, thus the same complexity applies for the
operations with MemberIterator or MapIterator.

For FindMember() and RemoveMember(), the complexity drops from O(n) to
the multimap/rbtree's O(log n).
For EraseMember() it drops from O(n-m) to O((log n)-m), m representing
the move/copy of the trailing members.
For AddMember() though, the complexity grows from O(1) to O(log n) due to
the insertion in the multimap too.

Consequently parsing will be slower, up to ~20% measured in perftests on
my laptop (since it's mainly composed of insertions). But later work on
the Document (usually the goal of parsing...) will be much faster; the
new DocumentFind perftest included in this commit is 8 times faster with
RAPIDJSON_USE_MEMBERSMAP (still on my laptop). Overall the tests are 4%
slower (mainly composed of parsing), and notably 15% slower for schemas
parsing/validation (which supposedly comes from the larger JSON files
parsing, still). As a side note, when RAPIDJSON_USE_MEMBERSMAP is not
defined, this commit does nothing (same results for perftest with regard
to previous versions).

Finally, the multimap is allocated and constructed using StdAllocator,
so they will use the same Allocator than for any other Value allocation,
and thus will benefit from the same performance/safety/security/whatever
provided by the user given Allocator.
2021-04-07 18:22:46 +02:00
Milo Yip
7d801bbe45
Merge pull request #1503 from ylavic/sub_value_assignment
Fix (Sub-)Value assignment
2021-04-07 17:52:51 +08:00
ylavic
683010b02d Add rvalue copy and assignment to MemoryPoolAllocator and StdAllocator. 2021-04-04 12:51:47 +02:00
ylavic
6bed9b266f Don't define StdAllocator<void> from C++17. 2021-03-30 13:47:04 +02:00
ylavic
08cf9a56c0 Make StdAllocator C++17-20 compatible. 2021-03-29 11:32:33 +02:00
ylavic
02f42604bd Make StdAllocator C++17-20 compatible. 2021-03-28 23:48:14 +02:00
ylavic
49e4dd619f Provide StdAllocator, STL compatible, for use with STL types. 2021-03-16 01:03:04 +01:00
ylavic
c033292aea Safer GenericValue& operator=(GenericValue& rhs).
When rhs is a sub-Value of *this, destroying *this also destroys/frees
rhs, thus the following RawAssign(rhs) crashes.

Address this by saving/moving rhs to a temporary first, which clears rhs
and avoids its destruction with *this.

The crash can be reproduced in test Value.MergeDuplicateKey by using the
CrtAllocator instead of the default Document's MemoryPoolAllocator.
2021-03-15 23:57:42 +01:00
ylavic
d51dd2d0e9 RAPIDJSON_NOEXCEPT_ASSERT should assert regardless of RAPIDJSON_HAS_CXX11_NOEXCEPT. 2021-03-12 15:32:17 +01:00
ylavic
cdb2d4757d Provide RAPIDJSON_HAS_CXX11 and use it for RAPIDJSON_HAS_CXX11_RVALUE_REFS and RAPIDJSON_HAS_CXX11_NOEXCEPT. 2021-03-12 15:14:30 +01:00
Steve Hanson
24b9b7e276 satisfy all compilers 2 2021-03-11 18:16:24 +00:00
Steve Hanson
32722fa31d satisfy all compilers 2021-03-11 16:53:05 +00:00
Steve Hanson
8768b5b1d6 correct #defines in uri.h 2021-03-11 15:13:17 +00:00
Steve Hanson
6c9da69abf remove comma 2021-03-11 15:06:02 +00:00
Steve Hanson
6b57738e4a handle internal refs properly 2021-03-11 14:49:28 +00:00
Steve Hanson
ad73c032e7 fix compile errors 2021-02-25 22:51:35 +00:00
Steve Hanson
892f6e3fd3 fix bracket 2021-02-25 22:21:20 +00:00
Steve Hanson
cabc3d5aa1 merge 2021-02-25 22:12:05 +00:00
Steve Hanson
7698b3cd48 code and tests 2021-02-25 21:45:29 +00:00
Milo Yip
b1a4d91a53
Merge pull request #1779 from pavel-pimenov/fix-1778-part-1
fix 1778  (part 1)
2021-02-23 10:23:34 +08:00
Laurent Stacul
24ebd51287 Fix recursive operator== call in C++20 (#1846) 2021-02-22 16:52:27 +00:00