RetroArch
|
JSON Schema Validator. More...
#include <fwd.h>
Public Types | |
typedef SchemaDocumentType::SchemaType | SchemaType |
typedef SchemaDocumentType::PointerType | PointerType |
typedef SchemaType::EncodingType | EncodingType |
typedef EncodingType::Ch | Ch |
Public Member Functions | |
GenericSchemaValidator (const SchemaDocumentType &schemaDocument, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity) | |
Constructor without output handler. More... | |
GenericSchemaValidator (const SchemaDocumentType &schemaDocument, OutputHandler &outputHandler, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity) | |
Constructor with output handler. More... | |
~GenericSchemaValidator () | |
Destructor. More... | |
void | Reset () |
Reset the internal states. More... | |
virtual bool | IsValid () const |
Checks whether the current state is valid. More... | |
PointerType | GetInvalidSchemaPointer () const |
Gets the JSON pointer pointed to the invalid schema. More... | |
const Ch * | GetInvalidSchemaKeyword () const |
Gets the keyword of invalid schema. More... | |
PointerType | GetInvalidDocumentPointer () const |
Gets the JSON pointer pointed to the invalid value. More... | |
bool | Null () |
bool | Bool (bool b) |
bool | Int (int i) |
bool | Uint (unsigned u) |
bool | Int64 (int64_t i) |
bool | Uint64 (uint64_t u) |
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 len, bool copy) |
bool | EndObject (SizeType memberCount) |
bool | StartArray () |
bool | EndArray (SizeType elementCount) |
virtual ISchemaValidator * | CreateSchemaValidator (const SchemaType &root) |
virtual void | DestroySchemaValidator (ISchemaValidator *validator) |
virtual void * | CreateHasher () |
virtual uint64_t | GetHashCode (void *hasher) |
virtual void | DestroryHasher (void *hasher) |
virtual void * | MallocState (size_t size) |
virtual void | FreeState (void *p) |
Public Member Functions inherited from internal::ISchemaStateFactory< SchemaDocumentType::SchemaType > | |
virtual | ~ISchemaStateFactory () |
virtual void | DestroySchemaValidator (ISchemaValidator *validator)=0 |
Public Member Functions inherited from internal::ISchemaValidator | |
virtual | ~ISchemaValidator () |
Private Types | |
typedef SchemaType::Context | Context |
typedef GenericValue< UTF8<>, StateAllocator > | HashCodeArray |
typedef internal::Hasher< EncodingType, StateAllocator > | HasherType |
Private Member Functions | |
GenericSchemaValidator (const SchemaDocumentType &schemaDocument, const SchemaType &root, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity) | |
StateAllocator & | GetStateAllocator () |
bool | BeginValue () |
bool | EndValue () |
void | AppendToken (const Ch *str, SizeType len) |
RAPIDJSON_FORCEINLINE void | PushSchema (const SchemaType &schema) |
RAPIDJSON_FORCEINLINE void | PopSchema () |
const SchemaType & | CurrentSchema () const |
Context & | CurrentContext () |
const Context & | CurrentContext () const |
Static Private Member Functions | |
static OutputHandler & | GetNullHandler () |
Private Attributes | |
const SchemaDocumentType * | schemaDocument_ |
const SchemaType & | root_ |
OutputHandler & | outputHandler_ |
StateAllocator * | stateAllocator_ |
StateAllocator * | ownStateAllocator_ |
internal::Stack< StateAllocator > | schemaStack_ |
stack to store the current path of schema (BaseSchemaType *) More... | |
internal::Stack< StateAllocator > | documentStack_ |
stack to store the current path of validating document (Ch) More... | |
bool | valid_ |
Static Private Attributes | |
static const size_t | kDefaultSchemaStackCapacity = 1024 |
static const size_t | kDefaultDocumentStackCapacity = 256 |
JSON Schema Validator.
A SAX style JSON schema validator. It uses a GenericSchemaDocument
to validate SAX events. It delegates the incoming SAX events to an output handler. The default output handler does nothing. It can be reused multiple times by calling Reset()
.
SchemaDocumentType | Type of schema document. |
OutputHandler | Type of output handler. Default handler does nothing. |
StateAllocator | Allocator for storing the internal validation states. |
typedef EncodingType::Ch GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::Ch |
|
private |
typedef SchemaType::EncodingType GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::EncodingType |
|
private |
|
private |
typedef SchemaDocumentType::PointerType GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::PointerType |
typedef SchemaDocumentType::SchemaType GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::SchemaType |
|
inline |
Constructor without output handler.
schemaDocument | The schema document to conform to. |
allocator | Optional allocator for storing internal validation states. |
schemaStackCapacity | Optional initial capacity of schema path stack. |
documentStackCapacity | Optional initial capacity of document path stack. |
|
inline |
Constructor with output handler.
schemaDocument | The schema document to conform to. |
allocator | Optional allocator for storing internal validation states. |
schemaStackCapacity | Optional initial capacity of schema path stack. |
documentStackCapacity | Optional initial capacity of document path stack. |
|
inline |
Destructor.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inlinevirtual |
Implements internal::ISchemaStateFactory< SchemaDocumentType::SchemaType >.
|
inlinevirtual |
Implements internal::ISchemaStateFactory< SchemaDocumentType::SchemaType >.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlinevirtual |
|
inlinevirtual |
Implements internal::ISchemaStateFactory< SchemaDocumentType::SchemaType >.
|
inline |
Gets the JSON pointer pointed to the invalid value.
|
inline |
Gets the keyword of invalid schema.
|
inline |
Gets the JSON pointer pointed to the invalid schema.
|
inlinestaticprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inlinevirtual |
Checks whether the current state is valid.
Implements internal::ISchemaValidator.
|
inline |
|
inlinevirtual |
Implements internal::ISchemaStateFactory< SchemaDocumentType::SchemaType >.
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
Reset the internal states.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
stack to store the current path of validating document (Ch)
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
stack to store the current path of schema (BaseSchemaType *)
|
private |
|
private |