MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / GenericDocument

Class GenericDocument

rapidjson/document.h:2066–2441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2064*/
2065template <typename Encoding, typename Allocator = CrtAllocator, typename StackAllocator = CrtAllocator>
2066class GenericDocument : public GenericValue<Encoding, Allocator> {
2067public:
2068 typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding.
2069 typedef GenericValue<Encoding, Allocator> ValueType; //!< Value type of the document.
2070 typedef Allocator AllocatorType; //!< Allocator type from template parameter.
2071
2072 //! Constructor
2073 /*! Creates an empty document of specified type.
2074 \param type Mandatory type of object to create.
2075 \param allocator Optional allocator for allocating memory.
2076 \param stackCapacity Optional initial capacity of stack in bytes.
2077 \param stackAllocator Optional allocator for allocating memory for stack.
2078 */
2079 explicit GenericDocument(Type type, Allocator* allocator = 0, size_t stackCapacity = kDefaultStackCapacity, StackAllocator* stackAllocator = 0) :
2080 GenericValue<Encoding, Allocator>(type), allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_()
2081 {
2082 if (!allocator_)
2083 ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator());
2084 }
2085
2086 //! Constructor
2087 /*! Creates an empty document which type is Null.
2088 \param allocator Optional allocator for allocating memory.
2089 \param stackCapacity Optional initial capacity of stack in bytes.
2090 \param stackAllocator Optional allocator for allocating memory for stack.
2091 */
2092 GenericDocument(Allocator* allocator = 0, size_t stackCapacity = kDefaultStackCapacity, StackAllocator* stackAllocator = 0) :
2093 allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_()
2094 {
2095 if (!allocator_)
2096 ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator());
2097 }
2098
2099#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
2100 //! Move constructor in C++11
2101 GenericDocument(GenericDocument&& rhs) RAPIDJSON_NOEXCEPT
2102 : ValueType(std::forward<ValueType>(rhs)), // explicit cast to avoid prohibited move from Document
2103 allocator_(rhs.allocator_),
2104 ownAllocator_(rhs.ownAllocator_),
2105 stack_(std::move(rhs.stack_)),
2106 parseResult_(rhs.parseResult_)
2107 {
2108 rhs.allocator_ = 0;
2109 rhs.ownAllocator_ = 0;
2110 rhs.parseResult_ = ParseResult();
2111 }
2112#endif
2113
2114 ~GenericDocument() {
2115 Destroy();
2116 }
2117
2118#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
2119 //! Move assignment in C++11
2120 GenericDocument& operator=(GenericDocument&& rhs) RAPIDJSON_NOEXCEPT
2121 {
2122 // The cast to ValueType is necessary here, because otherwise it would
2123 // attempt to call GenericValue's templated assignment operator.

Callers

nothing calls this directly

Calls 6

operator=Function · 0.85
ParseResultClass · 0.85
gFunction · 0.85
HasAllocatorMethod · 0.80
c_strMethod · 0.80
GetSizeMethod · 0.45

Tested by

no test coverage detected