• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Determining if NS/CFDictionary is mutable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Determining if NS/CFDictionary is mutable?
      • From: Douglas Davidson <email@hidden>
    • Re: Determining if NS/CFDictionary is mutable?
      • From: Sherm Pendley <email@hidden>
    • Re: Determining if NS/CFDictionary is mutable?
      • From: Tomas Zahradnicky <email@hidden>
  • Prev by Date: NSCFNumber, no pool in place - just leaking
  • Next by Date: Re: SetLevel: window and drawers
  • Previous by thread: Re: NSCFNumber, no pool in place - just leaking
  • Next by thread: Re: Determining if NS/CFDictionary is mutable?
  • Index(es):
    • Date
    • Thread