Change SchemaValidator::GetNullHandler() from singleton to instance.
This commit is contained in:
parent
517dd4dbb8
commit
b963eb447b
@ -1368,7 +1368,7 @@ public:
|
|||||||
}
|
}
|
||||||
else if (refEntry->schema)
|
else if (refEntry->schema)
|
||||||
*refEntry->schema = SchemaType::GetTypeless();
|
*refEntry->schema = SchemaType::GetTypeless();
|
||||||
|
|
||||||
refEntry->~SchemaRefEntry();
|
refEntry->~SchemaRefEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1579,11 +1579,11 @@ public:
|
|||||||
:
|
:
|
||||||
schemaDocument_(&schemaDocument),
|
schemaDocument_(&schemaDocument),
|
||||||
root_(schemaDocument.GetRoot()),
|
root_(schemaDocument.GetRoot()),
|
||||||
outputHandler_(GetNullHandler()),
|
|
||||||
stateAllocator_(allocator),
|
stateAllocator_(allocator),
|
||||||
ownStateAllocator_(0),
|
ownStateAllocator_(0),
|
||||||
schemaStack_(allocator, schemaStackCapacity),
|
schemaStack_(allocator, schemaStackCapacity),
|
||||||
documentStack_(allocator, documentStackCapacity),
|
documentStack_(allocator, documentStackCapacity),
|
||||||
|
outputHandler_(CreateNullHandler()),
|
||||||
valid_(true)
|
valid_(true)
|
||||||
#if RAPIDJSON_SCHEMA_VERBOSE
|
#if RAPIDJSON_SCHEMA_VERBOSE
|
||||||
, depth_(0)
|
, depth_(0)
|
||||||
@ -1607,11 +1607,12 @@ public:
|
|||||||
:
|
:
|
||||||
schemaDocument_(&schemaDocument),
|
schemaDocument_(&schemaDocument),
|
||||||
root_(schemaDocument.GetRoot()),
|
root_(schemaDocument.GetRoot()),
|
||||||
outputHandler_(outputHandler),
|
|
||||||
stateAllocator_(allocator),
|
stateAllocator_(allocator),
|
||||||
ownStateAllocator_(0),
|
ownStateAllocator_(0),
|
||||||
schemaStack_(allocator, schemaStackCapacity),
|
schemaStack_(allocator, schemaStackCapacity),
|
||||||
documentStack_(allocator, documentStackCapacity),
|
documentStack_(allocator, documentStackCapacity),
|
||||||
|
outputHandler_(outputHandler),
|
||||||
|
nullHandler_(0),
|
||||||
valid_(true)
|
valid_(true)
|
||||||
#if RAPIDJSON_SCHEMA_VERBOSE
|
#if RAPIDJSON_SCHEMA_VERBOSE
|
||||||
, depth_(0)
|
, depth_(0)
|
||||||
@ -1795,11 +1796,11 @@ private:
|
|||||||
:
|
:
|
||||||
schemaDocument_(&schemaDocument),
|
schemaDocument_(&schemaDocument),
|
||||||
root_(root),
|
root_(root),
|
||||||
outputHandler_(GetNullHandler()),
|
|
||||||
stateAllocator_(allocator),
|
stateAllocator_(allocator),
|
||||||
ownStateAllocator_(0),
|
ownStateAllocator_(0),
|
||||||
schemaStack_(allocator, schemaStackCapacity),
|
schemaStack_(allocator, schemaStackCapacity),
|
||||||
documentStack_(allocator, documentStackCapacity),
|
documentStack_(allocator, documentStackCapacity),
|
||||||
|
outputHandler_(CreateNullHandler()),
|
||||||
valid_(true)
|
valid_(true)
|
||||||
#if RAPIDJSON_SCHEMA_VERBOSE
|
#if RAPIDJSON_SCHEMA_VERBOSE
|
||||||
, depth_(depth)
|
, depth_(depth)
|
||||||
@ -1913,20 +1914,20 @@ private:
|
|||||||
Context& CurrentContext() { return *schemaStack_.template Top<Context>(); }
|
Context& CurrentContext() { return *schemaStack_.template Top<Context>(); }
|
||||||
const Context& CurrentContext() const { return *schemaStack_.template Top<Context>(); }
|
const Context& CurrentContext() const { return *schemaStack_.template Top<Context>(); }
|
||||||
|
|
||||||
static OutputHandler& GetNullHandler() {
|
OutputHandler& CreateNullHandler() {
|
||||||
static OutputHandler nullHandler;
|
return *(nullHandler_ = static_cast<OutputHandler*>(stateAllocator_->Malloc(sizeof(OutputHandler))));
|
||||||
return nullHandler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const size_t kDefaultSchemaStackCapacity = 1024;
|
static const size_t kDefaultSchemaStackCapacity = 1024;
|
||||||
static const size_t kDefaultDocumentStackCapacity = 256;
|
static const size_t kDefaultDocumentStackCapacity = 256;
|
||||||
const SchemaDocumentType* schemaDocument_;
|
const SchemaDocumentType* schemaDocument_;
|
||||||
const SchemaType& root_;
|
const SchemaType& root_;
|
||||||
OutputHandler& outputHandler_;
|
|
||||||
StateAllocator* stateAllocator_;
|
StateAllocator* stateAllocator_;
|
||||||
StateAllocator* ownStateAllocator_;
|
StateAllocator* ownStateAllocator_;
|
||||||
internal::Stack<StateAllocator> schemaStack_; //!< stack to store the current path of schema (BaseSchemaType *)
|
internal::Stack<StateAllocator> schemaStack_; //!< stack to store the current path of schema (BaseSchemaType *)
|
||||||
internal::Stack<StateAllocator> documentStack_; //!< stack to store the current path of validating document (Ch)
|
internal::Stack<StateAllocator> documentStack_; //!< stack to store the current path of validating document (Ch)
|
||||||
|
OutputHandler& outputHandler_;
|
||||||
|
OutputHandler* nullHandler_;
|
||||||
bool valid_;
|
bool valid_;
|
||||||
#if RAPIDJSON_SCHEMA_VERBOSE
|
#if RAPIDJSON_SCHEMA_VERBOSE
|
||||||
unsigned depth_;
|
unsigned depth_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user