Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. NSDictionary* freToDictionary(FREObject object)
  2. {
  3.     NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
  4.     //
  5.     FREObject _freKeysList = nil;
  6.     FREResult res = FREGetObjectProperty(object, (const uint8_t*)"freKeysList", &_freKeysList, nil);
  7.     if (res != FRE_OK) return dictionary;
  8.     if (!_freKeysList) return dictionary;
  9.     NSArray* freKeysList = freToMArray(_freKeysList, 0);
  10.     //
  11.     NSInteger count = freKeysList.count;
  12.     NSString* key;
  13.     //
  14.     FREObject _value;
  15.     id value;
  16.     for (NSInteger i=0; i<count; i++) {
  17.         key = [freKeysList objectAtIndex:i];
  18.         //
  19.         res = FREGetObjectProperty(object, (const uint8_t*)[key UTF8String], &_value, nil);
  20.         if (res == FRE_OK) {
  21.             value = freToId(_value);
  22.             if (value) {
  23.                 [dictionary setValue:value forKey:key];
  24.             }
  25.         }
  26.     }
  27.     //
  28.     return dictionary;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement