rapidjson::GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator > 模板类 参考

JSON Schema Validator. 更多...

#include <schema.h>

类 rapidjson::GenericSchemaValidator< SchemaDocumentType, OutputHandler, StateAllocator > 继承关系图:

Public 类型

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

Public 成员函数

 GenericSchemaValidator (const SchemaDocumentType &schemaDocument, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity)
 Constructor without output handler. 更多...
 
 GenericSchemaValidator (const SchemaDocumentType &schemaDocument, OutputHandler &outputHandler, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity)
 Constructor with output handler. 更多...
 
 ~GenericSchemaValidator ()
 Destructor.
 
void Reset ()
 Reset the internal states.
 
void ResetError ()
 Reset the error state.
 
void SetValidateFlags (unsigned flags)
 Implementation of ISchemaValidator
 
virtual unsigned GetValidateFlags () const
 
virtual bool IsValid () const
 Checks whether the current state is valid.
 
ValueTypeGetError ()
 Gets the error object.
 
const ValueTypeGetError () const
 
PointerType GetInvalidSchemaPointer () const
 Gets the JSON pointer pointed to the invalid schema.
 
const Ch * GetInvalidSchemaKeyword () const
 Gets the keyword of invalid schema.
 
ValidateErrorCode GetInvalidSchemaCode () const
 Gets the error code of invalid schema.
 
PointerType GetInvalidDocumentPointer () const
 Gets the JSON pointer pointed to the invalid value.
 
void NotMultipleOf (int64_t actual, const SValue &expected)
 
void NotMultipleOf (uint64_t actual, const SValue &expected)
 
void NotMultipleOf (double actual, const SValue &expected)
 
void AboveMaximum (int64_t actual, const SValue &expected, bool exclusive)
 
void AboveMaximum (uint64_t actual, const SValue &expected, bool exclusive)
 
void AboveMaximum (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)
 
void BelowMinimum (double actual, const SValue &expected, bool exclusive)
 
void TooLong (const Ch *str, SizeType length, SizeType expected)
 
void TooShort (const Ch *str, SizeType length, SizeType expected)
 
void DoesNotMatch (const Ch *str, SizeType length)
 
void DisallowedItem (SizeType index)
 
void TooFewItems (SizeType actualCount, SizeType expectedCount)
 
void TooManyItems (SizeType actualCount, SizeType expectedCount)
 
void DuplicateItems (SizeType index1, SizeType index2)
 
void TooManyProperties (SizeType actualCount, SizeType expectedCount)
 
void TooFewProperties (SizeType actualCount, SizeType expectedCount)
 
void StartMissingProperties ()
 
void AddMissingProperty (const SValue &name)
 
bool EndMissingProperties ()
 
void PropertyViolations (ISchemaValidator **subvalidators, SizeType count)
 
void DisallowedProperty (const Ch *name, SizeType length)
 
void StartDependencyErrors ()
 
void StartMissingDependentProperties ()
 
void AddMissingDependentProperty (const SValue &targetName)
 
void EndMissingDependentProperties (const SValue &sourceName)
 
void AddDependencySchemaError (const SValue &sourceName, ISchemaValidator *subvalidator)
 
bool EndDependencyErrors ()
 
void DisallowedValue (const ValidateErrorCode code=kValidateErrorEnum)
 
void StartDisallowedType ()
 
void AddExpectedType (const typename SchemaType::ValueType &expectedType)
 
void EndDisallowedType (const typename SchemaType::ValueType &actualType)
 
void NotAllOf (ISchemaValidator **subvalidators, SizeType count)
 
void NoneOf (ISchemaValidator **subvalidators, SizeType count)
 
void NotOneOf (ISchemaValidator **subvalidators, SizeType count, bool matched=false)
 
void Disallowed ()
 
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, const bool inheritContinueOnErrors)
 
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)
 

详细描述

template<typename SchemaDocumentType, typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
class rapidjson::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().

模板参数
SchemaDocumentTypeType of schema document.
OutputHandlerType of output handler. Default handler does nothing.
StateAllocatorAllocator for storing the internal validation states.

构造及析构函数说明

◆ GenericSchemaValidator() [1/2]

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

Constructor without output handler.

参数
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.

◆ GenericSchemaValidator() [2/2]

template<typename SchemaDocumentType , typename OutputHandler = BaseReaderHandler<typename SchemaDocumentType::SchemaType::EncodingType>, typename StateAllocator = CrtAllocator>
rapidjson::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.

参数
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.

该类的文档由以下文件生成: