Oolite
Loading...
Searching...
No Matches
OOCollectionExtractors.h
Go to the documentation of this file.
1/*
2
3OOCollectionExtractors.h
4
5Convenience extensions to Foundation collections to extract optional values.
6In addition to being convenient, these perform type checking. Which is,
7y'know, good to have.
8
9Note on types: ideally, stdint.h types would be used for integers. However,
10NSNumber doesn't do this, so doing so portably would add new complications.
11
12Starting with Oolite 1.69.1, the various integer methods will always clamp
13values to the range of the return type, rather than truncating like NSNumber.
14Before that, they weren't entirely inconsistent.
15
16The "non-negative float"/"non-negative double" will clamp read values to zero
17if negative, but will return a negative defaultValue unchanged.
18
19
20Copyright (C) 2007-2013 Jens Ayton and contributors
21
22Permission is hereby granted, free of charge, to any person obtaining a copy
23of this software and associated documentation files (the "Software"), to deal
24in the Software without restriction, including without limitation the rights
25to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26copies of the Software, and to permit persons to whom the Software is
27furnished to do so, subject to the following conditions:
28
29The above copyright notice and this permission notice shall be included in all
30copies or substantial portions of the Software.
31
32THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38SOFTWARE.
39
40*/
41
43#import <Foundation/Foundation.h>
44#include <limits.h>
45
46#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
47#import "OOMaths.h"
48#endif
49
50@interface NSArray (OOExtractor)
51
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;
58
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;
65
66- (BOOL)oo_boolAtIndex:(NSUInteger)index defaultValue:(BOOL)value;
67#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
68- (BOOL)oo_fuzzyBooleanAtIndex:(NSUInteger)index defaultValue:(float)value; // Reads a float in the range [0, 1], and returns YES with that probability.
69#endif
70
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;
75
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;
83
84#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
85- (Vector)oo_vectorAtIndex:(NSUInteger)index defaultValue:(Vector)value;
86- (Quaternion)oo_quaternionAtIndex:(NSUInteger)index defaultValue:(Quaternion)value;
87#endif
88
89// Default: 0
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;
96
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;
103
104// Default: NO
105- (BOOL)oo_boolAtIndex:(NSUInteger)index;
106#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
107- (BOOL)oo_fuzzyBooleanAtIndex:(NSUInteger)index; // Reads a float in the range [0, 1], and returns YES with that probability.
108#endif
109
110// Default: 0.0
111- (float)oo_floatAtIndex:(NSUInteger)index;
112- (double)oo_doubleAtIndex:(NSUInteger)index;
113- (float)oo_nonNegativeFloatAtIndex:(NSUInteger)index;
114- (double)oo_nonNegativeDoubleAtIndex:(NSUInteger)index;
115
116// Default: nil
117- (id)oo_objectAtIndex:(NSUInteger)index; // Differs from objectAtIndex: in that it returns nil rather than throwing NSRangeException.
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;
124
125#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
126// Default: kZeroVector
127- (Vector)oo_vectorAtIndex:(NSUInteger)index;
128// Default: kIdentityQuaternion
129- (Quaternion)oo_quaternionAtIndex:(NSUInteger)index;
130#endif
131
132@end
133
134@interface NSDictionary (OOExtractor)
135
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;
142
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;
149
150- (BOOL)oo_boolForKey:(id)key defaultValue:(BOOL)value;
151#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
152- (BOOL)oo_fuzzyBooleanForKey:(id)key defaultValue:(float)value; // Reads a float in the range [0, 1], and returns YES with that probability.
153#endif
154
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;
159
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;
168
169#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
170- (Vector)oo_vectorForKey:(id)key defaultValue:(Vector)value;
171- (HPVector)oo_hpvectorForKey:(id)key defaultValue:(HPVector)value;
172- (Quaternion)oo_quaternionForKey:(id)key defaultValue:(Quaternion)value;
173#endif
174
175// Default: 0
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;
182
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;
189
190// Default: NO
191- (BOOL)oo_boolForKey:(id)key;
192#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
193- (BOOL)oo_fuzzyBooleanForKey:(id)key; // Reads a float in the range [0, 1], and returns YES with that probability.
194#endif
195
196// Default: 0.0
197- (float)oo_floatForKey:(id)key;
198- (double)oo_doubleForKey:(id)key;
199- (float)oo_nonNegativeFloatForKey:(id)key;
200- (double)oo_nonNegativeDoubleForKey:(id)key;
201
202// Default: nil
203// - (id)objectForKey:(id)key; // Already defined
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;
211
212#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
213// Default: kZeroVector
214- (Vector)oo_vectorForKey:(id)key;
215// Default: kZeroHPVector
216- (HPVector)oo_hpvectorForKey:(id)key;
217// Default: kIdentityQuaternion
218- (Quaternion)oo_quaternionForKey:(id)key;
219#endif
220
221@end
222
223@interface NSUserDefaults (OOExtractor)
224
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;
231
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;
238
239- (BOOL)oo_boolForKey:(id)key defaultValue:(BOOL)value;
240#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
241- (BOOL)oo_fuzzyBooleanForKey:(id)key defaultValue:(float)value; // Reads a float in the range [0, 1], and returns YES with that probability.
242#endif
243
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;
248
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;
256
257// Default: 0
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;
263
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;
269
270// Default: NO
271// - (BOOL) boolForKey:(id)key;
272#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
273- (BOOL)oo_fuzzyBooleanForKey:(id)key; // Reads a float in the range [0, 1], and returns YES with that probability.
274#endif
275
276// Default: 0.0
277// - (float) floatForKey:(id)key;
278- (double)oo_doubleForKey:(NSString*)key;
279- (float)oo_nonNegativeFloatForKey:(id)key;
280- (double)oo_nonNegativeDoubleForKey:(id)key;
281
282// Default: nil
283// - (id) objectForKey:(id)key; // Already defined
284- (id)oo_objectOfClass:(Class)class forKey:(id)key;
285// - (NSString *) stringForKey:(id)key;
286// - (NSArray *) arrayForKey:(id)key;
287- (NSSet*)oo_setForKey:(id)key;
288// - (NSDictionary *) dictionaryForKey:(id)key;
289// - (NSData *) dataForKey:(id)key;
290
291@end
292
293@interface NSMutableArray (OOInserter)
294
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;
301- (void)oo_addQuaternion:(Quaternion)value;
302#endif
303
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;
311#endif
312
313@end
314
315@interface NSMutableDictionary (OOInserter)
316
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;
327#endif
328
329@end
330
331@interface NSMutableSet (OOInserter)
332
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;
339- (void)oo_addQuaternion:(Quaternion)value;
340#endif
341
342@end
343
344// *** Value extraction utilities ***
345
346/* Utility function to interpret a boolean. May be an NSNumber or any of the
347 following strings (case-insensitive):
348 yes
349 true
350 on
351
352 no
353 false
354 off
355*/
356BOOL OOBooleanFromObject(id object, BOOL defaultValue);
357
358#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
359/* Utility function to interpret a fuzzy boolean. May be any of the strings
360 accepted by OOBooleanFromObject(), or a number indicating probability of
361 a yes (between 0 and 1).
362*/
363BOOL OOFuzzyBooleanFromObject(id object, float defaultValue);
364#endif
365
366float OOFloatFromObject(id object, float defaultValue);
367double OODoubleFromObject(id object, double defaultValue);
368float OONonNegativeFloatFromObject(id object, float defaultValue);
369double OONonNegativeDoubleFromObject(id object, double defaultValue);
370
371#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
372// These take strings, dictionaries or arrays.
373Vector OOVectorFromObject(id object, Vector defaultValue);
374HPVector OOHPVectorFromObject(id object, HPVector defaultValue);
375Quaternion OOQuaternionFromObject(id object, Quaternion defaultValue);
376
377NSDictionary* OOPropertyListFromVector(Vector value);
378NSDictionary* OOPropertyListFromHPVector(HPVector value);
379NSDictionary* OOPropertyListFromQuaternion(Quaternion value);
380#endif
381
382OOINLINE long long OOClampInteger(long long value, long long minValue, long long maxValue) ALWAYS_INLINE_FUNC;
383long long OOLongLongFromObject(id object, long long defaultValue);
384unsigned long long OOUnsignedLongLongFromObject(id object, unsigned long long defaultValue);
385
386OOINLINE long long OOClampInteger(long long value, long long minValue, long long maxValue)
387{
388 return (minValue < value) ? ((value < maxValue) ? value : maxValue) : minValue;
389}
390
391/* Define an inline function to clamp a give type and its unsigned
392 counterpart. Example:
393
394 OO_DEFINE_CLAMP_PAIR(char, Char, CHAR)
395
396 expands to
397
398 OOINLINE char OOCharFromObject(id object, char defaultValue)
399 {
400 return OOClampInteger(OOLongLongFromObject(object, defaultValue), CHAR_MIN, CHAR_MAX);
401 }
402 OOINLINE unsigned char OOUnsignedCharFromObject(id object, unsigned char defaultValue)
403 {
404 return OOClampInteger(OOLongLongFromObject(object, defaultValue), 0, UCHAR_MAX);
405 }
406*/
407#define OO_DEFINE_CLAMP(type, typeName, min, max) \
408 OOINLINE type OO##typeName##FromObject(id object, type defaultValue) \
409 { \
410 return (type)OOClampInteger(OOLongLongFromObject(object, defaultValue), min, max); \
411 }
412
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)
416
417OO_DEFINE_CLAMP_PAIR(char, Char, CHAR)
418OO_DEFINE_CLAMP_PAIR(short, Short, SHRT)
419
420/* When ints or longs are as large as long longs, we can't do any clamping
421 because the clamping code will overflow (unless we add pointless complexity).
422 Instead, we alias the long long versions which don't clamp. Inlines are
423 used instead of macros so that the functions always have the precise type
424 they should; this is necessary for stuff that uses @encode, notably the
425 SenTestingKit framework.
426*/
427#define OO_ALIAS_CLAMP_LONG_LONG(type, typeName) \
428 static inline type OO##typeName##FromObject(id object, type defaultValue) \
429 { \
430 return OOLongLongFromObject(object, defaultValue); \
431 }
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)
435
436#if INT_MAX == LLONG_MAX
437// Should never get here under Mac OS X, but may under GNUstep.
439#else
440OO_DEFINE_CLAMP_PAIR(int, Int, INT)
441#endif
442
443#if LONG_MAX == LLONG_MAX
445#else
446OO_DEFINE_CLAMP_PAIR(long, Long, LONG)
447#endif
448
449#if OOLITE_64_BIT
450OOINLINE NSInteger OOIntegerFromObject(id object, NSInteger defaultValue)
451{
452 return OOLongLongFromObject(object, defaultValue);
453}
454
455OOINLINE NSInteger OOUIntegerFromObject(id object, NSUInteger defaultValue)
456{
457 return OOUnsignedLongLongFromObject(object, defaultValue);
458}
459#else
460OOINLINE NSInteger OOIntegerFromObject(id object, NSInteger defaultValue)
461{
462 return OOLongFromObject(object, defaultValue);
463}
464
465OOINLINE NSInteger OOUIntegerFromObject(id object, NSUInteger defaultValue)
466{
467 return OOUnsignedLongFromObject(object, defaultValue);
468}
469#endif
470
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
float OONonNegativeFloatFromObject(id object, float defaultValue)
OOINLINE long long OOClampInteger(long long value, long long minValue, long long maxValue) ALWAYS_INLINE_FUNC
unsigned long long OOUnsignedLongLongFromObject(id object, unsigned long long defaultValue)
#define OO_DEFINE_CLAMP_PAIR(type, typeName, minMaxSymb)
OOINLINE NSInteger OOUIntegerFromObject(id object, NSUInteger defaultValue)
NSDictionary * OOPropertyListFromVector(Vector value)
NSDictionary * OOPropertyListFromHPVector(HPVector value)
Vector OOVectorFromObject(id object, Vector defaultValue)
NSDictionary * OOPropertyListFromQuaternion(Quaternion value)
#define OO_ALIAS_CLAMP_PAIR_LONG_LONG(type, typeName)
double OODoubleFromObject(id object, double defaultValue)
HPVector OOHPVectorFromObject(id object, HPVector defaultValue)
double OONonNegativeDoubleFromObject(id object, double defaultValue)
OOINLINE NSInteger OOIntegerFromObject(id object, NSInteger defaultValue)
Quaternion OOQuaternionFromObject(id object, Quaternion defaultValue)
BOOL OOBooleanFromObject(id object, BOOL defaultValue)
long long OOLongLongFromObject(id object, long long defaultValue)
BOOL OOFuzzyBooleanFromObject(id object, float defaultValue)
float OOFloatFromObject(id object, float defaultValue)
#define ALWAYS_INLINE_FUNC
#define OOINLINE
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque