From 106a8a60c4f88cb45e3120544f05fb2ac48e6b28 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Mon, 24 Aug 2020 21:58:03 -0400 Subject: rapidjson serialization --- rapidjson/document.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'rapidjson/document.h') 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 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 > +template 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 > 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 StackAllocator = CrtAllocator> +template class GenericDocument : public GenericValue { public: typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding. -- cgit v1.3.1