Re: NSString accessing characters
Re: NSString accessing characters
- Subject: Re: NSString accessing characters
- From: Ken Thomases <email@hidden>
- Date: Sat, 18 Jun 2011 05:34:05 -0500
On Jun 17, 2011, at 5:35 AM, Andreas Grosam wrote:
> Thank you Ken, for your valuable tips,
You're welcome.
> On Jun 17, 2011, at 10:40 AM, Ken Thomases wrote:
>
>> After that, maybe use CFStringInitInlineBuffer() and CFStringGetCharacterFromInlineBuffer(), although that doesn't fit with your iterator interface. You could wrap an iterator around them easily, though.
> I don't understand the purpose of the "inline buffer" facility fully, though. Is accessing a NSString's content through an inline buffer faster than accessing the content of a raw pointer whose content has a known encoding?
No. The inline buffer would be slower than either of the Get...Ptr functions. However, it is an optimized way of doing a conversion, as would be required when the Get...Ptr functions return NULL. It converts in chunks and preserves state between chunks so that conversion of the next chunk can resume without recomputing state. Also, it uses a fixed-size stack buffer, avoiding heap allocation.
Regards,
Ken
_______________________________________________
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