RAPIDJSON_FORCEINLINE bool EndValue()

in include/rapidjson/schema.h [698:778]


    RAPIDJSON_FORCEINLINE bool EndValue(Context& context) const {
        if (context.patternPropertiesValidatorCount > 0) {
            bool otherValid = false;
            SizeType count = context.patternPropertiesValidatorCount;
            if (context.objectPatternValidatorType != Context::kPatternValidatorOnly)
                otherValid = context.patternPropertiesValidators[--count]->IsValid();

            bool patternValid = true;
            for (SizeType i = 0; i < count; i++)
                if (!context.patternPropertiesValidators[i]->IsValid()) {
                    patternValid = false;
                    break;
                }

            if (context.objectPatternValidatorType == Context::kPatternValidatorOnly) {
                if (!patternValid) {
                    context.error_handler.PropertyViolations(context.patternPropertiesValidators, count);
                    RAPIDJSON_INVALID_KEYWORD_RETURN(GetPatternPropertiesString());
                }
            }
            else if (context.objectPatternValidatorType == Context::kPatternValidatorWithProperty) {
                if (!patternValid || !otherValid) {
                    context.error_handler.PropertyViolations(context.patternPropertiesValidators, count + 1);
                    RAPIDJSON_INVALID_KEYWORD_RETURN(GetPatternPropertiesString());
                }
            }
            else if (!patternValid && !otherValid) { // kPatternValidatorWithAdditionalProperty)
                context.error_handler.PropertyViolations(context.patternPropertiesValidators, count + 1);
                RAPIDJSON_INVALID_KEYWORD_RETURN(GetPatternPropertiesString());
            }
        }

        if (enum_) {
            const uint64_t h = context.factory.GetHashCode(context.hasher);
            for (SizeType i = 0; i < enumCount_; i++)
                if (enum_[i] == h)
                    goto foundEnum;
            context.error_handler.DisallowedValue();
            RAPIDJSON_INVALID_KEYWORD_RETURN(GetEnumString());
            foundEnum:;
        }

        if (allOf_.schemas)
            for (SizeType i = allOf_.begin; i < allOf_.begin + allOf_.count; i++)
                if (!context.validators[i]->IsValid()) {
                    context.error_handler.NotAllOf(&context.validators[allOf_.begin], allOf_.count);
                    RAPIDJSON_INVALID_KEYWORD_RETURN(GetAllOfString());
                }
        
        if (anyOf_.schemas) {
            for (SizeType i = anyOf_.begin; i < anyOf_.begin + anyOf_.count; i++)
                if (context.validators[i]->IsValid())
                    goto foundAny;
            context.error_handler.NoneOf(&context.validators[anyOf_.begin], anyOf_.count);
            RAPIDJSON_INVALID_KEYWORD_RETURN(GetAnyOfString());
            foundAny:;
        }

        if (oneOf_.schemas) {
            bool oneValid = false;
            for (SizeType i = oneOf_.begin; i < oneOf_.begin + oneOf_.count; i++)
                if (context.validators[i]->IsValid()) {
                    if (oneValid) {
                        context.error_handler.NotOneOf(&context.validators[oneOf_.begin], oneOf_.count);
                        RAPIDJSON_INVALID_KEYWORD_RETURN(GetOneOfString());
                    } else
                        oneValid = true;
                }
            if (!oneValid) {
                context.error_handler.NotOneOf(&context.validators[oneOf_.begin], oneOf_.count);
                RAPIDJSON_INVALID_KEYWORD_RETURN(GetOneOfString());
            }
        }

        if (not_ && context.validators[notValidatorIndex_]->IsValid()) {
            context.error_handler.Disallowed();
            RAPIDJSON_INVALID_KEYWORD_RETURN(GetNotString());
        }

        return true;
    }