Skip to content

Commit 64c0ec4

Browse files
committed
Clean up unused code & remove missed debug line
1 parent 9a044b2 commit 64c0ec4

File tree

1 file changed

+0
-236
lines changed

1 file changed

+0
-236
lines changed

include/rapidjson/schema.h

Lines changed: 0 additions & 236 deletions
Original file line numberDiff line numberDiff line change
@@ -6018,240 +6018,6 @@ class Schema {
60186018
// return false;
60196019
// }
60206020

6021-
// bool Compare(Context& context,
6022-
// const Schema<SchemaDocumentType>& rhs) const {
6023-
// if (this == &rhs) return true;
6024-
// bool native_scalar = false;
6025-
// bool lhs_any = (type_ == ((1 << kTotalSchemaType) - 1));
6026-
// bool rhs_any = (rhs.type_ == ((1 << kTotalSchemaType) - 1));
6027-
// // Type
6028-
// if (!(((type_ || rhs.type_) && (type_ & rhs.type_)) ||
6029-
// ((yggtype_ || rhs.yggtype_) && (yggtype_ & rhs.yggtype_)))) {
6030-
// if (CompareNativeScalar(rhs.type_) ||
6031-
// rhs.CompareNativeScalar(this->type_)) {
6032-
// native_scalar = true;
6033-
// } else {
6034-
// DisallowedTypeKey(context);
6035-
// rhs.DisallowedTypeKey(context, true);
6036-
// RAPIDJSON_INCOMPATIBLE_SCHEMA_COMP(GetTypeString(), SValue(kNullType).Move(), SValue(kNullType).Move());
6037-
// }
6038-
// }
6039-
// if ((!native_scalar) && (!(rhs_any || lhs_any))
6040-
// && (!(subtype_ & rhs.subtype_))) {
6041-
// DisallowedSubTypeKey(context);
6042-
// rhs.DisallowedSubTypeKey(context, true);
6043-
// RAPIDJSON_INCOMPATIBLE_SCHEMA_COMP(GetSubTypeString(), SValue(kNullType).Move(), SValue(kNullType).Move());
6044-
// }
6045-
// // Enum
6046-
// if (enumCount_ || rhs.enumCount_) {
6047-
// for (SizeType i = 0; i < enumCount_; i++) {
6048-
// for (SizeType j = 0; j < rhs.enumCount_; j++) {
6049-
// if (enum_[i] == rhs.enum_[j])
6050-
// goto foundEnum;
6051-
// }
6052-
// }
6053-
// RAPIDJSON_INCOMPATIBLE_SCHEMA(GetEnumString(), enumValues_, rhs.enumValues_);
6054-
// foundEnum:;
6055-
// }
6056-
6057-
// // if (!Schema(context, rhs)) return false;
6058-
// // // Schema logic
6059-
// // if (not_) {
6060-
// // if (not_->Compare(rhs, context)) {
6061-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA_BOOL(GetNotString(), false, true);
6062-
// // }
6063-
// // context.error_handler.ResetError();
6064-
// // } else if (rhs.not_) {
6065-
// // if (Compare(*(rhs.not_), context)) {
6066-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA_BOOL(GetNotString(), false, true);
6067-
// // }
6068-
// // context.error_handler.ResetError();
6069-
// // }
6070-
// // if (allOf_.schemas) {
6071-
// // for (SizeType i = 0; i < allOf_.count; i++) {
6072-
// // if (!allOf_.schemas[i]->Compare(rhs, context))
6073-
// // return false;
6074-
// // }
6075-
// // } else if (rhs.allOf_.schemas) {
6076-
// // for (SizeType i = 0; i < rhs.allOf_.count; i++) {
6077-
// // if (!Compare(*(rhs.allOf_.schemas[i]), context))
6078-
// // return false;
6079-
// // }
6080-
// // }
6081-
// // if (anyOf_.schemas) {
6082-
// // bool match = false;
6083-
// // for (SizeType i = 0; i < anyOf_.count; i++) {
6084-
// // if (anyOf_.schemas[i]->Compare(rhs, context))
6085-
// // match = true;
6086-
// // context.error_handler.ResetError();
6087-
// // }
6088-
// // if (!match) {
6089-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA_BOOL(GetAnyOfString(), true, false);
6090-
// // }
6091-
// // } else if (rhs.anyOf_.schemas) {
6092-
// // bool match = false;
6093-
// // for (SizeType i = 0; i < rhs.anyOf_.count; i++) {
6094-
// // if (Compare(*(rhs.anyOf_.schemas[i]), context))
6095-
// // match = true;
6096-
// // context.error_handler.ResetError();
6097-
// // }
6098-
// // if (!match) {
6099-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA_BOOL(GetAnyOfString(), true, false);
6100-
// // }
6101-
// // }
6102-
// // if (oneOf_.schemas) {
6103-
// // int matches = 0;
6104-
// // for (SizeType i = 0; i < oneOf_.count; i++) {
6105-
// // if (oneOf_.schemas[i]->Compare(rhs, context))
6106-
// // matches++;
6107-
// // context.error_handler.ResetError();
6108-
// // }
6109-
// // if (matches != 1) {
6110-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA_WRAP(GetOneOfString(), 1, matches);
6111-
// // }
6112-
// // } else if (rhs.oneOf_.schemas) {
6113-
// // int matches = 0;
6114-
// // for (SizeType i = 0; i < rhs.oneOf_.count; i++) {
6115-
// // if (Compare(*(rhs.oneOf_.schemas[i]), context))
6116-
// // matches++;
6117-
// // context.error_handler.ResetError();
6118-
// // }
6119-
// // if (matches != 1) {
6120-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA_WRAP(GetOneOfString(), 1, matches);
6121-
// // }
6122-
// // }
6123-
// // if (allowSingularSchema_.schemas) {
6124-
// // if (allowSingularSchema_.schemas[1]->Compare(rhs, context))
6125-
// // return true;
6126-
// // context.error_handler.ResetError();
6127-
// // return allowSingularSchema_.schemas[0]->Compare(rhs, context);
6128-
// // } else if (rhs.allowSingularSchema_.schemas) {
6129-
// // if (Compare(*(rhs.allowSingularSchema_.schemas[1]), context))
6130-
// // return true;
6131-
// // context.error_handler.ResetError();
6132-
// // return Compare(*(rhs.allowSingularSchema_.schemas[0]), context);
6133-
// // }
6134-
// // if (allowWrappedSchema_.schemas) {
6135-
// // if (allowWrappedSchema_.schemas[1]->Compare(rhs, context))
6136-
// // return true;
6137-
// // context.error_handler.ResetError();
6138-
// // return allowWrappedSchema_.schemas[0]->Compare(rhs, context);
6139-
// // } else if (rhs.allowWrappedSchema_.schemas) {
6140-
// // if (Compare(*(rhs.allowWrappedSchema_.schemas[1]), context))
6141-
// // return true;
6142-
// // context.error_handler.ResetError();
6143-
// // return Compare(*(rhs.allowWrappedSchema_.schemas[0]), context);
6144-
// // }
6145-
// // Early exit if types not constrained
6146-
// // if (lhs_any || rhs_any)
6147-
// // return true;
6148-
6149-
// // // Properties
6150-
// // if (properties_) {
6151-
// // for (SizeType i = 0; i < propertyCount_; i++) {
6152-
// // const SchemaType* ischema = rhs.FindPropertySchema(properties_[i].name);
6153-
// // if (ischema) {
6154-
// // if (!properties_[i].schema->Compare(*ischema, context))
6155-
// // return false;
6156-
// // } else if (!rhs.additionalProperties_ || properties_[i].required) {
6157-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA(GetPropertiesString(), properties_[i].name, SValue(kNullType).Move());
6158-
// // }
6159-
// // }
6160-
// // }
6161-
// // if (rhs.properties_) {
6162-
// // for (SizeType j = 0; j < rhs.propertyCount_; j++) {
6163-
// // SizeType i = 0;
6164-
// // if (FindPropertyIndex(rhs.properties_[j].name.GetString(),
6165-
// // rhs.properties_[j].name.GetStringLength(), &i))
6166-
// // continue;
6167-
// // const SchemaType* ischema = FindPropertySchema(rhs.properties_[j].name);
6168-
// // if (ischema) {
6169-
// // if (!ischema->Compare(*rhs.properties_[j].schema, context))
6170-
// // return false;
6171-
// // } else if (!additionalProperties_ || rhs.properties_[j].required) {
6172-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA(GetPropertiesString(), SValue(kNullType).Move(), rhs.properties_[j].name);
6173-
// // }
6174-
// // }
6175-
// // }
6176-
// // // Additional proeprties
6177-
// // bool lhs_addProps = (additionalProperties_ || additionalPropertiesSchema_);
6178-
// // bool rhs_addProps = (rhs.additionalProperties_ || rhs.additionalPropertiesSchema_);
6179-
// // if (lhs_addProps != rhs_addProps) {
6180-
// // if ((!rhs_addProps && maxProperties_ == SizeType(~0)) ||
6181-
// // (!lhs_addProps && rhs.maxProperties_ == SizeType(~0))) {
6182-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA_BOOL(GetAdditionalPropertiesString(), lhs_addProps, rhs_addProps);
6183-
// // }
6184-
// // }
6185-
// // if (additionalPropertiesSchema_ && rhs.additionalPropertiesSchema_ &&
6186-
// // !additionalPropertiesSchema_->Compare(*rhs.additionalPropertiesSchema_, context))
6187-
// // return false;
6188-
// // // Pattern properties
6189-
// // for (SizeType i = 0; i < patternPropertyCount_; i++) {
6190-
// // bool patternMatch = false;
6191-
// // const SchemaType* ischema = rhs.FindPatternPropertySchema(patternProperties_[i].patternStr, patternProperties_[i].pattern, patternMatch);
6192-
// // if (ischema) {
6193-
// // if (!patternMatch && !patternProperties_[i].schema->Compare(*ischema, context))
6194-
// // return false;
6195-
// // } else if (!rhs.additionalProperties_) {
6196-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA(GetPatternPropertiesString(), patternProperties_[i].patternStr, SValue(kNullType).Move());
6197-
// // }
6198-
// // }
6199-
// // for (SizeType j = 0; j < rhs.patternPropertyCount_; j++) {
6200-
// // bool patternMatch = false;
6201-
// // const SchemaType* ischema = FindPatternPropertySchema(rhs.patternProperties_[j].patternStr, rhs.patternProperties_[j].pattern, patternMatch);
6202-
// // if (ischema) {
6203-
// // if (!patternMatch && !ischema->Compare(*rhs.patternProperties_[j].schema, context))
6204-
// // return false;
6205-
// // } else if (!additionalProperties_) {
6206-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA(GetPatternPropertiesString(), SValue(kNullType).Move(), rhs.patternProperties_[j].patternStr);
6207-
// // }
6208-
// // }
6209-
// // // Items
6210-
// // for (SizeType i = 0; i < itemsTupleCount_; i++) {
6211-
// // const SchemaType* ischema = rhs.FindItemSchema(i);
6212-
// // if (ischema) {
6213-
// // if (!itemsTuple_[i]->Compare(*ischema, context))
6214-
// // return false;
6215-
// // } else if (!rhs.additionalItems_) {
6216-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA_WRAP(GetItemsString(), i, kNullType);
6217-
// // }
6218-
// // }
6219-
// // for (SizeType j = 0; j < rhs.itemsTupleCount_; j++) {
6220-
// // if (j < itemsTupleCount_) continue;
6221-
// // const SchemaType* ischema = FindItemSchema(j);
6222-
// // if (ischema) {
6223-
// // if (!ischema->Compare(*rhs.itemsTuple_[j], context))
6224-
// // return false;
6225-
// // } else if (!additionalItems_) {
6226-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA_WRAP(GetItemsString(), kNullType, j);
6227-
// // }
6228-
// // }
6229-
// // if (!(itemsTuple_ || rhs.itemsTuple_)) {
6230-
// // if (itemsList_ && rhs.itemsList_) {
6231-
// // if (!itemsList_->Compare(*rhs.itemsList_, context))
6232-
// // return false;
6233-
// // } else if (itemsList_ && rhs.additionalItemsSchema_) {
6234-
// // if (!itemsList_->Compare(*rhs.additionalItemsSchema_, context))
6235-
// // return false;
6236-
// // } else if (additionalItemsSchema_ && rhs.itemsList_) {
6237-
// // if (!additionalItemsSchema_->Compare(*rhs.itemsList_, context))
6238-
// // return false;
6239-
// // }
6240-
// // }
6241-
// // // Additional items
6242-
// // bool lhs_addItems = (additionalItems_ || additionalItemsSchema_);
6243-
// // bool rhs_addItems = (rhs.additionalItems_ || rhs.additionalItemsSchema_);
6244-
// // if (lhs_addItems != rhs_addItems) {
6245-
// // if ((!rhs_addItems && maxItems_ == SizeType(~0)) ||
6246-
// // (!lhs_addItems && rhs.maxItems_ == SizeType(~0))) {
6247-
// // RAPIDJSON_INCOMPATIBLE_SCHEMA_BOOL(GetAdditionalItemsString(), lhs_addItems, rhs_addItems);
6248-
// // }
6249-
// // }
6250-
// // if (additionalItemsSchema_ && rhs.additionalItemsSchema_ &&
6251-
// // !additionalItemsSchema_->Compare(*rhs.additionalItemsSchema_, context))
6252-
// // return false;
6253-
// return true;
6254-
// }
62556021
template<typename VT>
62566022
bool GenerateNull(Context& context, VT& data) const {
62576023
data.SetNull();
@@ -6931,7 +6697,6 @@ class Schema {
69316697
#endif // RAPIDJSON_YGGDRASIL
69326698

69336699
// For enums only check if we have a hasher
6934-
if (enum_ && !context.hasher)
69356700
if (enum_ && context.hasher) {
69366701
const uint64_t h = context.factory.GetHashCode(context.hasher);
69376702
for (SizeType i = 0; i < enumCount_; i++)
@@ -14064,7 +13829,6 @@ class GenericSchemaValidator :
1406413829
PointerType p;
1406513830
return static_cast<GenericSchemaValidator*>(CreateSchemaValidator(root_, false, p));
1406613831
}
14067-
std::cerr << "CreateSchemaHandler: Non-root" << std::endl;
1406813832
return static_cast<GenericSchemaValidator*>(CreateSchemaValidator(CurrentSchema(), false, CurrentContext().schemaPointerAbs));
1406913833
}
1407013834

0 commit comments

Comments
 (0)