@@ -8633,6 +8633,34 @@ class Schema {
86338633 return true;
86348634 }
86358635
8636+ bool CheckString(Context& context, const Ch* str, SizeType length) const {
8637+ if (minLength_ != 0 || maxLength_ != SizeType(~0)) {
8638+ SizeType count;
8639+ if (internal::CountStringCodePoint<EncodingType>(str, length, &count)) {
8640+ if (count < minLength_) {
8641+ context.error_handler.TooShort(str, length, minLength_);
8642+ RAPIDJSON_INVALID_KEYWORD_RETURN(kValidateErrorMinLength);
8643+ }
8644+ if (count > maxLength_) {
8645+ context.error_handler.TooLong(str, length, maxLength_);
8646+ RAPIDJSON_INVALID_KEYWORD_RETURN(kValidateErrorMaxLength);
8647+ }
8648+ }
8649+ }
8650+
8651+ if (pattern_ && !IsPatternMatch(pattern_, str, length)) {
8652+ #ifdef RAPIDJSON_YGGDRASIL
8653+ context.error_handler.DoesNotMatch(str, length,
8654+ patternStr_.GetString(),
8655+ patternStr_.GetStringLength());
8656+ #else // RAPIDJSON_YGGDRASIL
8657+ context.error_handler.DoesNotMatch(str, length);
8658+ #endif // RAPIDJSON_YGGDRASIL
8659+ RAPIDJSON_INVALID_KEYWORD_RETURN(kValidateErrorPattern);
8660+ }
8661+ return true;
8662+ }
8663+
86368664#ifdef RAPIDJSON_YGGDRASIL
86378665 void YggDisallowedType(Context& context, const ValueType& actualType) const {
86388666#define CHECK_(name) \
@@ -8721,34 +8749,6 @@ class Schema {
87218749 return false;
87228750 return true;
87238751 }
8724- bool CheckString(Context& context, const Ch* str, SizeType length) const {
8725- if (minLength_ != 0 || maxLength_ != SizeType(~0)) {
8726- SizeType count;
8727- if (internal::CountStringCodePoint<EncodingType>(str, length, &count)) {
8728- if (count < minLength_) {
8729- context.error_handler.TooShort(str, length, minLength_);
8730- RAPIDJSON_INVALID_KEYWORD_RETURN(kValidateErrorMinLength);
8731- }
8732- if (count > maxLength_) {
8733- context.error_handler.TooLong(str, length, maxLength_);
8734- RAPIDJSON_INVALID_KEYWORD_RETURN(kValidateErrorMaxLength);
8735- }
8736- }
8737- }
8738-
8739- if (pattern_ && !IsPatternMatch(pattern_, str, length)) {
8740- #ifdef RAPIDJSON_YGGDRASIL
8741- context.error_handler.DoesNotMatch(str, length,
8742- patternStr_.GetString(),
8743- patternStr_.GetStringLength());
8744- #else // RAPIDJSON_YGGDRASIL
8745- context.error_handler.DoesNotMatch(str, length);
8746- #endif // RAPIDJSON_YGGDRASIL
8747- RAPIDJSON_INVALID_KEYWORD_RETURN(kValidateErrorPattern);
8748- }
8749- return true;
8750- }
8751-
87528752 bool CheckSubType(Context& context, const ValueType* subtype_str,
87538753 const bool has_encoding) const {
87548754 return CheckSubType(context, subtype_str, has_encoding, subtype_);
0 commit comments