RE: Equivalent of isKindOfClass for Foundation Types?
RE: Equivalent of isKindOfClass for Foundation Types?
- Subject: RE: Equivalent of isKindOfClass for Foundation Types?
- From: "Christopher Hickman" <email@hidden>
- Date: Thu, 4 May 2006 12:31:51 -0400
Incidentally, I typed that directly into my email from memory, and brain
short-circuited to AppleScript on the "end if" line. That line doesn't
exist in my implementation... :)
-----Original Message-----
From: cocoa-dev-bounces+tophu=email@hidden
[mailto:cocoa-dev-bounces+tophu=email@hidden] On Behalf Of
Christopher Hickman
Sent: Thursday, May 04, 2006 11:45 AM
To: email@hidden
Subject: Equivalent of isKindOfClass for Foundation Types?
I need to test if the value passed to my NSValueTransformer is an
NSTimeInterval. Since NSTimeInterval is just a typedef from double and not
a class, I can't use the NSObject methods to test its type.
The best I can think of now is to test it with typeof() against
NSTimeInterval, but I think I should really allow any numeric type for this
transformer.
Currently my code says this:
- (id)transformedValue:(id)value;
{
if (typeof(value) != typeof(NSTimeInterval)) { //bail if not
NSTimeInterval
return nil;
end if
NSMutableString *result = [NSMutableString string];
//do my stuff
return result;
}
What is the best way to test this value to see if it is numeric, so my
transformer could be a little more flexible?
Topher
_______________________________________________
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
_______________________________________________
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