JSON Schema Validator. More...
#include <fwd.h>
Public Types | |
typedef EncodingType::Ch | Ch |
typedef SchemaType::EncodingType | EncodingType |
typedef SchemaDocumentType::PointerType | PointerType |
typedef SchemaDocumentType::SchemaType | SchemaType |
Public Member Functions | |
bool | Bool (bool b) |
virtual void * | CreateHasher () |
virtual ISchemaValidator * | CreateSchemaValidator (const SchemaType &root) |
virtual void | DestroryHasher (void *hasher) |
virtual void | DestroySchemaValidator (ISchemaValidator *validator) |
bool | Double (double d) |
bool | EndArray (SizeType elementCount) |
bool | EndObject (SizeType memberCount) |
virtual void | FreeState (void *p) |
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... | |
virtual uint64_t | GetHashCode (void *hasher) |
PointerType | GetInvalidDocumentPointer () const |
Gets the JSON pointer pointed to the invalid value. More... | |
const Ch * | GetInvalidSchemaKeyword () const |
Gets the keyword of invalid schema. More... | |
PointerType | GetInvalidSchemaPointer () const |
Gets the JSON pointer pointed to the invalid schema. More... | |
bool | Int (int i) |
bool | Int64 (int64_t i) |
virtual bool | IsValid () const |
Checks whether the current state is valid. More... | |
bool | Key (const Ch *str, SizeType len, bool copy) |
virtual void * | MallocState (size_t size) |
bool | Null () |
bool | RawNumber (const Ch *str, SizeType length, bool copy) |
void | Reset () |
Reset the internal states. More... | |
bool | StartArray () |
bool | StartObject () |
bool | String (const Ch *str, SizeType length, bool copy) |
bool | Uint (unsigned u) |
bool | Uint64 (uint64_t u) |
~GenericSchemaValidator () | |
Destructor. More... | |
Public Member Functions inherited from internal::ISchemaStateFactory< SchemaDocumentType::SchemaType > | |
virtual void | DestroySchemaValidator (ISchemaValidator *validator)=0 |
virtual | ~ISchemaStateFactory () |
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 | |
void | AppendToken (const Ch *str, SizeType len) |
bool | BeginValue () |
Context & | CurrentContext () |
const Context & | CurrentContext () const |
const SchemaType & | CurrentSchema () const |
bool | EndValue () |
GenericSchemaValidator (const SchemaDocumentType &schemaDocument, const SchemaType &root, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity) | |
StateAllocator & | GetStateAllocator () |
RAPIDJSON_FORCEINLINE void | PopSchema () |
RAPIDJSON_FORCEINLINE void | PushSchema (const SchemaType &schema) |
Private Attributes | |
internal::Stack< StateAllocator > | documentStack_ |
stack to store the current path of validating document (Ch) More... | |
OutputHandler * | outputHandler_ |
StateAllocator * | ownStateAllocator_ |
const SchemaType & | root_ |
const SchemaDocumentType * | schemaDocument_ |
internal::Stack< StateAllocator > | schemaStack_ |
stack to store the current path of schema (BaseSchemaType *) More... | |
StateAllocator * | stateAllocator_ |
bool | valid_ |
Static Private Attributes | |
static const size_t | kDefaultDocumentStackCapacity = 256 |
static const size_t | kDefaultSchemaStackCapacity = 1024 |
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 |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inline |
|
inline |
|
inlinevirtual |
Checks whether the current state is valid.
Implements internal::ISchemaValidator.
|
inline |
|
inlinevirtual |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |