419 Commits

Author SHA1 Message Date
Philipp A. Hartmann
06c3ddbac5 GenericValue::AddMember<T>: add missing overload (closes #254)
As discovered by @felipegb94, there are missing overloads to the
`GenericValue::AddMember<T>` template function, taking an explicit
`GenericValue&` as a name and accepting arbitrary primitive values.

This patch adds the missing overloads. The `StringRefType` overload
is needed to disambiguate the addition of a string literal as
value.

Some tests are added to `TEST(Value, Object)` in `valuetest.cpp`.
2015-03-10 19:11:27 +01:00
Milo Yip
3804a06032 Merge pull request #241 from yachoor/compilation_fixes
Compilation fixes
2015-02-23 21:30:39 +08:00
Philipp A. Hartmann
a7319330cb error.h: drop trailing comma in enum
In C++'98/03, trailing commas in enumerations are not allowed, but have
been introduced in C++11. This patch drops the trailing commas in order
to avoid compiler warnings (e.g. GCC with -pedantic).

See #9 and http://code.google.com/p/rapidjson/issues/detail?id=49 for
previous instances of this issue.
2015-02-20 08:15:20 +01:00
Janusz Chorko
78befee2bd Fix compilation error when cstring does not import std::memcmp into global namespace. 2015-02-14 17:20:08 +01:00
Janusz Chorko
edfde4bfa2 Fix ambiguous overload when uint32_t is not unsigned int but unsigned long. 2015-02-14 17:20:07 +01:00
Philipp A. Hartmann
38dace775c warning fixes (closes #235, closes #236) 2015-02-07 14:49:25 +01:00
Drew Noakes
e54136d74c Add std::string overload to PrettyWriter when RAPIDJSON_HAS_STDSTRING defined. 2015-02-02 10:05:31 +00:00
Drew Noakes
1a76879c12 Include <string> if RAPIDJSON_HAS_STDSTRING set. 2015-02-02 09:34:48 +00:00
Drew Noakes
3cfd675163 Add std::string overload to Writer when RAPIDJSON_HAS_STDSTRING defined. 2015-02-02 09:21:28 +00:00
Drew Noakes
41f3c60b22 Use aligned SSE register load intrinsic.
The code goes to the trouble of ensuring that data is aligned at a
16-byte boundary, then goes ahead and uses the unaligned form of the
load intrinsic _mm_loadu_si128.

Either the code shouldn't bother aligning the data to the start of the
whitespace, or it should use the aligned form of the intrinsic.
2015-01-24 23:43:30 +00:00
Milo Yip
24563b28fb Correct Value(kStringType) and more assertions 2015-01-13 23:49:53 +08:00
Philipp A. Hartmann
0ee38bc918 Reader::Parse{Array,Object}: simplify switch
Closes #223.
2015-01-11 18:46:58 +01:00
Erik Martin
4b4f726dd8 Fix an issue with Windows x64. Including the rapidjson reader.h requires <intrin.h> to be included or _umul128 will be undefined. 2015-01-07 13:50:23 -05:00
Philipp A. Hartmann
8794bbd8bb fix include ordering 2014-12-08 15:59:54 +01:00
Philipp A. Hartmann
760883c2e8 stringbuffer.h: add missing include for std::move (fixes #208) 2014-12-08 15:41:58 +01:00
Milo Yip
320eff1c21 Fix #207 VC2013 imaxdiv_t redefinition 2014-12-08 21:53:29 +08:00
Milo Yip
e62d53751b Merge remote-tracking branch 'origin/master' into issue120floatprecision 2014-11-30 19:16:28 +08:00
Milo Yip
a6117dae16 Fix StringBuffer compilation error in VS2013
Add move constructor and prohibit copy constructor and assignment
operator.
2014-11-30 19:11:40 +08:00
Milo Yip
92554b52a2 Merge remote-tracking branch 'origin/master' into issue120floatprecision 2014-11-30 18:53:32 +08:00
Milo Yip
23b7a5ecae Add RAPIDJSON_PARSE_DEFAULT_FLAGS for customizing kParseDefaultFlags
https://github.com/miloyip/rapidjson/issues/120#issuecomment-54428797
2014-11-30 18:52:48 +08:00
Philipp A. Hartmann
2aab79207e GenericValue: improve copying performance
The GenericValue "copy" constructor (with Allocator) uses a temporary
GenericDocument object to perform the deep copying with the provided
allocator.  This leads to the temporary allocation of the `Stack`
memory, even in case of shallow values (numbers, etc.).

This patch improves the performance of this operation by only resorting
the the SAX Handler implementation in case of Array or Object values.
2014-11-26 23:11:00 +01:00
Anton Indrawan
5a96c1f93e Compile all examples with the Dinkum C++ of QNX 6.6
QCC -Wall -Wextra -Vgcc_ntoarmv7le -I../include <example>
2014-11-23 21:03:57 +01:00
Milo Yip
0a17e1a634 Fix namespace compilation errors 2014-11-23 18:59:35 +08:00
Milo Yip
b855c3f73a Minor optimization of strtod 2014-11-23 16:45:07 +08:00
Milo Yip
3679c280dd Merge remote-tracking branch 'origin/master' into issue120floatprecision_customstrtod 2014-11-23 08:48:03 +08:00
Philipp A. Hartmann
3220438aa5 GenericDocument: explicitly prohibit copying
See #201.
2014-11-21 13:05:54 +01:00
Philipp A. Hartmann
c88cc331d5 DiyFp: avoid shadowing (closes #195) 2014-11-17 13:31:24 +01:00
Philipp A. Hartmann
6b69662ce8 Writer: declare constructors as explicit
Avoids implicit conversion from an `OutputStream` (or an allocator pointer)
to a `Writer` instance.
2014-11-17 13:27:54 +01:00
Philipp A. Hartmann
c35bbe54d9 Writer: fix documentation of stackAllocator param (closes #196) 2014-11-17 13:26:49 +01:00
Milo Yip
57b91300fb Merge remote-tracking branch 'origin/master' into issue120floatprecision_customstrtod
Conflicts:
	include/rapidjson/internal/dtoa.h
	test/unittest/readertest.cpp
2014-11-14 22:23:16 +08:00
Milo Yip
22ca9312df Fix gcc/clang compilation errors and turn off exhaustive number test 2014-11-14 18:36:25 +08:00
Milo Yip
40852f4d6d Fixes StrtodDiyFp bugs 2014-11-14 18:23:51 +08:00
Philipp A. Hartmann
549dcb755d *.h: move to namespace macros 2014-11-06 20:52:49 +01:00
Philipp A. Hartmann
5d9125f51c add RAPIDJSON_NAMESPACE + _BEGIN, _END 2014-11-06 20:52:49 +01:00
miloyip
b4e2d58c74 Temp commit 2014-10-31 10:25:04 +08:00
Philipp A. Hartmann
e8f5d9f8ef MemoryPoolAllocator, Stack: lazily allocate Allocators
In order to make the constructors more efficient, especially
in the context of C++11 move semantics, the (dynamic) allocations
in MemoryPoolAllocator and Stack should be performed lazily.

Move the allocations to the first use of the allocator in both
classes.
2014-10-30 18:40:58 +01:00
Philipp A. Hartmann
d0c283254b Stack<>: add _ suffix to member ownAllocator_
For consistency, all member variables should follow the same pattern.
2014-10-30 18:21:27 +01:00
Philipp A. Hartmann
c557b230a6 Add customization macros for global new/delete
As mentioned in #181, some environments may require adaptations to
the internal calls to the global `new`/`delete` operators, like
adding explicit `NULL` checks to `delete.

This patch adds two new macros
 * RAPIDJSON_NEW(x)
 * RAPIDJSON_DELETE(x)
to allow user-defined expressions in these cases.

This fixes #181 in an alternative manner.
2014-10-30 11:20:46 +01:00
Sean Leather
716907b9fb Clarify documentation on RemoveMember, EraseMember ordering 2014-10-27 15:04:26 +02:00
Milo Yip
8fc0e57926 Merge pull request #177 from spl/use-deprecated
Use 'deprecated' instead of 'depreciated'
2014-10-27 14:53:29 +08:00
Sean Leather
32525a5d5e Use 'deprecated' instead of 'depreciated' 2014-10-26 14:51:35 +02:00
ecorm
b0328d2d3b GenericDocument move-assignment now uses std::foward to move-assign the base class. 2014-10-24 15:25:27 -03:00
ecorm
20a9cd2810 Merge branch 'master' into issue123movesupport 2014-10-24 14:09:30 -03:00
ecorm
fd12dcb3db Added MemoryPoolAllocator to GenericDocument moveunit tests. Added comment in GenericDocument move assignment operator explaining why the static_cast is needed to move the base class. 2014-10-24 14:05:32 -03:00
Philipp A. Hartmann
6bd5ecb08c GenericValue: improve documentation for operator[] 2014-10-24 14:45:48 +02:00
Philipp A. Hartmann
e8445e0bbc GenericValue: improve operator[] disambiguation
In the original disambiguation fix for `GenericValue::operator[]` (#170),
the documentation has been missing, which led to quite badly rendered
Doxygen pages.

During a cleanup, I've realized that a much simpler disambiguation is
possible:

````cpp
  GenericValue& operator[](SizeType idx); // array
  template <typename T>
  GenericValue& operator[](T* name);      // object
````

This approach works, as non-template functions are preferred over
template functions.

In order to improve the error messages, the pointer type is restricted
to `(const) Ch`.

Update `tutorial.md` to drop the ambiguity warning.
2014-10-24 13:55:26 +02:00
ecorm
cb33f910c3 Merge branch 'master' into issue123movesupport 2014-10-24 03:11:34 -03:00
ecorm
02f3b00ee6 Implemented C++11 move semantics for GenericDocument 2014-10-24 02:51:17 -03:00
Zhihao Yuan
7303d92990 Disambiguate GenericValue's [0] and ["string"] 2014-10-23 21:50:39 -04:00
Zhihao Yuan
0d90bcc709 No implicit conversion from Type to GenericValue 2014-10-23 21:50:39 -04:00