15#ifndef RAPIDJSON_SCHEMA_H_
16#define RAPIDJSON_SCHEMA_H_
23#if !defined(RAPIDJSON_SCHEMA_USE_INTERNALREGEX)
24#define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 1
26#define RAPIDJSON_SCHEMA_USE_INTERNALREGEX 0
29#if !RAPIDJSON_SCHEMA_USE_INTERNALREGEX && defined(RAPIDJSON_SCHEMA_USE_STDREGEX) && (__cplusplus >=201103L || (defined(_MSC_VER) && _MSC_VER >= 1800))
30#define RAPIDJSON_SCHEMA_USE_STDREGEX 1
32#define RAPIDJSON_SCHEMA_USE_STDREGEX 0
35#if RAPIDJSON_SCHEMA_USE_INTERNALREGEX
37#elif RAPIDJSON_SCHEMA_USE_STDREGEX
41#if RAPIDJSON_SCHEMA_USE_INTERNALREGEX || RAPIDJSON_SCHEMA_USE_STDREGEX
42#define RAPIDJSON_SCHEMA_HAS_REGEX 1
44#define RAPIDJSON_SCHEMA_HAS_REGEX 0
47#ifndef RAPIDJSON_SCHEMA_VERBOSE
48#define RAPIDJSON_SCHEMA_VERBOSE 0
51#if RAPIDJSON_SCHEMA_VERBOSE
58RAPIDJSON_DIAG_OFF(effc++)
62RAPIDJSON_DIAG_OFF(weak-vtables)
63RAPIDJSON_DIAG_OFF(exit-time-destructors)
64RAPIDJSON_DIAG_OFF(c++98-compat-pedantic)
65RAPIDJSON_DIAG_OFF(variadic-macros)
66#elif defined(_MSC_VER)
67RAPIDJSON_DIAG_OFF(4512)
75#if RAPIDJSON_SCHEMA_VERBOSE
79inline void PrintInvalidKeyword(
const char* keyword) {
80 printf(
"Fail keyword: %s\n", keyword);
83inline void PrintInvalidKeyword(
const wchar_t* keyword) {
84 wprintf(
L"Fail keyword: %ls\n", keyword);
87inline void PrintInvalidDocument(
const char* document) {
88 printf(
"Fail document: %s\n\n", document);
91inline void PrintInvalidDocument(
const wchar_t* document) {
92 wprintf(
L"Fail document: %ls\n\n", document);
95inline void PrintValidatorPointers(
unsigned depth,
const char*
s,
const char*
d) {
96 printf(
"S: %*s%s\nD: %*s%s\n\n",
depth * 4,
" ",
s,
depth * 4,
" ",
d);
99inline void PrintValidatorPointers(
unsigned depth,
const wchar_t*
s,
const wchar_t*
d) {
100 wprintf(
L"S: %*ls%ls\nD: %*ls%ls\n\n",
depth * 4,
L" ",
s,
depth * 4,
L" ",
d);
110#if RAPIDJSON_SCHEMA_VERBOSE
111#define RAPIDJSON_INVALID_KEYWORD_VERBOSE(keyword) internal::PrintInvalidKeyword(keyword)
113#define RAPIDJSON_INVALID_KEYWORD_VERBOSE(keyword)
116#define RAPIDJSON_INVALID_KEYWORD_RETURN(keyword)\
117RAPIDJSON_MULTILINEMACRO_BEGIN\
118 context.invalidKeyword = keyword.GetString();\
119 RAPIDJSON_INVALID_KEYWORD_VERBOSE(keyword.GetString());\
121RAPIDJSON_MULTILINEMACRO_END
126template <
typename ValueType,
typename Allocator>
131template <
typename SchemaDocumentType>
146template <
typename SchemaType>
162template <
typename SchemaType>
165 typedef typename SchemaType::Ch
Ch;
166 typedef typename SchemaType::SValue
SValue;
219template<
typename Encoding,
typename Allocator>
222 typedef typename Encoding::Ch
Ch;
228 bool Int(
int i) { Number n; n.u.
i = i; n.d =
static_cast<double>(i);
return WriteNumber(n); }
229 bool Uint(
unsigned u) { Number n; n.u.
u = u; n.d =
static_cast<double>(u);
return WriteNumber(n); }
255 for (
SizeType i = 0; i < memberCount; i++)
256 h ^=
Hash(kv[i * 2], kv[i * 2 + 1]);
257 *
stack_.template Push<uint64_t>() =
h;
265 for (
SizeType i = 0; i < elementCount; i++)
267 *
stack_.template Push<uint64_t>() =
h;
275 return *
stack_.template Top<uint64_t>();
295 const unsigned char*
d =
static_cast<const unsigned char*
>(
data);
296 for (
size_t i = 0; i < len; i++)
298 *
stack_.template Push<uint64_t>() =
h;
315template <
typename SchemaDocumentType>
321 typedef typename ValueType::Ch
Ch;
395template <
typename SchemaDocumentType>
398 typedef typename SchemaDocumentType::ValueType
ValueType;
402 typedef typename EncodingType::Ch
Ch;
413 typeless_(schemaDocument->GetTypeless()),
446 typedef typename SchemaDocumentType::ValueType
ValueType;
447 typedef typename ValueType::ConstValueIterator ConstValueIterator;
448 typedef typename ValueType::ConstMemberIterator ConstMemberIterator;
450 if (!
value.IsObject())
457 else if (v->IsArray())
458 for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr)
463 if (v->IsArray() && v->Size() > 0) {
464 enum_ = static_cast<uint64_t*>(allocator_->Malloc(sizeof(uint64_t) * v->Size()));
465 for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr) {
466 typedef Hasher<EncodingType, MemoryPoolAllocator<> > EnumHasherType;
467 char buffer[256 + 24];
468 MemoryPoolAllocator<> hasherAllocator(buffer, sizeof(buffer));
469 EnumHasherType h(&hasherAllocator, 256);
471 enum_[enumCount_++] = h.GetHashCode();
475 if (schemaDocument) {
482 schemaDocument->CreateSchema(&
not_, p.Append(GetNotString(),
allocator_), *v, document);
496 if (properties && properties->IsObject())
497 for (ConstMemberIterator itr = properties->MemberBegin(); itr != properties->MemberEnd(); ++itr)
500 if (required && required->IsArray())
501 for (ConstValueIterator itr = required->Begin(); itr != required->End(); ++itr)
505 if (dependencies && dependencies->IsObject())
506 for (ConstMemberIterator itr = dependencies->MemberBegin(); itr != dependencies->MemberEnd(); ++itr) {
508 if (itr->value.IsArray())
509 for (ConstValueIterator i = itr->value.Begin(); i != itr->value.End(); ++i)
514 if (allProperties.Size() > 0) {
525 if (properties && properties->IsObject()) {
527 for (ConstMemberIterator itr = properties->MemberBegin(); itr != properties->MemberEnd(); ++itr) {
530 schemaDocument->CreateSchema(&
properties_[index].schema,
q.Append(itr->name,
allocator_), itr->value, document);
539 for (ConstMemberIterator itr = v->MemberBegin(); itr != v->MemberEnd(); ++itr) {
547 if (required && required->IsArray())
548 for (ConstValueIterator itr = required->Begin(); itr != required->End(); ++itr)
549 if (itr->IsString()) {
557 if (dependencies && dependencies->IsObject()) {
560 for (ConstMemberIterator itr = dependencies->MemberBegin(); itr != dependencies->MemberEnd(); ++itr) {
563 if (itr->value.IsArray()) {
566 for (ConstValueIterator targetItr = itr->value.Begin(); targetItr != itr->value.End(); ++targetItr) {
569 properties_[sourceIndex].dependencies[targetIndex] =
true;
572 else if (itr->value.IsObject()) {
574 schemaDocument->CreateSchema(&
properties_[sourceIndex].dependenciesSchema,
q.Append(itr->name,
allocator_), itr->value, document);
585 else if (v->IsObject())
596 schemaDocument->CreateSchema(&
itemsList_, q, *v, document);
597 else if (v->IsArray()) {
600 for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr, index++)
611 else if (v->IsObject())
637 if (v->IsNumber() && v->GetDouble() > 0.0)
648 AllocatorType::Free(
enum_);
660#if RAPIDJSON_SCHEMA_HAS_REGEX
677 if (context.inArray) {
679 context.valueUniqueness =
true;
685 context.valueSchema =
itemsTuple_[context.arrayElementIndex];
691 context.error_handler.DisallowedItem(context.arrayElementIndex);
698 context.arrayElementIndex++;
704 if (context.patternPropertiesValidatorCount > 0) {
705 bool otherValid =
false;
706 SizeType count = context.patternPropertiesValidatorCount;
708 otherValid = context.patternPropertiesValidators[--count]->IsValid();
710 bool patternValid =
true;
711 for (
SizeType i = 0; i < count; i++)
712 if (!context.patternPropertiesValidators[i]->IsValid()) {
713 patternValid =
false;
719 context.error_handler.PropertyViolations(context.patternPropertiesValidators, count);
724 if (!patternValid || !otherValid) {
725 context.error_handler.PropertyViolations(context.patternPropertiesValidators, count + 1);
729 else if (!patternValid && !otherValid) {
730 context.error_handler.PropertyViolations(context.patternPropertiesValidators, count + 1);
736 const uint64_t h = context.factory.GetHashCode(context.hasher);
740 context.error_handler.DisallowedValue();
747 if (!context.validators[i]->IsValid()) {
748 context.error_handler.NotAllOf(&context.validators[
allOf_.begin],
allOf_.count);
754 if (context.validators[i]->IsValid())
756 context.error_handler.NoneOf(&context.validators[
anyOf_.begin],
anyOf_.count);
762 bool oneValid =
false;
764 if (context.validators[i]->IsValid()) {
766 context.error_handler.NotOneOf(&context.validators[
oneOf_.begin],
oneOf_.count);
772 context.error_handler.NotOneOf(&context.validators[
oneOf_.begin],
oneOf_.count);
778 context.error_handler.Disallowed();
864 context.error_handler.DoesNotMatch(
str, length);
878 context.propertyExist =
static_cast<bool*
>(context.factory.MallocState(
sizeof(
bool) *
propertyCount_));
879 std::memset(context.propertyExist, 0,
sizeof(
bool) *
propertyCount_);
884 context.patternPropertiesSchemas =
static_cast<const SchemaType**
>(context.factory.MallocState(
sizeof(
const SchemaType*) * count));
885 context.patternPropertiesSchemaCount = 0;
886 std::memset(context.patternPropertiesSchemas, 0,
sizeof(
SchemaType*) * count);
894 context.patternPropertiesSchemaCount = 0;
897 context.patternPropertiesSchemas[context.patternPropertiesSchemaCount++] =
patternProperties_[i].schema;
904 if (context.patternPropertiesSchemaCount > 0) {
905 context.patternPropertiesSchemas[context.patternPropertiesSchemaCount++] =
properties_[index].schema;
912 if (context.propertyExist)
913 context.propertyExist[index] =
true;
933 if (context.patternPropertiesSchemaCount == 0) {
934 context.error_handler.DisallowedProperty(
str, len);
943 context.error_handler.StartMissingProperties();
945 if (
properties_[index].required && !context.propertyExist[index])
946 if (
properties_[index].schema->defaultValueLength_ == 0 )
948 if (context.error_handler.EndMissingProperties())
953 context.error_handler.TooFewProperties(memberCount,
minProperties_);
958 context.error_handler.TooManyProperties(memberCount,
maxProperties_);
963 context.error_handler.StartDependencyErrors();
966 if (context.propertyExist[sourceIndex]) {
967 if (
source.dependencies) {
968 context.error_handler.StartMissingDependentProperties();
970 if (
source.dependencies[targetIndex] && !context.propertyExist[targetIndex])
971 context.error_handler.AddMissingDependentProperty(
properties_[targetIndex].
name);
972 context.error_handler.EndMissingDependentProperties(
source.name);
974 else if (
source.dependenciesSchema) {
976 if (!dependenciesValidator->
IsValid())
977 context.error_handler.AddDependencySchemaError(
source.name, dependenciesValidator);
981 if (context.error_handler.EndDependencyErrors())
994 context.arrayElementIndex = 0;
995 context.inArray =
true;
1001 context.inArray =
false;
1004 context.error_handler.TooFewItems(elementCount,
minItems_);
1009 context.error_handler.TooManyItems(elementCount,
maxItems_);
1017#define RAPIDJSON_STRING_(name, ...) \
1018 static const ValueType& Get##name##String() {\
1019 static const Ch s[] = { __VA_ARGS__, '\0' };\
1020 static const ValueType v(s, static_cast<SizeType>(sizeof(s) / sizeof(Ch) - 1));\
1037 RAPIDJSON_STRING_(Properties,
'p',
'r',
'o',
'p',
'e',
'r',
't',
'i',
'e',
's')
1039 RAPIDJSON_STRING_(Dependencies,
'd',
'e',
'p',
'e',
'n',
'd',
'e',
'n',
'c',
'i',
'e',
's')
1040 RAPIDJSON_STRING_(PatternProperties,
'p',
'a',
't',
't',
'e',
'r',
'n',
'P',
'r',
'o',
'p',
'e',
'r',
't',
'i',
'e',
's')
1041 RAPIDJSON_STRING_(AdditionalProperties,
'a',
'd',
'd',
'i',
't',
'i',
'o',
'n',
'a',
'l',
'P',
'r',
'o',
'p',
'e',
'r',
't',
'i',
'e',
's')
1042 RAPIDJSON_STRING_(MinProperties,
'm',
'i',
'n',
'P',
'r',
'o',
'p',
'e',
'r',
't',
'i',
'e',
's')
1043 RAPIDJSON_STRING_(MaxProperties,
'm',
'a',
'x',
'P',
'r',
'o',
'p',
'e',
'r',
't',
'i',
'e',
's')
1047 RAPIDJSON_STRING_(AdditionalItems,
'a',
'd',
'd',
'i',
't',
'i',
'o',
'n',
'a',
'l',
'I',
't',
'e',
'm',
's')
1048 RAPIDJSON_STRING_(UniqueItems,
'u',
'n',
'i',
'q',
'u',
'e',
'I',
't',
'e',
'm',
's')
1054 RAPIDJSON_STRING_(ExclusiveMinimum,
'e',
'x',
'c',
'l',
'u',
's',
'i',
'v',
'e',
'M',
'i',
'n',
'i',
'm',
'u',
'm')
1055 RAPIDJSON_STRING_(ExclusiveMaximum,
'e',
'x',
'c',
'l',
'u',
's',
'i',
'v',
'e',
'M',
'a',
'x',
'i',
'm',
'u',
'm')
1056 RAPIDJSON_STRING_(MultipleOf,
'm',
'u',
'l',
't',
'i',
'p',
'l',
'e',
'O',
'f')
1059#undef RAPIDJSON_STRING_
1073#if RAPIDJSON_SCHEMA_USE_INTERNALREGEX
1075#elif RAPIDJSON_SCHEMA_USE_STDREGEX
1076 typedef std::basic_regex<Ch> RegexType;
1089 template <
typename V1,
typename V2>
1091 for (
typename V1::ConstValueIterator itr =
a.Begin(); itr !=
a.End(); ++itr)
1099 typename ValueType::ConstMemberIterator itr =
value.FindMember(
name);
1100 return itr !=
value.MemberEnd() ? &(itr->value) : 0;
1111 if (v->IsUint64() && v->GetUint64() <=
SizeType(~0))
1112 out =
static_cast<SizeType>(v->GetUint64());
1117 if (v->IsArray() && v->Size() > 0) {
1119 out.count = v->Size();
1121 memset(out.schemas, 0,
sizeof(
Schema*)* out.count);
1122 for (
SizeType i = 0; i < out.count; i++)
1123 schemaDocument.CreateSchema(&out.schemas[i], q.Append(i,
allocator_), (*v)[i], document);
1130#if RAPIDJSON_SCHEMA_USE_INTERNALREGEX
1131 template <
typename ValueType>
1132 RegexType* CreatePattern(
const ValueType&
value) {
1133 if (
value.IsString()) {
1134 RegexType* r =
new (allocator_->Malloc(
sizeof(RegexType))) RegexType(
value.GetString(), allocator_);
1135 if (!r->IsValid()) {
1137 AllocatorType::Free(r);
1145 static bool IsPatternMatch(
const RegexType* pattern,
const Ch *
str,
SizeType) {
1147 return rs.Search(
str);
1149#elif RAPIDJSON_SCHEMA_USE_STDREGEX
1150 template <
typename ValueType>
1151 RegexType* CreatePattern(
const ValueType&
value) {
1152 if (
value.IsString())
1154 return new (allocator_->Malloc(
sizeof(RegexType))) RegexType(
value.GetString(), std::size_t(
value.GetStringLength()), std::regex_constants::ECMAScript);
1156 catch (
const std::regex_error&) {
1161 static bool IsPatternMatch(
const RegexType* pattern,
const Ch *
str,
SizeType length) {
1162 std::match_results<const Ch*>
r;
1163 return std::regex_search(
str,
str + length, r, *pattern);
1166 template <
typename ValueType>
1183 if (
enum_ || context.arrayUniqueness)
1184 context.hasher = context.factory.CreateHasher();
1206 context.validators[
properties_[i].dependenciesValidatorIndex] = context.factory.CreateSchemaValidator(*
properties_[i].dependenciesSchema);
1214 for (
SizeType i = 0; i < schemas.count; i++)
1215 context.validators[schemas.begin + i] = context.factory.CreateSchemaValidator(*schemas.schemas[i]);
1224 (std::memcmp(
properties_[index].name.GetString(),
str,
sizeof(
Ch) * len) == 0))
1269 context.error_handler.NotMultipleOf(i,
multipleOf_);
1317 context.error_handler.NotMultipleOf(i,
multipleOf_);
1346 double q = std::floor(
a /
b);
1347 double r =
a - q *
b;
1442template<
typename Stack,
typename Ch>
1445 *documentStack.template Push<Ch>() =
'/';
1447 size_t length =
static_cast<size_t>((
sizeof(
SizeType) == 4 ?
u32toa(index, buffer) :
u64toa(index, buffer)) - buffer);
1448 for (
size_t i = 0; i < length; i++)
1449 *documentStack.template Push<Ch>() =
static_cast<Ch>(buffer[i]);
1454template <
typename Stack>
1458 char *buffer = documentStack.template Push<char>(1 + 10);
1461 documentStack.template Pop<char>(
static_cast<size_t>(10 - (end - buffer)));
1464 char *buffer = documentStack.template Push<char>(1 + 20);
1467 documentStack.template Pop<char>(
static_cast<size_t>(20 - (end - buffer)));
1477template <
typename SchemaDocumentType>
1480 typedef typename SchemaDocumentType::Ch
Ch;
1498template <
typename ValueT,
typename Allocator = CrtAllocator>
1510 template <
typename,
typename,
typename>
1548 SchemaRefEntry* refEntry =
schemaRef_.template Pop<SchemaRefEntry>(1);
1550 if (refEntry->schema)
1551 *refEntry->schema =
s;
1558 else if (refEntry->schema)
1561 refEntry->~SchemaRefEntry();
1569#if RAPIDJSON_HAS_CXX11_RVALUE_REFS
1579 uri_(std::move(rhs.uri_))
1581 rhs.remoteProvider_ = 0;
1583 rhs.ownAllocator_ = 0;
1591 schemaMap_.template Pop<SchemaEntry>(1)->~SchemaEntry();
1645 for (
SizeType i = 0; i < v.Size(); i++)
1662 static const Ch kRefString[] = {
'$',
'r',
'e',
'f',
'\0' };
1663 static const ValueType kRefValue(kRefString, 4);
1666 if (itr == v.MemberEnd())
1669 if (itr->value.IsString()) {
1670 SizeType len = itr->value.GetStringLength();
1672 const Ch*
s = itr->value.GetString();
1674 while (i < len &&
s[i] !=
'#')
1692 else if (
s[i] ==
'#') {
1709 for (
const SchemaEntry* target =
schemaMap_.template Bottom<SchemaEntry>(); target !=
schemaMap_.template End<SchemaEntry>(); ++target)
1710 if (
pointer == target->pointer)
1711 return target->schema;
1716 for (
const SchemaEntry* target =
schemaMap_.template Bottom<SchemaEntry>(); target !=
schemaMap_.template End<SchemaEntry>(); ++target)
1717 if (schema == target->schema)
1718 return target->pointer;
1758 typename SchemaDocumentType,
1771 typedef typename EncodingType::Ch
Ch;
1783 const SchemaDocumentType& schemaDocument,
1784 StateAllocator* allocator = 0,
1789 root_(schemaDocument.GetRoot()),
1813 const SchemaDocumentType& schemaDocument,
1814 OutputHandler& outputHandler,
1815 StateAllocator* allocator = 0,
1820 root_(schemaDocument.GetRoot()),
1892 exclusive ? &SchemaType::GetExclusiveMaximumString : 0);
1896 exclusive ? &SchemaType::GetExclusiveMaximumString : 0);
1900 exclusive ? &SchemaType::GetExclusiveMaximumString : 0);
1904 exclusive ? &SchemaType::GetExclusiveMinimumString : 0);
1908 exclusive ? &SchemaType::GetExclusiveMinimumString : 0);
1912 exclusive ? &SchemaType::GetExclusiveMinimumString : 0);
1975 for (
SizeType i = 0; i < count; ++i)
2030 for (
SizeType i = 0; i < count; ++i) {
2035 AddErrorArray(SchemaType::GetAnyOfString(), subvalidators, count);
2038 AddErrorArray(SchemaType::GetOneOfString(), subvalidators, count);
2045#define RAPIDJSON_STRING_(name, ...) \
2046 static const StringRefType& Get##name##String() {\
2047 static const Ch s[] = { __VA_ARGS__, '\0' };\
2048 static const StringRefType v(s, static_cast<SizeType>(sizeof(s) / sizeof(Ch) - 1)); \
2052 RAPIDJSON_STRING_(InstanceRef,
'i',
'n',
's',
't',
'a',
'n',
'c',
'e',
'R',
'e',
'f')
2056 RAPIDJSON_STRING_(
Disallowed,
'd',
'i',
's',
'a',
'l',
'l',
'o',
'w',
'e',
'd')
2059 RAPIDJSON_STRING_(Duplicates,
'd',
'u',
'p',
'l',
'i',
'c',
'a',
't',
'e',
's')
2061#undef RAPIDJSON_STRING_
2063#if RAPIDJSON_SCHEMA_VERBOSE
2064#define RAPIDJSON_SCHEMA_HANDLE_BEGIN_VERBOSE_() \
2065RAPIDJSON_MULTILINEMACRO_BEGIN\
2066 *documentStack_.template Push<Ch>() = '\0';\
2067 documentStack_.template Pop<Ch>(1);\
2068 internal::PrintInvalidDocument(documentStack_.template Bottom<Ch>());\
2069RAPIDJSON_MULTILINEMACRO_END
2071#define RAPIDJSON_SCHEMA_HANDLE_BEGIN_VERBOSE_()
2074#define RAPIDJSON_SCHEMA_HANDLE_BEGIN_(method, arg1)\
2075 if (!valid_) return false; \
2076 if (!BeginValue() || !CurrentSchema().method arg1) {\
2077 RAPIDJSON_SCHEMA_HANDLE_BEGIN_VERBOSE_();\
2078 return valid_ = false;\
2081#define RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(method, arg2)\
2082 for (Context* context = schemaStack_.template Bottom<Context>(); context != schemaStack_.template End<Context>(); context++) {\
2083 if (context->hasher)\
2084 static_cast<HasherType*>(context->hasher)->method arg2;\
2085 if (context->validators)\
2086 for (SizeType i_ = 0; i_ < context->validatorCount; i_++)\
2087 static_cast<GenericSchemaValidator*>(context->validators[i_])->method arg2;\
2088 if (context->patternPropertiesValidators)\
2089 for (SizeType i_ = 0; i_ < context->patternPropertiesValidatorCount; i_++)\
2090 static_cast<GenericSchemaValidator*>(context->patternPropertiesValidators[i_])->method arg2;\
2093#define RAPIDJSON_SCHEMA_HANDLE_END_(method, arg2)\
2094 return valid_ = EndValue() && (!outputHandler_ || outputHandler_->method arg2)
2096#define RAPIDJSON_SCHEMA_HANDLE_VALUE_(method, arg1, arg2) \
2097 RAPIDJSON_SCHEMA_HANDLE_BEGIN_ (method, arg1);\
2098 RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(method, arg2);\
2099 RAPIDJSON_SCHEMA_HANDLE_END_ (method, arg2)
2120 if (!
valid_)
return false;
2128 if (!
valid_)
return false;
2141 if (!
valid_)
return false;
2147#undef RAPIDJSON_SCHEMA_HANDLE_BEGIN_VERBOSE_
2148#undef RAPIDJSON_SCHEMA_HANDLE_BEGIN_
2149#undef RAPIDJSON_SCHEMA_HANDLE_PARALLEL_
2150#undef RAPIDJSON_SCHEMA_HANDLE_VALUE_
2164 StateAllocator::Free(v);
2178 StateAllocator::Free(
h);
2186 StateAllocator::Free(p);
2195 const SchemaDocumentType& schemaDocument,
2197 const char* basePath,
size_t basePathSize,
2201 StateAllocator* allocator = 0,
2220 if (basePath && basePathSize)
2248 CurrentContext().objectPatternValidatorType = patternValidatorType;
2249 ISchemaValidator**& va =
CurrentContext().patternPropertiesValidators;
2251 va =
static_cast<ISchemaValidator**
>(
MallocState(
sizeof(ISchemaValidator*) * count));
2252 for (
SizeType i = 0; i < count; i++)
2265#if RAPIDJSON_SCHEMA_VERBOSE
2280 if (context.valueUniqueness) {
2285 if (itr->GetUint64() ==
h) {
2303 for (
SizeType i = 0; i < len; i++) {
2304 if (
str[i] ==
'~') {
2308 else if (
str[i] ==
'/') {
2322 a->~HashCodeArray();
2323 StateAllocator::Free(
a);
2331 ((parent && instancePointer.GetTokenCount() > 0)
2332 ?
PointerType(instancePointer.GetTokens(), instancePointer.GetTokenCount() - 1)
2333 : instancePointer).StringifyUriFragment(sb);
2349 if (member ==
error_.MemberEnd())
2352 if (member->value.IsObject()) {
2355 member->value = errors;
2383 ISchemaValidator** subvalidators,
SizeType count) {
2385 for (
SizeType i = 0; i < count; ++i)
2409#if RAPIDJSON_SCHEMA_VERBOSE
2430 unsigned parseFlags,
2431 typename InputStream,
2432 typename SourceEncoding,
2438 typedef typename InputStream::Ch
Ch;
2448 template <
typename Handler>
2480 const SchemaDocumentType&
sd_;
#define s(x, c)
Definition aesb.c:47
cryptonote::block b
Definition block.cpp:40
static uint64_t h
Definition blockchain_stats.cpp:55
C-runtime library allocator.
Definition allocators.h:75
Represents a JSON Pointer. Use Pointer for UTF8 encoding and default allocator.
Definition pointer.h:79
SAX-style JSON parser. Use Reader for UTF8 encoding and default allocator.
Definition reader.h:537
JSON schema document.
Definition schema.h:1499
const URIType & GetURI() const
Definition schema.h:1601
internal::Stack< CrtAllocator > schemaRef_
Definition schema.h:1733
const SchemaType * GetTypeless() const
Definition schema.h:1722
bool HandleRefSchema(const PointerType &source, const SchemaType **schema, const ValueType &v, const ValueType &document)
Definition schema.h:1661
const SchemaType * GetSchema(const PointerType &pointer) const
Definition schema.h:1708
void CreateSchemaRecursive(const SchemaType **schema, const PointerType &pointer, const ValueType &v, const ValueType &document)
Definition schema.h:1632
static const size_t kInitialSchemaMapSize
Definition schema.h:1724
const SchemaType * root_
Definition schema.h:1730
static const size_t kInitialSchemaRefSize
Definition schema.h:1725
const SchemaType & GetRoot() const
Get the root schema.
Definition schema.h:1604
~GenericSchemaDocument()
Destructor.
Definition schema.h:1589
URIType uri_
Definition schema.h:1734
SchemaType * typeless_
Definition schema.h:1731
internal::Stack< CrtAllocator > schemaMap_
Definition schema.h:1732
CrtAllocator * allocator_
Definition schema.h:1728
CrtAllocator * ownAllocator_
Definition schema.h:1729
GenericSchemaDocument & operator=(const GenericSchemaDocument &)
Prohibit assignment.
IGenericRemoteSchemaDocumentProvider< GenericSchemaDocument > IRemoteSchemaDocumentProviderType
Definition schema.h:1502
void CreateSchema(const SchemaType **schema, const PointerType &pointer, const ValueType &v, const ValueType &document)
Definition schema.h:1649
EncodingType::Ch Ch
Definition schema.h:1505
CrtAllocator AllocatorType
Definition schema.h:1503
GenericValue< EncodingType, CrtAllocator > URIType
Definition schema.h:1508
internal::Schema< GenericSchemaDocument > SchemaType
Definition schema.h:1506
ValueType::EncodingType EncodingType
Definition schema.h:1504
PointerType GetPointer(const SchemaType *schema) const
Definition schema.h:1715
Value ValueType
Definition schema.h:1501
GenericSchemaDocument(const GenericSchemaDocument &)
Prohibit copying.
IRemoteSchemaDocumentProviderType * remoteProvider_
Definition schema.h:1727
GenericSchemaDocument(const ValueType &document, const Ch *uri=0, SizeType uriLength=0, IRemoteSchemaDocumentProviderType *remoteProvider=0, Allocator *allocator=0)
Constructor.
Definition schema.h:1523
GenericPointer< ValueType, CrtAllocator > PointerType
Definition schema.h:1507
friend class GenericSchemaValidator
Definition schema.h:1511
JSON Schema Validator.
Definition schema.h:1765
static const size_t kDefaultDocumentStackCapacity
Definition schema.h:2397
virtual void DestroryHasher(void *hasher)
Definition schema.h:2175
ValueType missingDependents_
Definition schema.h:2407
Context & CurrentContext()
Definition schema.h:2393
void AddError(ValueType &keyword, ValueType &error)
Definition schema.h:2347
void BelowMinimum(int64_t actual, const SValue &expected, bool exclusive)
Definition schema.h:1902
CrtAllocator * ownStateAllocator_
Definition schema.h:2401
CrtAllocator * stateAllocator_
Definition schema.h:2400
GenericSchemaValidator(const SchemaDocumentType &schemaDocument, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity)
Constructor without output handler.
Definition schema.h:1782
void DisallowedValue()
Definition schema.h:2012
ValueType & GetError()
Gets the error object.
Definition schema.h:1858
void AddCurrentError(const typename SchemaType::ValueType &keyword, bool parent=false)
Definition schema.h:2361
void TooLong(const Ch *str, SizeType length, SizeType expected)
Definition schema.h:1915
void AddDependencySchemaError(const SValue &sourceName, ISchemaValidator *subvalidator)
Definition schema.h:1998
void PropertyViolations(ISchemaValidator **subvalidators, SizeType count)
Definition schema.h:1974
void DisallowedItem(SizeType index)
Definition schema.h:1929
bool String(const Ch *str, SizeType length, bool copy)
Definition schema.h:2110
bool BeginValue()
Definition schema.h:2230
SchemaType::SValue SValue
Definition schema.h:1770
~GenericSchemaValidator()
Destructor.
Definition schema.h:1837
void StartMissingProperties()
Definition schema.h:1959
void NotAllOf(ISchemaValidator **subvalidators, SizeType count)
Definition schema.h:2029
const SchemaDocument * schemaDocument_
Definition schema.h:2398
GenericValue< EncodingType, CrtAllocator > ValueType
Definition schema.h:1773
void DisallowedProperty(const Ch *name, SizeType length)
Definition schema.h:1978
virtual void * CreateHasher()
Definition schema.h:2167
void Reset()
Reset the internal states.
Definition schema.h:1843
void AboveMaximum(int64_t actual, const SValue &expected, bool exclusive)
Definition schema.h:1890
virtual void FreeState(void *p)
Definition schema.h:2185
bool EndMissingProperties()
Definition schema.h:1965
void MergeError(ValueType &other)
Definition schema.h:2366
bool StartObject()
Definition schema.h:2113
PointerType GetInvalidSchemaPointer() const
Gets the JSON pointer pointed to the invalid schema.
Definition schema.h:1862
void NotMultipleOf(uint64_t actual, const SValue &expected)
Definition schema.h:1884
GenericStringRef< Ch > StringRefType
Definition schema.h:1772
bool valid_
Definition schema.h:2408
bool EndArray(SizeType elementCount)
Definition schema.h:2140
void AddExpectedType(const typename SchemaType::ValueType &expectedType)
Definition schema.h:2019
virtual ISchemaValidator * CreateSchemaValidator(const SchemaType &root)
Definition schema.h:2153
RAPIDJSON_FORCEINLINE void PopSchema()
Definition schema.h:2319
bool Key(const Ch *str, SizeType len, bool copy)
Definition schema.h:2119
bool Null()
Definition schema.h:2101
const SchemaType & CurrentSchema() const
Definition schema.h:2392
const SchemaType & root_
Definition schema.h:2399
void StartDependencyErrors()
Definition schema.h:1984
void TooShort(const Ch *str, SizeType length, SizeType expected)
Definition schema.h:1919
void TooManyItems(SizeType actualCount, SizeType expectedCount)
Definition schema.h:1938
void DuplicateItems(SizeType index1, SizeType index2)
Definition schema.h:1942
void AddMissingDependentProperty(const SValue &targetName)
Definition schema.h:1990
GenericSchemaValidator(const SchemaDocumentType &schemaDocument, const SchemaType &root, const char *basePath, size_t basePathSize, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity)
Definition schema.h:2194
EncodingType::Ch Ch
Definition schema.h:1771
void AddMissingProperty(const SValue &name)
Definition schema.h:1962
virtual bool IsValid() const
Checks whether the current state is valid.
Definition schema.h:1855
void AboveMaximum(uint64_t actual, const SValue &expected, bool exclusive)
Definition schema.h:1894
StateAllocator & GetStateAllocator()
Definition schema.h:2224
internal::Stack< CrtAllocator > documentStack_
Definition schema.h:2403
void StartDisallowedType()
Definition schema.h:2016
ValueType error_
Definition schema.h:2405
virtual void * MallocState(size_t size)
Definition schema.h:2181
bool Bool(bool b)
Definition schema.h:2102
bool Uint(unsigned u)
Definition schema.h:2104
bool EndObject(SizeType memberCount)
Definition schema.h:2127
void AddNumberError(const typename SchemaType::ValueType &keyword, ValueType &actual, const SValue &expected, const typename SchemaType::ValueType &(*exclusive)()=0)
Definition schema.h:2372
static const size_t kDefaultSchemaStackCapacity
Definition schema.h:2396
void NoneOf(ISchemaValidator **subvalidators, SizeType count)
Definition schema.h:2034
void TooFewProperties(SizeType actualCount, SizeType expectedCount)
Definition schema.h:1955
void NotMultipleOf(int64_t actual, const SValue &expected)
Definition schema.h:1881
const Ch * GetInvalidSchemaKeyword() const
Gets the keyword of invalid schema.
Definition schema.h:1867
bool EndDependencyErrors()
Definition schema.h:2002
internal::Hasher< EncodingType, CrtAllocator > HasherType
Definition schema.h:2192
bool StartArray()
Definition schema.h:2134
void AboveMaximum(double actual, const SValue &expected, bool exclusive)
Definition schema.h:1898
bool Uint64(uint64_t u)
Definition schema.h:2106
virtual uint64_t GetHashCode(void *hasher)
Definition schema.h:2171
BaseReaderHandler< UTF8< char >, void > * outputHandler_
Definition schema.h:2404
PointerType GetInvalidDocumentPointer() const
Gets the JSON pointer pointed to the invalid value.
Definition schema.h:1872
GenericSchemaValidator(const SchemaDocumentType &schemaDocument, OutputHandler &outputHandler, StateAllocator *allocator=0, size_t schemaStackCapacity=kDefaultSchemaStackCapacity, size_t documentStackCapacity=kDefaultDocumentStackCapacity)
Constructor with output handler.
Definition schema.h:1812
void StartMissingDependentProperties()
Definition schema.h:1987
bool Int64(int64_t i)
Definition schema.h:2105
SchemaType::Context Context
Definition schema.h:2190
SchemaDocument::SchemaType SchemaType
Definition schema.h:1767
const Context & CurrentContext() const
Definition schema.h:2394
void Disallowed()
Definition schema.h:2040
SchemaType::EncodingType EncodingType
Definition schema.h:1769
void AppendToken(const Ch *str, SizeType len)
Definition schema.h:2300
void BelowMinimum(uint64_t actual, const SValue &expected, bool exclusive)
Definition schema.h:1906
void NotOneOf(ISchemaValidator **subvalidators, SizeType count)
Definition schema.h:2037
const ValueType & GetError() const
Definition schema.h:1859
void TooManyProperties(SizeType actualCount, SizeType expectedCount)
Definition schema.h:1951
bool Int(int i)
Definition schema.h:2103
SchemaDocument::PointerType PointerType
Definition schema.h:1768
void EndDisallowedType(const typename SchemaType::ValueType &actualType)
Definition schema.h:2022
GenericValue< UTF8<>, CrtAllocator > HashCodeArray
Definition schema.h:2191
virtual void DestroySchemaValidator(ISchemaValidator *validator)
Definition schema.h:2161
bool RawNumber(const Ch *str, SizeType length, bool copy)
Definition schema.h:2108
internal::Stack< CrtAllocator > schemaStack_
Definition schema.h:2402
void NotMultipleOf(double actual, const SValue &expected)
Definition schema.h:1887
RAPIDJSON_FORCEINLINE void PushSchema(const SchemaType &schema)
Definition schema.h:2317
bool EndValue()
Definition schema.h:2261
bool Double(double d)
Definition schema.h:2107
void DoesNotMatch(const Ch *str, SizeType length)
Definition schema.h:1923
void TooFewItems(SizeType actualCount, SizeType expectedCount)
Definition schema.h:1934
void AddErrorArray(const typename SchemaType::ValueType &keyword, ISchemaValidator **subvalidators, SizeType count)
Definition schema.h:2382
void AddErrorLocation(ValueType &result, bool parent)
Definition schema.h:2328
ValueType currentError_
Definition schema.h:2406
void EndMissingDependentProperties(const SValue &sourceName)
Definition schema.h:1993
void BelowMinimum(double actual, const SValue &expected, bool exclusive)
Definition schema.h:1910
Represents an in-memory output stream.
Definition stringbuffer.h:41
const Ch * GetString() const
Definition stringbuffer.h:73
void Clear()
Definition stringbuffer.h:60
size_t GetSize() const
Get the size of string in bytes in the string buffer.
Definition stringbuffer.h:82
Ch * Push(size_t count)
Definition stringbuffer.h:69
Represents a JSON value. Use Value for UTF8 encoding and default allocator.
Definition document.h:575
UTF8<> EncodingType
Definition document.h:579
GenericMemberIterator< false, EncodingType, CrtAllocator >::Iterator MemberIterator
Definition document.h:583
const GenericValue * ConstValueIterator
Constant value iterator for iterating in array.
Definition document.h:586
GenericMemberIterator< true, UTF8<>, MemoryPoolAllocator<> >::Iterator ConstMemberIterator
Definition document.h:584
virtual ~IGenericRemoteSchemaDocumentProvider()
Definition schema.h:1482
SchemaDocument::Ch Ch
Definition schema.h:1480
virtual const SchemaDocumentType * GetRemoteDocument(const Ch *uri, SizeType length)=0
ValueType error_
Definition schema.h:2487
const PointerType & GetInvalidDocumentPointer() const
Definition schema.h:2475
PointerType invalidSchemaPointer_
Definition schema.h:2483
SchemaDocumentType::PointerType PointerType
Definition schema.h:2437
const Ch * invalidSchemaKeyword_
Definition schema.h:2484
bool IsValid() const
Definition schema.h:2472
bool isValid_
Definition schema.h:2488
const PointerType & GetInvalidSchemaPointer() const
Definition schema.h:2473
InputStream::Ch Ch
Definition schema.h:2438
bool operator()(Handler &handler)
Definition schema.h:2449
StackAllocator allocator_
Definition schema.h:2486
ParseResult parseResult_
Definition schema.h:2482
const SchemaDocumentType & sd_
Definition schema.h:2480
const Ch * GetInvalidSchemaKeyword() const
Definition schema.h:2474
const ParseResult & GetParseResult() const
Definition schema.h:2471
PointerType invalidDocumentPointer_
Definition schema.h:2485
SchemaValidatingReader(InputStream &is, const SchemaDocumentType &sd)
Constructor.
Definition schema.h:2446
const ValueType & GetError() const
Definition schema.h:2476
GenericValue< SourceEncoding, StackAllocator > ValueType
Definition schema.h:2439
InputStream & is_
Definition schema.h:2479
Definition gtest-string.h:58
Regular expression engine with subset of ECMAscript grammar.
Definition regex.h:114
bool WriteBuffer(Type type, const void *data, size_t len)
Definition schema.h:292
static const size_t kDefaultSize
Definition schema.h:279
bool Bool(bool b)
Definition schema.h:227
bool Uint64(uint64_t u)
Definition schema.h:231
bool StartObject()
Definition schema.h:250
bool Key(const Ch *str, SizeType len, bool copy)
Definition schema.h:251
bool StartArray()
Definition schema.h:261
Encoding::Ch Ch
Definition schema.h:222
bool Uint(unsigned u)
Definition schema.h:229
bool Null()
Definition schema.h:226
bool EndObject(SizeType memberCount)
Definition schema.h:252
Hasher(Allocator *allocator=0, size_t stackCapacity=kDefaultSize)
Definition schema.h:224
bool Double(double d)
Definition schema.h:232
bool String(const Ch *str, SizeType len, bool)
Definition schema.h:245
bool Int(int i)
Definition schema.h:228
bool WriteNumber(const Number &n)
Definition schema.h:290
uint64_t GetHashCode() const
Definition schema.h:273
static uint64_t Hash(uint64_t h, uint64_t d)
Definition schema.h:302
bool EndArray(SizeType elementCount)
Definition schema.h:262
bool Int64(int64_t i)
Definition schema.h:230
bool IsValid() const
Definition schema.h:271
bool RawNumber(const Ch *str, SizeType len, bool)
Definition schema.h:240
Stack< StateAllocator > stack_
Definition schema.h:309
bool WriteType(Type type)
Definition schema.h:288
virtual void DestroySchemaValidator(ISchemaValidator *validator)=0
virtual void FreeState(void *p)=0
virtual ISchemaValidator * CreateSchemaValidator(const SchemaType &)=0
virtual void DestroryHasher(void *hasher)=0
virtual void * CreateHasher()=0
virtual void * MallocState(size_t size)=0
virtual uint64_t GetHashCode(void *hasher)=0
virtual ~ISchemaStateFactory()
Definition schema.h:149
virtual bool IsValid() const =0
virtual ~ISchemaValidator()
Definition schema.h:139
virtual void EndMissingDependentProperties(const SValue &sourceName)=0
virtual void DisallowedItem(SizeType index)=0
virtual void NotMultipleOf(int64_t actual, const SValue &expected)=0
SchemaType::Ch Ch
Definition schema.h:165
SchemaType::SValue SValue
Definition schema.h:166
virtual void AddMissingDependentProperty(const SValue &targetName)=0
virtual void TooManyProperties(SizeType actualCount, SizeType expectedCount)=0
virtual bool EndMissingProperties()=0
virtual void DuplicateItems(SizeType index1, SizeType index2)=0
virtual void AddMissingProperty(const SValue &name)=0
virtual void NotAllOf(ISchemaValidator **subvalidators, SizeType count)=0
virtual void AddDependencySchemaError(const SValue &souceName, ISchemaValidator *subvalidator)=0
virtual void Disallowed()=0
virtual void TooShort(const Ch *str, SizeType length, SizeType expected)=0
virtual void BelowMinimum(int64_t actual, const SValue &expected, bool exclusive)=0
virtual void AboveMaximum(double actual, const SValue &expected, bool exclusive)=0
virtual void AddExpectedType(const typename SchemaType::ValueType &expectedType)=0
virtual void DisallowedProperty(const Ch *name, SizeType length)=0
virtual void NoneOf(ISchemaValidator **subvalidators, SizeType count)=0
virtual void NotOneOf(ISchemaValidator **subvalidators, SizeType count)=0
virtual void AboveMaximum(uint64_t actual, const SValue &expected, bool exclusive)=0
virtual ~IValidationErrorHandler()
Definition schema.h:168
virtual void AboveMaximum(int64_t actual, const SValue &expected, bool exclusive)=0
virtual bool EndDependencyErrors()=0
virtual void BelowMinimum(double actual, const SValue &expected, bool exclusive)=0
virtual void TooManyItems(SizeType actualCount, SizeType expectedCount)=0
virtual void DoesNotMatch(const Ch *str, SizeType length)=0
virtual void StartDisallowedType()=0
virtual void BelowMinimum(uint64_t actual, const SValue &expected, bool exclusive)=0
virtual void StartDependencyErrors()=0
virtual void PropertyViolations(ISchemaValidator **subvalidators, SizeType count)=0
virtual void StartMissingProperties()=0
virtual void DisallowedValue()=0
virtual void EndDisallowedType(const typename SchemaType::ValueType &actualType)=0
virtual void NotMultipleOf(uint64_t actual, const SValue &expected)=0
virtual void NotMultipleOf(double actual, const SValue &expected)=0
virtual void TooFewProperties(SizeType actualCount, SizeType expectedCount)=0
virtual void TooLong(const Ch *str, SizeType length, SizeType expected)=0
virtual void StartMissingDependentProperties()=0
virtual void TooFewItems(SizeType actualCount, SizeType expectedCount)=0
bool Int64(Context &context, int64_t i) const
Definition schema.h:813
void CreateSchemaValidators(Context &context, const SchemaArray &schemas) const
Definition schema.h:1213
bool exclusiveMaximum_
Definition schema.h:1437
SizeType notValidatorIndex_
Definition schema.h:1406
bool StartArray(Context &context) const
Definition schema.h:988
bool CheckUint(Context &context, uint64_t i) const
Definition schema.h:1280
RegexType * CreatePattern(const ValueType &)
Definition schema.h:1167
bool StartObject(Context &context) const
Definition schema.h:871
SchemaDocumentType::PointerType PointerType
Definition schema.h:400
bool additionalProperties_
Definition schema.h:1415
bool exclusiveMinimum_
Definition schema.h:1436
bool Int(Context &context, int i) const
Definition schema.h:801
bool Uint64(Context &context, uint64_t u) const
Definition schema.h:819
bool uniqueItems_
Definition schema.h:1427
SizeType maxLength_
Definition schema.h:1431
bool FindPropertyIndex(const ValueType &name, SizeType *outIndex) const
Definition schema.h:1219
AllocatorType * allocator_
Definition schema.h:1394
static void AssignIfExist(SizeType &out, const ValueType &value, const ValueType &name)
Definition schema.h:1109
IValidationErrorHandler< Schema > ErrorHandler
Definition schema.h:406
Schema(SchemaDocumentType *schemaDocument, const PointerType &p, const ValueType &value, const ValueType &document, AllocatorType *allocator)
Definition schema.h:409
SizeType validatorCount_
Definition schema.h:1405
SValue maximum_
Definition schema.h:1434
bool CheckDoubleMultipleOf(Context &context, double d) const
Definition schema.h:1344
SchemaArray oneOf_
Definition schema.h:1402
SizeType minItems_
Definition schema.h:1424
~Schema()
Definition schema.h:647
static void AssignIfExist(bool &out, const ValueType &value, const ValueType &name)
Definition schema.h:1103
char RegexType
Definition schema.h:1078
void AddType(const ValueType &type)
Definition schema.h:1172
bool additionalItems_
Definition schema.h:1426
bool CheckDoubleMinimum(Context &context, double d) const
Definition schema.h:1328
bool EndObject(Context &context, SizeType memberCount) const
Definition schema.h:941
SizeType maxProperties_
Definition schema.h:1414
Property * properties_
Definition schema.h:1408
void DisallowedType(Context &context, const ValueType &actualType) const
Definition schema.h:1355
bool CheckInt(Context &context, int64_t i) const
Definition schema.h:1232
const SchemaType * typeless_
Definition schema.h:1397
SchemaDocumentType::AllocatorType AllocatorType
Definition schema.h:399
bool EndArray(Context &context, SizeType elementCount) const
Definition schema.h:1000
const SchemaType * additionalPropertiesSchema_
Definition schema.h:1409
SizeType defaultValueLength_
Definition schema.h:1439
bool Double(Context &context, double d) const
Definition schema.h:825
bool CreateParallelValidator(Context &context) const
Definition schema.h:1182
SchemaDocumentType::ValueType ValueType
Definition schema.h:398
const SchemaType * additionalItemsSchema_
Definition schema.h:1420
unsigned type_
Definition schema.h:1404
const PointerType & GetPointer() const
Definition schema.h:672
bool String(Context &context, const Ch *str, SizeType length, bool) const
Definition schema.h:843
static bool IsPatternMatch(const RegexType *, const Ch *, SizeType)
Definition schema.h:1169
bool CheckDoubleMaximum(Context &context, double d) const
Definition schema.h:1336
void AddUniqueElement(V1 &a, const V2 &v)
Definition schema.h:1090
SizeType enumCount_
Definition schema.h:1399
EncodingType::Ch Ch
Definition schema.h:402
SValue minimum_
Definition schema.h:1433
PatternProperty * patternProperties_
Definition schema.h:1410
ValueType::EncodingType EncodingType
Definition schema.h:401
static const ValueType * GetMember(const ValueType &value, const ValueType &name)
Definition schema.h:1098
SchemaArray allOf_
Definition schema.h:1400
SizeType minProperties_
Definition schema.h:1413
bool hasSchemaDependencies_
Definition schema.h:1418
GenericValue< EncodingType, AllocatorType > SValue
Definition schema.h:405
bool Bool(Context &context, bool) const
Definition schema.h:793
const SchemaType ** itemsTuple_
Definition schema.h:1422
const SchemaType * not_
Definition schema.h:1403
SizeType minLength_
Definition schema.h:1430
bool Uint(Context &context, unsigned u) const
Definition schema.h:807
bool Key(Context &context, const Ch *str, SizeType len, bool) const
Definition schema.h:892
PointerType pointer_
Definition schema.h:1396
SizeType maxItems_
Definition schema.h:1425
Schema< SchemaDocumentType > SchemaType
Definition schema.h:404
SchemaValidationContext< SchemaDocumentType > Context
Definition schema.h:403
SValue uri_
Definition schema.h:1395
bool Null(Context &context) const
Definition schema.h:785
const SValue & GetURI() const
Definition schema.h:668
SizeType itemsTupleCount_
Definition schema.h:1423
SizeType patternPropertyCount_
Definition schema.h:1411
bool hasRequired_
Definition schema.h:1417
SizeType propertyCount_
Definition schema.h:1412
RegexType * pattern_
Definition schema.h:1429
bool hasDependencies_
Definition schema.h:1416
bool BeginValue(Context &context) const
Definition schema.h:676
uint64_t * enum_
Definition schema.h:1398
void AssignIfExist(SchemaArray &out, SchemaDocumentType &schemaDocument, const PointerType &p, const ValueType &value, const ValueType &name, const ValueType &document)
Definition schema.h:1115
SValue multipleOf_
Definition schema.h:1435
SchemaValueType
Definition schema.h:1062
@ kArraySchemaType
Definition schema.h:1066
@ kNumberSchemaType
Definition schema.h:1068
@ kStringSchemaType
Definition schema.h:1067
@ kNullSchemaType
Definition schema.h:1063
@ kObjectSchemaType
Definition schema.h:1065
@ kIntegerSchemaType
Definition schema.h:1069
@ kBooleanSchemaType
Definition schema.h:1064
@ kTotalSchemaType
Definition schema.h:1070
const SchemaType * itemsList_
Definition schema.h:1421
RAPIDJSON_FORCEINLINE bool EndValue(Context &context) const
Definition schema.h:703
SchemaArray anyOf_
Definition schema.h:1401
A type-unsafe stack for storing different types of data.
Definition stack.h:36
Concept for allocating, resizing and freeing memory block.
Concept for receiving events from GenericReader upon parsing. The functions return true if no error o...
GenericSchemaDocument< Value, CrtAllocator > SchemaDocument
Definition fwd.h:138
GenericSchemaValidator< SchemaDocument, BaseReaderHandler< UTF8< char >, void >, CrtAllocator > SchemaValidator
Definition fwd.h:147
IGenericRemoteSchemaDocumentProvider< SchemaDocument > IRemoteSchemaDocumentProvider
Definition fwd.h:139
void * memcpy(void *a, const void *b, size_t c)
Definition glibc_compat.cpp:16
internal::NotMatcher< InnerMatcher > Not(InnerMatcher m)
Definition gmock-matchers.h:4107
internal::AllOfResult2< M1, M2 >::type AllOf(M1 m1, M2 m2)
Definition gmock-generated-matchers.h:1002
internal::AnyOfResult2< M1, M2 >::type AnyOf(M1 m1, M2 m2)
Definition gmock-generated-matchers.h:1085
#define RAPIDJSON_ASSERT(x)
Assertion.
Definition rapidjson.h:411
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition rapidjson.h:121
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition rapidjson.h:124
#define L(m0, m1, m2, m3, m4, m5, m6, m7)
Definition jh.c:116
int q
Definition base.py:2
Definition document.h:406
char * u64toa(uint64_t value, char *buffer)
Definition itoa.h:126
bool CountStringCodePoint(const typename Encoding::Ch *s, SizeType length, SizeType *outCount)
Returns number of code points in a encoded string.
Definition strfunc.h:50
char * u32toa(uint32_t value, char *buffer)
Definition itoa.h:39
int i
Definition pymoduletest.py:23
p
Definition pymoduletest.py:75
r
Definition testupnpigd.py:61
const char * name
Definition options.c:30
const GenericPointer< typename T::ValueType > T2 value
Definition pointer.h:1225
const GenericPointer< typename T::ValueType > & pointer
Definition pointer.h:1124
const CharType(& source)[N]
Definition pointer.h:1147
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1124
const char *const str
Definition portlistingparse.c:23
Type
Type of JSON value.
Definition rapidjson.h:623
@ kFalseType
false
Definition rapidjson.h:625
@ kObjectType
object
Definition rapidjson.h:627
@ kTrueType
true
Definition rapidjson.h:626
@ kStringType
string
Definition rapidjson.h:629
@ kNullType
null
Definition rapidjson.h:624
@ kArrayType
array
Definition rapidjson.h:628
@ kNumberType
number
Definition rapidjson.h:630
#define RAPIDJSON_DELETE(x)
! customization point for global delete
Definition rapidjson.h:610
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.).
Definition rapidjson.h:389
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
Definition rapidjson.h:294
#define RAPIDJSON_NEW(TypeName)
! customization point for global new
Definition rapidjson.h:606
#define RAPIDJSON_SCHEMA_HANDLE_BEGIN_(method, arg1)
Definition schema.h:2074
#define RAPIDJSON_SCHEMA_VERBOSE
Definition schema.h:48
#define RAPIDJSON_SCHEMA_HANDLE_VALUE_(method, arg1, arg2)
Definition schema.h:2096
#define RAPIDJSON_SCHEMA_HANDLE_END_(method, arg2)
Definition schema.h:2093
#define RAPIDJSON_STRING_(name,...)
Definition schema.h:1017
#define RAPIDJSON_INVALID_KEYWORD_RETURN(keyword)
Definition schema.h:116
#define RAPIDJSON_SCHEMA_HANDLE_PARALLEL_(method, arg2)
Definition schema.h:2081
#define Ch(x, y, z)
Definition sha512-blocks.c:34
tools::wallet2::message_signature_result_t result
Definition signature.cpp:62
if(!cryptonote::get_account_address_from_str_or_url(info, cryptonote::TESTNET, "9uVsvEryzpN8WH2t1WWhFFCG5tS8cBNdmJYNRuckLENFimfauV5pZKeS1P2CbxGkSDTUPHXWwiYE5ZGSXDAGbaZgDxobqDN"))
Definition signature.cpp:53
static __thread int depth
Definition threadpool.cpp:34
signed __int64 int64_t
Definition stdint.h:135
unsigned __int64 uint64_t
Definition stdint.h:136
Default implementation of Handler.
Definition reader.h:196
bool owned
Definition schema.h:1629
~SchemaEntry()
Definition schema.h:1621
PointerType pointer
Definition schema.h:1627
SchemaType * schema
Definition schema.h:1628
SchemaEntry(const PointerType &p, SchemaType *s, bool o, Allocator *allocator)
Definition schema.h:1620
SchemaRefEntry(const PointerType &s, const PointerType &t, const SchemaType **outSchema, Allocator *allocator)
Definition schema.h:1613
PointerType target
Definition schema.h:1615
const SchemaType ** schema
Definition schema.h:1616
PointerType source
Definition schema.h:1614
Reference to a constant string (not taking a copy).
Definition document.h:253
Result of parsing (wraps ParseErrorCode).
Definition error.h:106
CharType Ch
Definition encodings.h:97
union internal::Hasher::Number::U u
bool arrayUniqueness
Definition schema.h:389
SizeType validatorCount
Definition schema.h:378
const SchemaType ** patternPropertiesSchemas
Definition schema.h:381
ISchemaValidator ** validators
Definition schema.h:377
SizeType arrayElementIndex
Definition schema.h:385
bool valueUniqueness
Definition schema.h:388
SizeType patternPropertiesValidatorCount
Definition schema.h:380
ISchemaStateFactory< SchemaType > SchemaValidatorFactoryType
Definition schema.h:318
const SchemaType * valueSchema
Definition schema.h:373
bool * propertyExist
Definition schema.h:386
void * hasher
Definition schema.h:375
IValidationErrorHandler< SchemaType > ErrorHandlerType
Definition schema.h:319
PatternValidatorType
Definition schema.h:323
@ kPatternValidatorWithProperty
Definition schema.h:325
@ kPatternValidatorWithAdditionalProperty
Definition schema.h:326
@ kPatternValidatorOnly
Definition schema.h:324
void * arrayElementHashCodes
Definition schema.h:376
ISchemaValidator ** patternPropertiesValidators
Definition schema.h:379
SizeType patternPropertiesSchemaCount
Definition schema.h:382
Schema< SchemaDocumentType > SchemaType
Definition schema.h:317
const Ch * invalidKeyword
Definition schema.h:374
~SchemaValidationContext()
Definition schema.h:351
ValueType::Ch Ch
Definition schema.h:321
SchemaType::ValueType ValueType
Definition schema.h:320
PatternValidatorType valuePatternValidatorType
Definition schema.h:383
SchemaValidationContext(SchemaValidatorFactoryType &f, ErrorHandlerType &eh, const SchemaType *s)
Definition schema.h:329
ErrorHandlerType & error_handler
Definition schema.h:371
PatternValidatorType objectPatternValidatorType
Definition schema.h:384
SchemaValidatorFactoryType & factory
Definition schema.h:370
bool inArray
Definition schema.h:387
const SchemaType * schema
Definition schema.h:372
~PatternProperty()
Definition schema.h:1384
RegexType * pattern
Definition schema.h:1391
const SchemaType * schema
Definition schema.h:1390
PatternProperty()
Definition schema.h:1383
const SchemaType * dependenciesSchema
Definition schema.h:1376
bool required
Definition schema.h:1379
~Property()
Definition schema.h:1373
const SchemaType * schema
Definition schema.h:1375
SizeType dependenciesValidatorIndex
Definition schema.h:1377
bool * dependencies
Definition schema.h:1378
SValue name
Definition schema.h:1374
Property()
Definition schema.h:1372
SchemaArray()
Definition schema.h:1082
const SchemaType ** schemas
Definition schema.h:1084
~SchemaArray()
Definition schema.h:1083
SizeType count
Definition schema.h:1086
SizeType begin
Definition schema.h:1085
static RAPIDJSON_FORCEINLINE void AppendIndexToken(Stack &documentStack, SizeType index)
Definition schema.h:1456
static RAPIDJSON_FORCEINLINE void AppendIndexToken(Stack &documentStack, SizeType index)
Definition schema.h:1444
std::string data
Definition base58.cpp:37
int64_t i
Definition schema.h:283
uint64_t u
Definition schema.h:282