bes  Updated for version 3.20.10
GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator > Class Template Referenceabstract

JSON Schema Validator. More...

#include <schema.h>

Collaboration diagram for GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >:
Collaboration graph

Public Types

typedef EncodingType::Ch Ch
 
typedef SchemaType::EncodingType EncodingType
 
typedef SchemaDocumentType::PointerType PointerType
 
typedef SchemaDocumentType::SchemaType SchemaType
 
typedef GenericStringRef< Ch > StringRefType
 
typedef SchemaType::SValue SValue
 
typedef GenericValue< EncodingType, StateAllocator > ValueType
 

Public Member Functions

void AboveMaximum (double actual, const SValue &expected, bool exclusive)
 
void AboveMaximum (int64_t actual, const SValue &expected, bool exclusive)
 
void AboveMaximum (uint64_t actual, const SValue &expected, bool exclusive)
 
virtual void AddDependencySchemaError (const SValue &souceName, ISchemaValidator *subvalidator)=0
 
void AddDependencySchemaError (const SValue &sourceName, ISchemaValidator *subvalidator)
 
void AddExpectedType (const typename SchemaType::ValueType &expectedType)
 
void AddMissingDependentProperty (const SValue &targetName)
 
void AddMissingProperty (const SValue &name)
 
void BelowMinimum (double actual, const SValue &expected, bool exclusive)
 
void BelowMinimum (int64_t actual, const SValue &expected, bool exclusive)
 
void BelowMinimum (uint64_t actual, const SValue &expected, bool exclusive)
 
bool Bool (bool b)
 
virtual void * CreateHasher ()
 
virtual ISchemaValidator * CreateSchemaValidator (const SchemaType &root)
 
virtual void DestroryHasher (void *hasher)
 
virtual void DestroySchemaValidator (ISchemaValidator *validator)
 
virtual void DestroySchemaValidator (ISchemaValidator *validator)=0
 
void Disallowed ()
 
void DisallowedItem (SizeType index)
 
void DisallowedProperty (const Ch *name, SizeType length)
 
virtual void DisallowedProperty (const Ch *name, SizeType length)=0
 
void DisallowedValue ()
 
void DoesNotMatch (const Ch *str, SizeType length)
 
virtual void DoesNotMatch (const Ch *str, SizeType length)=0
 
bool Double (double d)
 
void DuplicateItems (SizeType index1, SizeType index2)
 
bool EndArray (SizeType elementCount)
 
bool EndDependencyErrors ()
 
void EndDisallowedType (const typename SchemaType::ValueType &actualType)
 
void EndMissingDependentProperties (const SValue &sourceName)
 
bool EndMissingProperties ()
 
bool EndObject (SizeType memberCount)
 
virtual void FreeState (void *p)
 
 GenericSchemaValidator (const SchemaDocumentType &schemaDocument, OutputHandler &outputHandler, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity)
 Constructor with output handler. More...
 
 GenericSchemaValidator (const SchemaDocumentType &schemaDocument, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity)
 Constructor without output handler. More...
 
ValueTypeGetError ()
 Gets the error object. More...
 
const ValueTypeGetError () const
 
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)
 
void NoneOf (ISchemaValidator **subvalidators, SizeType count)
 
virtual void NoneOf (ISchemaValidator **subvalidators, SizeType count)=0
 
void NotAllOf (ISchemaValidator **subvalidators, SizeType count)
 
virtual void NotAllOf (ISchemaValidator **subvalidators, SizeType count)=0
 
void NotMultipleOf (double actual, const SValue &expected)
 
void NotMultipleOf (int64_t actual, const SValue &expected)
 
void NotMultipleOf (uint64_t actual, const SValue &expected)
 
void NotOneOf (ISchemaValidator **subvalidators, SizeType count)
 
virtual void NotOneOf (ISchemaValidator **subvalidators, SizeType count)=0
 
bool Null ()
 
void PropertyViolations (ISchemaValidator **subvalidators, SizeType count)
 
virtual void PropertyViolations (ISchemaValidator **subvalidators, SizeType count)=0
 
bool RawNumber (const Ch *str, SizeType length, bool copy)
 
