Re: Do I know whether a NSNumber was created with +numberWithBool rather than a different +numberWithxx method?
Re: Do I know whether a NSNumber was created with +numberWithBool rather than a different +numberWithxx method?
- Subject: Re: Do I know whether a NSNumber was created with +numberWithBool rather than a different +numberWithxx method?
- From: email@hidden
- Date: Thu, 2 Feb 2006 00:19:40 -0800
Hmmmm, I think you're right. -objCType is actually a method on
NSValue - and the values are documented as part of the Objective-C
runtime documentation:
file:///Developer/ADC Reference Library/documentation/Cocoa/
Conceptual/ObjectiveC/Articles/chapter_5_section_7.html
On that page, 'c' is listed as char.
I'll set up some unit tests and see what comes out of my objects.
Thanks for the pointer Gus!
-Blake
On Feb 1, 2006, at 11:42 PM, Gus Mueller wrote:
On Feb 1, 2006, at 10:29 PM, email@hidden wrote:
I am walking through a NSDictionary and have a variety of NSNumber
objects. Some where created with +numberWithBool: and others were
created with +numberWithInt:
Do I have any way to know whether that NSNumber represents a BOOL
rather than an int?
I _think_ you can look at NSNumber's objCType.
It returns "f" for floats, "d" for doubles, "i" for integers (and
longs), and "c" for booleans.
-gus
--
August 'Gus' Mueller
Flying Meat Inc.
http://flyingmeat.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden