Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
|
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... | |
Public Types inherited from GenericValue< Encoding, MemoryPoolAllocator<> > | |
typedef GenericMember< Encoding, MemoryPoolAllocator<> > | Member |
Name-value pair in an object. More... | |
typedef Encoding | EncodingType |
Encoding type from template parameter. More... | |
typedef MemoryPoolAllocator<> | 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, MemoryPoolAllocator<> >::Iterator | MemberIterator |
Member iterator for iterating in object. More... | |
typedef GenericMemberIterator< true, Encoding, MemoryPoolAllocator<> >::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... | |
typedef GenericValue< Encoding, MemoryPoolAllocator<> > | ValueType |
Value type of itself. More... | |
typedef GenericArray< false, ValueType > | Array |
typedef GenericArray< true, ValueType > | ConstArray |
typedef GenericObject< false, ValueType > | Object |
typedef GenericObject< true, ValueType > | ConstObject |
enum | |
Public Member Functions | |
GenericDocument (Type type, Allocator *allocator=0, size_t stackCapacity=kDefaultStackCapacity, StackAllocator *stackAllocator=0) | |
Constructor. More... | |
GenericDocument (Allocator *allocator=0, size_t stackCapacity=kDefaultStackCapacity, StackAllocator *stackAllocator=0) | |
Constructor. More... | |
~GenericDocument () | |
GenericDocument & | Swap (GenericDocument &rhs) RAPIDJSON_NOEXCEPT |
Exchange the contents of this document with those of another. More... | |
template<typename Generator > | |
GenericDocument & | Populate (Generator &g) |
Populate this document by a generator which produces SAX events. More... | |
Allocator & | GetAllocator () |
Get the allocator of this document. More... | |
size_t | GetStackCapacity () const |
Get the capacity of stack in bytes. More... | |
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 | RawNumber (const Ch *str, SizeType length, bool copy) |
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) |
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> | |
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 typename SourceEncoding::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... | |
template<unsigned parseFlags, typename SourceEncoding > | |
GenericDocument & | Parse (const typename SourceEncoding::Ch *str, size_t length) |
template<unsigned parseFlags> | |
GenericDocument & | Parse (const Ch *str, size_t length) |
GenericDocument & | Parse (const Ch *str, size_t length) |
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... | |
operator ParseResult () const | |
Implicit conversion to get the last parse result. More... | |
Public Member Functions inherited from GenericValue< Encoding, MemoryPoolAllocator<> > | |
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... | |
RAPIDJSON_DISABLEIF_RETURN ((internal::IsPointer< T >),(GenericValue &)) operator | |
Assignment with primitive types. More... | |
RAPIDJSON_FORCEINLINE const Ch * | GetStringPointer () const |
RAPIDJSON_FORCEINLINE const Ch * | SetStringPointer (const Ch *str) |
RAPIDJSON_FORCEINLINE GenericValue * | GetElementsPointer () const |
RAPIDJSON_FORCEINLINE GenericValue * | SetElementsPointer (GenericValue *elements) |
RAPIDJSON_FORCEINLINE Member * | GetMembersPointer () const |
RAPIDJSON_FORCEINLINE Member * | SetMembersPointer (Member *members) |
void | SetArrayRaw (GenericValue *values, SizeType count, MemoryPoolAllocator<> &allocator) |
void | SetObjectRaw (Member *members, SizeType count, MemoryPoolAllocator<> &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, MemoryPoolAllocator<> &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... | |
bool | StringEqual (const GenericValue< Encoding, SourceAllocator > &rhs) const |
GenericValue () RAPIDJSON_NOEXCEPT | |
Default constructor creates a null value. More... | |
GenericValue (Type type) RAPIDJSON_NOEXCEPT | |
Constructor with JSON value type. More... | |
GenericValue (const GenericValue< Encoding, SourceAllocator > &rhs, MemoryPoolAllocator<> &allocator, bool copyConstStrings=false) | |
Explicit copy constructor (with allocator) More... | |
GenericValue (T b, RAPIDJSON_ENABLEIF((internal::IsSame< bool, T >))) 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 (float f) RAPIDJSON_NOEXCEPT | |
Constructor for float 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, MemoryPoolAllocator<> &allocator) | |
Constructor for copy-string (i.e. do make a copy of string) More... | |
GenericValue (const Ch *s, MemoryPoolAllocator<> &allocator) | |
Constructor for copy-string (i.e. do make a copy of string) More... | |
GenericValue (Array a) RAPIDJSON_NOEXCEPT | |
Constructor for Array. More... | |
GenericValue (Object o) RAPIDJSON_NOEXCEPT | |
Constructor for Object. More... | |
~GenericValue () | |
Destructor. More... | |
Private Member Functions | |
GenericDocument (const GenericDocument &) | |
Prohibit copying. More... | |
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 > | |
class | GenericValue |
void | swap (GenericDocument &a, GenericDocument &b) RAPIDJSON_NOEXCEPT |
free-standing swap function helper More... | |
Additional Inherited Members | |
Public Attributes inherited from GenericValue< Encoding, MemoryPoolAllocator<> > | |
Data | data_ |
Static Public Attributes inherited from GenericValue< Encoding, MemoryPoolAllocator<> > | |
static const SizeType | kDefaultArrayCapacity |
static const SizeType | kDefaultObjectCapacity |
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 2087 of file document.h.
typedef Allocator GenericDocument< Encoding, Allocator, StackAllocator >::AllocatorType |
Allocator type from template parameter.
Definition at line 2091 of file document.h.
typedef Encoding::Ch GenericDocument< Encoding, Allocator, StackAllocator >::Ch |
Character type derived from Encoding.
Definition at line 2089 of file document.h.
typedef GenericValue<Encoding, Allocator> GenericDocument< Encoding, Allocator, StackAllocator >::ValueType |
Value type of the document.
Definition at line 2090 of file document.h.
|
inlineexplicit |
Constructor.
Creates an empty document of specified type.
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. |
Definition at line 2100 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::allocator_, GenericDocument< Encoding, Allocator, StackAllocator >::ownAllocator_, and RAPIDJSON_NEW.
|
inline |
Constructor.
Creates an empty document which type is Null.
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 2113 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::allocator_, GenericDocument< Encoding, Allocator, StackAllocator >::ownAllocator_, and RAPIDJSON_NEW.
|
inline |
Definition at line 2135 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::Destroy().
|
private |
Prohibit copying.
|
inline |
Definition at line 2401 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inlineprivate |
Definition at line 2448 of file document.h.
References internal::Stack< Allocator >::Clear(), internal::Stack< Allocator >::GetSize(), internal::Stack< Allocator >::ShrinkToFit(), and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
Referenced by GenericDocument< Encoding, Allocator, StackAllocator >::ClearStackOnExit::~ClearStackOnExit().
|
inlineprivate |
Definition at line 2457 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::ownAllocator_, and RAPIDJSON_DELETE.
Referenced by GenericDocument< Encoding, Allocator, StackAllocator >::~GenericDocument().
|
inline |
Definition at line 2406 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Definition at line 2436 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::GetAllocator(), and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Definition at line 2428 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::GetAllocator(), and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Get the allocator of this document.
Definition at line 2375 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::allocator_, and RAPIDJSON_ASSERT.
Referenced by GenericDocument< Encoding, Allocator, StackAllocator >::EndArray(), GenericDocument< Encoding, Allocator, StackAllocator >::EndObject(), GenericDocument< Encoding, Allocator, StackAllocator >::RawNumber(), and GenericDocument< Encoding, Allocator, StackAllocator >::String().
|
inline |
Get the position of last parsing error in input, 0 otherwise.
Definition at line 2357 of file document.h.
References ParseResult::Offset(), and GenericDocument< Encoding, Allocator, StackAllocator >::parseResult_.
|
inline |
Get the ParseErrorCode of last parsing.
Definition at line 2354 of file document.h.
References ParseResult::Code(), and GenericDocument< Encoding, Allocator, StackAllocator >::parseResult_.
|
inline |
Get the capacity of stack in bytes.
Definition at line 2381 of file document.h.
References internal::Stack< Allocator >::GetCapacity(), and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Whether a parse error has occured in the last parsing.
Definition at line 2351 of file document.h.
References ParseResult::IsError(), and GenericDocument< Encoding, Allocator, StackAllocator >::parseResult_.
|
inline |
Definition at line 2402 of file document.h.
References process_bag::i, and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Definition at line 2404 of file document.h.
References process_bag::i, and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Definition at line 2426 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::String().
|
inline |
Definition at line 2400 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Implicit conversion to get the last parse result.
Definition at line 2371 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::parseResult_.
|
private |
Prohibit assignment.
|
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 2299 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 2306 of file document.h.
|
inline |
Definition at line 2320 of file document.h.
|
inline |
Definition at line 2324 of file document.h.
|
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 2288 of file document.h.
References kParseInsituFlag, and RAPIDJSON_ASSERT.
|
inline |
Definition at line 2311 of file document.h.
References kParseInsituFlag, and RAPIDJSON_ASSERT.
|
inline |
Parse JSON text from a mutable string.
parseFlags | Combination of ParseFlag. |
str | Mutable zero-terminated string to be parsed. |
Definition at line 2265 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 2274 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 2222 of file document.h.
References internal::Stack< Allocator >::GetAllocator(), internal::Stack< Allocator >::GetSize(), internal::Stack< Allocator >::HasAllocator(), GenericValue< Encoding, Allocator >::operator=(), GenericDocument< Encoding, Allocator, StackAllocator >::parseResult_, RAPIDJSON_ASSERT, and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
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 2241 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 2251 of file document.h.
|
inline |
Populate this document by a generator which produces SAX events.
Generator | A functor with bool f(Handler) prototype. |
g | Generator functor which sends SAX events to the parameter. |
Definition at line 2202 of file document.h.
References internal::Stack< Allocator >::GetSize(), GenericValue< Encoding, Allocator >::operator=(), RAPIDJSON_ASSERT, and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Definition at line 2408 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::GetAllocator(), and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Definition at line 2434 of file document.h.
References kArrayType, and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Definition at line 2424 of file document.h.
References kObjectType, and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Definition at line 2416 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::GetAllocator(), and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
Referenced by GenericDocument< Encoding, Allocator, StackAllocator >::Key().
|
inline |
Exchange the contents of this document with those of another.
rhs | Another document. |
Definition at line 2169 of file document.h.
References GenericDocument< Encoding, Allocator, StackAllocator >::allocator_, GenericDocument< Encoding, Allocator, StackAllocator >::ownAllocator_, GenericDocument< Encoding, Allocator, StackAllocator >::parseResult_, GenericDocument< Encoding, Allocator, StackAllocator >::stack_, internal::Stack< Allocator >::Swap(), and internal::Swap().
|
inline |
Definition at line 2403 of file document.h.
References process_bag::i, and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
inline |
Definition at line 2405 of file document.h.
References process_bag::i, and GenericDocument< Encoding, Allocator, StackAllocator >::stack_.
|
friend |
Definition at line 2396 of file document.h.
|
friend |
free-standing swap function helper
Helper function to enable support for common swap implementation pattern based on std::swap:
Definition at line 2194 of file document.h.
|
staticprivate |
Definition at line 2461 of file document.h.
|
private |
Definition at line 2465 of file document.h.
Referenced by GenericDocument< Encoding, Allocator, StackAllocator >::GetErrorOffset(), GenericDocument< Encoding, Allocator, StackAllocator >::GetParseError(), GenericDocument< Encoding, Allocator, StackAllocator >::HasParseError(), GenericDocument< Encoding, Allocator, StackAllocator >::operator ParseResult(), GenericDocument< Encoding, Allocator, StackAllocator >::ParseStream(), and GenericDocument< Encoding, Allocator, StackAllocator >::Swap().
|
private |
Definition at line 2464 of file document.h.
Referenced by GenericDocument< Encoding, Allocator, StackAllocator >::Bool(), GenericDocument< Encoding, Allocator, StackAllocator >::ClearStack(), GenericDocument< Encoding, Allocator, StackAllocator >::Double(), GenericDocument< Encoding, Allocator, StackAllocator >::EndArray(), GenericDocument< Encoding, Allocator, StackAllocator >::EndObject(), GenericDocument< Encoding, Allocator, StackAllocator >::GetStackCapacity(), GenericDocument< Encoding, Allocator, StackAllocator >::Int(), GenericDocument< Encoding, Allocator, StackAllocator >::Int64(), GenericDocument< Encoding, Allocator, StackAllocator >::Null(), GenericDocument< Encoding, Allocator, StackAllocator >::ParseStream(), GenericDocument< Encoding, Allocator, StackAllocator >::Populate(), GenericDocument< Encoding, Allocator, StackAllocator >::RawNumber(), GenericDocument< Encoding, Allocator, StackAllocator >::StartArray(), GenericDocument< Encoding, Allocator, StackAllocator >::StartObject(), GenericDocument< Encoding, Allocator, StackAllocator >::String(), GenericDocument< Encoding, Allocator, StackAllocator >::Swap(), GenericDocument< Encoding, Allocator, StackAllocator >::Uint(), and GenericDocument< Encoding, Allocator, StackAllocator >::Uint64().