void Reset ()
 Reset the internal states. More...
 
bool StartArray ()
 
void StartDependencyErrors ()
 
void StartDisallowedType ()
 
void StartMissingDependentProperties ()
 
void StartMissingProperties ()
 
bool StartObject ()
 
bool String (const Ch *str, SizeType length, bool copy)
 
void TooFewItems (SizeType actualCount, SizeType expectedCount)
 
void TooFewProperties (SizeType actualCount, SizeType expectedCount)
 
void TooLong (const Ch *str, SizeType length, SizeType expected)
 
virtual void TooLong (const Ch *str, SizeType length, SizeType expected)=0
 
void TooManyItems (SizeType actualCount, SizeType expectedCount)
 
void TooManyProperties (SizeType actualCount, SizeType expectedCount)
 
void TooShort (const Ch *str, SizeType length, SizeType expected)
 
virtual void TooShort (const Ch *str, SizeType length, SizeType expected)=0
 
bool Uint (unsigned u)
 
bool Uint64 (uint64_t u)
 
 ~GenericSchemaValidator ()
 Destructor. More...
 

Detailed Description

template<typename SchemaDocumentType, typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
class GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >

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().

Template Parameters
SchemaDocumentTypeType of schema document.
OutputHandlerType of output handler. Default handler does nothing.
StateAllocatorAllocator for storing the internal validation states.

Definition at line 1763 of file schema.h.

Constructor & Destructor Documentation

◆ GenericSchemaValidator() [1/2]

template<typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::GenericSchemaValidator ( const SchemaDocumentType &  schemaDocument,
StateAllocator *  allocator = 0,
size_t  schemaStackCapacity = kDefaultSchemaStackCapacity,
size_t  documentStackCapacity = kDefaultDocumentStackCapacity 
)
inline

Constructor without output handler.

Parameters
schemaDocumentThe schema document to conform to.
allocatorOptional allocator for storing internal validation states.
schemaStackCapacityOptional initial capacity of schema path stack.
documentStackCapacityOptional initial capacity of document path stack.

Definition at line 1784 of file schema.h.

◆ GenericSchemaValidator() [2/2]

template<typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::GenericSchemaValidator ( const SchemaDocumentType &  schemaDocument,
OutputHandler &  outputHandler,
StateAllocator *  allocator = 0,
size_t  schemaStackCapacity = kDefaultSchemaStackCapacity,
size_t  documentStackCapacity = kDefaultDocumentStackCapacity 
)
inline

Constructor with output handler.

Parameters
schemaDocumentThe schema document to conform to.
allocatorOptional allocator for storing internal validation states.
schemaStackCapacityOptional initial capacity of schema path stack.
documentStackCapacityOptional initial capacity of document path stack.

Definition at line 1814 of file schema.h.

◆ ~GenericSchemaValidator()

template<typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::~GenericSchemaValidator ( )
inline

Destructor.

Definition at line 1839 of file schema.h.

Member Function Documentation

◆ GetError()

template<typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
ValueType& GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::GetError ( )
inline

Gets the error object.

Definition at line 1860 of file schema.h.

◆ GetInvalidDocumentPointer()

template<typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
PointerType GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::GetInvalidDocumentPointer ( ) const
inline

Gets the JSON pointer pointed to the invalid value.

Definition at line 1874 of file schema.h.

◆ GetInvalidSchemaKeyword()

template<typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
const Ch* GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::GetInvalidSchemaKeyword ( ) const
inline

Gets the keyword of invalid schema.

Definition at line 1869 of file schema.h.

◆ GetInvalidSchemaPointer()

template<typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
PointerType GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::GetInvalidSchemaPointer ( ) const
inline

Gets the JSON pointer pointed to the invalid schema.

Definition at line 1864 of file schema.h.

◆ IsValid()

template<typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
virtual bool GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::IsValid ( ) const
inlinevirtual

Checks whether the current state is valid.

Implements internal::ISchemaValidator.

Definition at line 1857 of file schema.h.

◆ Reset()

template<typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
void GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator >::Reset ( )
inline

Reset the internal states.

Definition at line 1845 of file schema.h.


The documentation for this class was generated from the following files: