One more thing…this all seems to work fine for Graphics::Point-typed attributes:

namespace Graphics
{

class Point : CGPoint
{
};

}


On Nov 1, 2012, at 23:36 , Rick Mann <rm...@latencyzero.com> wrote:

> Huh. I made this small test case to narrow down the issues. I've noticed 
> something. In my larger project, setBounds: gets called and its parameter 
> shows in the debugger as a Graphics::Rect&. But in my sample project, it's 
> the (correct) Graphics::Rect.
> 
> (Note in the sample below I omitted the "Graphics::" namespace.)
> 
> I can't figure out why this is. The sample code seems still fails to run 
> correctly.
> 
> -- 
> Rick
> 
> 
> On Nov 1, 2012, at 19:44 , Rick Mann <rm...@latencyzero.com> wrote:
> 
>> I'm trying to copy NSManagedObjects using -dictionaryWithValuesForKeys and 
>> -setValuesForKeysWithDictionary:. Some of my attributes are C++ objects 
>> (simple ones). For example:
>> 
>> class
>> Rect : public CGRect
>> {
>> };
>> 
>> @interface
>> MyObj : NSManagedObject
>> 
>> @property (nonatomic, assign)        Rect            bounds;
>> 
>> @end
>> 
>> 
>> When I get the dictionary of values from the source object, I get something 
>> reasonable:
>> 
>> (lldb) po values
>> (NSDictionary *) $0 = 0x0000000400770ae0 {
>>   bounds = "<00000000 000030c0 00000000 000038c0 00000000 00004040 00000000 
>> 00004640>";
>> }
>> 
>> But when I try to set the values in the target object, my setBounds: method
>> 
>> - (void)
>> setBounds: (Graphics::Rect) inVal
>> {
>>   NSString* v = NSStringFromRect(NSRectFromCGRect(inVal));
>>   [self willChangeValueForKey:@"bounds"];
>>   self.shadowBounds = v;
>>   [self didChangeValueForKey:@"bounds"];
>> }
>> 
>> gets called with
>> 
>> inVal = (Rect &)     0x0000000000000000
>>> CGRect (CGRect)
>> 
>> Showing in the debugger. That is, the type of inVal is a Rect reference 
>> (Rect&).
>> 
>> Something's clearly not right. Can I even do this?
>> 
>> Thanks,
>> -- 
>> Rick
>> 
>> 
>> 
>> 
>> _______________________________________________
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com
>> 
>> This email sent to rm...@latencyzero.com
> 
> 
> -- 
> Rick
> 
> 
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com
> 
> This email sent to rm...@latencyzero.com


-- 
Rick




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to