• 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: convert CFRange to NSRange?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: convert CFRange to NSRange?


  • Subject: Re: convert CFRange to NSRange?
  • From: Scott Ribe <email@hidden>
  • Date: Tue, 14 Dec 2010 12:13:24 -0700

On Dec 14, 2010, at 9:58 AM, Matt Neuburg wrote:

> I recognize that the conversion is not simple, but that is exactly why I am surprised that the frameworks do not supply a utility conversion method. If I were to write my own I would surely get it wrong.


The size & layout of the members is the same on 32-bit and 64-bit. But the "not found" values are different, so, you can't use any vile casting to reinterpret. But a macro to convert is pretty simple:

#define NSMakeRangeFromCF(cfr) NSMakeRange( cfr.location == kCFNotFound ? NSNotFound : cfr.location, cfr.length )

--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice




_______________________________________________

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: 
 >Re: convert CFRange to NSRange? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: assign property behaves differently from simple instance variable???
  • Next by Date: Re: Intercepting cocoa/quartz/opengl Draw command.
  • Previous by thread: Re: convert CFRange to NSRange?
  • Next by thread: [iOS 4.2] NSDateFormatter -init not available in iOS > 3.2 - how to init then?
  • Index(es):
    • Date
    • Thread