Commit dd2076f8 authored by Milo Yip's avatar Milo Yip

Minor refactoring

parent ba7aa979
......@@ -1550,7 +1550,6 @@ public:
, depth_(0)
#endif
{
CreateOwnAllocator();
}
//! Constructor with output handler.
......@@ -1579,7 +1578,6 @@ public:
, depth_(0)
#endif
{
CreateOwnAllocator();
}
//! Destructor.
......@@ -1592,7 +1590,7 @@ public:
void Reset() {
while (!schemaStack_.Empty())
PopSchema();
//documentStack_.Clear();
documentStack_.Clear();
valid_ = true;
}
......@@ -1615,10 +1613,6 @@ public:
return documentStack_.Empty() ? PointerType() : PointerType(documentStack_.template Bottom<Ch>(), documentStack_.GetSize() / sizeof(Ch));
}
StateAllocator& GetStateAllocator() {
return *stateAllocator_;
}
#if RAPIDJSON_SCHEMA_VERBOSE
#define RAPIDJSON_SCHEMA_HANDLE_BEGIN_VERBOSE_() \
RAPIDJSON_MULTILINEMACRO_BEGIN\
......@@ -1774,12 +1768,12 @@ private:
, depth_(depth)
#endif
{
CreateOwnAllocator();
}
void CreateOwnAllocator() {
StateAllocator& GetStateAllocator() {
if (!stateAllocator_)
stateAllocator_ = ownStateAllocator_ = RAPIDJSON_NEW(StateAllocator());
return *stateAllocator_;
}
bool BeginValue() {
......
......@@ -1148,6 +1148,8 @@ TEST(SchemaValidatingWriter, Simple) {
d.Parse("\"ABCD\"");
EXPECT_FALSE(d.Accept(validator));
EXPECT_FALSE(validator.IsValid());
EXPECT_TRUE(validator.GetInvalidSchemaPointer() == SchemaDocument::PointerType(""));
EXPECT_TRUE(validator.GetInvalidDocumentPointer() == SchemaDocument::PointerType(""));
}
#ifdef __clang__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment