Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Recursively list a CFDictionary.

7 views
Skip to first unread message
Message has been deleted

Bo Lindbergh

unread,
May 31, 2009, 5:35:48 AM5/31/09
to
In article <chine.bleu-EC834...@mara100-84.onlink.net>,
Hello China Blue Sky Hello <chine...@yahoo.com> wrote:

> All I want is to recursively enumerate a dictionary that can contain dictionary
> to a list like
> "dictionarykey" = "value"
> "key" = "value"
> "key.subkey" = "value"
> ...
>
> Why cam't Apple document how to get what type a dictionary value is?

What prevented you from finding the CFGetTypeID function?


/Bo Lindbergh

Message has been deleted

David Phillip Oster

unread,
May 31, 2009, 12:02:48 PM5/31/09
to
In article <chine.bleu-EC834...@mara100-84.onlink.net>,
Hello China Blue Sky Hello <chine...@yahoo.com> wrote:

> All I want is to recursively enumerate a dictionary that can contain
> dictionary
> to a list like
> "dictionarykey" = "value"
> "key" = "value"
> "key.subkey" = "value"
> ...
>
> Why cam't Apple document how to get what type a dictionary value is?

Because they already documented the general case:
- [NSObject isKindOfClass:]

and

- [NSbject respondsToSelector:]

usually, one writes this as:

void DictRecurse(NSDictionary *dict) {
NSEnumerator *keys = [dict keyEnumerator];
id key;
while(nil != (key = [keys nextObject])){
id value = [dict objectForKey:key];
if ([id respondsToSelector:@selector(objectForKey:)]) {
DictRecurse(id);
}
}
}

0 new messages