Re: convert CFRange to NSRange?
Re: convert CFRange to NSRange?
- Subject: Re: convert CFRange to NSRange?
- From: Matt Neuburg <email@hidden>
- Date: Tue, 14 Dec 2010 08:58:23 -0800
On Sun, 12 Dec 2010 08:04:55 -0800, "John C. Randolph" <email@hidden> said:
>
>On Dec 12, 2010, at 7:34 AM, Matt Neuburg wrote:
>
>> I feel like I'm missing something. I can't seem to typecast as
>> CFRange to an NSRange. I know I can pull a CFRange apart and
>> reassemble it as an NSRange, but shouldn't there be a simpler way? m.
>
>CFRange is defined as a pair of unsigned longs, and NSRange is defined
>as either unsigned ints or unsigned longs depending on whether you're
>compiling 32- or 64-bit.
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. This would be useful because you can receive a CFRange while mucking about in some lower-level framework (such as Core Text) which you would then like to apply to an AppKit object (such as an NSString). Obviously the problem can be solved by staying in the lower-level world (i.e., in my case I treated the NSString as a CFString) but it would be nice not to have to. m.
--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings_______________________________________________
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