27#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
37static NSSet *
SetForObject(
id object, NSSet *defaultValue);
41@implementation NSArray (OOExtractor)
43- (char) oo_charAtIndex:(NSUInteger)index defaultValue:(
char)value
45 return OOCharFromObject([
self oo_objectAtIndex:index], value);
43- (char) oo_charAtIndex:(NSUInteger)index defaultValue:(
char)value {
…}
49- (short) oo_shortAtIndex:(NSUInteger)index defaultValue:(
short)value
51 return OOShortFromObject([
self oo_objectAtIndex:index], value);
49- (short) oo_shortAtIndex:(NSUInteger)index defaultValue:(
short)value {
…}
55- (
int) oo_intAtIndex:(NSUInteger)index defaultValue:(
int)value
57 return OOIntFromObject([
self oo_objectAtIndex:index], value);
55- (
int) oo_intAtIndex:(NSUInteger)index defaultValue:(
int)value {
…}
61- (
long) oo_longAtIndex:(NSUInteger)index defaultValue:(
long)value
63 return OOLongFromObject([
self oo_objectAtIndex:index], value);
61- (
long) oo_longAtIndex:(NSUInteger)index defaultValue:(
long)value {
…}
67- (
long long) oo_longLongAtIndex:(NSUInteger)index defaultValue:(
long long)value
67- (
long long) oo_longLongAtIndex:(NSUInteger)index defaultValue:(
long long)value {
…}
73- (NSInteger) oo_integerAtIndex:(NSUInteger)index defaultValue:(NSInteger)value
73- (NSInteger) oo_integerAtIndex:(NSUInteger)index defaultValue:(NSInteger)value {
…}
79- (
unsigned char) oo_unsignedCharAtIndex:(NSUInteger)index defaultValue:(
unsigned char)value
81 return OOUnsignedCharFromObject([
self oo_objectAtIndex:index], value);
79- (
unsigned char) oo_unsignedCharAtIndex:(NSUInteger)index defaultValue:(
unsigned char)value {
…}
85- (
unsigned short) oo_unsignedShortAtIndex:(NSUInteger)index defaultValue:(
unsigned short)value
87 return OOUnsignedShortFromObject([
self oo_objectAtIndex:index], value);
85- (
unsigned short) oo_unsignedShortAtIndex:(NSUInteger)index defaultValue:(
unsigned short)value {
…}
91- (
unsigned int) oo_unsignedIntAtIndex:(NSUInteger)index defaultValue:(
unsigned int)value
93 return OOUnsignedIntFromObject([
self oo_objectAtIndex:index], value);
91- (
unsigned int) oo_unsignedIntAtIndex:(NSUInteger)index defaultValue:(
unsigned int)value {
…}
97- (
unsigned long) oo_unsignedLongAtIndex:(NSUInteger)index defaultValue:(
unsigned long)value
99 return OOUnsignedLongFromObject([
self oo_objectAtIndex:index], value);
97- (
unsigned long) oo_unsignedLongAtIndex:(NSUInteger)index defaultValue:(
unsigned long)value {
…}
103- (
unsigned long long) oo_unsignedLongLongAtIndex:(NSUInteger)index defaultValue:(
unsigned long long)value
103- (
unsigned long long) oo_unsignedLongLongAtIndex:(NSUInteger)index defaultValue:(
unsigned long long)value {
…}
109- (NSUInteger) oo_unsignedIntegerAtIndex:(NSUInteger)index defaultValue:(NSUInteger)value
109- (NSUInteger) oo_unsignedIntegerAtIndex:(NSUInteger)index defaultValue:(NSUInteger)value {
…}
115- (BOOL) oo_boolAtIndex:(NSUInteger)index defaultValue:(BOOL)value
115- (BOOL) oo_boolAtIndex:(NSUInteger)index defaultValue:(BOOL)value {
…}
121#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
122- (BOOL) oo_fuzzyBooleanAtIndex:(NSUInteger)index defaultValue:(
float)value
122- (BOOL) oo_fuzzyBooleanAtIndex:(NSUInteger)index defaultValue:(
float)value {
…}
129- (float) oo_floatAtIndex:(NSUInteger)index defaultValue:(
float)value
129- (float) oo_floatAtIndex:(NSUInteger)index defaultValue:(
float)value {
…}
135- (double) oo_doubleAtIndex:(NSUInteger)index defaultValue:(
double)value
135- (double) oo_doubleAtIndex:(NSUInteger)index defaultValue:(
double)value {
…}
141- (float) oo_nonNegativeFloatAtIndex:(NSUInteger)index defaultValue:(
float)value
141- (float) oo_nonNegativeFloatAtIndex:(NSUInteger)index defaultValue:(
float)value {
…}
147- (double) oo_nonNegativeDoubleAtIndex:(NSUInteger)index defaultValue:(
double)value
147- (double) oo_nonNegativeDoubleAtIndex:(NSUInteger)index defaultValue:(
double)value {
…}
153- (id) oo_objectAtIndex:(NSUInteger)index defaultValue:(
id)value
158 if (objVal !=
nil) result = objVal;
153- (id) oo_objectAtIndex:(NSUInteger)index defaultValue:(
id)value {
…}
165- (id) oo_objectOfClass:(Class)class atIndex:(NSUInteger)index defaultValue:(
id)value
170 if ([objVal isKindOfClass:
class]) result = objVal;
165- (id) oo_objectOfClass:(Class)class atIndex:(NSUInteger)index defaultValue:(
id)value {
…}
177- (NSString *) oo_stringAtIndex:(NSUInteger)index defaultValue:(NSString *)value
177- (NSString *) oo_stringAtIndex:(NSUInteger)index defaultValue:(NSString *)value {
…}
183- (NSArray *) oo_arrayAtIndex:(NSUInteger)index defaultValue:(NSArray *)value
183- (NSArray *) oo_arrayAtIndex:(NSUInteger)index defaultValue:(NSArray *)value {
…}
189- (NSSet *) oo_setAtIndex:(NSUInteger)index defaultValue:(NSSet *)value
191 return SetForObject([
self oo_objectAtIndex:index], value);
189- (NSSet *) oo_setAtIndex:(NSUInteger)index defaultValue:(NSSet *)value {
…}
195- (NSDictionary *) oo_dictionaryAtIndex:(NSUInteger)index defaultValue:(NSDictionary *)value
195- (NSDictionary *) oo_dictionaryAtIndex:(NSUInteger)index defaultValue:(NSDictionary *)value {
…}
201- (NSData *) oo_dataAtIndex:(NSUInteger)index defaultValue:(NSData *)value
201- (NSData *) oo_dataAtIndex:(NSUInteger)index defaultValue:(NSData *)value {
…}
207#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
208- (Vector) oo_vectorAtIndex:(NSUInteger)index defaultValue:(Vector)value
208- (Vector) oo_vectorAtIndex:(NSUInteger)index defaultValue:(Vector)value {
…}
214- (Quaternion) oo_quaternionAtIndex:(NSUInteger)index defaultValue:(Quaternion)value
214- (Quaternion) oo_quaternionAtIndex:(NSUInteger)index defaultValue:(Quaternion)value {
…}
221- (char) oo_charAtIndex:(NSUInteger)index
221- (char) oo_charAtIndex:(NSUInteger)index {
…}
227- (short) oo_shortAtIndex:(NSUInteger)index
227- (short) oo_shortAtIndex:(NSUInteger)index {
…}
233- (
int) oo_intAtIndex:(NSUInteger)index
233- (
int) oo_intAtIndex:(NSUInteger)index {
…}
239- (
long) oo_longAtIndex:(NSUInteger)index
239- (
long) oo_longAtIndex:(NSUInteger)index {
…}
245- (
long long) oo_longLongAtIndex:(NSUInteger)index
245- (
long long) oo_longLongAtIndex:(NSUInteger)index {
…}
251- (NSInteger) oo_integerAtIndex:(NSUInteger)index
251- (NSInteger) oo_integerAtIndex:(NSUInteger)index {
…}
257- (
unsigned char) oo_unsignedCharAtIndex:(NSUInteger)index
257- (
unsigned char) oo_unsignedCharAtIndex:(NSUInteger)index {
…}
263- (
unsigned short) oo_unsignedShortAtIndex:(NSUInteger)index
263- (
unsigned short) oo_unsignedShortAtIndex:(NSUInteger)index {
…}
269- (
unsigned int) oo_unsignedIntAtIndex:(NSUInteger)index
269- (
unsigned int) oo_unsignedIntAtIndex:(NSUInteger)index {
…}
275- (
unsigned long) oo_unsignedLongAtIndex:(NSUInteger)index
275- (
unsigned long) oo_unsignedLongAtIndex:(NSUInteger)index {
…}
281- (
unsigned long long) oo_unsignedLongLongAtIndex:(NSUInteger)index
281- (
unsigned long long) oo_unsignedLongLongAtIndex:(NSUInteger)index {
…}
287- (NSUInteger) oo_unsignedIntegerAtIndex:(NSUInteger)index
287- (NSUInteger) oo_unsignedIntegerAtIndex:(NSUInteger)index {
…}
293- (BOOL) oo_boolAtIndex:(NSUInteger)index
293- (BOOL) oo_boolAtIndex:(NSUInteger)index {
…}
299#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
300- (BOOL) oo_fuzzyBooleanAtIndex:(NSUInteger)index
300- (BOOL) oo_fuzzyBooleanAtIndex:(NSUInteger)index {
…}
307- (float) oo_floatAtIndex:(NSUInteger)index
307- (float) oo_floatAtIndex:(NSUInteger)index {
…}
313- (double) oo_doubleAtIndex:(NSUInteger)index
313- (double) oo_doubleAtIndex:(NSUInteger)index {
…}
319- (float) oo_nonNegativeFloatAtIndex:(NSUInteger)index
319- (float) oo_nonNegativeFloatAtIndex:(NSUInteger)index {
…}
325- (double) oo_nonNegativeDoubleAtIndex:(NSUInteger)index
325- (double) oo_nonNegativeDoubleAtIndex:(NSUInteger)index {
…}
331- (id) oo_objectAtIndex:(NSUInteger)index
333 if (index < [
self count])
return [
self objectAtIndex:index];
331- (id) oo_objectAtIndex:(NSUInteger)index {
…}
338- (id) oo_objectOfClass:(Class)class atIndex:(NSUInteger)index
338- (id) oo_objectOfClass:(Class)class atIndex:(NSUInteger)index {
…}
344- (NSString *) oo_stringAtIndex:(NSUInteger)index
344- (NSString *) oo_stringAtIndex:(NSUInteger)index {
…}
350- (NSArray *) oo_arrayAtIndex:(NSUInteger)index
350- (NSArray *) oo_arrayAtIndex:(NSUInteger)index {
…}
356- (NSSet *) oo_setAtIndex:(NSUInteger)index
356- (NSSet *) oo_setAtIndex:(NSUInteger)index {
…}
362- (NSDictionary *) oo_dictionaryAtIndex:(NSUInteger)index
362- (NSDictionary *) oo_dictionaryAtIndex:(NSUInteger)index {
…}
368- (NSData *) oo_dataAtIndex:(NSUInteger)index
368- (NSData *) oo_dataAtIndex:(NSUInteger)index {
…}
374#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
375- (Vector) oo_vectorAtIndex:(NSUInteger)index
375- (Vector) oo_vectorAtIndex:(NSUInteger)index {
…}
381- (Quaternion) oo_quaternionAtIndex:(NSUInteger)index
381- (Quaternion) oo_quaternionAtIndex:(NSUInteger)index {
…}
390@implementation NSDictionary (OOExtractor)
392- (char) oo_charForKey:(
id)key defaultValue:(
char)value
394 return OOCharFromObject([
self objectForKey:key], value);
392- (char) oo_charForKey:(
id)key defaultValue:(
char)value {
…}
398- (short) oo_shortForKey:(
id)key defaultValue:(
short)value
400 return OOShortFromObject([
self objectForKey:key], value);
398- (short) oo_shortForKey:(
id)key defaultValue:(
short)value {
…}
404- (
int) oo_intForKey:(
id)key defaultValue:(
int)value
406 return OOIntFromObject([
self objectForKey:key], value);
404- (
int) oo_intForKey:(
id)key defaultValue:(
int)value {
…}
410- (
long) oo_longForKey:(
id)key defaultValue:(
long)value
412 return OOLongFromObject([
self objectForKey:key], value);
410- (
long) oo_longForKey:(
id)key defaultValue:(
long)value {
…}
416- (
long long) oo_longLongForKey:(
id)key defaultValue:(
long long)value
416- (
long long) oo_longLongForKey:(
id)key defaultValue:(
long long)value {
…}
422- (NSInteger) oo_integerForKey:(
id)key defaultValue:(NSInteger)value
422- (NSInteger) oo_integerForKey:(
id)key defaultValue:(NSInteger)value {
…}
428- (
unsigned char) oo_unsignedCharForKey:(
id)key defaultValue:(
unsigned char)value
430 return OOUnsignedCharFromObject([
self objectForKey:key], value);
428- (
unsigned char) oo_unsignedCharForKey:(
id)key defaultValue:(
unsigned char)value {
…}
434- (
unsigned short) oo_unsignedShortForKey:(
id)key defaultValue:(
unsigned short)value
436 return OOUnsignedShortFromObject([
self objectForKey:key], value);
434- (
unsigned short) oo_unsignedShortForKey:(
id)key defaultValue:(
unsigned short)value {
…}
440- (
unsigned int) oo_unsignedIntForKey:(
id)key defaultValue:(
unsigned int)value
442 return OOUnsignedIntFromObject([
self objectForKey:key], value);
440- (
unsigned int) oo_unsignedIntForKey:(
id)key defaultValue:(
unsigned int)value {
…}
446- (
unsigned long) oo_unsignedLongForKey:(
id)key defaultValue:(
unsigned long)value
448 return OOUnsignedLongFromObject([
self objectForKey:key], value);
446- (
unsigned long) oo_unsignedLongForKey:(
id)key defaultValue:(
unsigned long)value {
…}
452- (
unsigned long long) oo_unsignedLongLongForKey:(
id)key defaultValue:(
unsigned long long)value
452- (
unsigned long long) oo_unsignedLongLongForKey:(
id)key defaultValue:(
unsigned long long)value {
…}
458- (NSUInteger) oo_unsignedIntegerForKey:(
id)key defaultValue:(NSUInteger)value
458- (NSUInteger) oo_unsignedIntegerForKey:(
id)key defaultValue:(NSUInteger)value {
…}
464- (BOOL) oo_boolForKey:(
id)key defaultValue:(BOOL)value
464- (BOOL) oo_boolForKey:(
id)key defaultValue:(BOOL)value {
…}
470#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
471- (BOOL) oo_fuzzyBooleanForKey:(
id)key defaultValue:(
float)value
471- (BOOL) oo_fuzzyBooleanForKey:(
id)key defaultValue:(
float)value {
…}
478- (float) oo_floatForKey:(
id)key defaultValue:(
float)value
478- (float) oo_floatForKey:(
id)key defaultValue:(
float)value {
…}
484- (double) oo_doubleForKey:(
id)key defaultValue:(
double)value
484- (double) oo_doubleForKey:(
id)key defaultValue:(
double)value {
…}
490- (float) oo_nonNegativeFloatForKey:(
id)key defaultValue:(
float)value
490- (float) oo_nonNegativeFloatForKey:(
id)key defaultValue:(
float)value {
…}
496- (double) oo_nonNegativeDoubleForKey:(
id)key defaultValue:(
double)value
496- (double) oo_nonNegativeDoubleForKey:(
id)key defaultValue:(
double)value {
…}
502- (id) oo_objectForKey:(
id)key defaultValue:(
id)value
504 id objVal = [
self objectForKey:key];
507 if (objVal !=
nil) result = objVal;
502- (id) oo_objectForKey:(
id)key defaultValue:(
id)value {
…}
514- (id) oo_objectOfClass:(Class)class forKey:(
id)key defaultValue:(
id)value
516 id objVal = [
self objectForKey:key];
519 if ([objVal isKindOfClass:
class]) result = objVal;
514- (id) oo_objectOfClass:(Class)class forKey:(
id)key defaultValue:(
id)value {
…}
526- (NSString *) oo_stringForKey:(
id)key defaultValue:(NSString *)value
526- (NSString *) oo_stringForKey:(
id)key defaultValue:(NSString *)value {
…}
532- (NSArray *) oo_arrayForKey:(
id)key defaultValue:(NSArray *)value
532- (NSArray *) oo_arrayForKey:(
id)key defaultValue:(NSArray *)value {
…}
538- (NSSet *) oo_setForKey:(
id)key defaultValue:(NSSet *)value
538- (NSSet *) oo_setForKey:(
id)key defaultValue:(NSSet *)value {
…}
544- (NSDictionary *) oo_dictionaryForKey:(
id)key defaultValue:(NSDictionary *)value
544- (NSDictionary *) oo_dictionaryForKey:(
id)key defaultValue:(NSDictionary *)value {
…}
550- (NSMutableDictionary *) oo_mutableDictionaryForKey:(
id)key defaultValue:(NSDictionary *)value
550- (NSMutableDictionary *) oo_mutableDictionaryForKey:(
id)key defaultValue:(NSDictionary *)value {
…}
557- (NSData *) oo_dataForKey:(
id)key defaultValue:(NSData *)value
557- (NSData *) oo_dataForKey:(
id)key defaultValue:(NSData *)value {
…}
563#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
564- (Vector) oo_vectorForKey:(
id)key defaultValue:(Vector)value
564- (Vector) oo_vectorForKey:(
id)key defaultValue:(Vector)value {
…}
569- (HPVector) oo_hpvectorForKey:(
id)key defaultValue:(HPVector)value
569- (HPVector) oo_hpvectorForKey:(
id)key defaultValue:(HPVector)value {
…}
575- (Quaternion) oo_quaternionForKey:(
id)key defaultValue:(Quaternion)value
575- (Quaternion) oo_quaternionForKey:(
id)key defaultValue:(Quaternion)value {
…}
582- (char) oo_charForKey:(
id)key
582- (char) oo_charForKey:(
id)key {
…}
588- (short) oo_shortForKey:(
id)key
588- (short) oo_shortForKey:(
id)key {
…}
594- (
int) oo_intForKey:(
id)key
594- (
int) oo_intForKey:(
id)key {
…}
606- (
long long) oo_longLongForKey:(
id)key
606- (
long long) oo_longLongForKey:(
id)key {
…}
612- (NSInteger) oo_integerForKey:(
id)key
612- (NSInteger) oo_integerForKey:(
id)key {
…}
618- (
unsigned char) oo_unsignedCharForKey:(
id)key
618- (
unsigned char) oo_unsignedCharForKey:(
id)key {
…}
624- (
unsigned short) oo_unsignedShortForKey:(
id)key
624- (
unsigned short) oo_unsignedShortForKey:(
id)key {
…}
630- (
unsigned int) oo_unsignedIntForKey:(
id)key
630- (
unsigned int) oo_unsignedIntForKey:(
id)key {
…}
636- (
unsigned long) oo_unsignedLongForKey:(
id)key
636- (
unsigned long) oo_unsignedLongForKey:(
id)key {
…}
642- (NSUInteger) oo_unsignedIntegerForKey:(
id)key
642- (NSUInteger) oo_unsignedIntegerForKey:(
id)key {
…}
648- (
unsigned long long) oo_unsignedLongLongForKey:(
id)key
648- (
unsigned long long) oo_unsignedLongLongForKey:(
id)key {
…}
654- (BOOL) oo_boolForKey:(
id)key
654- (BOOL) oo_boolForKey:(
id)key {
…}
660#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
661- (BOOL) oo_fuzzyBooleanForKey:(
id)key
661- (BOOL) oo_fuzzyBooleanForKey:(
id)key {
…}
668- (float) oo_floatForKey:(
id)key
668- (float) oo_floatForKey:(
id)key {
…}
674- (double) oo_doubleForKey:(
id)key
674- (double) oo_doubleForKey:(
id)key {
…}
680- (float) oo_nonNegativeFloatForKey:(
id)key
680- (float) oo_nonNegativeFloatForKey:(
id)key {
…}
686- (double) oo_nonNegativeDoubleForKey:(
id)key
686- (double) oo_nonNegativeDoubleForKey:(
id)key {
…}
692- (id) oo_objectOfClass:(Class)class forKey:(
id)key
692- (id) oo_objectOfClass:(Class)class forKey:(
id)key {
…}
698- (NSString *) oo_stringForKey:(
id)key
698- (NSString *) oo_stringForKey:(
id)key {
…}
704- (NSArray *) oo_arrayForKey:(
id)key
704- (NSArray *) oo_arrayForKey:(
id)key {
…}
710- (NSSet *) oo_setForKey:(
id)key
710- (NSSet *) oo_setForKey:(
id)key {
…}
716- (NSDictionary *) oo_dictionaryForKey:(
id)key
716- (NSDictionary *) oo_dictionaryForKey:(
id)key {
…}
722- (NSMutableDictionary *) oo_mutableDictionaryForKey:(
id)key
722- (NSMutableDictionary *) oo_mutableDictionaryForKey:(
id)key {
…}
728- (NSData *) oo_dataForKey:(
id)key
728- (NSData *) oo_dataForKey:(
id)key {
…}
734#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
735- (Vector) oo_vectorForKey:(
id)key
735- (Vector) oo_vectorForKey:(
id)key {
…}
740- (HPVector) oo_hpvectorForKey:(
id)key
740- (HPVector) oo_hpvectorForKey:(
id)key {
…}
746- (Quaternion) oo_quaternionForKey:(
id)key
746- (Quaternion) oo_quaternionForKey:(
id)key {
…}
755@implementation NSUserDefaults (OOExtractor)
757- (char) oo_charForKey:(
id)key defaultValue:(
char)value
759 return OOCharFromObject([
self objectForKey:key], value);
757- (char) oo_charForKey:(
id)key defaultValue:(
char)value {
…}
763- (short) oo_shortForKey:(
id)key defaultValue:(
short)value
765 return OOShortFromObject([
self objectForKey:key], value);
763- (short) oo_shortForKey:(
id)key defaultValue:(
short)value {
…}
769- (
int) oo_intForKey:(
id)key defaultValue:(
int)value
771 return OOIntFromObject([
self objectForKey:key], value);
769- (
int) oo_intForKey:(
id)key defaultValue:(
int)value {
…}
775- (
long) oo_longForKey:(
id)key defaultValue:(
long)value
777 return OOLongFromObject([
self objectForKey:key], value);
775- (
long) oo_longForKey:(
id)key defaultValue:(
long)value {
…}
781- (
long long) oo_longLongForKey:(
id)key defaultValue:(
long long)value
781- (
long long) oo_longLongForKey:(
id)key defaultValue:(
long long)value {
…}
787- (NSInteger) oo_integerForKey:(
id)key defaultValue:(NSInteger)value
787- (NSInteger) oo_integerForKey:(
id)key defaultValue:(NSInteger)value {
…}
793- (
unsigned char) oo_unsignedCharForKey:(
id)key defaultValue:(
unsigned char)value
795 return OOUnsignedCharFromObject([
self objectForKey:key], value);
793- (
unsigned char) oo_unsignedCharForKey:(
id)key defaultValue:(
unsigned char)value {
…}
799- (
unsigned short) oo_unsignedShortForKey:(
id)key defaultValue:(
unsigned short)value
801 return OOUnsignedShortFromObject([
self objectForKey:key], value);
799- (
unsigned short) oo_unsignedShortForKey:(
id)key defaultValue:(
unsigned short)value {
…}
805- (
unsigned int) oo_unsignedIntForKey:(
id)key defaultValue:(
unsigned int)value
807 return OOUnsignedIntFromObject([
self objectForKey:key], value);
805- (
unsigned int) oo_unsignedIntForKey:(
id)key defaultValue:(
unsigned int)value {
…}
811- (
unsigned long) oo_unsignedLongForKey:(
id)key defaultValue:(
unsigned long)value
813 return OOUnsignedLongFromObject([
self objectForKey:key], value);
811- (
unsigned long) oo_unsignedLongForKey:(
id)key defaultValue:(
unsigned long)value {
…}
817- (
unsigned long long) oo_unsignedLongLongForKey:(
id)key defaultValue:(
unsigned long long)value
817- (
unsigned long long) oo_unsignedLongLongForKey:(
id)key defaultValue:(
unsigned long long)value {
…}
823- (NSUInteger) oo_unsignedIntegerForKey:(
id)key defaultValue:(NSUInteger)value
823- (NSUInteger) oo_unsignedIntegerForKey:(
id)key defaultValue:(NSUInteger)value {
…}
829- (BOOL) oo_boolForKey:(
id)key defaultValue:(BOOL)value
829- (BOOL) oo_boolForKey:(
id)key defaultValue:(BOOL)value {
…}
835#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
836- (BOOL) oo_fuzzyBooleanForKey:(
id)key defaultValue:(
float)value
836- (BOOL) oo_fuzzyBooleanForKey:(
id)key defaultValue:(
float)value {
…}
843- (float) oo_floatForKey:(
id)key defaultValue:(
float)value
843- (float) oo_floatForKey:(
id)key defaultValue:(
float)value {
…}
849- (double) oo_doubleForKey:(
id)key defaultValue:(
double)value
849- (double) oo_doubleForKey:(
id)key defaultValue:(
double)value {
…}
855- (float) oo_nonNegativeFloatForKey:(
id)key defaultValue:(
float)value
855- (float) oo_nonNegativeFloatForKey:(
id)key defaultValue:(
float)value {
…}
861- (double) oo_nonNegativeDoubleForKey:(
id)key defaultValue:(
double)value
861- (double) oo_nonNegativeDoubleForKey:(
id)key defaultValue:(
double)value {
…}
867- (id) oo_objectForKey:(
id)key defaultValue:(
id)value
869 id objVal = [
self objectForKey:key];
872 if (objVal !=
nil) result = objVal;
867- (id) oo_objectForKey:(
id)key defaultValue:(
id)value {
…}
879- (id) oo_objectOfClass:(Class)class forKey:(
id)key defaultValue:(
id)value
881 id objVal = [
self objectForKey:key];
884 if ([objVal isKindOfClass:
class]) result = objVal;
879- (id) oo_objectOfClass:(Class)class forKey:(
id)key defaultValue:(
id)value {
…}
891- (NSString *) oo_stringForKey:(
id)key defaultValue:(NSString *)value
891- (NSString *) oo_stringForKey:(
id)key defaultValue:(NSString *)value {
…}
897- (NSArray *) oo_arrayForKey:(
id)key defaultValue:(NSArray *)value
897- (NSArray *) oo_arrayForKey:(
id)key defaultValue:(NSArray *)value {
…}
903- (NSSet *) oo_setForKey:(
id)key defaultValue:(NSSet *)value
903- (NSSet *) oo_setForKey:(
id)key defaultValue:(NSSet *)value {
…}
909- (NSDictionary *) oo_dictionaryForKey:(
id)key defaultValue:(NSDictionary *)value
909- (NSDictionary *) oo_dictionaryForKey:(
id)key defaultValue:(NSDictionary *)value {
…}
915- (NSData *) oo_dataForKey:(
id)key defaultValue:(NSData *)value
915- (NSData *) oo_dataForKey:(
id)key defaultValue:(NSData *)value {
…}
921- (char) oo_charForKey:(
id)key
921- (char) oo_charForKey:(
id)key {
…}
927- (short) oo_shortForKey:(
id)key
927- (short) oo_shortForKey:(
id)key {
…}
933- (
int) oo_intForKey:(
id)key
933- (
int) oo_intForKey:(
id)key {
…}
945- (
long long) oo_longLongForKey:(
id)key
945- (
long long) oo_longLongForKey:(
id)key {
…}
951- (
unsigned char) oo_unsignedCharForKey:(
id)key
951- (
unsigned char) oo_unsignedCharForKey:(
id)key {
…}
957- (
unsigned short) oo_unsignedShortForKey:(
id)key
957- (
unsigned short) oo_unsignedShortForKey:(
id)key {
…}
963- (
unsigned int) oo_unsignedIntForKey:(
id)key
963- (
unsigned int) oo_unsignedIntForKey:(
id)key {
…}
969- (
unsigned long) oo_unsignedLongForKey:(
id)key
969- (
unsigned long) oo_unsignedLongForKey:(
id)key {
…}
975- (
unsigned long long) oo_unsignedLongLongForKey:(
id)key
975- (
unsigned long long) oo_unsignedLongLongForKey:(
id)key {
…}
981#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
982- (BOOL) oo_fuzzyBooleanForKey:(
id)key
982- (BOOL) oo_fuzzyBooleanForKey:(
id)key {
…}
989- (double) oo_doubleForKey:(NSString *)key
989- (double) oo_doubleForKey:(NSString *)key {
…}
995- (float) oo_nonNegativeFloatForKey:(
id)key
995- (float) oo_nonNegativeFloatForKey:(
id)key {
…}
1001- (double) oo_nonNegativeDoubleForKey:(
id)key
1001- (double) oo_nonNegativeDoubleForKey:(
id)key {
…}
1007- (id) oo_objectOfClass:(Class)class forKey:(
id)key
1007- (id) oo_objectOfClass:(Class)class forKey:(
id)key {
…}
1013- (NSSet *) oo_setForKey:(
id)key
1013- (NSSet *) oo_setForKey:(
id)key {
…}
1021@implementation NSMutableArray (OOInserter)
1023- (void) oo_addInteger:(
long)value
1025 [
self addObject:[
NSNumber numberWithLong:value]];
1023- (void) oo_addInteger:(
long)value {
…}
1029- (void) oo_addUnsignedInteger:(
unsigned long)value
1031 [
self addObject:[
NSNumber numberWithUnsignedLong:value]];
1029- (void) oo_addUnsignedInteger:(
unsigned long)value {
…}
1035- (void) oo_addFloat:(
double)value
1037 [
self addObject:[
NSNumber numberWithDouble:value]];
1035- (void) oo_addFloat:(
double)value {
…}
1041- (void) oo_addBool:(BOOL)value
1043 [
self addObject:[
NSNumber numberWithBool:value]];
1041- (void) oo_addBool:(BOOL)value {
…}
1047#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
1048- (void) oo_addVector:(Vector)value
1050 [
self addObject:OOPropertyListFromVector(value)];
1048- (void) oo_addVector:(Vector)value {
…}
1054- (void) oo_addQuaternion:(Quaternion)value
1056 [
self addObject:OOPropertyListFromQuaternion(value)];
1054- (void) oo_addQuaternion:(Quaternion)value {
…}
1061- (void) oo_insertInteger:(
long)value atIndex:(NSUInteger)index
1063 [
self insertObject:[
NSNumber numberWithLong:value] atIndex:index];
1061- (void) oo_insertInteger:(
long)value atIndex:(NSUInteger)index {
…}
1067- (void) oo_insertUnsignedInteger:(
unsigned long)value atIndex:(NSUInteger)index
1069 [
self insertObject:[
NSNumber numberWithUnsignedLong:value] atIndex:index];
1067- (void) oo_insertUnsignedInteger:(
unsigned long)value atIndex:(NSUInteger)index {
…}
1073- (void) oo_insertFloat:(
double)value atIndex:(NSUInteger)index
1075 [
self insertObject:[
NSNumber numberWithDouble:value] atIndex:index];
1073- (void) oo_insertFloat:(
double)value atIndex:(NSUInteger)index {
…}
1079- (void) oo_insertBool:(BOOL)value atIndex:(NSUInteger)index
1081 [
self insertObject:[
NSNumber numberWithBool:value] atIndex:index];
1079- (void) oo_insertBool:(BOOL)value atIndex:(NSUInteger)index {
…}
1085#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
1086- (void) oo_insertVector:(Vector)value atIndex:(NSUInteger)index
1088 [
self insertObject:OOPropertyListFromVector(value) atIndex:index];
1086- (void) oo_insertVector:(Vector)value atIndex:(NSUInteger)index {
…}
1092- (void) oo_insertQuaternion:(Quaternion)value atIndex:(NSUInteger)index
1094 [
self insertObject:OOPropertyListFromQuaternion(value) atIndex:index];
1092- (void) oo_insertQuaternion:(Quaternion)value atIndex:(NSUInteger)index {
…}
1101@implementation NSMutableDictionary (OOInserter)
1103- (void) oo_setInteger:(
long)value forKey:(
id)key
1105 [
self setObject:[
NSNumber numberWithLong:value] forKey:key];
1103- (void) oo_setInteger:(
long)value forKey:(
id)key {
…}
1109- (void) oo_setUnsignedInteger:(
unsigned long)value forKey:(
id)key
1111 [
self setObject:[
NSNumber numberWithUnsignedLong:value] forKey:key];
1109- (void) oo_setUnsignedInteger:(
unsigned long)value forKey:(
id)key {
…}
1115- (void) oo_setLongLong:(
long long)value forKey:(
id)key
1117 [
self setObject:[
NSNumber numberWithLongLong:value] forKey:key];
1115- (void) oo_setLongLong:(
long long)value forKey:(
id)key {
…}
1121- (void) oo_setUnsignedLongLong:(
unsigned long long)value forKey:(
id)key
1123 [
self setObject:[
NSNumber numberWithUnsignedLongLong:value] forKey:key];
1121- (void) oo_setUnsignedLongLong:(
unsigned long long)value forKey:(
id)key {
…}
1127- (void) oo_setFloat:(
double)value forKey:(
id)key
1129 [
self setObject:[
NSNumber numberWithDouble:value] forKey:key];
1127- (void) oo_setFloat:(
double)value forKey:(
id)key {
…}
1133- (void) oo_setBool:(BOOL)value forKey:(
id)key
1135 [
self setObject:[
NSNumber numberWithBool:value] forKey:key];
1133- (void) oo_setBool:(BOOL)value forKey:(
id)key {
…}
1139#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
1140- (void) oo_setVector:(Vector)value forKey:(
id)key
1142 [
self setObject:OOPropertyListFromVector(value) forKey:key];
1140- (void) oo_setVector:(Vector)value forKey:(
id)key {
…}
1145- (void) oo_setHPVector:(HPVector)value forKey:(
id)key
1147 [
self setObject:OOPropertyListFromHPVector(value) forKey:key];
1145- (void) oo_setHPVector:(HPVector)value forKey:(
id)key {
…}
1150- (void) oo_setQuaternion:(Quaternion)value forKey:(
id)key
1152 [
self setObject:OOPropertyListFromQuaternion(value) forKey:key];
1150- (void) oo_setQuaternion:(Quaternion)value forKey:(
id)key {
…}
1159@implementation NSMutableSet (OOInserter)
1161- (void) oo_addInteger:(
long)value
1163 [
self addObject:[
NSNumber numberWithLong:value]];
1161- (void) oo_addInteger:(
long)value {
…}
1167- (void) oo_addUnsignedInteger:(
unsigned long)value
1169 [
self addObject:[
NSNumber numberWithUnsignedLong:value]];
1167- (void) oo_addUnsignedInteger:(
unsigned long)value {
…}
1173- (void) oo_addFloat:(
double)value
1175 [
self addObject:[
NSNumber numberWithDouble:value]];
1173- (void) oo_addFloat:(
double)value {
…}
1179- (void) oo_addBool:(BOOL)value
1181 [
self addObject:[
NSNumber numberWithBool:value]];
1179- (void) oo_addBool:(BOOL)value {
…}
1185#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
1186- (void) oo_addVector:(Vector)value
1188 [
self addObject:OOPropertyListFromVector(value)];
1186- (void) oo_addVector:(Vector)value {
…}
1192- (void) oo_addQuaternion:(Quaternion)value
1194 [
self addObject:OOPropertyListFromQuaternion(value)];
1192- (void) oo_addQuaternion:(Quaternion)value {
…}
1205 if ([
object respondsToSelector:
@selector(longLongValue)]) llValue = [object longLongValue];
1206 else if ([
object respondsToSelector:
@selector(longValue)]) llValue = [object longValue];
1207 else if ([
object respondsToSelector:
@selector(intValue)]) llValue = [object intValue];
1208 else llValue = defaultValue;
1216 unsigned long long ullValue;
1218 if ([
object respondsToSelector:
@selector(unsignedLongLongValue)]) ullValue = [object unsignedLongLongValue];
1219 else if ([
object respondsToSelector:
@selector(unsignedLongValue)]) ullValue = [object unsignedLongValue];
1220 else if ([
object respondsToSelector:
@selector(unsignedIntValue)]) ullValue = [object unsignedIntValue];
1221 else if ([
object respondsToSelector:
@selector(intValue)]) ullValue = [object intValue];
1222 else ullValue = defaultValue;
1230 return value ==
' ' || value ==
'\t';
1244 unsigned long i = 0,
count = [string length];
1245#define PEEK() ((i >= count) ? -1 : [string characterAtIndex:i])
1248 if (
PEEK() ==
' ') ++i;
1249 return PEEK() ==
'0';
1257 if (NSOrderedSame == [
string caseInsensitiveCompare:
@"yes"] ||
1258 NSOrderedSame == [
string caseInsensitiveCompare:
@"true"] ||
1259 NSOrderedSame == [
string caseInsensitiveCompare:
@"on"] ||
1260 [
string doubleValue] != 0.0)
1264 else if (NSOrderedSame == [
string caseInsensitiveCompare:
@"no"] ||
1265 NSOrderedSame == [
string caseInsensitiveCompare:
@"false"] ||
1266 NSOrderedSame == [
string caseInsensitiveCompare:
@"off"] ||
1271 return defaultValue;
1275#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
1278 if (NSOrderedSame == [
string caseInsensitiveCompare:
@"yes"] ||
1279 NSOrderedSame == [
string caseInsensitiveCompare:
@"true"] ||
1280 NSOrderedSame == [
string caseInsensitiveCompare:
@"on"] ||
1281 [
string doubleValue] != 0.0)
1285 else if (NSOrderedSame == [
string caseInsensitiveCompare:
@"no"] ||
1286 NSOrderedSame == [
string caseInsensitiveCompare:
@"false"] ||
1287 NSOrderedSame == [
string caseInsensitiveCompare:
@"off"] ||
1292 return defaultValue;
1301 if ([
object isKindOfClass:[NSString
class]])
1307 if ([
object respondsToSelector:
@selector(boolValue)]) result = [object boolValue];
1308 else if ([
object respondsToSelector:
@selector(intValue)]) result = [object intValue] != 0;
1309 else result = defaultValue;
1316#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
1321 if ([
object isKindOfClass:[NSString
class]])
1323 probability = [object floatValue];
1341 return randf() < probability;
1350 if ([
object respondsToSelector:
@selector(floatValue)])
1352 result = [object floatValue];
1353 if (result == 0.0f && [
object isKindOfClass:[NSString
class]] && !
IsZeroString(
object)) result = defaultValue;
1355 else if ([
object respondsToSelector:
@selector(doubleValue)]) result = [object doubleValue];
1356 else if ([
object respondsToSelector:
@selector(intValue)]) result = [object intValue];
1357 else result = defaultValue;
1367 if ([
object respondsToSelector:
@selector(doubleValue)])
1369 result = [object doubleValue];
1370 if (result == 0.0 && [
object isKindOfClass:[NSString
class]] && !
IsZeroString(
object)) result = defaultValue;
1372 else if ([
object respondsToSelector:
@selector(floatValue)]) result = [object floatValue];
1373 else if ([
object respondsToSelector:
@selector(intValue)]) result = [object intValue];
1374 else result = defaultValue;
1384 if ([
object respondsToSelector:
@selector(floatValue)]) result = [object floatValue];
1385 else if ([
object respondsToSelector:
@selector(doubleValue)]) result = [object doubleValue];
1386 else if ([
object respondsToSelector:
@selector(intValue)]) result = [object intValue];
1387 else return defaultValue;
1389 return fmax(result, 0.0f);
1397 if ([
object respondsToSelector:
@selector(doubleValue)]) result = [object doubleValue];
1398 else if ([
object respondsToSelector:
@selector(floatValue)]) result = [object floatValue];
1399 else if ([
object respondsToSelector:
@selector(intValue)]) result = [object intValue];
1400 else return defaultValue;
1402 return fmax(result, 0.0);
1406#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
1409 Vector result = defaultValue;
1410 NSDictionary *dict =
nil;
1412 if ([
object isKindOfClass:[OONativeVector
class]])
1414 result = [object getVector];
1416 else if ([
object isKindOfClass:[NSString
class]])
1421 else if ([
object isKindOfClass:[NSArray
class]] && [
object count] == 3)
1423 result.x = [object oo_floatAtIndex:0];
1424 result.y = [object oo_floatAtIndex:1];
1425 result.z = [object oo_floatAtIndex:2];
1427 else if ([
object isKindOfClass:[NSDictionary
class]])
1431 if ([dict objectForKey:
@"x"] !=
nil ||
1432 [dict objectForKey:
@"y"] !=
nil ||
1433 [dict objectForKey:
@"z"] !=
nil)
1436 result.x = [dict oo_floatForKey:@"x" defaultValue:0.0f];
1437 result.y = [dict oo_floatForKey:@"y" defaultValue:0.0f];
1438 result.z = [dict oo_floatForKey:@"z" defaultValue:0.0f];
1447 HPVector result = defaultValue;
1448 NSDictionary *dict =
nil;
1450 if ([
object isKindOfClass:[NSString
class]])
1455 else if ([
object isKindOfClass:[NSArray
class]] && [
object count] == 3)
1457 result.x = [object oo_doubleAtIndex:0];
1458 result.y = [object oo_doubleAtIndex:1];
1459 result.z = [object oo_doubleAtIndex:2];
1461 else if ([
object isKindOfClass:[NSDictionary
class]])
1465 if ([dict objectForKey:
@"x"] !=
nil ||
1466 [dict objectForKey:
@"y"] !=
nil ||
1467 [dict objectForKey:
@"z"] !=
nil)
1470 result.x = [dict oo_doubleForKey:@"x" defaultValue:0.0];
1471 result.y = [dict oo_doubleForKey:@"y" defaultValue:0.0];
1472 result.z = [dict oo_doubleForKey:@"z" defaultValue:0.0];
1482 Quaternion result = defaultValue;
1483 NSDictionary *dict =
nil;
1485 if ([
object isKindOfClass:[NSString
class]])
1490 else if ([
object isKindOfClass:[NSArray
class]] && [
object count] == 4)
1492 result.w = [object oo_floatAtIndex:0];
1493 result.x = [object oo_floatAtIndex:1];
1494 result.y = [object oo_floatAtIndex:2];
1495 result.z = [object oo_floatAtIndex:3];
1497 else if ([
object isKindOfClass:[NSDictionary
class]])
1501 if ([dict objectForKey:
@"w"] !=
nil ||
1502 [dict objectForKey:
@"x"] !=
nil ||
1503 [dict objectForKey:
@"y"] !=
nil ||
1504 [dict objectForKey:
@"z"] !=
nil)
1507 result.w = [dict oo_floatForKey:@"w" defaultValue:0.0f];
1508 result.x = [dict oo_floatForKey:@"x" defaultValue:0.0f];
1509 result.y = [dict oo_floatForKey:@"y" defaultValue:0.0f];
1510 result.z = [dict oo_floatForKey:@"z" defaultValue:0.0f];
1520 return [NSDictionary dictionaryWithObjectsAndKeys:
1521 [NSNumber numberWithFloat:value.x], @"x",
1522 [NSNumber numberWithFloat:value.y], @"y",
1523 [NSNumber numberWithFloat:value.z], @"z",
1529 return [NSDictionary dictionaryWithObjectsAndKeys:
1530 [NSNumber numberWithDouble:value.x], @"x",
1531 [NSNumber numberWithDouble:value.y], @"y",
1532 [NSNumber numberWithDouble:value.z], @"z",
1539 return [NSDictionary dictionaryWithObjectsAndKeys:
1540 [NSNumber numberWithFloat:value.w], @"w",
1541 [NSNumber numberWithFloat:value.x], @"x",
1542 [NSNumber numberWithFloat:value.y], @"y",
1543 [NSNumber numberWithFloat:value.z], @"z",
1551 if ([
object isKindOfClass:[NSArray
class]])
return [NSSet setWithArray:object];
1552 else if ([
object isKindOfClass:[NSSet
class]])
return [[object copy] autorelease];
1554 return defaultValue;
1560 if ([
object isKindOfClass:[NSString
class]])
return object;
1561 else if ([
object respondsToSelector:
@selector(stringValue)])
return [object stringValue];
1563 return defaultValue;
BOOL ScanHPVectorFromString(NSString *xyzString, HPVector *outVector)
BOOL ScanQuaternionFromString(NSString *wxyzString, Quaternion *outQuaternion)
BOOL ScanVectorFromString(NSString *xyzString, Vector *outVector)
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque