252 Commits

Author SHA1 Message Date
Philipp A. Hartmann
d75bb90a5d Avoid inheritance from std::iterator
Instead of inheriting from the deprecated std::iterator
template, define the member typedefs needed for
std::iterator_traits directly.

Closes #1131.
2017-12-12 21:16:07 +01:00
h46incon
a8e9990603 Add MemberCapacity() and MemberReserve() interface for object type. 2017-10-19 20:41:27 +08:00
Christopher Warrington
a683902b2c Assert Type enum lower bound as well 2017-09-06 15:13:20 -07:00
Christopher Warrington
6e38649ec6 Guard against min/max being macros in document.h
Sometimes, particularly when Microsoft's windows.h is included, min/max
are defined as macros, interfering with use of
std::numeric_limits::min() and the like.

To guard against this, the function name is wrapped in an extra set of
parenthesis, which inhibits function-style macro expansion.
2017-09-05 18:26:47 -07:00
bluehero
f9004b90c5 modify 2017-08-07 13:09:22 +08:00
bluehero
c831675026 modify 2017-08-07 11:58:37 +08:00
bluehero
5fb06596a9 modify 2017-08-07 11:44:27 +08:00
bluehero
7c1f208253 modify 2017-08-05 16:53:45 +08:00
Philipp A. Hartmann
70171f9790 GenericStringRef: move assert out of expression 2017-07-10 22:32:18 +02:00
Philipp A. Hartmann
47c3c1ec9f Improved handling of NULL strings
* Safely assert upon passing NULL string without length
   (requires usage of RAPIDJSON_ASSERT within an expression)
 * Allow using a NULL string together with an explicit length 0
   (GenericStringRef, GenericValue::SetString, ...), see #817
 * Add GenericValue::SetString(StringRefType, Allocator&) overload
 * Add tests for the various cases
2017-07-09 14:46:59 +02:00
Philipp A. Hartmann
68c96e987b Fixup #964 by forwarding copyConstStrings recursively
As reported by @Llerd in #962, the `copyConstStrings` parameter
has not been forwarded recursively to the constructors of
object members and array elements.
2017-05-27 10:26:35 +02:00
Philipp A. Hartmann
4ef1ff4fba GenericValue::CopyFrom: add option to force copying of strings
Copying the result of an in-situ parsing into another value/document
currently requires that the original buffer - still holding the strings
from the parsing, outlives the  destination object as well.

In order to obtain a "full" copy of a GenericValue, this commit adds
an optional flag `copyConstStrings` to `CopyFrom`, which then forces
to take a copy of all embedded strings in the source value.

This solves the problem discussed in #962.
2017-05-18 19:11:04 +02:00
Oliver Hahm
63423eb6f8 fix return values 2017-04-21 14:49:12 +02:00
Milo Yip
77f643dc51 Fix #910 incorrect casting 2017-04-07 10:23:30 +08:00
Milo Yip
e5635fb27f Fix #899 2017-03-16 10:46:48 +08:00
Andrey Glebov
41ceb8624f - replaced RAPIDJSON_NEW with C++98 compatible version 2016-12-21 14:03:53 +03:00
Andrey Glebov
9fe93bb984 - replaced RAPIDJSON_NEW macro with variadic varient 2016-12-21 10:17:25 +03:00
Milo Yip
e07d0e9438 Move GenericValue deep-clone constructor into the class declaration. 2016-10-31 18:28:53 +08:00
Milo Yip
95b346c3ca Refactor GenericValue deep-clone constructor 2016-10-31 18:24:17 +08:00
Milo Yip
3b1a037499 Merge pull request #748 from sfinktah/sfinktah-minwindef-fix
Fix for winmindef.h defining min/max macros
2016-10-17 14:29:10 +08:00
Milo Yip
2363227974 Add Value::Value(float) and static_cast for suppressing clang warning 2016-10-14 22:03:54 +08:00
Sfinktah Bungholio
51a31ce006 Fix for winmindef.h defining min/max macros 2016-09-25 20:36:33 +10:00
Janusz Chorko
862c39be37 Explicitly disable copy assignment operator 2016-08-26 21:26:50 +02:00
Janusz Chorko
3b2441b87f Removed non-compiling assignment operator. Fixed #718 2016-08-26 21:17:38 +02:00
fuzhufang
b67ff2fb11 if define RAPIDJSON_HAS_STDSTRING, FindMember use std::string, but it
also use internal::StrLen to get the string lengtht,
when it call FindMember(StringRef(name)).
Now use GenericValue construct it, then can use the std::string.size.
now it will be faster.
2016-07-14 17:50:48 +08:00
yiteng.nyt
8c43554de6 fix rapidjson::value::Get<std::string>() may returns wrong data
Change-Id: Ia7325edb437e3039e29223d0ecc4d9c83d824bc0
2016-07-11 12:38:10 +08:00
Philipp A. Hartmann
f6a07692f9 Fix warnings on GCC 6 and later (closes #666)
* document.h
  * suppress -Wterminate on GCC 6.x and later
  * simplify warning handling
* schema.h
  * drop RAPIDJSON_NOEXCEPT from GenericSchemaDocument constructor
    (calls RAPIDJSON_NEW anyway)
  * simplify warning handling
    (avoids RAPIDJSON_POP mismatch on Clang)
* encodingtest.cpp, istreamwrappertest.cpp
  * work around -Wdangling-else
* readertest.cpp
  * suppress -Wdangling-else
2016-06-23 21:42:16 +02:00
Eli Fidler
21acc56d57 range check in IsLosslessFloat to avoid undefined double->float cast
UBSAN gave in Value.IsLosslessFloat:
include/rapidjson/document.h:981:38: runtime error: value 3.40282e+38 is outside the range of representable values of type 'float'
2016-06-14 07:01:41 -07:00
Eli Fidler
c52cec7e51 fix undefined double to uint64_t cast
note that std::numeric_limits<uint64_t>::max() and
std::numeric_limits<int64_t>::max() aren't exactly representable in a
double, so we need to be strictly less to be definitely lossless

UBSAN gave during Value.IsLosslessDouble test:
include/rapidjson/document.h:955:42: runtime error: value 1.84467e+19 is outside the range of representable values of type 'unsigned long'
2016-06-14 07:01:41 -07:00
Milo Yip
12425693ba Revert formatting of enum 2016-04-06 23:33:26 +08:00
Milo Yip
be5a886f8f Fix clang compilation error 2016-04-06 00:34:45 +08:00
Milo Yip
35ccca8b74 Try to fix VC warning C4512 2016-04-05 23:56:50 +08:00
Milo Yip
8991037ecd Revert using of static const back to enum due to gcc error 2016-04-05 23:26:08 +08:00
Milo Yip
c843a2655b Try to fix all /W4 warnings in VC2015 2016-04-04 15:01:34 +08:00
Milo Yip
4fdcb10c3e Fix #587 2016-03-26 22:47:07 +08:00
Milo Yip
01b2d463f7 Fix #573 2016-03-05 10:34:00 +08:00
Milo Yip
d9cf99baf6 Normalize all line endings 2016-03-04 09:44:01 +08:00
Sergey Kosarevsky
2bbfe0d8a8 Number() -> RawNumber() to avoid name clashes with the union Number 2016-02-28 18:50:04 +01:00
Sergey Kosarevsky
4f94ec9b0b Added GenericDocument::Number() 2016-02-28 18:38:06 +01:00
Kevin Atkinson
2f1e59324f Documentation fix.
GenericObject is a helper class for accessing Value of _object_ type.
2016-02-22 00:53:58 -05:00
Milo Yip
4620fa60f5 Fix VS2010 compilation errors 2016-02-21 12:52:14 +08:00
Milo Yip
5fc59cb6fa Merge branch 'master' into issue158_parsestdstring 2016-02-20 00:35:52 +08:00
Milo Yip
b8c83c53b1 Resolve conflicts 2016-02-19 23:40:48 +08:00
Milo Yip
9f6736c2cc Add noexcept to the constructors 2016-02-19 01:07:16 +08:00
Milo Yip
46dc8e9240 Add implicit constructors of GenericValue for GenercArray|Object
Also remove SetArray|Object(…)
2016-02-19 00:49:05 +08:00
Milo Yip
d13be6c721 Change pointer to reference in GenericArray|Object 2016-02-18 19:04:22 +08:00
Milo Yip
70f9671bdf Return value type for GenericObject/Array member functions 2016-02-18 01:19:47 +08:00
Milo Yip
8c79fb65ae Fix return type of GenericObject::AddMember() 2016-02-17 09:34:19 +08:00
Milo Yip
4ababca893 Fixed typos pointed out by @pah 2016-02-17 08:48:22 +08:00
Milo Yip
48378b751e Optimize the new Parse() interfaces 2016-02-15 20:21:36 +08:00