From 2bfd0cc6c7f1f2ad2c2b142ec64906ba6c8a551c Mon Sep 17 00:00:00 2001 From: Yuri Khan Date: Sat, 23 Sep 2017 20:42:39 +0700 Subject: [PATCH] internal::Schema: Keep pointer for future use --- include/rapidjson/schema.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/rapidjson/schema.h b/include/rapidjson/schema.h index abcf1a1..e51b369 100644 --- a/include/rapidjson/schema.h +++ b/include/rapidjson/schema.h @@ -349,6 +349,7 @@ public: Schema(SchemaDocumentType* schemaDocument, const PointerType& p, const ValueType& value, const ValueType& document, AllocatorType* allocator) : allocator_(allocator), + pointer_(p), typeless_(schemaDocument->GetTypeless()), enum_(), enumCount_(), @@ -596,6 +597,10 @@ public: #endif } + const PointerType& GetPointer() const { + return pointer_; + } + bool BeginValue(Context& context) const { if (context.inArray) { if (uniqueItems_) @@ -1215,6 +1220,7 @@ private: }; AllocatorType* allocator_; + PointerType pointer_; const SchemaType* typeless_; uint64_t* enum_; SizeType enumCount_; @@ -1650,7 +1656,7 @@ public: //! Gets the JSON pointer pointed to the invalid schema. PointerType GetInvalidSchemaPointer() const { - return schemaStack_.Empty() ? PointerType() : schemaDocument_->GetPointer(&CurrentSchema()); + return schemaStack_.Empty() ? PointerType() : CurrentSchema().GetPointer(); } //! Gets the keyword of invalid schema.