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.
This commit is contained in:
parent
5d5d90c100
commit
413144a8b2
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user