Public Types | Public Member Functions | Private Attributes | List of all members
SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator > Class Template Reference

A helper class for parsing with validation. More...

#include <schema.h>

Public Types

typedef SchemaDocumentType::PointerType PointerType
 
typedef InputStream::Ch Ch
 
typedef GenericValue< SourceEncoding, StackAllocator > ValueType
 

Public Member Functions

 SchemaValidatingReader (InputStream &is, const SchemaDocumentType &sd)
 Constructor. More...
 
template<typename Handler >
bool operator() (Handler &handler)
 
const ParseResultGetParseResult () const
 
bool IsValid () const
 
const PointerTypeGetInvalidSchemaPointer () const
 
const ChGetInvalidSchemaKeyword () const
 
const PointerTypeGetInvalidDocumentPointer () const
 
const ValueTypeGetError () const
 

Private Attributes

InputStream & is_
 
const SchemaDocumentType & sd_
 
ParseResult parseResult_
 
PointerType invalidSchemaPointer_
 
const ChinvalidSchemaKeyword_
 
PointerType invalidDocumentPointer_
 
StackAllocator allocator_
 
ValueType error_
 
bool isValid_
 

Detailed Description

template<unsigned parseFlags, typename InputStream, typename SourceEncoding, typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
class SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >

A helper class for parsing with validation.

This helper class is a functor, designed as a parameter of GenericDocument::Populate().

Template Parameters
parseFlagsCombination of ParseFlag.
InputStreamType of input stream, implementing Stream concept.
SourceEncodingEncoding of the input stream.
SchemaDocumentTypeType of schema document.
StackAllocatorAllocator type for stack.

Definition at line 2435 of file schema.h.

Member Typedef Documentation

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
typedef InputStream::Ch SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::Ch

Definition at line 2438 of file schema.h.

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
typedef SchemaDocumentType::PointerType SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::PointerType

Definition at line 2437 of file schema.h.

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
typedef GenericValue<SourceEncoding, StackAllocator> SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::ValueType

Definition at line 2439 of file schema.h.

Constructor & Destructor Documentation

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::SchemaValidatingReader ( InputStream &  is,
const SchemaDocumentType &  sd 
)
inline

Constructor.

Parameters
isInput stream.
sdSchema document.

Definition at line 2446 of file schema.h.

2446 : is_(is), sd_(sd), invalidSchemaKeyword_(), error_(kObjectType), isValid_(true) {}
const Ch * invalidSchemaKeyword_
Definition: schema.h:2484
object
Definition: rapidjson.h:622
InputStream & is_
Definition: schema.h:2479
const SchemaDocumentType & sd_
Definition: schema.h:2480

Member Function Documentation

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
const ValueType& SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::GetError ( ) const
inline

Definition at line 2476 of file schema.h.

2476 { return error_; }
template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
const PointerType& SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::GetInvalidDocumentPointer ( ) const
inline

Definition at line 2475 of file schema.h.

2475 { return invalidDocumentPointer_; }
PointerType invalidDocumentPointer_
Definition: schema.h:2485
template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
const Ch* SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::GetInvalidSchemaKeyword ( ) const
inline

Definition at line 2474 of file schema.h.

2474 { return invalidSchemaKeyword_; }
const Ch * invalidSchemaKeyword_
Definition: schema.h:2484
template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
const PointerType& SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::GetInvalidSchemaPointer ( ) const
inline

Definition at line 2473 of file schema.h.

2473 { return invalidSchemaPointer_; }
PointerType invalidSchemaPointer_
Definition: schema.h:2483
template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
const ParseResult& SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::GetParseResult ( ) const
inline

Definition at line 2471 of file schema.h.

2471 { return parseResult_; }
ParseResult parseResult_
Definition: schema.h:2482
template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
bool SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::IsValid ( ) const
inline

Definition at line 2472 of file schema.h.

2472 { return isValid_; }
template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
template<typename Handler >
bool SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::operator() ( Handler &  handler)
inline

Definition at line 2449 of file schema.h.

2449  {
2452  parseResult_ = reader.template Parse<parseFlags>(is_, validator);
2453 
2454  isValid_ = validator.IsValid();
2455  if (isValid_) {
2459  error_.SetObject();
2460  }
2461  else {
2462  invalidSchemaPointer_ = validator.GetInvalidSchemaPointer();
2463  invalidSchemaKeyword_ = validator.GetInvalidSchemaKeyword();
2464  invalidDocumentPointer_ = validator.GetInvalidDocumentPointer();
2465  error_.CopyFrom(validator.GetError(), allocator_);
2466  }
2467 
2468  return parseResult_;
2469  }
ParseResult parseResult_
Definition: schema.h:2482
PointerType invalidDocumentPointer_
Definition: schema.h:2485
const Ch * invalidSchemaKeyword_
Definition: schema.h:2484
PointerType invalidSchemaPointer_
Definition: schema.h:2483
InputStream & is_
Definition: schema.h:2479
SAX-style JSON parser. Use Reader for UTF8 encoding and default allocator.
Definition: fwd.h:88
SchemaDocumentType::PointerType PointerType
Definition: schema.h:2437
const SchemaDocumentType & sd_
Definition: schema.h:2480
StackAllocator allocator_
Definition: schema.h:2486
static msg_handler handler
Definition: qglobal.cpp:234
JSON Schema Validator.
Definition: fwd.h:145

Member Data Documentation

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
StackAllocator SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::allocator_
private

Definition at line 2486 of file schema.h.

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
ValueType SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::error_
private

Definition at line 2487 of file schema.h.

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
PointerType SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::invalidDocumentPointer_
private

Definition at line 2485 of file schema.h.

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
const Ch* SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::invalidSchemaKeyword_
private

Definition at line 2484 of file schema.h.

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
PointerType SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::invalidSchemaPointer_
private

Definition at line 2483 of file schema.h.

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
InputStream& SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::is_
private

Definition at line 2479 of file schema.h.

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
bool SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::isValid_
private

Definition at line 2488 of file schema.h.

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
ParseResult SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::parseResult_
private

Definition at line 2482 of file schema.h.

template<unsigned parseFlags, typename InputStream , typename SourceEncoding , typename SchemaDocumentType = SchemaDocument, typename StackAllocator = CrtAllocator>
const SchemaDocumentType& SchemaValidatingReader< parseFlags, InputStream, SourceEncoding, SchemaDocumentType, StackAllocator >::sd_
private

Definition at line 2480 of file schema.h.


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