43#import <Foundation/Foundation.h>
46#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
50@interface NSArray (OOExtractor)
52- (char)oo_charAtIndex:(NSUInteger)index defaultValue:(
char)value;
53- (short)oo_shortAtIndex:(NSUInteger)index defaultValue:(
short)value;
54- (
int)oo_intAtIndex:(NSUInteger)index defaultValue:(
int)value;
55- (
long)oo_longAtIndex:(NSUInteger)index defaultValue:(
long)value;
56- (
long long)oo_longLongAtIndex:(NSUInteger)index defaultValue:(
long long)value;
57- (NSInteger)oo_integerAtIndex:(NSUInteger)index defaultValue:(NSInteger)value;
59- (
unsigned char)oo_unsignedCharAtIndex:(NSUInteger)index defaultValue:(
unsigned char)value;
60- (
unsigned short)oo_unsignedShortAtIndex:(NSUInteger)index defaultValue:(
unsigned short)value;
61- (
unsigned int)oo_unsignedIntAtIndex:(NSUInteger)index defaultValue:(
unsigned int)value;
62- (
unsigned long)oo_unsignedLongAtIndex:(NSUInteger)index defaultValue:(
unsigned long)value;
63- (
unsigned long long)oo_unsignedLongLongAtIndex:(NSUInteger)index defaultValue:(
unsigned long long)value;
64- (NSUInteger)oo_unsignedIntegerAtIndex:(NSUInteger)index defaultValue:(NSUInteger)value;
66- (BOOL)oo_boolAtIndex:(NSUInteger)index defaultValue:(BOOL)value;
67#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
68- (BOOL)oo_fuzzyBooleanAtIndex:(NSUInteger)index defaultValue:(
float)value;
71- (float)oo_floatAtIndex:(NSUInteger)index defaultValue:(
float)value;
72- (double)oo_doubleAtIndex:(NSUInteger)index defaultValue:(
double)value;
73- (float)oo_nonNegativeFloatAtIndex:(NSUInteger)index defaultValue:(
float)value;
74- (double)oo_nonNegativeDoubleAtIndex:(NSUInteger)index defaultValue:(
double)value;
76- (id)oo_objectAtIndex:(NSUInteger)index defaultValue:(
id)value;
77- (id)oo_objectOfClass:(Class)class atIndex:(NSUInteger)index defaultValue:(
id)value;
78- (NSString*)oo_stringAtIndex:(NSUInteger)index defaultValue:(NSString*)value;
79- (NSArray*)oo_arrayAtIndex:(NSUInteger)index defaultValue:(NSArray*)value;
80- (NSSet*)oo_setAtIndex:(NSUInteger)index defaultValue:(NSSet*)value;
81- (NSDictionary*)oo_dictionaryAtIndex:(NSUInteger)index defaultValue:(NSDictionary*)value;
82- (NSData*)oo_dataAtIndex:(NSUInteger)index defaultValue:(NSData*)value;
84#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
85- (
Vector)oo_vectorAtIndex:(NSUInteger)index defaultValue:(
Vector)value;
90- (char)oo_charAtIndex:(NSUInteger)index;
91- (short)oo_shortAtIndex:(NSUInteger)index;
92- (
int)oo_intAtIndex:(NSUInteger)index;
93- (
long)oo_longAtIndex:(NSUInteger)index;
94- (
long long)oo_longLongAtIndex:(NSUInteger)index;
95- (NSInteger)oo_integerAtIndex:(NSUInteger)index;
97- (
unsigned char)oo_unsignedCharAtIndex:(NSUInteger)index;
98- (
unsigned short)oo_unsignedShortAtIndex:(NSUInteger)index;
99- (
unsigned int)oo_unsignedIntAtIndex:(NSUInteger)index;
100- (
unsigned long)oo_unsignedLongAtIndex:(NSUInteger)index;
101- (
unsigned long long)oo_unsignedLongLongAtIndex:(NSUInteger)index;
102- (NSUInteger)oo_unsignedIntegerAtIndex:(NSUInteger)index;
105- (BOOL)oo_boolAtIndex:(NSUInteger)index;
106#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
107- (BOOL)oo_fuzzyBooleanAtIndex:(NSUInteger)index;
111- (float)oo_floatAtIndex:(NSUInteger)index;
112- (double)oo_doubleAtIndex:(NSUInteger)index;
113- (float)oo_nonNegativeFloatAtIndex:(NSUInteger)index;
114- (double)oo_nonNegativeDoubleAtIndex:(NSUInteger)index;
117- (id)oo_objectAtIndex:(NSUInteger)index;
118- (id)oo_objectOfClass:(Class)class atIndex:(NSUInteger)index;
119- (NSString*)oo_stringAtIndex:(NSUInteger)index;
120- (NSArray*)oo_arrayAtIndex:(NSUInteger)index;
121- (NSSet*)oo_setAtIndex:(NSUInteger)index;
122- (NSDictionary*)oo_dictionaryAtIndex:(NSUInteger)index;
123- (NSData*)oo_dataAtIndex:(NSUInteger)index;
125#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
127- (
Vector)oo_vectorAtIndex:(NSUInteger)index;
129- (
Quaternion)oo_quaternionAtIndex:(NSUInteger)index;
134@interface NSDictionary (OOExtractor)
136- (char)oo_charForKey:(
id)key defaultValue:(
char)value;
137- (short)oo_shortForKey:(
id)key defaultValue:(
short)value;
138- (
int)oo_intForKey:(
id)key defaultValue:(
int)value;
139- (
long)oo_longForKey:(
id)key defaultValue:(
long)value;
140- (
long long)oo_longLongForKey:(
id)key defaultValue:(
long long)value;
141- (NSInteger)oo_integerForKey:(
id)key defaultValue:(NSInteger)value;
143- (
unsigned char)oo_unsignedCharForKey:(
id)key defaultValue:(
unsigned char)value;
144- (
unsigned short)oo_unsignedShortForKey:(
id)key defaultValue:(
unsigned short)value;
145- (
unsigned int)oo_unsignedIntForKey:(
id)key defaultValue:(
unsigned int)value;
146- (
unsigned long)oo_unsignedLongForKey:(
id)key defaultValue:(
unsigned long)value;
147- (
unsigned long long)oo_unsignedLongLongForKey:(
id)key defaultValue:(
unsigned long long)value;
148- (NSUInteger)oo_unsignedIntegerForKey:(
id)key defaultValue:(NSUInteger)value;
150- (BOOL)oo_boolForKey:(
id)key defaultValue:(BOOL)value;
151#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
152- (BOOL)oo_fuzzyBooleanForKey:(
id)key defaultValue:(
float)value;
155- (float)oo_floatForKey:(
id)key defaultValue:(
float)value;
156- (double)oo_doubleForKey:(
id)key defaultValue:(
double)value;
157- (float)oo_nonNegativeFloatForKey:(
id)key defaultValue:(
float)value;
158- (double)oo_nonNegativeDoubleForKey:(
id)key defaultValue:(
double)value;
160- (id)oo_objectForKey:(
id)key defaultValue:(
id)value;
161- (id)oo_objectOfClass:(Class)class forKey:(
id)key defaultValue:(
id)value;
162- (NSString*)oo_stringForKey:(
id)key defaultValue:(NSString*)value;
163- (NSArray*)oo_arrayForKey:(
id)key defaultValue:(NSArray*)value;
164- (NSSet*)oo_setForKey:(
id)key defaultValue:(NSSet*)value;
165- (NSDictionary*)oo_dictionaryForKey:(
id)key defaultValue:(NSDictionary*)value;
166- (NSMutableDictionary*)oo_mutableDictionaryForKey:(
id)key defaultValue:(NSDictionary*)value;
167- (NSData*)oo_dataForKey:(
id)key defaultValue:(NSData*)value;
169#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
170- (
Vector)oo_vectorForKey:(
id)key defaultValue:(
Vector)value;
176- (char)oo_charForKey:(
id)key;
177- (short)oo_shortForKey:(
id)key;
178- (
int)oo_intForKey:(
id)key;
179- (
long)oo_longForKey:(
id)key;
180- (
long long)oo_longLongForKey:(
id)key;
181- (NSInteger)oo_integerForKey:(
id)key;
183- (
unsigned char)oo_unsignedCharForKey:(
id)key;
184- (
unsigned short)oo_unsignedShortForKey:(
id)key;
185- (
unsigned int)oo_unsignedIntForKey:(
id)key;
186- (
unsigned long)oo_unsignedLongForKey:(
id)key;
187- (
unsigned long long)oo_unsignedLongLongForKey:(
id)key;
188- (NSUInteger)oo_unsignedIntegerForKey:(
id)key;
191- (BOOL)oo_boolForKey:(
id)key;
192#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
193- (BOOL)oo_fuzzyBooleanForKey:(
id)key;
197- (float)oo_floatForKey:(
id)key;
198- (double)oo_doubleForKey:(
id)key;
199- (float)oo_nonNegativeFloatForKey:(
id)key;
200- (double)oo_nonNegativeDoubleForKey:(
id)key;
204- (id)oo_objectOfClass:(Class)class forKey:(
id)key;
205- (NSString*)oo_stringForKey:(
id)key;
206- (NSArray*)oo_arrayForKey:(
id)key;
207- (NSSet*)oo_setForKey:(
id)key;
208- (NSDictionary*)oo_dictionaryForKey:(
id)key;
209- (NSMutableDictionary*)oo_mutableDictionaryForKey:(
id)key;
210- (NSData*)oo_dataForKey:(
id)key;
212#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
214- (
Vector)oo_vectorForKey:(
id)key;
216- (
HPVector)oo_hpvectorForKey:(
id)key;
223@interface NSUserDefaults (OOExtractor)
225- (char)oo_charForKey:(
id)key defaultValue:(
char)value;
226- (short)oo_shortForKey:(
id)key defaultValue:(
short)value;
227- (
int)oo_intForKey:(
id)key defaultValue:(
int)value;
228- (
long)oo_longForKey:(
id)key defaultValue:(
long)value;
229- (
long long)oo_longLongForKey:(
id)key defaultValue:(
long long)value;
230- (NSInteger)oo_integerForKey:(
id)key defaultValue:(NSInteger)value;
232- (
unsigned char)oo_unsignedCharForKey:(
id)key defaultValue:(
unsigned char)value;
233- (
unsigned short)oo_unsignedShortForKey:(
id)key defaultValue:(
unsigned short)value;
234- (
unsigned int)oo_unsignedIntForKey:(
id)key defaultValue:(
unsigned int)value;
235- (
unsigned long)oo_unsignedLongForKey:(
id)key defaultValue:(
unsigned long)value;
236- (
unsigned long long)oo_unsignedLongLongForKey:(
id)key defaultValue:(
unsigned long long)value;
237- (NSUInteger)oo_unsignedIntegerForKey:(
id)key defaultValue:(NSUInteger)value;
239- (BOOL)oo_boolForKey:(
id)key defaultValue:(BOOL)value;
240#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
241- (BOOL)oo_fuzzyBooleanForKey:(
id)key defaultValue:(
float)value;
244- (float)oo_floatForKey:(
id)key defaultValue:(
float)value;
245- (double)oo_doubleForKey:(
id)key defaultValue:(
double)value;
246- (float)oo_nonNegativeFloatForKey:(
id)key defaultValue:(
float)value;
247- (double)oo_nonNegativeDoubleForKey:(
id)key defaultValue:(
double)value;
249- (id)oo_objectForKey:(
id)key defaultValue:(
id)value;
250- (id)oo_objectOfClass:(Class)class forKey:(
id)key defaultValue:(
id)value;
251- (NSString*)oo_stringForKey:(
id)key defaultValue:(NSString*)value;
252- (NSArray*)oo_arrayForKey:(
id)key defaultValue:(NSArray*)value;
253- (NSSet*)oo_setForKey:(
id)key defaultValue:(NSSet*)value;
254- (NSDictionary*)oo_dictionaryForKey:(
id)key defaultValue:(NSDictionary*)value;
255- (NSData*)oo_dataForKey:(
id)key defaultValue:(NSData*)value;
258- (char)oo_charForKey:(
id)key;
259- (short)oo_shortForKey:(
id)key;
260- (
int)oo_intForKey:(
id)key;
261- (
long)oo_longForKey:(
id)key;
262- (
long long)oo_longLongForKey:(
id)key;
264- (
unsigned char)oo_unsignedCharForKey:(
id)key;
265- (
unsigned short)oo_unsignedShortForKey:(
id)key;
266- (
unsigned int)oo_unsignedIntForKey:(
id)key;
267- (
unsigned long)oo_unsignedLongForKey:(
id)key;
268- (
unsigned long long)oo_unsignedLongLongForKey:(
id)key;
272#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
273- (BOOL)oo_fuzzyBooleanForKey:(
id)key;
278- (double)oo_doubleForKey:(NSString*)key;
279- (float)oo_nonNegativeFloatForKey:(
id)key;
280- (double)oo_nonNegativeDoubleForKey:(
id)key;
284- (id)oo_objectOfClass:(Class)class forKey:(
id)key;
287- (NSSet*)oo_setForKey:(
id)key;
293@interface NSMutableArray (OOInserter)
295- (void)oo_addInteger:(
long)value;
296- (void)oo_addUnsignedInteger:(
unsigned long)value;
297- (void)oo_addFloat:(
double)value;
298- (void)oo_addBool:(BOOL)value;
299#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
300- (void)oo_addVector:(
Vector)value;
304- (void)oo_insertInteger:(
long)value atIndex:(NSUInteger)index;
305- (void)oo_insertUnsignedInteger:(
unsigned long)value atIndex:(NSUInteger)index;
306- (void)oo_insertFloat:(
double)value atIndex:(NSUInteger)index;
307- (void)oo_insertBool:(BOOL)value atIndex:(NSUInteger)index;
308#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
309- (void)oo_insertVector:(
Vector)value atIndex:(NSUInteger)index;
310- (void)oo_insertQuaternion:(
Quaternion)value atIndex:(NSUInteger)index;
315@interface NSMutableDictionary (OOInserter)
317- (void)oo_setInteger:(
long)value forKey:(
id)key;
318- (void)oo_setUnsignedInteger:(
unsigned long)value forKey:(
id)key;
319- (void)oo_setLongLong:(
long long)value forKey:(
id)key;
320- (void)oo_setUnsignedLongLong:(
unsigned long long)value forKey:(
id)key;
321- (void)oo_setFloat:(
double)value forKey:(
id)key;
322- (void)oo_setBool:(BOOL)value forKey:(
id)key;
323#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
324- (void)oo_setVector:(
Vector)value forKey:(
id)key;
325- (void)oo_setHPVector:(
HPVector)value forKey:(
id)key;
326- (void)oo_setQuaternion:(
Quaternion)value forKey:(
id)key;
331@interface NSMutableSet (OOInserter)
333- (void)oo_addInteger:(
long)value;
334- (void)oo_addUnsignedInteger:(
unsigned long)value;
335- (void)oo_addFloat:(
double)value;
336- (void)oo_addBool:(BOOL)value;
337#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
338- (void)oo_addVector:(
Vector)value;
358#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
371#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
388 return (minValue < value) ? ((value < maxValue) ? value : maxValue) : minValue;
407#define OO_DEFINE_CLAMP(type, typeName, min, max) \
408 OOINLINE type OO##typeName##FromObject(id object, type defaultValue) \
410 return (type)OOClampInteger(OOLongLongFromObject(object, defaultValue), min, max); \
413#define OO_DEFINE_CLAMP_PAIR(type, typeName, minMaxSymb) \
414 OO_DEFINE_CLAMP(type, typeName, minMaxSymb##_MIN, minMaxSymb##_MAX) \
415 OO_DEFINE_CLAMP(unsigned type, Unsigned##typeName, 0, U##minMaxSymb##_MAX)
427#define OO_ALIAS_CLAMP_LONG_LONG(type, typeName) \
428 static inline type OO##typeName##FromObject(id object, type defaultValue) \
430 return OOLongLongFromObject(object, defaultValue); \
432#define OO_ALIAS_CLAMP_PAIR_LONG_LONG(type, typeName) \
433 OO_ALIAS_CLAMP_LONG_LONG(type, typeName) \
434 OO_ALIAS_CLAMP_LONG_LONG(unsigned type, Unsigned##typeName)
436#if INT_MAX == LLONG_MAX
443#if LONG_MAX == LLONG_MAX
462 return OOLongFromObject(
object, defaultValue);
467 return OOUnsignedLongFromObject(
object, defaultValue);
471#undef OO_DEFINE_CLAMP
472#undef OO_DEFINE_CLAMP_PAIR
473#undef OO_ALIAS_CLAMP_LONG_LONG
474#undef OO_ALIAS_CLAMP_PAIR_LONG_LONG
#define ALWAYS_INLINE_FUNC
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque