A document for parsing JSON text as DOM.
More...
|
| GenericDocument (Allocator *allocator=0, size_t stackCapacity=kDefaultStackCapacity, StackAllocator *stackAllocator=0) |
| Constructor. More...
|
|
| GenericDocument (Type type, Allocator *allocator=0, size_t stackCapacity=kDefaultStackCapacity, StackAllocator *stackAllocator=0) |
| Constructor. More...
|
|
Allocator & | GetAllocator () |
| Get the allocator of this document. More...
|
|
size_t | GetStackCapacity () const |
| Get the capacity of stack in bytes. More...
|
|
GenericDocument & | Swap (GenericDocument &rhs) RAPIDJSON_NOEXCEPT |
| Exchange the contents of this document with those of another. More...
|
|
| ~GenericDocument () |
|
|
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...
|
|
|
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...
|
|
|
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...
|
|
|
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 Encoding, typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
class GenericDocument< Encoding, Allocator, StackAllocator >
A document for parsing JSON text as DOM.
- Note
- implements Handler concept
- Template Parameters
-
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. |
- Warning
- Although GenericDocument inherits from GenericValue, the API does not provide any virtual functions, especially no virtual destructor. To avoid memory leaks, do not
delete
a GenericDocument object via a pointer to a GenericValue.
◆ AllocatorType
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Allocator type from template parameter.
◆ Ch
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Character type derived from Encoding.
◆ ValueType
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Value type of the document.
◆ GenericDocument() [1/2]
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Constructor.
Creates an empty document of specified type.
- Parameters
-
type | Mandatory type of object to create. |
allocator | Optional allocator for allocating memory. |
stackCapacity | Optional initial capacity of stack in bytes. |
stackAllocator | Optional allocator for allocating memory for stack. |
◆ GenericDocument() [2/2]
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Constructor.
Creates an empty document which type is Null.
- Parameters
-
allocator | Optional allocator for allocating memory. |
stackCapacity | Optional initial capacity of stack in bytes. |
stackAllocator | Optional allocator for allocating memory for stack. |
◆ ~GenericDocument()
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
◆ GetAllocator()
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Get the allocator of this document.
◆ GetErrorOffset()
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Get the position of last parsing error in input, 0 otherwise.
◆ GetParseError()
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
◆ GetStackCapacity()
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Get the capacity of stack in bytes.
◆ HasParseError()
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Whether a parse error has occured in the last parsing.
◆ Parse() [1/3]
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename SourceEncoding >
Parse JSON text from a read-only string (with Encoding conversion)
- Template Parameters
-
- Parameters
-
str | Read-only zero-terminated string to be parsed. |
◆ Parse() [2/3]
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
template<unsigned parseFlags>
Parse JSON text from a read-only string.
- Template Parameters
-
- Parameters
-
str | Read-only zero-terminated string to be parsed. |
◆ Parse() [3/3]
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Parse JSON text from a read-only string (with kParseDefaultFlags)
- Parameters
-
str | Read-only zero-terminated string to be parsed. |
◆ ParseInsitu() [1/2]
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
template<unsigned parseFlags>
Parse JSON text from a mutable string.
- Template Parameters
-
- Parameters
-
str | Mutable zero-terminated string to be parsed. |
- Returns
- The document itself for fluent API.
◆ ParseInsitu() [2/2]
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Parse JSON text from a mutable string (with kParseDefaultFlags)
- Parameters
-
str | Mutable zero-terminated string to be parsed. |
- Returns
- The document itself for fluent API.
◆ ParseStream() [1/3]
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename SourceEncoding , typename InputStream >
Parse JSON text from an input stream (with Encoding conversion)
- Template Parameters
-
parseFlags | Combination of ParseFlag. |
SourceEncoding | Encoding of input stream |
InputStream | Type of input stream, implementing Stream concept |
- Parameters
-
is | Input stream to be parsed. |
- Returns
- The document itself for fluent API.
◆ ParseStream() [2/3]
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream >
Parse JSON text from an input stream.
- Template Parameters
-
parseFlags | Combination of ParseFlag. |
InputStream | Type of input stream, implementing Stream concept |
- Parameters
-
is | Input stream to be parsed. |
- Returns
- The document itself for fluent API.
◆ ParseStream() [3/3]
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
template<typename InputStream >
Parse JSON text from an input stream (with kParseDefaultFlags)
- Template Parameters
-
InputStream | Type of input stream, implementing Stream concept |
- Parameters
-
is | Input stream to be parsed. |
- Returns
- The document itself for fluent API.
◆ Swap()
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
Exchange the contents of this document with those of another.
- Parameters
-
- Note
- Constant complexity.
- See also
- GenericValue::Swap
◆ GenericReader
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
template<typename , typename , typename >
◆ GenericValue
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
template<typename , typename >
◆ swap
template<typename Encoding , typename Allocator = MemoryPoolAllocator<>, typename StackAllocator = CrtAllocator>
free-standing swap function helper
Helper function to enable support for common swap implementation pattern based on std::swap:
void swap(MyClass&
a, MyClass& b) {
using std::swap;
}
- See also
- Swap()
The documentation for this class was generated from the following file: