• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do I get NSRect to be the same as CGRect?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >How do I get NSRect to be the same as CGRect? (From: Rick Mann <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: "Clark Cox" <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: Rick Mann <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: "Sean McBride" <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: Rick Mann <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: "Sean McBride" <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: How do I get NSRect to be the same as CGRect?
  • Next by Date: Re: How do I get NSRect to be the same as CGRect?
  • Previous by thread: Re: How do I get NSRect to be the same as CGRect?
  • Next by thread: Re: How do I get NSRect to be the same as CGRect?
  • Index(es):
    • Date
    • Thread