MCPcopy Create free account
hub / github.com/USCiLab/cereal / String

Method String

include/cereal/external/rapidjson/schema.h:843–869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

841 }
842
843 bool String(Context& context, const Ch* str, SizeType length, bool) const {
844 if (!(type_ & (1 << kStringSchemaType))) {
845 DisallowedType(context, GetStringString());
846 CEREAL_RAPIDJSON_INVALID_KEYWORD_RETURN(GetTypeString());
847 }
848
849 if (minLength_ != 0 || maxLength_ != SizeType(~0)) {
850 SizeType count;
851 if (internal::CountStringCodePoint<EncodingType>(str, length, &count)) {
852 if (count < minLength_) {
853 context.error_handler.TooShort(str, length, minLength_);
854 CEREAL_RAPIDJSON_INVALID_KEYWORD_RETURN(GetMinLengthString());
855 }
856 if (count > maxLength_) {
857 context.error_handler.TooLong(str, length, maxLength_);
858 CEREAL_RAPIDJSON_INVALID_KEYWORD_RETURN(GetMaxLengthString());
859 }
860 }
861 }
862
863 if (pattern_ && !IsPatternMatch(pattern_, str, length)) {
864 context.error_handler.DoesNotMatch(str, length);
865 CEREAL_RAPIDJSON_INVALID_KEYWORD_RETURN(GetPatternString());
866 }
867
868 return CreateParallelValidator(context);
869 }
870
871 bool StartObject(Context& context) const {
872 if (!(type_ & (1 << kObjectSchemaType))) {

Callers

nothing calls this directly

Calls 3

TooShortMethod · 0.80
TooLongMethod · 0.80
DoesNotMatchMethod · 0.80

Tested by

no test coverage detected