Commit 413144a8 authored by Mateusz Loskot's avatar Mateusz Loskot

Add GenericDocument ctor overload to specify JSON type.

It unifies the interfaces with Value where kXXXType can be passed
into constructor.
It enables shortcut that helps to avoid extra SetXXX() call following
construction of a document.
parent 5d5d90c1
......@@ -1748,6 +1748,13 @@ public:
typedef GenericValue<Encoding, Allocator> ValueType; //!< Value type of the document.
typedef Allocator AllocatorType; //!< Allocator type from template parameter.
GenericDocument(Type type, Allocator* allocator = 0, size_t stackCapacity = kDefaultStackCapacity, StackAllocator* stackAllocator = 0) :
GenericValue<Encoding, Allocator>(type), allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_()
{
if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator());
}
//! Constructor
/*! \param allocator Optional allocator for allocating memory.
\param stackCapacity Optional initial capacity of stack in bytes.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment