Oolite 1.91.0.7645-241119-222d325
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
42
43#import <Foundation/Foundation.h>
45#include <limits.h>
46
47#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
48#import "OOMaths.h"
49#endif
50
51
52
53@interface NSArray (OOExtractor)
54
55- (char) oo_charAtIndex:(NSUInteger)index defaultValue:(char)value;
56- (short) oo_shortAtIndex:(NSUInteger)index defaultValue:(short)value;
57- (int) oo_intAtIndex:(NSUInteger)index defaultValue:(int)value;
58- (long) oo_longAtIndex:(NSUInteger)index defaultValue:(long)value;
59- (long long) oo_longLongAtIndex:(NSUInteger)index defaultValue:(long long)value;
60- (NSInteger) oo_integerAtIndex:(NSUInteger)index defaultValue:(NSInteger)value;
61
62- (unsigned char) oo_unsignedCharAtIndex:(NSUInteger)index defaultValue:(unsigned char)value;
63- (unsigned short) oo_unsignedShortAtIndex:(NSUInteger)index defaultValue:(unsigned short)value;
64- (unsigned int) oo_unsignedIntAtIndex:(NSUInteger)index defaultValue:(unsigned int)value;
65- (unsigned long) oo_unsignedLongAtIndex:(NSUInteger)index defaultValue:(unsigned long)value;
66- (unsigned long long) oo_unsignedLongLongAtIndex:(NSUInteger)index defaultValue:(unsigned long long)value;
67- (NSUInteger) oo_unsignedIntegerAtIndex:(NSUInteger)index defaultValue:(NSUInteger)value;
68
69- (BOOL) oo_boolAtIndex:(NSUInteger)index defaultValue:(BOOL)value;
70#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
71- (BOOL) oo_fuzzyBooleanAtIndex:(NSUInteger)index defaultValue:(float)value; // Reads a float in the range [0, 1], and returns YES with that probability.
72#endif
73
74- (float) oo_floatAtIndex:(NSUInteger)index defaultValue:(float)value;
75- (double) oo_doubleAtIndex:(NSUInteger)index defaultValue:(double)value;
76- (float) oo_nonNegativeFloatAtIndex:(NSUInteger)index defaultValue:(float)value;
77- (double) oo_nonNegativeDoubleAtIndex:(NSUInteger)index defaultValue:(double)value;
78
79- (id) oo_objectAtIndex:(NSUInteger)index defaultValue:(id)value;
80- (id) oo_objectOfClass:(Class)class atIndex:(NSUInteger)index defaultValue:(id)value;
81- (NSString *) oo_stringAtIndex:(NSUInteger)index defaultValue:(NSString *)value;
82- (NSArray *) oo_arrayAtIndex:(NSUInteger)index defaultValue:(NSArray *)value;
83- (NSSet *) oo_setAtIndex:(NSUInteger)index defaultValue:(NSSet *)value;
84- (NSDictionary *) oo_dictionaryAtIndex:(NSUInteger)index defaultValue:(NSDictionary *)value;
85- (NSData *) oo_dataAtIndex:(NSUInteger)index defaultValue:(NSData *)value;
86
87#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
88- (Vector) oo_vectorAtIndex:(NSUInteger)index defaultValue:(Vector)value;
89- (Quaternion) oo_quaternionAtIndex:(NSUInteger)index defaultValue:(Quaternion)value;
90#endif
91
92
93// Default: 0
94- (char) oo_charAtIndex:(NSUInteger)index;
95- (short) oo_shortAtIndex:(NSUInteger)index;
96- (int) oo_intAtIndex:(NSUInteger)index;
97- (long) oo_longAtIndex:(NSUInteger)index;
98- (long long) oo_longLongAtIndex:(NSUInteger)index;
99- (NSInteger) oo_integerAtIndex:(NSUInteger)index;
100
101- (unsigned char) oo_unsignedCharAtIndex:(NSUInteger)index;
102- (unsigned short) oo_unsignedShortAtIndex:(NSUInteger)index;
103- (unsigned int) oo_unsignedIntAtIndex:(NSUInteger)index;
104- (unsigned long) oo_unsignedLongAtIndex:(NSUInteger)index;
105- (unsigned long long) oo_unsignedLongLongAtIndex:(NSUInteger)index;
106- (NSUInteger) oo_unsignedIntegerAtIndex:(NSUInteger)index;
107
108// Default: NO
109- (BOOL) oo_boolAtIndex:(NSUInteger)index;
110#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
111- (BOOL) oo_fuzzyBooleanAtIndex:(NSUInteger)index; // Reads a float in the range [0, 1], and returns YES with that probability.
112#endif
113
114// Default: 0.0
115- (float) oo_floatAtIndex:(NSUInteger)index;
116- (double) oo_doubleAtIndex:(NSUInteger)index;
117- (float) oo_nonNegativeFloatAtIndex:(NSUInteger)index;
118- (double) oo_nonNegativeDoubleAtIndex:(NSUInteger)index;
119
120// Default: nil
121- (id) oo_objectAtIndex:(NSUInteger)index; // Differs from objectAtIndex: in that it returns nil rather than throwing NSRangeException.
122- (id) oo_objectOfClass:(Class)class atIndex:(NSUInteger)index;
123- (NSString *) oo_stringAtIndex:(NSUInteger)index;
124- (NSArray *) oo_arrayAtIndex:(NSUInteger)index;
125- (NSSet *) oo_setAtIndex:(NSUInteger)index;
126- (NSDictionary *) oo_dictionaryAtIndex:(NSUInteger)index;
127- (NSData *) oo_dataAtIndex:(NSUInteger)index;
128
129#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
130// Default: kZeroVector
131- (Vector) oo_vectorAtIndex:(NSUInteger)index;
132// Default: kIdentityQuaternion
133- (Quaternion) oo_quaternionAtIndex:(NSUInteger)index;
134#endif
135
136@end
137
138
139@interface NSDictionary (OOExtractor)
140
141- (char) oo_charForKey:(id)key defaultValue:(char)value;
142- (short) oo_shortForKey:(id)key defaultValue:(short)value;
143- (int) oo_intForKey:(id)key defaultValue:(int)value;
144- (long) oo_longForKey:(id)key defaultValue:(long)value;
145- (long long) oo_longLongForKey:(id)key defaultValue:(long long)value;
146- (NSInteger) oo_integerForKey:(id)key defaultValue:(NSInteger)value;
147
148- (unsigned char) oo_unsignedCharForKey:(id)key defaultValue:(unsigned char)value;
149- (unsigned short) oo_unsignedShortForKey:(id)key defaultValue:(unsigned short)value;
150- (unsigned int) oo_unsignedIntForKey:(id)key defaultValue:(unsigned int)value;
151- (unsigned long) oo_unsignedLongForKey:(id)key defaultValue:(unsigned long)value;
152- (unsigned long long) oo_unsignedLongLongForKey:(id)key defaultValue:(unsigned long long)value;
153- (NSUInteger) oo_unsignedIntegerForKey:(id)key defaultValue:(NSUInteger)value;
154
155- (BOOL) oo_boolForKey:(id)key defaultValue:(BOOL)value;
156#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
157- (BOOL) oo_fuzzyBooleanForKey:(id)key defaultValue:(float)value; // Reads a float in the range [0, 1], and returns YES with that probability.
158#endif
159
160- (float) oo_floatForKey:(id)key defaultValue:(float)value;
161- (double) oo_doubleForKey:(id)key defaultValue:(double)value;
162- (float) oo_nonNegativeFloatForKey:(id)key defaultValue:(float)value;
163- (double) oo_nonNegativeDoubleForKey:(id)key defaultValue:(double)value;
164
165- (id) oo_objectForKey:(id)key defaultValue:(id)value;
166- (id) oo_objectOfClass:(Class)class forKey:(id)key defaultValue:(id)value;
167- (NSString *) oo_stringForKey:(id)key defaultValue:(NSString *)value;
168- (NSArray *) oo_arrayForKey:(id)key defaultValue:(NSArray *)value;
169- (NSSet *) oo_setForKey:(id)key defaultValue:(NSSet *)value;
170- (NSDictionary *) oo_dictionaryForKey:(id)key defaultValue:(NSDictionary *)value;
171- (NSMutableDictionary *) oo_mutableDictionaryForKey:(id)key defaultValue:(NSDictionary *)value;
172- (NSData *) oo_dataForKey:(id)key defaultValue:(NSData *)value;
173
174#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
175- (Vector) oo_vectorForKey:(id)key defaultValue:(Vector)value;
176- (HPVector) oo_hpvectorForKey:(id)key defaultValue:(HPVector)value;
177- (Quaternion) oo_quaternionForKey:(id)key defaultValue:(Quaternion)value;
178#endif
179
180
181// Default: 0
182- (char) oo_charForKey:(id)key;
183- (short) oo_shortForKey:(id)key;
184- (int) oo_intForKey:(id)key;
185- (long) oo_longForKey:(id)key;
186- (long long) oo_longLongForKey:(id)key;
187- (NSInteger) oo_integerForKey:(id)key;
188
189- (unsigned char) oo_unsignedCharForKey:(id)key;
190- (unsigned short) oo_unsignedShortForKey:(id)key;
191- (unsigned int) oo_unsignedIntForKey:(id)key;
192- (unsigned long) oo_unsignedLongForKey:(id)key;
193- (unsigned long long) oo_unsignedLongLongForKey:(id)key;
194- (NSUInteger) oo_unsignedIntegerForKey:(id)key;
195
196// Default: NO
197- (BOOL) oo_boolForKey:(id)key;
198#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
199- (BOOL) oo_fuzzyBooleanForKey:(id)key; // Reads a float in the range [0, 1], and returns YES with that probability.
200#endif
201
202// Default: 0.0
203- (float) oo_floatForKey:(id)key;
204- (double) oo_doubleForKey:(id)key;
205- (float) oo_nonNegativeFloatForKey:(id)key;
206- (double) oo_nonNegativeDoubleForKey:(id)key;
207
208// Default: nil
209// - (id)objectForKey:(id)key; // Already defined
210- (id) oo_objectOfClass:(Class)class forKey:(id)key;
211- (NSString *) oo_stringForKey:(id)key;
212- (NSArray *) oo_arrayForKey:(id)key;
213- (NSSet *) oo_setForKey:(id)key;
214- (NSDictionary *) oo_dictionaryForKey:(id)key;
215- (NSMutableDictionary *) oo_mutableDictionaryForKey:(id)key;
216- (NSData *) oo_dataForKey:(id)key;
217
218#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
219// Default: kZeroVector
220- (Vector) oo_vectorForKey:(id)key;
221// Default: kZeroHPVector
222- (HPVector) oo_hpvectorForKey:(id)key;
223// Default: kIdentityQuaternion
224- (Quaternion) oo_quaternionForKey:(id)key;
225#endif
226
227@end
228
229
230@interface NSUserDefaults (OOExtractor)
231
232- (char) oo_charForKey:(id)key defaultValue:(char)value;
233- (short) oo_shortForKey:(id)key defaultValue:(short)value;
234- (int) oo_intForKey:(id)key defaultValue:(int)value;
235- (long) oo_longForKey:(id)key defaultValue:(long)value;
236- (long long) oo_longLongForKey:(id)key defaultValue:(long long)value;
237- (NSInteger) oo_integerForKey:(id)key defaultValue:(NSInteger)value;
238
239- (unsigned char) oo_unsignedCharForKey:(id)key defaultValue:(unsigned char)value;
240- (unsigned short) oo_unsignedShortForKey:(id)key defaultValue:(unsigned short)value;
241- (unsigned int) oo_unsignedIntForKey:(id)key defaultValue:(unsigned int)value;
242- (unsigned long) oo_unsignedLongForKey:(id)key defaultValue:(unsigned long)value;
243- (unsigned long long) oo_unsignedLongLongForKey:(id)key defaultValue:(unsigned long long)value;
244- (NSUInteger) oo_unsignedIntegerForKey:(id)key defaultValue:(NSUInteger)value;
245
246- (BOOL) oo_boolForKey:(id)key defaultValue:(BOOL)value;
247#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
248- (BOOL) oo_fuzzyBooleanForKey:(id)key defaultValue:(float)value; // Reads a float in the range [0, 1], and returns YES with that probability.
249#endif
250
251- (float) oo_floatForKey:(id)key defaultValue:(float)value;
252- (double) oo_doubleForKey:(id)key defaultValue:(double)value;
253- (float) oo_nonNegativeFloatForKey:(id)key defaultValue:(float)value;
254- (double) oo_nonNegativeDoubleForKey:(id)key defaultValue:(double)value;
255
256- (id) oo_objectForKey:(id)key defaultValue:(id)value;
257- (id) oo_objectOfClass:(Class)class forKey:(id)key defaultValue:(id)value;
258- (NSString *) oo_stringForKey:(id)key defaultValue:(NSString *)value;
259- (NSArray *) oo_arrayForKey:(id)key defaultValue:(NSArray *)value;
260- (NSSet *) oo_setForKey:(id)key defaultValue:(NSSet *)value;
261- (NSDictionary *) oo_dictionaryForKey:(id)key defaultValue:(NSDictionary *)value;
262- (NSData *) oo_dataForKey:(id)key defaultValue:(NSData *)value;
263
264
265// Default: 0
266- (char) oo_charForKey:(id)key;
267- (short) oo_shortForKey:(id)key;
268- (int) oo_intForKey:(id)key;
269- (long) oo_longForKey:(id)key;
270- (long long) oo_longLongForKey:(id)key;
271
272- (unsigned char) oo_unsignedCharForKey:(id)key;
273- (unsigned short) oo_unsignedShortForKey:(id)key;
274- (unsigned int) oo_unsignedIntForKey:(id)key;
275- (unsigned long) oo_unsignedLongForKey:(id)key;
276- (unsigned long long) oo_unsignedLongLongForKey:(id)key;
277
278// Default: NO
279// - (BOOL) boolForKey:(id)key;
280#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
281- (BOOL) oo_fuzzyBooleanForKey:(id)key; // Reads a float in the range [0, 1], and returns YES with that probability.
282#endif
283
284// Default: 0.0
285// - (float) floatForKey:(id)key;
286- (double) oo_doubleForKey:(NSString *)key;
287- (float) oo_nonNegativeFloatForKey:(id)key;
288- (double) oo_nonNegativeDoubleForKey:(id)key;
289
290// Default: nil
291// - (id) objectForKey:(id)key; // Already defined
292- (id) oo_objectOfClass:(Class)class forKey:(id)key;
293// - (NSString *) stringForKey:(id)key;
294// - (NSArray *) arrayForKey:(id)key;
295- (NSSet *) oo_setForKey:(id)key;
296// - (NSDictionary *) dictionaryForKey:(id)key;
297// - (NSData *) dataForKey:(id)key;
298
299@end
300
301
302@interface NSMutableArray (OOInserter)
303
304- (void) oo_addInteger:(long)value;
305- (void) oo_addUnsignedInteger:(unsigned long)value;
306- (void) oo_addFloat:(double)value;
307- (void) oo_addBool:(BOOL)value;
308#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
309- (void) oo_addVector:(Vector)value;
310- (void) oo_addQuaternion:(Quaternion)value;
311#endif
312
313- (void) oo_insertInteger:(long)value atIndex:(NSUInteger)index;
314- (void) oo_insertUnsignedInteger:(unsigned long)value atIndex:(NSUInteger)index;
315- (void) oo_insertFloat:(double)value atIndex:(NSUInteger)index;
316- (void) oo_insertBool:(BOOL)value atIndex:(NSUInteger)index;
317#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
318- (void) oo_insertVector:(Vector)value atIndex:(NSUInteger)index;
319- (void) oo_insertQuaternion:(Quaternion)value atIndex:(NSUInteger)index;
320#endif
321
322@end
323
324
325@interface NSMutableDictionary (OOInserter)
326
327- (void) oo_setInteger:(long)value forKey:(id)key;
328- (void) oo_setUnsignedInteger:(unsigned long)value forKey:(id)key;
329- (void) oo_setLongLong:(long long)value forKey:(id)key;
330- (void) oo_setUnsignedLongLong:(unsigned long long)value forKey:(id)key;
331- (void) oo_setFloat:(double)value forKey:(id)key;
332- (void) oo_setBool:(BOOL)value forKey:(id)key;
333#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
334- (void) oo_setVector:(Vector)value forKey:(id)key;
335- (void) oo_setHPVector:(HPVector)value forKey:(id)key;
336- (void) oo_setQuaternion:(Quaternion)value forKey:(id)key;
337#endif
338
339@end
340
341
342@interface NSMutableSet (OOInserter)
343
344- (void)oo_addInteger:(long)value;
345- (void)oo_addUnsignedInteger:(unsigned long)value;
346- (void)oo_addFloat:(double)value;
347- (void)oo_addBool:(BOOL)value;
348#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
349- (void)oo_addVector:(Vector)value;
350- (void)oo_addQuaternion:(Quaternion)value;
351#endif
352
353@end
354
355
356// *** Value extraction utilities ***
357
358/* Utility function to interpret a boolean. May be an NSNumber or any of the
359 following strings (case-insensitive):
360 yes
361 true
362 on
363
364 no
365 false
366 off
367*/
368BOOL OOBooleanFromObject(id object, BOOL defaultValue);
369
370
371#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
372/* Utility function to interpret a fuzzy boolean. May be any of the strings
373 accepted by OOBooleanFromObject(), or a number indicating probability of
374 a yes (between 0 and 1).
375*/
376BOOL OOFuzzyBooleanFromObject(id object, float defaultValue);
377#endif
378
379
380float OOFloatFromObject(id object, float defaultValue);
381double OODoubleFromObject(id object, double defaultValue);
382float OONonNegativeFloatFromObject(id object, float defaultValue);
383double OONonNegativeDoubleFromObject(id object, double defaultValue);
384
385#ifndef OOCOLLECTIONEXTRACTORS_SIMPLE
386// These take strings, dictionaries or arrays.
387Vector OOVectorFromObject(id object, Vector defaultValue);
388HPVector OOHPVectorFromObject(id object, HPVector defaultValue);
389Quaternion OOQuaternionFromObject(id object, Quaternion defaultValue);
390
391NSDictionary *OOPropertyListFromVector(Vector value);
392NSDictionary *OOPropertyListFromHPVector(HPVector value);
393NSDictionary *OOPropertyListFromQuaternion(Quaternion value);
394#endif
395
396
397OOINLINE long long OOClampInteger(long long value, long long minValue, long long maxValue) ALWAYS_INLINE_FUNC;
398long long OOLongLongFromObject(id object, long long defaultValue);
399unsigned long long OOUnsignedLongLongFromObject(id object, unsigned long long defaultValue);
400
401
402OOINLINE long long OOClampInteger(long long value, long long minValue, long long maxValue)
403{
404 return (minValue < value) ? ((value < maxValue) ? value : maxValue) : minValue;
405}
406
407
408/* Define an inline function to clamp a give type and its unsigned
409 counterpart. Example:
410
411 OO_DEFINE_CLAMP_PAIR(char, Char, CHAR)
412
413 expands to
414
415 OOINLINE char OOCharFromObject(id object, char defaultValue)
416 {
417 return OOClampInteger(OOLongLongFromObject(object, defaultValue), CHAR_MIN, CHAR_MAX);
418 }
419 OOINLINE unsigned char OOUnsignedCharFromObject(id object, unsigned char defaultValue)
420 {
421 return OOClampInteger(OOLongLongFromObject(object, defaultValue), 0, UCHAR_MAX);
422 }
423*/
424#define OO_DEFINE_CLAMP(type, typeName, min, max) \
425 OOINLINE type OO ## typeName ## FromObject(id object, type defaultValue) \
426 { \
427 return (type)OOClampInteger(OOLongLongFromObject(object, defaultValue), min, max); \
428 }
429
430#define OO_DEFINE_CLAMP_PAIR(type, typeName, minMaxSymb) \
431 OO_DEFINE_CLAMP(type, typeName, minMaxSymb ## _MIN, minMaxSymb ## _MAX) \
432 OO_DEFINE_CLAMP(unsigned type, Unsigned ## typeName, 0, U ## minMaxSymb ## _MAX)
433
434OO_DEFINE_CLAMP_PAIR(char, Char, CHAR)
435OO_DEFINE_CLAMP_PAIR(short, Short, SHRT)
436
437/* When ints or longs are as large as long longs, we can't do any clamping
438 because the clamping code will overflow (unless we add pointless complexity).
439 Instead, we alias the long long versions which don't clamp. Inlines are
440 used instead of macros so that the functions always have the precise type
441 they should; this is necessary for stuff that uses @encode, notably the
442 SenTestingKit framework.
443*/
444#define OO_ALIAS_CLAMP_LONG_LONG(type, typeName) \
445static inline type OO##typeName##FromObject(id object, type defaultValue) \
446{ \
447 return OOLongLongFromObject(object, defaultValue); \
448}
449#define OO_ALIAS_CLAMP_PAIR_LONG_LONG(type, typeName) \
450OO_ALIAS_CLAMP_LONG_LONG(type, typeName) \
451OO_ALIAS_CLAMP_LONG_LONG(unsigned type, Unsigned##typeName)
452
453#if INT_MAX == LLONG_MAX
454// Should never get here under Mac OS X, but may under GNUstep.
456#else
457OO_DEFINE_CLAMP_PAIR(int, Int, INT)
458#endif
459
460#if LONG_MAX == LLONG_MAX
462#else
463OO_DEFINE_CLAMP_PAIR(long, Long, LONG)
464#endif
465
466
467#if OOLITE_64_BIT
468OOINLINE NSInteger OOIntegerFromObject(id object, NSInteger defaultValue)
469{
470 return OOLongLongFromObject(object, defaultValue);
471}
472
473OOINLINE NSInteger OOUIntegerFromObject(id object, NSUInteger defaultValue)
474{
475 return OOUnsignedLongLongFromObject(object, defaultValue);
476}
477#else
478OOINLINE NSInteger OOIntegerFromObject(id object, NSInteger defaultValue)
479{
480 return OOLongFromObject(object, defaultValue);
481}
482
483OOINLINE NSInteger OOUIntegerFromObject(id object, NSUInteger defaultValue)
484{
485 return OOUnsignedLongFromObject(object, defaultValue);
486}
487#endif
488
489
490#undef OO_DEFINE_CLAMP
491#undef OO_DEFINE_CLAMP_PAIR
492#undef OO_ALIAS_CLAMP_LONG_LONG
493#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