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:@"$w2"] 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;
288 NSEnumerator *componentEnum =
nil;
292 result = [NSMutableString string];
294 for (componentEnum = [keyPath objectEnumerator]; (component = [componentEnum nextObject]); )
296 if ([component isKindOfClass:[NSNumber
class]])
298 [result appendFormat:@"[%@]", component];
300 else if ([component isKindOfClass:[NSString
class]])
302 if (!first) [result appendString:@"."];
303 [result appendString:component];
321@implementation OOPListSchemaVerifier (OOPrivate)
323- (BOOL)delegateVerifierWithPropertyList:(
id)rootPList
324 named:(NSString *)name
325 testProperty:(
id)subPList
327 againstType:(NSString *)typeKey
328 error:(NSError **)outError
331 NSError *error =
nil;
333 if ([_delegate respondsToSelector:
@selector(verifier:withPropertyList:named:testProperty:atPath:againstType:error:)])
337 result = [_delegate verifier:self
338 withPropertyList:rootPList
340 testProperty:subPList
341 atPath:KeyPathToArray(keyPath)
345 @catch (NSException *exception)
347 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);
352 if (outError != NULL)
354 if (!result || error !=
nil)
359 else *outError =
nil;
364 if (!_badDelegateWarning)
366 OOLog(
@"plistVerifier.badDelegate",
@"%@",
@"Property list schema verifier: delegate does not handle delegated types.");
367 _badDelegateWarning = YES;
376- (BOOL)delegateVerifierWithPropertyList:(
id)rootPList
377 named:(NSString *)name
378 failedForProperty:(
id)subPList
379 withError:(NSError *)error
380 expectedType:(NSDictionary *)localSchema
384 if ([_delegate respondsToSelector:
@selector(verifier:withPropertyList:named:failedForProperty:withError:expectedType:)])
388 result = [_delegate verifier:self
389 withPropertyList:rootPList
391 failedForProperty:subPList
393 expectedType:localSchema];
395 @catch (NSException *exception)
397 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);
403 OOLog(
@"plistVerifier.failed",
@"Verification of property list \"%@\
" failed at %@: %@", name, [error plistKeyPathDescription], [error localizedFailureReason]);
410- (BOOL)verifyPList:(
id)rootPList
411 named:(NSString *)name
412 subProperty:(
id)subProperty
413 againstSchemaType:(
id)subSchema
415 tentative:(BOOL)tentative
416 error:(NSError **)outError
420 NSError *error =
nil;
421 NSDictionary *resolvedSpecifier =
nil;
422 NSAutoreleasePool *pool =
nil;
424 assert(outStop != NULL);
426 pool = [[NSAutoreleasePool alloc] init];
434 resolvedSpecifier = [
self resolveSchemaType:subSchema atPath:keyPath error:&error];
435 if (resolvedSpecifier !=
nil) type =
StringToSchemaType([resolvedSpecifier objectForKey:
@"type"], &error);
437 #define VERIFY_CASE(T) case kType##T: error = Verify_##T(self, subProperty, resolvedSpecifier, rootPList, name, keyPath, tentative, outStop); break;
461 @catch (NSException *exception)
472 *outStop = ![
self delegateVerifierWithPropertyList:rootPList
474 failedForProperty:subProperty
476 expectedType:subSchema];
478 else if (tentative) *outStop = YES;
481 if (outError != NULL && error !=
nil)
483 *outError = [error retain];
496- (NSDictionary *)resolveSchemaType:(
id)specifier
498 error:(NSError **)outError
501 NSString *complaint =
nil;
503 assert(outError != NULL);
505 if (![specifier isKindOfClass:[NSString
class]] && ![specifier isKindOfClass:[NSDictionary
class]])
goto BAD_TYPE;
509 if ([specifier isKindOfClass:[NSString
class]]) specifier = [NSDictionary dictionaryWithObject:specifier forKey:@"type"];
510 typeVal = [(NSDictionary *)specifier objectForKey:@"type"];
512 if ([typeVal isKindOfClass:[NSString
class]])
514 if ([typeVal hasPrefix:
@"$"])
517 specifier = [_definitions objectForKey:typeVal];
518 if (specifier ==
nil)
530 else if ([typeVal isKindOfClass:[NSDictionary
class]])
542 if (typeVal ==
nil) complaint =
@"no type specified";
543 else complaint =
@"not string or dictionary";
554 static NSDictionary *typeMap =
nil;
560 [[NSDictionary dictionaryWithObjectsAndKeys:
561 [NSNumber numberWithUnsignedInt:kTypeString], @"string",
562 [NSNumber numberWithUnsignedInt:kTypeArray], @"array",
563 [NSNumber numberWithUnsignedInt:kTypeDictionary], @"dictionary",
564 [NSNumber numberWithUnsignedInt:kTypeInteger], @"integer",
565 [NSNumber numberWithUnsignedInt:kTypePositiveInteger], @"positiveInteger",
566 [NSNumber numberWithUnsignedInt:kTypeFloat], @"float",
567 [NSNumber numberWithUnsignedInt:kTypePositiveFloat], @"positiveFloat",
568 [NSNumber numberWithUnsignedInt:kTypeOneOf], @"oneOf",
569 [NSNumber numberWithUnsignedInt:kTypeEnumeration], @"enumeration",
570 [NSNumber numberWithUnsignedInt:kTypeBoolean], @"boolean",
571 [NSNumber numberWithUnsignedInt:kTypeFuzzyBoolean], @"fuzzyBoolean",
572 [NSNumber numberWithUnsignedInt:kTypeVector], @"vector",
573 [NSNumber numberWithUnsignedInt:kTypeQuaternion], @"quaternion",
574 [NSNumber numberWithUnsignedInt:kTypeDelegatedType], @"delegatedType",
579 result = [[typeMap objectForKey:string] unsignedIntValue];
582 if ([
string hasPrefix:
@"$"])
598 NSEnumerator *filterEnum =
nil;
602 assert(outError != NULL);
604 if (filterSpec ==
nil)
return string;
606 if ([filterSpec isKindOfClass:[NSString
class]])
608 filterSpec = [NSArray arrayWithObject:filterSpec];
610 if ([filterSpec isKindOfClass:[NSArray
class]])
612 for (filterEnum = [filterSpec objectEnumerator]; (filter = [filterEnum nextObject]); )
614 if ([filter isKindOfClass:[NSString
class]])
616 if ([filter isEqual:
@"lowerCase"])
string = [string lowercaseString];
617 else if ([filter isEqual:
@"upperCase"])
string = [string uppercaseString];
618 else if ([filter isEqual:
@"capitalized"])
string = [string capitalizedString];
619 else if ([filter hasPrefix:
@"truncFront:"])
621 string = [string substringToIndex:[[filter substringFromIndex:11] intValue]];
623 else if ([filter hasPrefix:
@"truncBack:"])
625 string = [string substringToIndex:[[filter substringFromIndex:10] intValue]];
627 else if ([filter hasPrefix:
@"subStringTo:"])
629 range = [string rangeOfString:[filter substringFromIndex:12]];
630 if (range.location != NSNotFound)
632 string = [string substringToIndex:range.location];
635 else if ([filter hasPrefix:
@"subStringFrom:"])
637 range = [string rangeOfString:[filter substringFromIndex:14]];
638 if (range.location != NSNotFound)
640 string = [string substringFromIndex:range.location + range.length];
643 else if ([filter hasPrefix:
@"subStringToInclusive:"])
645 range = [string rangeOfString:[filter substringFromIndex:21]];
646 if (range.location != NSNotFound)
648 string = [string substringToIndex:range.location + range.length];
651 else if ([filter hasPrefix:
@"subStringFromInclusive:"])
653 range = [string rangeOfString:[filter substringFromIndex:23]];
654 if (range.location != NSNotFound)
656 string = [string substringFromIndex:range.location];
681 BOOL (*testIMP)(id, SEL, NSString *);
682 NSEnumerator *testEnum =
nil;
685 assert(outError != NULL);
687 if (test ==
nil)
return YES;
689 testIMP = (BOOL(*)(id, SEL, NSString *))[string methodForSelector:testSelector];
692 *outError =
Error(
kPListErrorInternal, &keyPath,
@"OOPListSchemaVerifier internal error: NSString does not respond to test selector %@.", NSStringFromSelector(testSelector));
696 if ([test isKindOfClass:[NSString
class]])
698 test = [NSArray arrayWithObject:test];
701 if ([test isKindOfClass:[NSArray
class]])
703 for (testEnum = [test objectEnumerator]; (subTest = [testEnum nextObject]); )
705 if ([subTest isKindOfClass:[NSString
class]])
707 if (testIMP(
string, testSelector, subTest))
return YES;
726 NSMutableArray *result =
nil;
729 result = [NSMutableArray array];
730 for (curr = &keyPath; curr != NULL; curr = curr->
link)
732 if (curr->
element !=
nil) [result insertObject:curr->element atIndex:0];
751 string = [string substringToIndex:kMaximumLengthForStringInErrorMessage];
753 result = [NSMutableString stringWithString:string];
754 [result replaceOccurrencesOfString:@"\t" withString:@" " options:0 range:NSMakeRange(0, [string length])];
755 [result replaceOccurrencesOfString:@"\r\n" withString:@" \\ " options:0 range:NSMakeRange(0, [string length])];
756 [result replaceOccurrencesOfString:@"\n" withString:@" \\ " options:0 range:NSMakeRange(0, [string length])];
757 [result replaceOccurrencesOfString:@"\r" withString:@" \\ " options:0 range:NSMakeRange(0, [string length])];
761 result = [result substringToIndex:kMaximumLengthForStringInErrorMessage - 3];
762 result = [result stringByAppendingString:@"..."];
771 NSString *result =
nil;
772 NSString *
string =
nil;
774 NSAutoreleasePool *pool =
nil;
776 count = [array count];
777 if (
count == 0)
return @"( )";
779 pool = [[NSAutoreleasePool alloc] init];
781 result = [NSString stringWithFormat:@"(%@", [array objectAtIndex:0]];
783 for (i = 1; i !=
count; ++i)
785 string = [result stringByAppendingFormat:@", %@", [array objectAtIndex:i]];
788 result = [result stringByAppendingString:@", ..."];
794 result = [result stringByAppendingString:@")"];
798 return [result autorelease];
804 return ArrayForErrorReport([[
set allObjects] sortedArrayUsingSelector:
@selector(caseInsensitiveCompare:)]);
810 if ([value isKindOfClass:[NSString
class]])
812 return [NSString stringWithFormat:@"\"%@\"", StringForErrorReport(value)];
815 if (arrayPrefix ==
nil) arrayPrefix =
@"";
816 if ([value isKindOfClass:[NSArray
class]])
818 return [arrayPrefix stringByAppendingString:ArrayForErrorReport(value)];
820 if ([value isKindOfClass:[NSSet
class]])
822 return [arrayPrefix stringByAppendingString:SetForErrorReport(value)];
824 if (value ==
nil)
return @"(null)";
831#define REQUIRE_TYPE(CLASSNAME, NAMESTRING) do { \
832 if (![value isKindOfClass:[CLASSNAME class]]) \
834 return ErrorTypeMismatch([CLASSNAME class], NAMESTRING, value, keyPath); \
840 NSString *filteredString =
nil;
843 NSUInteger lengthConstraint;
844 NSError *error =
nil;
851 filteredString =
ApplyStringFilter(value, [params objectForKey:
@"filter"], keyPath, &error);
852 if (filteredString ==
nil)
return error;
855 testValue = [params objectForKey:@"requiredPrefix"];
856 if (testValue !=
nil)
858 if (!
ApplyStringTest(filteredString, testValue,
@selector(hasPrefix:),
@"prefix", keyPath, &error))
865 testValue = [params objectForKey:@"requiredSuffix"];
866 if (testValue !=
nil)
868 if (!
ApplyStringTest(filteredString, testValue,
@selector(hasSuffix:),
@"suffix", keyPath, &error))
875 testValue = [params objectForKey:@"requiredSubString"];
876 if (testValue !=
nil)
878 if (!
ApplyStringTest(filteredString, testValue,
@selector(ooPListVerifierHasSubString:),
@"substring", keyPath, &error))
886 length = [filteredString length];
887 lengthConstraint = [params oo_unsignedIntegerForKey:@"minLength"];
888 if (length < lengthConstraint)
893 lengthConstraint = [params oo_unsignedIntegerForKey:@"maxLength" defaultValue:NSUIntegerMax];
894 if (lengthConstraint < length)
907 BOOL OK = YES, stop = NO;
909 id subProperty =
nil;
910 NSUInteger constraint;
917 count = [value count];
918 constraint = [params oo_unsignedIntegerForKey:@"minCount" defaultValue:0];
919 if (
count < constraint)
924 constraint = [params oo_unsignedIntegerForKey:@"maxCount" defaultValue:NSUIntegerMax];
925 if (constraint <
count)
931 valueType = [params objectForKey:@"valueType"];
932 if (valueType !=
nil)
934 for (i = 0; i !=
count; ++i)
936 subProperty = [value objectAtIndex:i];
938 if (![verifier verifyPList:rootPList
940 subProperty:subProperty
941 againstSchemaType:valueType
950 if ((stop && !tentative) || (tentative && !OK))
break;
954 *outStop = stop && !tentative;
963 NSDictionary *schema =
nil;
966 NSEnumerator *keyEnum =
nil;
968 id subProperty =
nil;
969 BOOL OK = YES, stop = NO, prematureExit = NO;
971 NSMutableSet *requiredKeys =
nil;
972 NSArray *requiredKeyList =
nil;
973 NSUInteger
count, constraint;
980 count = [value count];
981 constraint = [params oo_unsignedIntegerForKey:@"minCount" defaultValue:0];
982 if (
count < constraint)
986 constraint = [params oo_unsignedIntegerForKey:@"maxCount" defaultValue:NSUIntegerMax];
987 if (constraint <
count)
993 schema = [params oo_dictionaryForKey:@"schema"];
994 valueType = [params objectForKey:@"valueType"];
995 allowOthers = [params oo_boolForKey:@"allowOthers" defaultValue:YES];
996 requiredKeyList = [params oo_arrayForKey:@"requiredKeys"];
999 if (schema ==
nil && valueType ==
nil && requiredKeyList ==
nil && allowOthers)
return nil;
1001 if (requiredKeyList !=
nil)
1003 requiredKeys = [NSMutableSet setWithArray:requiredKeyList];
1009 for (keyEnum = [value keyEnumerator]; (key = [keyEnum nextObject]) && !stop; )
1011 subProperty = [(NSDictionary *)value objectForKey:key];
1012 typeSpec = [schema objectForKey:key];
1013 if (typeSpec ==
nil) typeSpec = valueType;
1018 if (typeSpec !=
nil)
1020 if (![verifier verifyPList:rootPList
1022 subProperty:subProperty
1023 againstSchemaType:typeSpec
1032 else if (!allowOthers && ![requiredKeys containsObject:key] && [schema objectForKey:key] ==
nil)
1049 [requiredKeys removeObject:key];
1051 if ((stop && !tentative) || (tentative && !OK))
1053 prematureExit = YES;
1061 if (!prematureExit && [requiredKeys
count] != 0)
1066 *outStop = stop && !tentative;
1075 long long numericValue;
1076 long long constraint;
1080 DebugDump(
@"* integer: %lli", numericValue);
1089 constraint = [params oo_longLongForKey:@"minimum" defaultValue:LLONG_MIN];
1090 if (numericValue < constraint)
1095 constraint = [params oo_longLongForKey:@"maximum" defaultValue:LLONG_MAX];
1096 if (constraint < numericValue)
1107 unsigned long long numericValue;
1108 unsigned long long constraint;
1112 DebugDump(
@"* positive integer: %llu", numericValue);
1117 return ErrorTypeMismatch([NSNumber
class],
@"positive integer", value, keyPath);
1121 constraint = [params oo_unsignedLongLongForKey:@"minimum" defaultValue:0];
1122 if (numericValue < constraint)
1127 constraint = [params oo_unsignedLongLongForKey:@"maximum" defaultValue:ULLONG_MAX];
1128 if (constraint < numericValue)
1139 double numericValue;
1144 DebugDump(
@"* float: %g", numericValue);
1153 constraint = [params oo_doubleForKey:@"minimum" defaultValue:-INFINITY];
1154 if (numericValue < constraint)
1159 constraint = [params oo_doubleForKey:@"maximum" defaultValue:INFINITY];
1160 if (constraint < numericValue)
1171 double numericValue;
1176 DebugDump(
@"* positive float: %g", numericValue);
1184 if (numericValue < 0)
1190 constraint = [params oo_doubleForKey:@"minimum" defaultValue:0];
1191 if (numericValue < constraint)
1196 constraint = [params oo_doubleForKey:@"maximum" defaultValue:INFINITY];
1197 if (constraint < numericValue)
1208 NSArray *options =
nil;
1209 BOOL OK = NO, stop = NO;
1210 NSEnumerator *optionEnum =
nil;
1213 NSMutableDictionary *errors =
nil;
1217 options = [params oo_arrayForKey:@"options"];
1224 errors = [[NSMutableDictionary alloc] initWithCapacity:[options count]];
1226 for (optionEnum = [options objectEnumerator]; (option = [optionEnum nextObject]) ;)
1228 if ([verifier verifyPList:rootPList
1231 againstSchemaType:option
1241 [errors setObject:error forKey:option];
1258 NSArray *values =
nil;
1259 NSString *filteredString =
nil;
1260 NSError *error =
nil;
1266 values = [params oo_arrayForKey:@"values"];
1275 filteredString =
ApplyStringFilter(value, [params objectForKey:
@"filter"], keyPath, &error);
1276 if (filteredString ==
nil)
return error;
1278 if ([values containsObject:filteredString])
return nil;
1296 DebugDump(
@"* fuzzy boolean: %@", value);
1301 else return ErrorTypeMismatch([NSNumber
class],
@"fuzzy boolean", value, keyPath);
1328 NSString *key =
nil;
1330 NSError *error =
nil;
1332 DebugDump(
@"* delegated type: %@", [params objectForKey:
@"key"]);
1334 baseType = [params objectForKey:@"baseType"];
1335 if (baseType !=
nil)
1337 if (![verifier verifyPList:rootPList
1340 againstSchemaType:baseType
1351 key = [params objectForKey:@"key"];
1362@implementation NSString (OOPListSchemaVerifierHelpers)
1364- (BOOL)ooPListVerifierHasSubString:(NSString *)string
1366 return [
self rangeOfString:string].location != NSNotFound;
1372@implementation NSError (OOPListSchemaVerifierConveniences)
1374- (NSArray *)plistKeyPath
1376 return [[
self userInfo] oo_arrayForKey:kPListKeyPathErrorKey];
1380- (NSString *)plistKeyPathDescription
1386- (NSSet *)missingRequiredKeys
1388 return [[
self userInfo] oo_setForKey:kMissingRequiredKeysErrorKey];
1392- (Class)expectedClass
1394 return [[
self userInfo] objectForKey:kExpectedClassErrorKey];
1398- (NSString *)expectedClassName
1400 NSString *result = [[
self userInfo] objectForKey:kExpectedClassNameErrorKey];
1401 if (result ==
nil) result = [[
self expectedClass] description];
1410 NSError *result =
nil;
1413 va_start(args, format);
1423 NSError *result =
nil;
1425 NSDictionary *dict =
nil;
1427 if (propKey !=
nil && propValue !=
nil)
1429 dict = [NSDictionary dictionaryWithObject:propValue forKey:propKey];
1431 va_start(args, format);
1441 NSError *result =
nil;
1444 va_start(args, format);
1454 NSString *message =
nil;
1455 NSMutableDictionary *userInfo =
nil;
1457 message = [[NSString alloc] initWithFormat:format arguments:arguments];
1459 userInfo = [NSMutableDictionary dictionaryWithDictionary:dict];
1460 [userInfo setObject:message forKey:NSLocalizedFailureReasonErrorKey];
1461 if (keyPath != NULL)
1463 [userInfo setObject:KeyPathToArray(*keyPath) forKey:kPListKeyPathErrorKey];
1468 return [NSError errorWithDomain:kOOPListSchemaVerifierErrorDomain code:errorCode userInfo:userInfo];
1474 NSDictionary *dict =
nil;
1475 NSString *className =
nil;
1477 if (expectedClassName ==
nil) expectedClassName = [expectedClass description];
1479 dict = [NSDictionary dictionaryWithObjectsAndKeys:
1480 expectedClassName, kExpectedClassNameErrorKey,
1481 expectedClass, kExpectedClassErrorKey,
1484 if (actualObject ==
nil) className =
@"nothing";
1485 else if ([actualObject isKindOfClass:[NSString
class]]) className =
@"string";
1486 else if ([actualObject isKindOfClass:[NSNumber
class]]) className =
@"number";
1487 else if ([actualObject isKindOfClass:[NSArray
class]]) className =
@"array";
1488 else if ([actualObject isKindOfClass:[NSDictionary
class]]) className =
@"dictionary";
1489 else if ([actualObject isKindOfClass:[NSData
class]]) className =
@"data";
1490 else if ([actualObject isKindOfClass:[NSDate
class]]) className =
@"date";
1491 else className = [[actualObject class] description];
1499 return [NSError errorWithDomain:kOOPListSchemaVerifierErrorDomain code:kPListErrorFailedAndErrorHasBeenReported userInfo:nil];
#define OOLog(class, format,...)
void OOLogSetDisplayMessagesInClass(NSString *inClass, BOOL inFlag)
OOPListSchemaVerifierErrorCode
@ kPListErrorDictionaryMissingRequiredKeys
@ kPListErrorSchemaNoEnumerationValues
@ kPListErrorNumberIsNegative
@ kPListErrorEnumerationBadValue
@ kPListErrorSchemaBadTypeSpecifier
@ kPListErrorSchemaNoOneOfOptions
@ kPListErrorTypeMismatch
@ kPListErrorStringSubstringMissing
@ kPListErrorSchemaUnknownType
@ kPListErrorMaximumConstraintNotMet
@ kPListErrorDictionaryUnknownKey
@ kPListErrorMinimumConstraintNotMet
@ kPListErrorLastErrorCode
@ kPListDelegatedTypeError
@ kPListErrorStringSuffixMissing
@ kPListErrorOneOfNoMatch
@ kPListErrorSchemaUndefiniedMacroReference
@ kPListErrorSchemaBadComparator
@ kPListErrorSchemaUnknownFilter
@ kPListErrorStringPrefixMissing
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:testProperty:atPath:againstType:error:(id rootPList,[named] NSString *name,[testProperty] id subPList,[atPath] BackLinkChain keyPath,[againstType] NSString *typeKey,[error] NSError **outError)
BOOL delegateVerifierWithPropertyList:named:failedForProperty:withError:expectedType:(id rootPList,[named] NSString *name,[failedForProperty] id subPList,[withError] NSError *error,[expectedType] NSDictionary *localSchema)