00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #import "util-osx.h"
00017
00018 #import <CoreFoundation/CFNumber.h>
00019
00020 #include <stdio.h>
00021
00022
00023 int get_int_CF(CFDictionaryRef dict, CFStringRef key)
00024 {
00025 CFNumberRef ref = (CFNumberRef) CFDictionaryGetValue(dict, key);
00026 int val = 0;
00027
00028 if ( ! ref )
00029 puts("get_int_CF() - Failed to get number reference");
00030 else
00031 if ( ! CFNumberGetValue(ref, kCFNumberSInt32Type, &val) )
00032 puts("get_int_CF() - Failed to get 32bit int from number");
00033
00034 return val;
00035 }
00036
00037 float get_float_CF(CFDictionaryRef dict, CFStringRef key)
00038 {
00039 CFNumberRef ref = (CFNumberRef) CFDictionaryGetValue(dict, key);
00040 float val = 0.0;
00041
00042 if ( ! ref )
00043 puts("get_float_CF() - Failed to get number reference");
00044 else
00045 if ( ! CFNumberGetValue(ref, kCFNumberFloatType, &val) )
00046 puts("get_float_CF() - Failed to get float from number");
00047
00048 return val;
00049 }