Determining if NS/CFDictionary is mutable?
Determining if NS/CFDictionary is mutable?
- Subject: Determining if NS/CFDictionary is mutable?
- From: Nicholas Riley <email@hidden>
- Date: Mon, 23 Dec 2002 12:52:11 -0600
- Mail-followup-to: email@hidden
Hi,
Is there any public, documented way I can figure out whether a
NSDictionary is a mutable dictionary? This doesn't work:
- (NSMutableDictionary *)asMutableDictionary;
{
if ([self isKindOfClass: [NSMutableDictionary class]]) return (NSMutableDictionary *)self;
return [[self mutableCopy] autorelease];
}
Without being able to do this, I end up creating lots of autoreleased
dictionaries because my API takes a NSDictionary and outputs a
NSDictionary. 99% of the time it will be mutable, so I'd like to save
the object creation overhead where I can.
All the dictionaries I've found are NSCFDictionaries, but
NSCFDictionary is a subclass of NSMutableDictionary even when the
dictionary is not mutable. I've checked in the CFLite sources and it
appears what I want is __CFDictionaryGetType, but that of course is
not public.
--
=Nicholas Riley <email@hidden> | <
http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.