From 5c93e64c6815f9ba0f364dc94fbeeb32b2de2ae9 Mon Sep 17 00:00:00 2001 From: miloyip Date: Fri, 1 May 2015 20:16:41 +0800 Subject: [PATCH] Fix clang compilation --- include/rapidjson/schema.h | 185 ++++++++++++++++++++++--------------- 1 file changed, 108 insertions(+), 77 deletions(-) diff --git a/include/rapidjson/schema.h b/include/rapidjson/schema.h index cd24989..f021a27 100644 --- a/include/rapidjson/schema.h +++ b/include/rapidjson/schema.h @@ -38,7 +38,7 @@ struct SchemaValidationContext { template class BaseSchema { public: - typedef typename Encoding::Ch Ch; //!< Character type derived from Encoding. + typedef typename Encoding::Ch Ch; typedef SchemaValidationContext Context; BaseSchema() {} @@ -46,7 +46,7 @@ public: template BaseSchema(const ValueType& value) { - ValueType::ConstMemberIterator enumItr = value.FindMember("enum"); + typename ValueType::ConstMemberIterator enumItr = value.FindMember("enum"); if (enumItr != value.MemberEnd()) { if (enumItr->value.IsArray() && enumItr->value.Size() > 0) enum_.CopyFrom(enumItr->value, allocator_); @@ -58,16 +58,16 @@ public: virtual ~BaseSchema() {} - virtual void BeginValue(Context& context) const {} + virtual void BeginValue(Context&) const {} - virtual bool Null() const { return enum_.IsArray() ? CheckEnum(GenericValue()) : true; } - virtual bool Bool(bool b) const { return enum_.IsArray() ? CheckEnum(GenericValue(b)) : true; } - virtual bool Int(int i) const { return enum_.IsArray() ? CheckEnum(GenericValue(i)) : true; } - virtual bool Uint(unsigned u) const { return enum_.IsArray() ? CheckEnum(GenericValue(u)) : true; } - virtual bool Int64(int64_t i) const { return enum_.IsArray() ? CheckEnum(GenericValue(i)) : true; } - virtual bool Uint64(uint64_t u) const { return enum_.IsArray() ? CheckEnum(GenericValue(u)) : true; } - virtual bool Double(double d) const { return enum_.IsArray() ? CheckEnum(GenericValue(d)) : true; } - virtual bool String(const Ch* s, SizeType length, bool) const { return enum_.IsArray() ? CheckEnum(GenericValue(s, length)) : true; } + virtual bool Null() const { return enum_.IsArray() ? CheckEnum(GenericValue().Move()) : true; } + virtual bool Bool(bool b) const { return enum_.IsArray() ? CheckEnum(GenericValue(b).Move()) : true; } + virtual bool Int(int i) const { return enum_.IsArray() ? CheckEnum(GenericValue(i).Move()) : true; } + virtual bool Uint(unsigned u) const { return enum_.IsArray() ? CheckEnum(GenericValue(u).Move()) : true; } + virtual bool Int64(int64_t i) const { return enum_.IsArray() ? CheckEnum(GenericValue(i).Move()) : true; } + virtual bool Uint64(uint64_t u) const { return enum_.IsArray() ? CheckEnum(GenericValue(u).Move()) : true; } + virtual bool Double(double d) const { return enum_.IsArray() ? CheckEnum(GenericValue(d).Move()) : true; } + virtual bool String(const Ch* s, SizeType length, bool) const { return enum_.IsArray() ? CheckEnum(GenericValue(s, length).Move()) : true; } virtual bool StartObject(Context&) const { return true; } virtual bool Key(Context&, const Ch*, SizeType, bool) const { return true; } virtual bool EndObject(Context&, SizeType) const { return true; } @@ -76,7 +76,7 @@ public: protected: bool CheckEnum(const GenericValue& v) const { - for (GenericValue::ConstValueIterator itr = enum_.Begin(); itr != enum_.End(); ++itr) + for (typename GenericValue::ConstValueIterator itr = enum_.Begin(); itr != enum_.End(); ++itr) if (v == *itr) return true; return false; @@ -87,30 +87,17 @@ protected: }; template -inline BaseSchema* CreateSchema(const ValueType& value) { - if (!value.IsObject()) - return 0; - - ValueType::ConstMemberIterator typeItr = value.FindMember("type"); - - if (typeItr == value.MemberEnd()) return new TypelessSchema(value); - else if (typeItr->value == Value("null")) return new NullSchema(value); - else if (typeItr->value == Value("boolean")) return new BooleanSchema(value); - else if (typeItr->value == Value("object")) return new ObjectSchema(value); - else if (typeItr->value == Value("array")) return new ArraySchema(value); - else if (typeItr->value == Value("string")) return new StringSchema(value); - else if (typeItr->value == Value("integer")) return new IntegerSchema(value); - else if (typeItr->value == Value("number")) return new NumberSchema(value); - else return 0; -} +inline BaseSchema* CreateSchema(const ValueType& value); template class TypelessSchema : public BaseSchema { public: + typedef SchemaValidationContext Context; + TypelessSchema() {} template - TypelessSchema(const ValueType& value) : BaseSchema(value) {} + TypelessSchema(const ValueType& value) : BaseSchema(value) {} virtual void BeginValue(Context& context) const { context.valueSchema = this; } }; @@ -118,10 +105,13 @@ public: template class NullSchema : public BaseSchema { public: + typedef typename Encoding::Ch Ch; + typedef SchemaValidationContext Context; + template NullSchema(const ValueType& value) : BaseSchema(value) {} - virtual bool Null() const { return BaseSchema::Null(); } + virtual bool Null() const { return BaseSchema::Null(); } virtual bool Bool(bool) const { return false; } virtual bool Int(int) const { return false; } virtual bool Uint(unsigned) const { return false; } @@ -139,22 +129,33 @@ public: template class BooleanSchema : public BaseSchema { public: + typedef typename Encoding::Ch Ch; + typedef SchemaValidationContext Context; + template BooleanSchema(const ValueType& value) : BaseSchema(value) {} virtual bool Null() const { return false; } - virtual bool Bool(bool b) const { return BaseSchema::Bool(b); } + virtual bool Bool(bool b) const { return BaseSchema::Bool(b); } virtual bool Int(int) const { return false; } virtual bool Uint(unsigned) const { return false; } virtual bool Int64(int64_t) const { return false; } virtual bool Uint64(uint64_t) const { return false; } virtual bool Double(double) const { return false; } virtual bool String(const Ch*, SizeType, bool) const { return false; } + virtual bool StartObject(Context&) const { return false; } + virtual bool Key(Context&, const Ch*, SizeType, bool) const { return false; } + virtual bool EndObject(Context&, SizeType) const { return false; } + virtual bool StartArray(Context&) const { return false; } + virtual bool EndArray(Context&, SizeType) const { return false; } }; template class ObjectSchema : public BaseSchema { public: + typedef typename Encoding::Ch Ch; + typedef SchemaValidationContext Context; + template ObjectSchema(const ValueType& value) : BaseSchema(value), @@ -166,24 +167,24 @@ public: maxProperties_(SizeType(~0)), additionalProperty_(true) { - ValueType::ConstMemberIterator propretiesItr = value.FindMember(Value("properties")); + typename ValueType::ConstMemberIterator propretiesItr = value.FindMember(Value("properties").Move()); if (propretiesItr != value.MemberEnd()) { const ValueType& properties = propretiesItr->value; properties_ = new Property[properties.MemberCount()]; propertyCount_ = 0; - for (ValueType::ConstMemberIterator propertyItr = properties.MemberBegin(); propertyItr != properties.MemberEnd(); ++propertyItr) { - properties_[propertyCount_].name.SetString(propertyItr->name.GetString(), propertyItr->name.GetStringLength(), allocator_); + for (typename ValueType::ConstMemberIterator propertyItr = properties.MemberBegin(); propertyItr != properties.MemberEnd(); ++propertyItr) { + properties_[propertyCount_].name.SetString(propertyItr->name.GetString(), propertyItr->name.GetStringLength(), BaseSchema::allocator_); properties_[propertyCount_].schema = CreateSchema(propertyItr->value); // TODO: Check error propertyCount_++; } } // Establish required after properties - ValueType::ConstMemberIterator requiredItr = value.FindMember(Value("required")); + typename ValueType::ConstMemberIterator requiredItr = value.FindMember(Value("required").Move()); if (requiredItr != value.MemberEnd()) { if (requiredItr->value.IsArray()) { - for (ValueType::ConstValueIterator itr = requiredItr->value.Begin(); itr != requiredItr->value.End(); ++itr) { + for (typename ValueType::ConstValueIterator itr = requiredItr->value.Begin(); itr != requiredItr->value.End(); ++itr) { if (itr->IsString()) { SizeType index; if (FindPropertyIndex(*itr, &index)) { @@ -199,7 +200,7 @@ public: } } - ValueType::ConstMemberIterator additionalPropretiesItr = value.FindMember(Value("additionalProperties")); + typename ValueType::ConstMemberIterator additionalPropretiesItr = value.FindMember(Value("additionalProperties").Move()); if (additionalPropretiesItr != value.MemberEnd()) { if (additionalPropretiesItr->value.IsBool()) additionalProperty_ = additionalPropretiesItr->value.GetBool(); @@ -210,7 +211,7 @@ public: } } - ValueType::ConstMemberIterator minPropertiesItr = value.FindMember(Value("minProperties")); + typename ValueType::ConstMemberIterator minPropertiesItr = value.FindMember(Value("minProperties").Move()); if (minPropertiesItr != value.MemberEnd()) { if (minPropertiesItr->value.IsUint64() && minPropertiesItr->value.GetUint64() <= SizeType(~0)) minProperties_ = static_cast(minPropertiesItr->value.GetUint64()); @@ -219,7 +220,7 @@ public: } } - ValueType::ConstMemberIterator maxPropertiesItr = value.FindMember(Value("maxProperties")); + typename ValueType::ConstMemberIterator maxPropertiesItr = value.FindMember(Value("maxProperties").Move()); if (maxPropertiesItr != value.MemberEnd()) { if (maxPropertiesItr->value.IsUint64() && maxPropertiesItr->value.GetUint64() <= SizeType(~0)) maxProperties_ = static_cast(maxPropertiesItr->value.GetUint64()); @@ -248,7 +249,7 @@ public: return true; } - virtual bool Key(Context& context, const Ch* str, SizeType len, bool copy) const { + virtual bool Key(Context& context, const Ch* str, SizeType len, bool) const { SizeType index; if (FindPropertyIndex(str, len, &index)) { context.valueSchema = properties_[index].schema; @@ -313,13 +314,13 @@ private: } GenericValue name; - BaseSchema* schema; + BaseSchema* schema; bool required; }; TypelessSchema typeless_; Property* properties_; - BaseSchema* additionalPropertySchema_; + BaseSchema* additionalPropertySchema_; SizeType propertyCount_; SizeType requiredCount_; SizeType minProperties_; @@ -330,6 +331,9 @@ private: template class ArraySchema : public BaseSchema { public: + typedef typename Encoding::Ch Ch; + typedef SchemaValidationContext Context; + template ArraySchema(const ValueType& value) : BaseSchema(value), @@ -339,14 +343,14 @@ public: minItems_(), maxItems_(SizeType(~0)) { - ValueType::ConstMemberIterator itemsItr = value.FindMember(Value("items")); + typename ValueType::ConstMemberIterator itemsItr = value.FindMember(Value("items").Move()); if (itemsItr != value.MemberEnd()) { if (itemsItr->value.IsObject()) itemsList_ = CreateSchema(itemsItr->value); // List validation else if (itemsItr->value.IsArray()) { // Tuple validation - itemsTuple_ = new BaseSchema*[itemsItr->value.Size()]; - for (ValueType::ConstValueIterator itr = itemsItr->value.Begin(); itr != itemsItr->value.End(); ++itr) { + itemsTuple_ = new BaseSchema*[itemsItr->value.Size()]; + for (typename ValueType::ConstValueIterator itr = itemsItr->value.Begin(); itr != itemsItr->value.End(); ++itr) { itemsTuple_[itemsTupleCount_] = CreateSchema(*itr); itemsTupleCount_++; } @@ -356,7 +360,7 @@ public: } } - ValueType::ConstMemberIterator minItemsItr = value.FindMember(Value("minItems")); + typename ValueType::ConstMemberIterator minItemsItr = value.FindMember(Value("minItems").Move()); if (minItemsItr != value.MemberEnd()) { if (minItemsItr->value.IsUint64() && minItemsItr->value.GetUint64() <= SizeType(~0)) minItems_ = static_cast(minItemsItr->value.GetUint64()); @@ -365,7 +369,7 @@ public: } } - ValueType::ConstMemberIterator maxItemsItr = value.FindMember(Value("maxItems")); + typename ValueType::ConstMemberIterator maxItemsItr = value.FindMember(Value("maxItems").Move()); if (maxItemsItr != value.MemberEnd()) { if (maxItemsItr->value.IsUint64() && maxItemsItr->value.GetUint64() <= SizeType(~0)) maxItems_ = static_cast(maxItemsItr->value.GetUint64()); @@ -416,8 +420,8 @@ public: private: TypelessSchema typeless_; - BaseSchema* itemsList_; - BaseSchema** itemsTuple_; + BaseSchema* itemsList_; + BaseSchema** itemsTuple_; SizeType itemsTupleCount_; SizeType minItems_; SizeType maxItems_; @@ -426,13 +430,16 @@ private: template class StringSchema : public BaseSchema { public: + typedef typename Encoding::Ch Ch; + typedef SchemaValidationContext Context; + template StringSchema(const ValueType& value) : BaseSchema(value), minLength_(0), maxLength_(~SizeType(0)) { - ValueType::ConstMemberIterator minLengthItr = value.FindMember(Value("minLength")); + typename ValueType::ConstMemberIterator minLengthItr = value.FindMember(Value("minLength").Move()); if (minLengthItr != value.MemberEnd()) { if (minLengthItr->value.IsUint64() && minLengthItr->value.GetUint64() <= ~SizeType(0)) minLength_ = static_cast(minLengthItr->value.GetUint64()); @@ -441,7 +448,7 @@ public: } } - ValueType::ConstMemberIterator maxLengthItr = value.FindMember(Value("maxLength")); + typename ValueType::ConstMemberIterator maxLengthItr = value.FindMember(Value("maxLength").Move()); if (maxLengthItr != value.MemberEnd()) { if (maxLengthItr->value.IsUint64() && maxLengthItr->value.GetUint64() <= ~SizeType(0)) maxLength_ = static_cast(maxLengthItr->value.GetUint64()); @@ -460,7 +467,7 @@ public: virtual bool Double(double) const { return false; } virtual bool String(const Ch* str, SizeType length, bool copy) const { - return BaseSchema::String(str, length, copy) && length >= minLength_ && length <= maxLength_; + return BaseSchema::String(str, length, copy) && length >= minLength_ && length <= maxLength_; } virtual bool StartArray(Context&) const { return true; } @@ -474,6 +481,9 @@ private: template class IntegerSchema : public BaseSchema { public: + typedef typename Encoding::Ch Ch; + typedef SchemaValidationContext Context; + template IntegerSchema(const ValueType& value) : BaseSchema(value), @@ -481,7 +491,7 @@ public: exclusiveMinimum_(false), exclusiveMaximum_(false) { - ValueType::ConstMemberIterator minimumItr = value.FindMember(Value("minimum")); + typename ValueType::ConstMemberIterator minimumItr = value.FindMember(Value("minimum").Move()); if (minimumItr != value.MemberEnd()) { if (minimumItr->value.IsInt64()) minimum_.SetInt64(minimumItr->value.GetInt64()); @@ -492,7 +502,7 @@ public: } } - ValueType::ConstMemberIterator maximumItr = value.FindMember(Value("maximum")); + typename ValueType::ConstMemberIterator maximumItr = value.FindMember(Value("maximum").Move()); if (maximumItr != value.MemberEnd()) { if (maximumItr->value.IsInt64()) maximum_.SetInt64(maximumItr->value.GetInt64()); @@ -503,7 +513,7 @@ public: } } - ValueType::ConstMemberIterator exclusiveMinimumItr = value.FindMember(Value("exclusiveMinimum")); + typename ValueType::ConstMemberIterator exclusiveMinimumItr = value.FindMember(Value("exclusiveMinimum").Move()); if (exclusiveMinimumItr != value.MemberEnd()) { if (exclusiveMinimumItr->value.IsBool()) exclusiveMinimum_ = exclusiveMinimumItr->value.GetBool(); @@ -512,7 +522,7 @@ public: } } - ValueType::ConstMemberIterator exclusiveMaximumItr = value.FindMember(Value("exclusiveMaximum")); + typename ValueType::ConstMemberIterator exclusiveMaximumItr = value.FindMember(Value("exclusiveMaximum").Move()); if (exclusiveMaximumItr != value.MemberEnd()) { if (exclusiveMaximumItr->value.IsBool()) exclusiveMaximum_ = exclusiveMaximumItr->value.GetBool(); @@ -521,7 +531,7 @@ public: } } - ValueType::ConstMemberIterator multipleOfItr = value.FindMember(Value("multipleOf")); + typename ValueType::ConstMemberIterator multipleOfItr = value.FindMember(Value("multipleOf").Move()); if (multipleOfItr != value.MemberEnd()) { if (multipleOfItr->value.IsUint64()) multipleOf_ = multipleOfItr->value.GetUint64(); @@ -534,10 +544,10 @@ public: virtual bool Null() const { return false; } virtual bool Bool(bool) const { return false; } - virtual bool Int(int i) const { return BaseSchema::Int64(i) && Int64(i); } - virtual bool Uint(unsigned u) const { return BaseSchema::Uint64(u) && Uint64(u); } - virtual bool Int64(int64_t i) const { return BaseSchema::Int64(i) && CheckInt64(i); } - virtual bool Uint64(uint64_t u) const { return BaseSchema::Uint64(u) && CheckUint64(u); } + virtual bool Int(int i) const { return BaseSchema::Int64(i) && Int64(i); } + virtual bool Uint(unsigned u) const { return BaseSchema::Uint64(u) && Uint64(u); } + virtual bool Int64(int64_t i) const { return BaseSchema::Int64(i) && CheckInt64(i); } + virtual bool Uint64(uint64_t u) const { return BaseSchema::Uint64(u) && CheckUint64(u); } virtual bool Double(double) const { return false; } virtual bool String(const Ch*, SizeType, bool) const { return false; } @@ -615,6 +625,9 @@ private: template class NumberSchema : public BaseSchema { public: + typedef typename Encoding::Ch Ch; + typedef SchemaValidationContext Context; + template NumberSchema(const ValueType& value) : BaseSchema(value), @@ -625,7 +638,7 @@ public: exclusiveMinimum_(false), exclusiveMaximum_(false) { - ValueType::ConstMemberIterator minimumItr = value.FindMember(Value("minimum")); + typename ValueType::ConstMemberIterator minimumItr = value.FindMember(Value("minimum").Move()); if (minimumItr != value.MemberEnd()) { if (minimumItr->value.IsNumber()) minimum_ = minimumItr->value.GetDouble(); @@ -634,7 +647,7 @@ public: } } - ValueType::ConstMemberIterator maximumItr = value.FindMember(Value("maximum")); + typename ValueType::ConstMemberIterator maximumItr = value.FindMember(Value("maximum").Move()); if (maximumItr != value.MemberEnd()) { if (maximumItr->value.IsNumber()) maximum_ = maximumItr->value.GetDouble(); @@ -643,7 +656,7 @@ public: } } - ValueType::ConstMemberIterator exclusiveMinimumItr = value.FindMember(Value("exclusiveMinimum")); + typename ValueType::ConstMemberIterator exclusiveMinimumItr = value.FindMember(Value("exclusiveMinimum").Move()); if (exclusiveMinimumItr != value.MemberEnd()) { if (exclusiveMinimumItr->value.IsBool()) exclusiveMinimum_ = exclusiveMinimumItr->value.GetBool(); @@ -652,7 +665,7 @@ public: } } - ValueType::ConstMemberIterator exclusiveMaximumItr = value.FindMember(Value("exclusiveMaximum")); + typename ValueType::ConstMemberIterator exclusiveMaximumItr = value.FindMember(Value("exclusiveMaximum").Move()); if (exclusiveMaximumItr != value.MemberEnd()) { if (exclusiveMaximumItr->value.IsBool()) exclusiveMaximum_ = exclusiveMaximumItr->value.GetBool(); @@ -661,7 +674,7 @@ public: } } - ValueType::ConstMemberIterator multipleOfItr = value.FindMember(Value("multipleOf")); + typename ValueType::ConstMemberIterator multipleOfItr = value.FindMember(Value("multipleOf").Move()); if (multipleOfItr != value.MemberEnd()) { if (multipleOfItr->value.IsNumber()) { multipleOf_ = multipleOfItr->value.GetDouble(); @@ -676,11 +689,11 @@ public: virtual bool Null() const { return false; } virtual bool Bool(bool) const { return false; } - virtual bool Int(int i) const { return BaseSchema::Int(i) && CheckDouble(i); } - virtual bool Uint(unsigned u) const { return BaseSchema::Uint(u) && CheckDouble(u); } - virtual bool Int64(int64_t i) const { return BaseSchema::Int64(i) && CheckDouble(i); } - virtual bool Uint64(uint64_t u) const { return BaseSchema::Uint64(u) && CheckDouble(u); } - virtual bool Double(double d) const { return BaseSchema::Double(d) && CheckDouble(d); } + virtual bool Int(int i) const { return BaseSchema::Int(i) && CheckDouble(i); } + virtual bool Uint(unsigned u) const { return BaseSchema::Uint(u) && CheckDouble(u); } + virtual bool Int64(int64_t i) const { return BaseSchema::Int64(i) && CheckDouble(i); } + virtual bool Uint64(uint64_t u) const { return BaseSchema::Uint64(u) && CheckDouble(u); } + virtual bool Double(double d) const { return BaseSchema::Double(d) && CheckDouble(d); } virtual bool String(const Ch*, SizeType, bool) const { return false; } virtual bool StartObject(Context&) const { return false; } @@ -705,15 +718,33 @@ private: bool exclusiveMaximum_; }; +template +inline BaseSchema* CreateSchema(const ValueType& value) { + if (!value.IsObject()) + return 0; + + typename ValueType::ConstMemberIterator typeItr = value.FindMember("type"); + + if (typeItr == value.MemberEnd()) return new TypelessSchema(value); + else if (typeItr->value == Value("null" ).Move()) return new NullSchema(value); + else if (typeItr->value == Value("boolean").Move()) return new BooleanSchema(value); + else if (typeItr->value == Value("object" ).Move()) return new ObjectSchema(value); + else if (typeItr->value == Value("array" ).Move()) return new ArraySchema(value); + else if (typeItr->value == Value("string" ).Move()) return new StringSchema(value); + else if (typeItr->value == Value("integer").Move()) return new IntegerSchema(value); + else if (typeItr->value == Value("number" ).Move()) return new NumberSchema(value); + else return 0; +} + template > class GenericSchema { public: - template + template friend class GenericSchemaValidator; template GenericSchema(const DocumentType& document) : root_() { - root_ = CreateSchema(document); + root_ = CreateSchema(document); } ~GenericSchema() { @@ -767,13 +798,13 @@ public: documentStack_.Clear(); }; - bool Null() { BeginValue(); return PopSchema().Null() ? outputHandler_.Null() : false; } + bool Null() { BeginValue(); return PopSchema().Null() ? outputHandler_.Null() : false; } bool Bool(bool b) { BeginValue(); return PopSchema().Bool(b) ? outputHandler_.Bool(b) : false; } bool Int(int i) { BeginValue(); return PopSchema().Int(i) ? outputHandler_.Int(i) : false; } bool Uint(unsigned u) { BeginValue(); return PopSchema().Uint(u) ? outputHandler_.Uint(u) : false; } bool Int64(int64_t i64) { BeginValue(); return PopSchema().Int64(i64) ? outputHandler_.Int64(i64) : false; } bool Uint64(uint64_t u64) { BeginValue(); return PopSchema().Uint64(u64) ? outputHandler_.Uint64(u64) : false; } - bool Double(double d) { BeginValue(); return PopSchema().Double(d) ? outputHandler_.Double(d) : false; } + bool Double(double d) { BeginValue(); return PopSchema().Double(d) ? outputHandler_.Double(d) : false; } bool String(const Ch* str, SizeType length, bool copy) { BeginValue(); return PopSchema().String(str, length, copy) ? outputHandler_.String(str, length, copy) : false; } bool StartObject() { BeginValue(); return CurrentSchema().StartObject(CurrentContext()) ? outputHandler_.StartObject() : false; } bool Key(const Ch* str, SizeType len, bool copy) { return CurrentSchema().Key(CurrentContext(), str, len, copy) ? outputHandler_.Key(str, len, copy) : false; } @@ -815,8 +846,8 @@ private: void PushSchema(const BaseSchemaType& schema) { *schemaStack_.template Push() = Context(&schema); } const BaseSchemaType& PopSchema() { return *schemaStack_.template Pop(1)->schema; } - const BaseSchemaType& CurrentSchema() { return *schemaStack_.Top()->schema; } - Context& CurrentContext() { return *schemaStack_.Top(); } + const BaseSchemaType& CurrentSchema() { return *schemaStack_.template Top()->schema; } + Context& CurrentContext() { return *schemaStack_.template Top(); } static const size_t kDefaultSchemaStackCapacity = 256; static const size_t kDefaultDocumentStackCapacity = 256;