diff options
| author | Josh Ferrell <josh@vector35.com> | 2020-08-24 21:58:03 -0400 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2020-10-28 18:53:24 -0400 |
| commit | 106a8a60c4f88cb45e3120544f05fb2ac48e6b28 (patch) | |
| tree | e5a71b6d91bbdfa3f64cdd2cbbd75abd5fe5d24e /rapidjson/document.h | |
| parent | be44532917b2458bb81ba838bce0a0d045957909 (diff) | |
rapidjson serialization
Diffstat (limited to 'rapidjson/document.h')
| -rw-r--r-- | rapidjson/document.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/rapidjson/document.h b/rapidjson/document.h index e3e20dfb..f873c272 100644 --- a/rapidjson/document.h +++ b/rapidjson/document.h @@ -536,7 +536,7 @@ template <bool, typename> class GenericObject; \tparam Encoding Encoding of the value. (Even non-string values need to have the same encoding in a document) \tparam Allocator Allocator type for allocating memory of object, array and string. */ -template <typename Encoding, typename Allocator = MemoryPoolAllocator<> > +template <typename Encoding, typename Allocator = CrtAllocator > class GenericValue { public: //! Name-value pair in an object. @@ -1206,6 +1206,11 @@ public: return *this; } + GenericValue& AddMember(GenericValue& name, BinaryNinjaCore::string& value, Allocator& allocator) { + GenericValue v(value.data(), allocator); + return AddMember(name, v, allocator); + } + //! Add a constant string value as member (name-value pair) to the object. /*! \param name A string value as name of member. \param value constant string reference as value of member. @@ -1546,6 +1551,11 @@ public: return *this; } + GenericValue& PushBack(BinaryNinjaCore::string value, Allocator& allocator) { + GenericValue v(value.c_str(), allocator); + return PushBack(v, allocator); + } + #if RAPIDJSON_HAS_CXX11_RVALUE_REFS GenericValue& PushBack(GenericValue&& value, Allocator& allocator) { return PushBack(value, allocator); @@ -2020,7 +2030,7 @@ typedef GenericValue<UTF8<> > Value; \tparam StackAllocator Allocator for allocating memory for stack during parsing. \warning Although GenericDocument inherits from GenericValue, the API does \b not provide any virtual functions, especially no virtual destructor. To avoid memory leaks, do not \c delete a GenericDocument object via a pointer to a GenericValue. */ -template <typename Encoding, typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator> +template <typename Encoding, typename Allocator = CrtAllocator, typename StackAllocator = CrtAllocator> class GenericDocument : public GenericValue<Encoding, Allocator> { public: typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding. |
