Re: How do I get NSRect to be the same as CGRect?
Re: How do I get NSRect to be the same as CGRect?
- Subject: Re: How do I get NSRect to be the same as CGRect?
- From: glenn andreas <email@hidden>
- Date: Mon, 17 Dec 2007 15:20:49 -0600
On Dec 17, 2007, at 3:11 PM, Rick Mann wrote:
On Dec 17, 2007, at 1:04 PM, Sean McBride wrote:
I agree it's unlikely, but the possibility is no doubt the reason for
NSRectToCGRect() existing (it uses the union trick).
I think that means that NSRectToCGRect() must take care to be
compiled with the correct setting of -fstrict-aliasing.
Could you not make your Graphics::Rect class Objective-C++? Just
changing its extension should do the trick.
Perhaps, but it would limit its usefulness. All files that included
the header file would need to use .mm as an extension.
Not really:
MyRect.h:
class Rect {
public:
Rect(CGRect rect);
#ifdef __OBJC__
Rect(NSRect rect);
#endif
Rect(float left, float top, float right, float bottom);
}
MyRect.mm:
Rect::Rect(CGRect rect) {
}
Rect::Rect(NSRect rect) {
}
...
Any ".mm" file that includes MyRect.h will be able to use the NSRect
version, a ".cp" file wont (nor should it be able to, since it would
need to be Objective-C++ to have seen an NSRect in the first place)
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next
generation of fractal art
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden