Re: value transformer for structs?
Re: value transformer for structs?
- Subject: Re: value transformer for structs?
- From: "John C. Randolph" <email@hidden>
- Date: Thu, 23 Mar 2006 11:38:06 -0800
On Mar 23, 2006, at 10:21 AM, Derrick Bass wrote:
On Mar 23, 2006, at 7:45 AM, Michael B Johnson wrote:
@implementation MYQTTimeRangeValueTransformer
+ (Class)transformedValueClass { return [NSString self]; }
+ (BOOL)allowsReverseTransformation { return NO; }
- (id)transformedValue:(id)value {
QTTimeRange* r = (QTTimeRange*)value;
return (value == nil) ? nil : QTStringFromTimeRange(*r);
}
@end
A QTTimeRange is not an object, so casting an id to a QTTimeRange*
is bad. What you need to do instead is use an NSValue internally.
To get the time range in and out, you can use valueWithQTTimeRange
and QTTimeRangeValue. E.g.
Whoops! I didn't spot that..
-jcr
John C. Randolph <email@hidden> (408) 914-0013
Roaming Cocoa Engineer,
Available for your projects at great Expense and Inconvenience.
_______________________________________________
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