A document for parsing JSON text as DOM. More...
#include <document.h>
Classes | |
struct | ClearStackOnExit |
Public Types | |
typedef Encoding::Ch | Ch |
Character type derived from Encoding. More... | |
typedef GenericValue< Encoding, Allocator > | ValueType |
Value type of the document. More... | |
typedef Allocator | AllocatorType |
Allocator type from template parameter. More... | |
![]() | |
enum | { kBoolFlag = 0x100, kNumberFlag = 0x200, kIntFlag = 0x400, kUintFlag = 0x800, kInt64Flag = 0x1000, kUint64Flag = 0x2000, kDoubleFlag = 0x4000, kStringFlag = 0x100000, kCopyFlag = 0x200000, kInlineStrFlag = 0x400000, kNullFlag = kNullType, kTrueFlag = kTrueType | kBoolFlag, kFalseFlag = kFalseType | kBoolFlag, kNumberIntFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag, kNumberUintFlag = kNumberType | kNumberFlag | kUintFlag | kUint64Flag | kInt64Flag, kNumberInt64Flag = kNumberType | kNumberFlag | kInt64Flag, kNumberUint64Flag = kNumberType | kNumberFlag | kUint64Flag, kNumberDoubleFlag = kNumberType | kNumberFlag | kDoubleFlag, kNumberAnyFlag = kNumberType | kNumberFlag | kIntFlag | kInt64Flag | kUintFlag | kUint64Flag | kDoubleFlag, kConstStringFlag = kStringType | kStringFlag, kCopyStringFlag = kStringType | kStringFlag | kCopyFlag, kShortStringFlag = kStringType | kStringFlag | kCopyFlag | kInlineStrFlag, kObjectFlag = kObjectType, kArrayFlag = kArrayType, kTypeMask = 0xFF } |
typedef GenericMember< Encoding, Allocator > | Member |
Name-value pair in an object. More... | |
typedef Encoding | EncodingType |
Encoding type from template parameter. More... | |
typedef Allocator | AllocatorType |
Allocator type from template parameter. More... | |
typedef Encoding::Ch | Ch |
Character type derived from Encoding. More... | |
typedef GenericStringRef< Ch > | StringRefType |
Reference to a constant string. More... | |
typedef GenericMemberIterator< false, Encoding, Allocator >::Iterator | MemberIterator |
Member iterator for iterating in object. More... | |
typedef GenericMemberIterator< true, Encoding, Allocator >::Iterator | ConstMemberIterator |
Constant member iterator for iterating in object. More... | |
typedef GenericValue * | ValueIterator |
Value iterator for iterating in array. More... | |
typedef const GenericValue * | ConstValueIterator |
Constant value iterator for iterating in array. More... | |
Public Member Functions | |
GenericDocument (Allocator *allocator=0, size_t stackCapacity=kDefaultStackCapacity, StackAllocator *stackAllocator=0) | |
Constructor. More... | |
~GenericDocument () | |
Allocator & | GetAllocator () |
Get the allocator of this document. More... | |
size_t | GetStackCapacity () const |
Get the capacity of stack in bytes. More... | |
Parse from stream | |
template<unsigned parseFlags, typename SourceEncoding , typename InputStream > | |
GenericDocument & | ParseStream (InputStream &is) |
Parse JSON text from an input stream (with Encoding conversion) More... | |
template<unsigned parseFlags, typename InputStream > | |
GenericDocument & | ParseStream (InputStream &is) |
Parse JSON text from an input stream. More... | |
template<typename InputStream > | |
GenericDocument & | ParseStream (InputStream &is) |
Parse JSON text from an input stream (with kParseDefaultFlags) More... | |
Parse in-place from mutable string | |
template<unsigned parseFlags, typename SourceEncoding > | |
GenericDocument & | ParseInsitu (Ch *str) |
Parse JSON text from a mutable string (with Encoding conversion) More... | |
template<unsigned parseFlags> | |
GenericDocument & | ParseInsitu (Ch *str) |
Parse JSON text from a mutable string. More... | |
GenericDocument & | ParseInsitu (Ch *str) |
Parse JSON text from a mutable string (with kParseDefaultFlags) More... | |
Parse from read-only string | |
template<unsigned parseFlags, typename SourceEncoding > | |
GenericDocument & | Parse (const Ch *str) |
Parse JSON text from a read-only string (with Encoding conversion) More... | |
template<unsigned parseFlags> | |
GenericDocument & | Parse (const Ch *str) |
Parse JSON text from a read-only string. More... | |
GenericDocument & | Parse (const Ch *str) |
Parse JSON text from a read-only string (with kParseDefaultFlags) More... | |
Handling parse errors | |
bool | HasParseError () const |
Whether a parse error has occured in the last parsing. More... | |
ParseErrorCode | GetParseError () const |
Get the ParseErrorCode of last parsing. More... | |
size_t | GetErrorOffset () const |
Get the position of last parsing error in input, 0 otherwise. More... | |
![]() | |
template<typename T > | |
RAPIDJSON_DISABLEIF_RETURN ((internal::IsPointer< T >),(GenericValue &)) operator | |
Assignment with primitive types. More... | |
void | SetArrayRaw (GenericValue *values, SizeType count, Allocator &allocator) |
void | SetObjectRaw (Member *members, SizeType count, Allocator &allocator) |
Initialize this value as object with initial data, without calling destructor. More... | |
void | SetStringRaw (StringRefType s) RAPIDJSON_NOEXCEPT |
Initialize this value as constant string, without calling destructor. More... | |
void | SetStringRaw (StringRefType s, Allocator &allocator) |
Initialize this value as copy string with initial data, without calling destructor. More... | |
void | RawAssign (GenericValue &rhs) RAPIDJSON_NOEXCEPT |
Assignment without calling destructor. More... | |
template<typename SourceAllocator > | |
bool | StringEqual (const GenericValue< Encoding, SourceAllocator > &rhs) const |
GenericValue & | operator= (GenericValue &rhs) RAPIDJSON_NOEXCEPT |
Assignment with move semantics. More... | |
GenericValue & | operator= (StringRefType str) RAPIDJSON_NOEXCEPT |
Assignment of constant string reference (no copy) More... | |
GenericValue () RAPIDJSON_NOEXCEPT | |
Default constructor creates a null value. More... | |
GenericValue (Type type) RAPIDJSON_NOEXCEPT | |
Constructor with JSON value type. More... | |
template<typename SourceAllocator > | |
GenericValue (const GenericValue< Encoding, SourceAllocator > &rhs, Allocator &allocator) | |
Explicit copy constructor (with allocator) More... | |
template<typename T > | |
GenericValue (T b, RAPIDJSON_ENABLEIF((internal::IsSame< T, bool >))) RAPIDJSON_NOEXCEPT | |
Constructor for boolean value. More... | |
GenericValue (int i) RAPIDJSON_NOEXCEPT | |
Constructor for int value. More... | |
GenericValue (unsigned u) RAPIDJSON_NOEXCEPT | |
Constructor for unsigned value. More... | |
GenericValue (int64_t i64) RAPIDJSON_NOEXCEPT | |
Constructor for int64_t value. More... | |
GenericValue (uint64_t u64) RAPIDJSON_NOEXCEPT | |
Constructor for uint64_t value. More... | |
GenericValue (double d) RAPIDJSON_NOEXCEPT | |
Constructor for double value. More... | |
GenericValue (const Ch *s, SizeType length) RAPIDJSON_NOEXCEPT | |
Constructor for constant string (i.e. do not make a copy of string) More... | |
GenericValue (StringRefType s) RAPIDJSON_NOEXCEPT | |
Constructor for constant string (i.e. do not make a copy of string) More... | |
GenericValue (const Ch *s, SizeType length, Allocator &allocator) | |
Constructor for copy-string (i.e. do make a copy of string) More... | |
GenericValue (const Ch *s, Allocator &allocator) | |
Constructor for copy-string (i.e. do make a copy of string) More... | |
~GenericValue () | |
Destructor. More... | |
Private Member Functions | |
bool | Null () |
bool | Bool (bool b) |
bool | Int (int i) |
bool | Uint (unsigned i) |
bool | Int64 (int64_t i) |
bool | Uint64 (uint64_t i) |
bool | Double (double d) |
bool | String (const Ch *str, SizeType length, bool copy) |
bool | StartObject () |
bool | Key (const Ch *str, SizeType length, bool copy) |
bool | EndObject (SizeType memberCount) |
bool | StartArray () |
bool | EndArray (SizeType elementCount) |
GenericDocument & | operator= (const GenericDocument &) |
Prohibit assignment. More... | |
void | ClearStack () |
void | Destroy () |
Private Attributes | |
Allocator * | allocator_ |
Allocator * | ownAllocator_ |
internal::Stack< StackAllocator > | stack_ |
ParseResult | parseResult_ |
Static Private Attributes | |
static const size_t | kDefaultStackCapacity = 1024 |
Friends | |
template<typename , typename , typename > | |
class | GenericReader |
template<typename , typename > | |
class | GenericValue |
Additional Inherited Members | |
![]() | |
Data | data_ |
unsigned | flags_ |
![]() | |
static const SizeType | kDefaultArrayCapacity = 16 |
static const SizeType | kDefaultObjectCapacity = 16 |
A document for parsing JSON text as DOM.
Encoding | Encoding for both parsing and string storage. |
Allocator | Allocator for allocating memory for the DOM |
StackAllocator | Allocator for allocating memory for stack during parsing. |
delete
a GenericDocument object via a pointer to a GenericValue. Definition at line 1622 of file document.h.
typedef Allocator rapidjson::GenericDocument< Encoding, Allocator, StackAllocator >::AllocatorType |
Allocator type from template parameter.
Definition at line 1626 of file document.h.
typedef Encoding::Ch rapidjson::GenericDocument< Encoding, Allocator, StackAllocator >::Ch |
Character type derived from Encoding.
Definition at line 1624 of file document.h.
typedef GenericValue<Encoding, Allocator> rapidjson::GenericDocument< Encoding, Allocator, StackAllocator >::ValueType |
Value type of the document.
Definition at line 1625 of file document.h.
|
inline |
Constructor.
allocator | Optional allocator for allocating memory. |
stackCapacity | Optional initial capacity of stack in bytes. |
stackAllocator | Optional allocator for allocating memory for stack. |
Definition at line 1633 of file document.h.
|
inline |
Definition at line 1655 of file document.h.
|
inlineprivate |
Definition at line 1831 of file document.h.
|
inlineprivate |
Definition at line 1868 of file document.h.
|
inlineprivate |
Definition at line 1877 of file document.h.
|
inlineprivate |
Definition at line 1836 of file document.h.
|
inlineprivate |
Definition at line 1858 of file document.h.
|
inlineprivate |
Definition at line 1850 of file document.h.
|
inline |
|
inline |
Get the position of last parsing error in input, 0 otherwise.
Definition at line 1804 of file document.h.
|
inline |
|
inline |
Get the capacity of stack in bytes.
Definition at line 1812 of file document.h.
|
inline |
Whether a parse error has occured in the last parsing.
Definition at line 1798 of file document.h.
|
inlineprivate |
Definition at line 1832 of file document.h.
|
inlineprivate |
Definition at line 1834 of file document.h.
|
inlineprivate |
Definition at line 1848 of file document.h.
|
inlineprivate |
Definition at line 1830 of file document.h.
|
private |
Prohibit assignment.
|
inline |
Parse JSON text from a read-only string (with Encoding conversion)
parseFlags | Combination of ParseFlag (must not contain kParseInsituFlag). |
SourceEncoding | Transcoding from input Encoding |
str | Read-only zero-terminated string to be parsed. |
Definition at line 1771 of file document.h.
|
inline |
Parse JSON text from a read-only string.
parseFlags | Combination of ParseFlag (must not contain kParseInsituFlag). |
str | Read-only zero-terminated string to be parsed. |
Definition at line 1782 of file document.h.
|
inline |
Parse JSON text from a read-only string (with kParseDefaultFlags)
str | Read-only zero-terminated string to be parsed. |
Definition at line 1789 of file document.h.
|
inline |
Parse JSON text from a mutable string (with Encoding conversion)
parseFlags | Combination of ParseFlag. |
SourceEncoding | Transcoding from input Encoding |
str | Mutable zero-terminated string to be parsed. |
Definition at line 1738 of file document.h.
|
inline |
Parse JSON text from a mutable string.
parseFlags | Combination of ParseFlag. |
str | Mutable zero-terminated string to be parsed. |
Definition at line 1749 of file document.h.
|
inline |
Parse JSON text from a mutable string (with kParseDefaultFlags)
str | Mutable zero-terminated string to be parsed. |
Definition at line 1757 of file document.h.
|
inline |
Parse JSON text from an input stream (with Encoding conversion)
parseFlags | Combination of ParseFlag. |
SourceEncoding | Encoding of input stream |
InputStream | Type of input stream, implementing Stream concept |
is | Input stream to be parsed. |
Definition at line 1694 of file document.h.
|
inline |
Parse JSON text from an input stream.
parseFlags | Combination of ParseFlag. |
InputStream | Type of input stream, implementing Stream concept |
is | Input stream to be parsed. |
Definition at line 1713 of file document.h.
|
inline |
Parse JSON text from an input stream (with kParseDefaultFlags)
InputStream | Type of input stream, implementing Stream concept |
is | Input stream to be parsed. |
Definition at line 1723 of file document.h.
|
inlineprivate |
Definition at line 1856 of file document.h.
|
inlineprivate |
Definition at line 1846 of file document.h.
|
inlineprivate |
Definition at line 1838 of file document.h.
|
inlineprivate |
Definition at line 1833 of file document.h.
|
inlineprivate |
Definition at line 1835 of file document.h.
|
friend |
Definition at line 1826 of file document.h.
|
friend |
Definition at line 1827 of file document.h.
|
private |
Definition at line 1882 of file document.h.
|
staticprivate |
Definition at line 1881 of file document.h.
|
private |
Definition at line 1883 of file document.h.
|
private |
Definition at line 1885 of file document.h.
|
private |
Definition at line 1884 of file document.h.