30#if OO_OXP_VERIFIER_ENABLED
38#define PLIST_VERIFIER_DEBUG_DUMP_ENABLED 1
57#if PLIST_VERIFIER_DEBUG_DUMP_ENABLED
60#define DebugDumpIndent() do { if (sDebugDump) OOLogIndent(); } while (0)
61#define DebugDumpOutdent() do { if (sDebugDump) OOLogOutdent(); } while (0)
62#define DebugDumpPushIndent() do { if (sDebugDump) OOLogPushIndent(); } while (0)
63#define DebugDumpPopIndent() do { if (sDebugDump) OOLogPopIndent(); } while (0)
64#define DebugDump(...) do { if (sDebugDump) OOLog(@"verifyOXP.verbose.plistDebugDump", __VA_ARGS__); } while (0)
66#define DebugDumpIndent() do { } while (0)
67#define DebugDumpOutdent() do { } while (0)
68#define DebugDumpPushIndent() do { } while (0)
69#define DebugDumpPopIndent() do { } while (0)
70#define DebugDump(...) do { } while (0)
139static BOOL
ApplyStringTest(NSString *
string,
id test,
SEL testSelector, NSString *testDescription,
BackLinkChain keyPath, NSError **outError);
157@interface OOPListSchemaVerifier (OOPrivate)
160- (BOOL)delegateVerifierWithPropertyList:(
id)rootPList
161 named:(NSString *)name
162 testProperty:(
id)subPList
164 againstType:(NSString *)typeKey
165 error:(NSError **)outError;
167- (BOOL)delegateVerifierWithPropertyList:(
id)rootPList
168 named:(NSString *)name
169 failedForProperty:(
id)subPList
170 withError:(NSError *)error
171 expectedType:(NSDictionary *)localSchema;
173- (BOOL)verifyPList:(
id)rootPList
174 named:(NSString *)name
175 subProperty:(
id)subProperty
176 againstSchemaType:(
id)subSchema
178 tentative:(BOOL)tentative
179 error:(NSError **)outError
180 stop:(BOOL *)outStop;
182- (NSDictionary *)resolveSchemaType:(
id)specifier
184 error:(NSError **)outError;
189@interface NSString (OOPListSchemaVerifierHelpers)
191- (BOOL)ooPListVerifierHasSubString:(NSString *)string;
196#define VERIFY_PROTO(T) static NSError *Verify_##T(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
215+ (id)verifierWithSchema:(NSDictionary *)schema
217 return [[[
self alloc] initWithSchema:schema] autorelease];
221- (id)initWithSchema:(NSDictionary *)schema
226 _schema = [schema retain];
227 _definitions = [[_schema oo_dictionaryForKey:@"$definitions"] retain];
228 sDebugDump = [[NSUserDefaults standardUserDefaults] boolForKey:@"plist-schema-verifier-dump-structure"];
245 [_definitions release];
251- (void)setDelegate:(
id)delegate
253 if (_delegate != delegate)
255 _delegate = delegate;
256 _badDelegateWarning = NO;
267- (BOOL)verifyPropertyList:(
id)plist named:(NSString *)name
272 OK = [
self verifyPList:plist
275 againstSchemaType:_schema
276 atPath:BackLinkRoot()
285+ (NSString *)descriptionForKeyPath:(NSArray *)keyPath
287 NSMutableString *result =
nil;
291 result = [NSMutableString string];
293 foreach (component, keyPath)
295 if ([component isKindOfClass:[NSNumber class]])
297 [result appendFormat:@"[%@]", component];
299 else if ([component isKindOfClass:[NSString class]])
301 if (!first) [result appendString:@"."];
302 [result appendString:component];
320@implementation OOPListSchemaVerifier (OOPrivate)
322- (BOOL)delegateVerifierWithPropertyList:(
id)rootPList
323 named:(NSString *)name
324 testProperty:(
id)subPList
326 againstType:(NSString *)typeKey
327 error:(NSError **)outError
330 NSError *error =
nil;
332 if ([_delegate respondsToSelector:@selector(verifier:withPropertyList:named:testProperty:atPath:againstType:error:)])
336 result = [_delegate verifier:self
337 withPropertyList:rootPList
339 testProperty:subPList
340 atPath:KeyPathToArray(keyPath)
344 @catch (NSException *exception)
346 OOLog(
@"plistVerifier.delegateException",
@"Property list schema verifier: delegate threw exception (%@) in -verifier:withPropertyList:named:testProperty:atPath:againstType: for type \"%@\
" at %@ in %@ -- treating as failure.", [exception name], typeKey,
KeyPathToString(keyPath), name);
351 if (outError != NULL)
353 if (!result || error !=
nil)
358 else *outError =
nil;
363 if (!_badDelegateWarning)
365 OOLog(
@"plistVerifier.badDelegate",
@"%@",
@"Property list schema verifier: delegate does not handle delegated types.");
366 _badDelegateWarning = YES;
375- (BOOL)delegateVerifierWithPropertyList:(
id)rootPList
376 named:(NSString *)name
377 failedForProperty:(
id)subPList
378 withError:(NSError *)error
379 expectedType:(NSDictionary *)localSchema
383 if ([_delegate respondsToSelector:@selector(verifier:withPropertyList:named:failedForProperty:withError:expectedType:)])
387 result = [_delegate verifier:self
388 withPropertyList:rootPList
390 failedForProperty:subPList
392 expectedType:localSchema];
394 @catch (NSException *exception)
396 OOLog(
@"plistVerifier.delegateException",
@"Property list schema verifier: delegate threw exception (%@) in -verifier:withPropertyList:named:failedForProperty:atPath:expectedType: at %@ in %@ -- stopping.", [exception name], [error plistKeyPathDescription], name);
402 OOLog(
@"plistVerifier.failed",
@"Verification of property list \"%@\
" failed at %@: %@", name, [error plistKeyPathDescription], [error localizedFailureReason]);
409- (BOOL)verifyPList:(
id)rootPList
410 named:(NSString *)name
411 subProperty:(
id)subProperty
412 againstSchemaType:(
id)subSchema
414 tentative:(BOOL)tentative
415 error:(NSError **)outError
419 NSError *error =
nil;
420 NSDictionary *resolvedSpecifier =
nil;
421 NSAutoreleasePool *pool =
nil;
423 assert(outStop != NULL);
425 pool = [[NSAutoreleasePool alloc] init];
433 resolvedSpecifier = [
self resolveSchemaType:subSchema atPath:keyPath error:&error];
434 if (resolvedSpecifier !=
nil) type =
StringToSchemaType([resolvedSpecifier objectForKey:
@"type"], &error);
436 #define VERIFY_CASE(T) case kType##T: error = Verify_##T(self, subProperty, resolvedSpecifier, rootPList, name, keyPath, tentative, outStop); break;
460 @catch (NSException *exception)
471 *outStop = ![
self delegateVerifierWithPropertyList:rootPList
473 failedForProperty:subProperty
475 expectedType:subSchema];
477 else if (tentative) *outStop = YES;
480 if (outError != NULL && error !=
nil)
482 *outError = [error retain];
495- (NSDictionary *)resolveSchemaType:(
id)specifier
497 error:(NSError **)outError
500 NSString *complaint =
nil;
502 assert(outError != NULL);
504 if (![specifier isKindOfClass:[NSString class]] && ![specifier isKindOfClass:[NSDictionary class]]) goto BAD_TYPE;
508 if ([specifier isKindOfClass:[NSString class]]) specifier = [NSDictionary dictionaryWithObject:specifier forKey:
@"type"];
509 typeVal = [(NSDictionary *)specifier objectForKey:@"type"];
511 if ([typeVal isKindOfClass:[NSString class]])
513 if ([typeVal hasPrefix:
@"$"])
516 specifier = [_definitions objectForKey:typeVal];
517 if (specifier ==
nil)
529 else if ([typeVal isKindOfClass:[NSDictionary class]])
541 if (typeVal ==
nil) complaint =
@"no type specified";
542 else complaint =
@"not string or dictionary";
553 static NSDictionary *typeMap =
nil;
559 [[NSDictionary dictionaryWithObjectsAndKeys:
560 [NSNumber numberWithUnsignedInt:kTypeString], @"string",
561 [NSNumber numberWithUnsignedInt:kTypeArray], @"array",
562 [NSNumber numberWithUnsignedInt:kTypeDictionary], @"dictionary",
563 [NSNumber numberWithUnsignedInt:kTypeInteger], @"integer",
564 [NSNumber numberWithUnsignedInt:kTypePositiveInteger], @"positiveInteger",
565 [NSNumber numberWithUnsignedInt:kTypeFloat], @"float",
566 [NSNumber numberWithUnsignedInt:kTypePositiveFloat], @"positiveFloat",
567 [NSNumber numberWithUnsignedInt:kTypeOneOf], @"oneOf",
568 [NSNumber numberWithUnsignedInt:kTypeEnumeration], @"enumeration",
569 [NSNumber numberWithUnsignedInt:kTypeBoolean], @"boolean",
570 [NSNumber numberWithUnsignedInt:kTypeFuzzyBoolean], @"fuzzyBoolean",
571 [NSNumber numberWithUnsignedInt:kTypeVector], @"vector",
572 [NSNumber numberWithUnsignedInt:kTypeQuaternion], @"quaternion",
573 [NSNumber numberWithUnsignedInt:kTypeDelegatedType], @"delegatedType",
578 result = [[typeMap objectForKey:string] unsignedIntValue];
581 if ([
string hasPrefix:
@"$"])
597 NSEnumerator *filterEnum =
nil;
601 assert(outError != NULL);
603 if (filterSpec ==
nil)
return string;
605 if ([filterSpec isKindOfClass:[NSString class]])
607 filterSpec = [NSArray arrayWithObject:filterSpec];
609 if ([filterSpec isKindOfClass:[NSArray class]])
611 for (filterEnum = [filterSpec objectEnumerator]; (filter = [filterEnum nextObject]); )
613 if ([filter isKindOfClass:[NSString class]])
615 if ([filter isEqual:
@"lowerCase"])
string = [
string lowercaseString];
616 else if ([filter isEqual:
@"upperCase"])
string = [
string uppercaseString];
617 else if ([filter isEqual:
@"capitalized"])
string = [
string capitalizedString];
618 else if ([filter hasPrefix:
@"truncFront:"])
620 string = [string substringToIndex:[[filter substringFromIndex:11] intValue]];
622 else if ([filter hasPrefix:
@"truncBack:"])
624 string = [string substringToIndex:[[filter substringFromIndex:10] intValue]];
626 else if ([filter hasPrefix:
@"subStringTo:"])
628 range = [string rangeOfString:[filter substringFromIndex:12]];
629 if (range.location != NSNotFound)
631 string = [string substringToIndex:range.location];
634 else if ([filter hasPrefix:
@"subStringFrom:"])
636 range = [string rangeOfString:[filter substringFromIndex:14]];
637 if (range.location != NSNotFound)
639 string = [string substringFromIndex:range.location + range.length];
642 else if ([filter hasPrefix:
@"subStringToInclusive:"])
644 range = [string rangeOfString:[filter substringFromIndex:21]];
645 if (range.location != NSNotFound)
647 string = [string substringToIndex:range.location + range.length];
650 else if ([filter hasPrefix:
@"subStringFromInclusive:"])
652 range = [string rangeOfString:[filter substringFromIndex:23]];
653 if (range.location != NSNotFound)
655 string = [string substringFromIndex:range.location];
680 BOOL (*testIMP)(id, SEL, NSString *);
681 NSEnumerator *testEnum =
nil;
684 assert(outError != NULL);
686 if (test ==
nil)
return YES;
688 testIMP = (BOOL(*)(id, SEL, NSString *))[string methodForSelector:testSelector];
691 *outError =
Error(
kPListErrorInternal, &keyPath,
@"OOPListSchemaVerifier internal error: NSString does not respond to test selector %@.", NSStringFromSelector(testSelector));
695 if ([test isKindOfClass:[NSString class]])
697 test = [NSArray arrayWithObject:test];
700 if ([test isKindOfClass:[NSArray class]])
702 for (testEnum = [test objectEnumerator]; (subTest = [testEnum nextObject]); )
704 if ([subTest isKindOfClass:[NSString class]])
706 if (testIMP(
string, testSelector, subTest))
return YES;
725 NSMutableArray *result =
nil;
728 result = [NSMutableArray array];
729 for (curr = &keyPath; curr != NULL; curr = curr->
link)
731 if (curr->
element !=
nil) [result insertObject:curr->element atIndex:0];
750 string = [string substringToIndex:kMaximumLengthForStringInErrorMessage];
752 result = [NSMutableString stringWithString:string];
753 [result replaceOccurrencesOfString:@"\t" withString:@" " options:0 range:NSMakeRange(0, [string length])];
754 [result replaceOccurrencesOfString:@"\r\n" withString:@" \\ " options:0 range:NSMakeRange(0, [string length])];
755 [result replaceOccurrencesOfString:@"\n" withString:@" \\ " options:0 range:NSMakeRange(0, [string length])];
756 [result replaceOccurrencesOfString:@"\r" withString:@" \\ " options:0 range:NSMakeRange(0, [string length])];
760 result = [result substringToIndex:kMaximumLengthForStringInErrorMessage - 3];
761 result = [result stringByAppendingString:@"..."];
770 NSString *result =
nil;
771 NSString *
string =
nil;
773 NSAutoreleasePool *pool =
nil;
775 count = [array count];
776 if (
count == 0)
return @"( )";
778 pool = [[NSAutoreleasePool alloc] init];
780 result = [NSString stringWithFormat:@"(%@", [array objectAtIndex:0]];
782 for (i = 1; i !=
count; ++i)
784 string = [result stringByAppendingFormat:@", %@", [array objectAtIndex:i]];
787 result = [result stringByAppendingString:@", ..."];
793 result = [result stringByAppendingString:@")"];
797 return [result autorelease];
803 return ArrayForErrorReport([[
set allObjects] sortedArrayUsingSelector:
@selector(caseInsensitiveCompare:)]);
809 if ([value isKindOfClass:[NSString class]])
811 return [NSString stringWithFormat:@"\"%@\"", StringForErrorReport(value)];
814 if (arrayPrefix ==
nil) arrayPrefix =
@"";
815 if ([value isKindOfClass:[NSArray class]])
817 return [arrayPrefix stringByAppendingString:ArrayForErrorReport(value)];
819 if ([value isKindOfClass:[NSSet class]])
821 return [arrayPrefix stringByAppendingString:SetForErrorReport(value)];
823 if (value ==
nil)
return @"(null)";
830#define REQUIRE_TYPE(CLASSNAME, NAMESTRING) do { \
831 if (![value isKindOfClass:[CLASSNAME class]]) \
833 return ErrorTypeMismatch([CLASSNAME class], NAMESTRING, value, keyPath); \
839 NSString *filteredString =
nil;
842 NSUInteger lengthConstraint;
843 NSError *error =
nil;
850 filteredString =
ApplyStringFilter(value, [params objectForKey:
@"filter"], keyPath, &error);
851 if (filteredString ==
nil)
return error;
854 testValue = [params objectForKey:@"requiredPrefix"];
855 if (testValue !=
nil)
857 if (!
ApplyStringTest(filteredString, testValue,
@selector(hasPrefix:),
@"prefix", keyPath, &error))
864 testValue = [params objectForKey:@"requiredSuffix"];
865 if (testValue !=
nil)
867 if (!
ApplyStringTest(filteredString, testValue,
@selector(hasSuffix:),
@"suffix", keyPath, &error))
874 testValue = [params objectForKey:@"requiredSubString"];
875 if (testValue !=
nil)
877 if (!
ApplyStringTest(filteredString, testValue,
@selector(ooPListVerifierHasSubString:),
@"substring", keyPath, &error))
885 length = [filteredString length];
886 lengthConstraint = [params oo_unsignedIntegerForKey:@"minLength"];
887 if (length < lengthConstraint)
892 lengthConstraint = [params oo_unsignedIntegerForKey:@"maxLength" defaultValue:NSUIntegerMax];
893 if (lengthConstraint < length)
906 BOOL OK = YES, stop = NO;
908 id subProperty =
nil;
909 NSUInteger constraint;
916 count = [value count];
917 constraint = [params oo_unsignedIntegerForKey:@"minCount" defaultValue:0];
918 if (
count < constraint)
923 constraint = [params oo_unsignedIntegerForKey:@"maxCount" defaultValue:NSUIntegerMax];
924 if (constraint <
count)
930 valueType = [params objectForKey:@"valueType"];
931 if (valueType !=
nil)
933 for (i = 0; i !=
count; ++i)
935 subProperty = [value objectAtIndex:i];
937 if (![verifier verifyPList:rootPList
939 subProperty:subProperty
940 againstSchemaType:valueType
949 if ((stop && !tentative) || (tentative && !OK))
break;
953 *outStop = stop && !tentative;
962 NSDictionary *schema =
nil;
965 NSEnumerator *keyEnum =
nil;
967 id subProperty =
nil;
968 BOOL OK = YES, stop = NO, prematureExit = NO;
970 NSMutableSet *requiredKeys =
nil;
971 NSArray *requiredKeyList =
nil;
972 NSUInteger
count, constraint;
979 count = [value count];
980 constraint = [params oo_unsignedIntegerForKey:@"minCount" defaultValue:0];
981 if (
count < constraint)
985 constraint = [params oo_unsignedIntegerForKey:@"maxCount" defaultValue:NSUIntegerMax];
986 if (constraint <
count)
992 schema = [params oo_dictionaryForKey:@"schema"];
993 valueType = [params objectForKey:@"valueType"];
994 allowOthers = [params oo_boolForKey:@"allowOthers" defaultValue:YES];
995 requiredKeyList = [params oo_arrayForKey:@"requiredKeys"];
998 if (schema ==
nil && valueType ==
nil && requiredKeyList ==
nil && allowOthers)
return nil;
1000 if (requiredKeyList !=
nil)
1002 requiredKeys = [NSMutableSet setWithArray:requiredKeyList];
1008 for (keyEnum = [value keyEnumerator]; (key = [keyEnum nextObject]) && !stop; )
1010 subProperty = [(NSDictionary *)value objectForKey:key];
1011 typeSpec = [schema objectForKey:key];
1012 if (typeSpec ==
nil) typeSpec = valueType;
1017 if (typeSpec !=
nil)
1019 if (![verifier verifyPList:rootPList
1021 subProperty:subProperty
1022 againstSchemaType:typeSpec
1031 else if (!allowOthers && ![requiredKeys containsObject:key] && [schema objectForKey:key] ==
nil)
1048 [requiredKeys removeObject:key];
1050 if ((stop && !tentative) || (tentative && !OK))
1052 prematureExit = YES;
1060 if (!prematureExit && [requiredKeys
count] != 0)
1065 *outStop = stop && !tentative;
1074 long long numericValue;
1075 long long constraint;
1079 DebugDump(
@"* integer: %lli", numericValue);
1088 constraint = [params oo_longLongForKey:@"minimum" defaultValue:LLONG_MIN];
1089 if (numericValue < constraint)
1094 constraint = [params oo_longLongForKey:@"maximum" defaultValue:LLONG_MAX];
1095 if (constraint < numericValue)
1106 unsigned long long numericValue;
1107 unsigned long long constraint;
1111 DebugDump(
@"* positive integer: %llu", numericValue);
1116 return ErrorTypeMismatch([NSNumber
class],
@"positive integer", value, keyPath);
1120 constraint = [params oo_unsignedLongLongForKey:@"minimum" defaultValue:0];
1121 if (numericValue < constraint)
1126 constraint = [params oo_unsignedLongLongForKey:@"maximum" defaultValue:ULLONG_MAX];
1127 if (constraint < numericValue)
1138 double numericValue;
1143 DebugDump(
@"* float: %g", numericValue);
1152 constraint = [params oo_doubleForKey:@"minimum" defaultValue:-INFINITY];
1153 if (numericValue < constraint)
1158 constraint = [params oo_doubleForKey:@"maximum" defaultValue:INFINITY];
1159 if (constraint < numericValue)
1170 double numericValue;
1175 DebugDump(
@"* positive float: %g", numericValue);
1183 if (numericValue < 0)
1189 constraint = [params oo_doubleForKey:@"minimum" defaultValue:0];
1190 if (numericValue < constraint)
1195 constraint = [params oo_doubleForKey:@"maximum" defaultValue:INFINITY];
1196 if (constraint < numericValue)
1207 NSArray *options =
nil;
1208 BOOL OK = NO, stop = NO;
1211 NSMutableDictionary *errors =
nil;
1215 options = [params oo_arrayForKey:@"options"];
1222 errors = [[NSMutableDictionary alloc] initWithCapacity:[options count]];
1224 foreach (option, options)
1226 if ([verifier verifyPList:rootPList
1229 againstSchemaType:option
1239 [errors setObject:error forKey:option];
1256 NSArray *values =
nil;
1257 NSString *filteredString =
nil;
1258 NSError *error =
nil;
1264 values = [params oo_arrayForKey:@"values"];
1273 filteredString =
ApplyStringFilter(value, [params objectForKey:
@"filter"], keyPath, &error);
1274 if (filteredString ==
nil)
return error;
1276 if ([values containsObject:filteredString])
return nil;
1294 DebugDump(
@"* fuzzy boolean: %@", value);
1299 else return ErrorTypeMismatch([NSNumber
class],
@"fuzzy boolean", value, keyPath);
1326 NSString *key =
nil;
1328 NSError *error =
nil;
1330 DebugDump(
@"* delegated type: %@", [params objectForKey:
@"key"]);
1332 baseType = [params objectForKey:@"baseType"];
1333 if (baseType !=
nil)
1335 if (![verifier verifyPList:rootPList
1338 againstSchemaType:baseType
1349 key = [params objectForKey:@"key"];
1360@implementation NSString (OOPListSchemaVerifierHelpers)
1362- (BOOL)ooPListVerifierHasSubString:(NSString *)string
1364 return [
self rangeOfString:string].location != NSNotFound;
1370@implementation NSError (OOPListSchemaVerifierConveniences)
1372- (NSArray *)plistKeyPath
1374 return [[
self userInfo] oo_arrayForKey:kPListKeyPathErrorKey];
1378- (NSString *)plistKeyPathDescription
1384- (NSSet *)missingRequiredKeys
1386 return [[
self userInfo] oo_setForKey:kMissingRequiredKeysErrorKey];
1390- (Class)expectedClass
1392 return [[
self userInfo] objectForKey:kExpectedClassErrorKey];
1396- (NSString *)expectedClassName
1398 NSString *result = [[
self userInfo] objectForKey:kExpectedClassNameErrorKey];
1399 if (result ==
nil) result = [[
self expectedClass] description];
1408 NSError *result =
nil;
1411 va_start(args, format);
1421 NSError *result =
nil;
1423 NSDictionary *dict =
nil;
1425 if (propKey !=
nil && propValue !=
nil)
1427 dict = [NSDictionary dictionaryWithObject:propValue forKey:propKey];
1429 va_start(args, format);
1439 NSError *result =
nil;
1442 va_start(args, format);
1452 NSString *message =
nil;
1453 NSMutableDictionary *userInfo =
nil;
1455 message = [[NSString alloc] initWithFormat:format arguments:arguments];
1457 userInfo = [NSMutableDictionary dictionaryWithDictionary:dict];
1458 [userInfo setObject:message forKey:NSLocalizedFailureReasonErrorKey];
1459 if (keyPath != NULL)
1461 [userInfo setObject:KeyPathToArray(*keyPath) forKey:kPListKeyPathErrorKey];
1466 return [NSError errorWithDomain:kOOPListSchemaVerifierErrorDomain code:errorCode userInfo:userInfo];
1472 NSDictionary *dict =
nil;
1473 NSString *className =
nil;
1475 if (expectedClassName ==
nil) expectedClassName = [expectedClass description];
1477 dict = [NSDictionary dictionaryWithObjectsAndKeys:
1478 expectedClassName, kExpectedClassNameErrorKey,
1479 expectedClass, kExpectedClassErrorKey,
1482 if (actualObject ==
nil) className =
@"nothing";
1483 else if ([actualObject isKindOfClass:[NSString class]]) className =
@"string";
1484 else if ([actualObject isKindOfClass:[NSNumber class]]) className =
@"number";
1485 else if ([actualObject isKindOfClass:[NSArray class]]) className =
@"array";
1486 else if ([actualObject isKindOfClass:[NSDictionary class]]) className =
@"dictionary";
1487 else if ([actualObject isKindOfClass:[NSData class]]) className =
@"data";
1488 else if ([actualObject isKindOfClass:[NSDate class]]) className =
@"date";
1489 else className = [[actualObject class] description];
1497 return [NSError errorWithDomain:kOOPListSchemaVerifierErrorDomain code:kPListErrorFailedAndErrorHasBeenReported userInfo:nil];
#define OOLog(class, format,...)
void OOLogSetDisplayMessagesInClass(NSString *inClass, BOOL inFlag)
NSString *const kMissingRequiredKeysErrorKey
NSString *const kUndefinedMacroErrorKey
NSString *const kErrorsByOptionErrorKey
OOPListSchemaVerifierErrorCode
@ kPListErrorDictionaryMissingRequiredKeys
@ kPListErrorSchemaNoEnumerationValues
@ kPListErrorNumberIsNegative
@ kPListErrorEnumerationBadValue
@ kPListErrorSchemaBadTypeSpecifier
@ kPListErrorSchemaNoOneOfOptions
@ kPListErrorTypeMismatch
@ kPListErrorStringSubstringMissing
@ kPListErrorSchemaUnknownType
@ kPListErrorMaximumConstraintNotMet
@ kPListErrorDictionaryUnknownKey
@ kPListErrorMinimumConstraintNotMet
@ kPListErrorLastErrorCode
@ kPListDelegatedTypeError
@ kPListErrorStringSuffixMissing
@ kPListErrorOneOfNoMatch
@ kPListErrorSchemaUndefiniedMacroReference
@ kPListErrorSchemaBadComparator
@ kPListErrorSchemaUnknownFilter
@ kPListErrorStringPrefixMissing
NSString *const kUnnownFilterErrorKey
NSString *const kUnknownTypeErrorKey
NSString *const kMissingSubStringErrorKey
NSString *const kUnknownKeyErrorKey
static NSError * ErrorWithDictionaryAndArguments(OOPListSchemaVerifierErrorCode errorCode, BackLinkChain *keyPath, NSDictionary *dict, NSString *format, va_list arguments)
NSString *const kMissingRequiredKeysErrorKey
NSString *const kExpectedClassErrorKey
static NSString * SetForErrorReport(NSSet *set)
NSString *const kUndefinedMacroErrorKey
static NSString * KeyPathToString(BackLinkChain keyPath)
NSString *const kSchemaKeyPathErrorKey
@ kPListErrorFailedAndErrorHasBeenReported
@ kStartOfPrivateErrorCodes
static NSError * ErrorFailureAlreadyReported(void)
static NSError * Verify_OneOf(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
static SchemaType StringToSchemaType(NSString *string, NSError **outError)
static NSError * Verify_Boolean(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
static NSString * StringForErrorReport(NSString *string)
NSString *const kErrorsByOptionErrorKey
OOINLINE BackLinkChain BackLink(BackLinkChain *link, id element)
static NSError * Verify_Integer(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
static NSError * Verify_Quaternion(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
static NSError * Verify_String(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
static NSString * ArrayForErrorReport(NSArray *array)
static NSError * Verify_Array(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
static NSArray * KeyPathToArray(BackLinkChain keyPath)
NSString *const kExpectedClassNameErrorKey
static NSError * Verify_PositiveFloat(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
#define DebugDumpPopIndent()
static BOOL ApplyStringTest(NSString *string, id test, SEL testSelector, NSString *testDescription, BackLinkChain keyPath, NSError **outError)
#define DebugDumpIndent()
OOINLINE BackLinkChain BackLinkRoot(void)
static NSError * Error(OOPListSchemaVerifierErrorCode errorCode, BackLinkChain *keyPath, NSString *format,...)
static NSError * ErrorWithDictionary(OOPListSchemaVerifierErrorCode errorCode, BackLinkChain *keyPath, NSDictionary *dict, NSString *format,...)
static NSError * Verify_Enumeration(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
NSString *const kUnnownFilterErrorKey
NSString *const kPListKeyPathErrorKey
static NSError * Verify_Vector(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
static NSString * StringOrArrayForErrorReport(id value, NSString *arrayPrefix)
static NSError * Verify_PositiveInteger(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
NSString *const kUnknownTypeErrorKey
NSString *const kOOPListSchemaVerifierErrorDomain
static NSError * Verify_FuzzyBoolean(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
static NSError * ErrorWithProperty(OOPListSchemaVerifierErrorCode errorCode, BackLinkChain *keyPath, NSString *propKey, id propValue, NSString *format,...)
static NSError * Verify_Float(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
#define DebugDumpPushIndent()
static NSError * ErrorTypeMismatch(Class expectedClass, NSString *expectedClassName, id actualObject, BackLinkChain keyPath)
static BOOL IsFailureAlreadyReportedError(NSError *error)
NSString *const kMissingSubStringErrorKey
NSString *const kUnknownKeyErrorKey
static NSError * Verify_Dictionary(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
OOINLINE BackLinkChain BackLinkIndex(BackLinkChain *link, NSUInteger index)
@ kMaximumLengthForStringInErrorMessage
static NSError * Verify_DelegatedType(OOPListSchemaVerifier *verifier, id value, NSDictionary *params, id rootPList, NSString *name, BackLinkChain keyPath, BOOL tentative, BOOL *outStop)
#define DebugDumpOutdent()
#define REQUIRE_TYPE(CLASSNAME, NAMESTRING)
static NSString * ApplyStringFilter(NSString *string, id filterSpec, BackLinkChain keyPath, NSError **outError)
const Quaternion kIdentityQuaternion
const Quaternion kZeroQuaternion
static void Error(OOTCPStreamDecoderRef decoder, OOALStringRef format,...)
const Vector kBasisXVector
NSString * descriptionForKeyPath:(NSArray *keyPath)
BOOL delegateVerifierWithPropertyList:named:failedForProperty:withError:expectedType:(id rootPList,[named] NSString *name,[failedForProperty] id subPList,[withError] NSError *error,[expectedType] NSDictionary *localSchema)
BOOL delegateVerifierWithPropertyList:named:testProperty:atPath:againstType:error:(id rootPList,[named] NSString *name,[testProperty] id subPList,[atPath] BackLinkChain keyPath,[againstType] NSString *typeKey,[error] NSError **outError)