On Mar 16, 2009, at 7:37 AM, Michael Ash wrote:

On Mon, Mar 16, 2009 at 10:26 AM, Adam R. Maxwell <amaxw...@mac.com> wrote:

On Mar 16, 2009, at 7:02 AM, Roland King wrote:

Any good ideas for doing a key-case-insensitive NSDictionary of NSString to NSString? I have some HTTP headers I want to stick in a dictionary and
look up later. HTTP headers have case-insensitive keys.

Use a CFDictionary with custom key callbacks that have a case- insensitive hash and equality function. You can then cast it to an NSDictionary for
easier access.

Alas, toll-free bridging doesn't work properly when custom callbacks
are in effect. It *might* work for something as simple as this, but
you may have to use only the CF functions on it.

In the case of strings (or when pointer equality isn't used), toll- free bridging does work. Your custom callbacks will be invoked, and - [NSMutableDictionary setObject:forKey:] key-copying doesn't hurt anything.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to