• 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
NSData and Nested Arrays
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSData and Nested Arrays


  • Subject: NSData and Nested Arrays
  • From: "Fen Soares" <email@hidden>
  • Date: Tue, 6 Mar 2007 09:18:10 +0000

I'm using RubyCocoa as a file parser. It returns an NSArray of NSArrays each
containing NSDecimalNumbers in the following format:
((1,2,3), (4,5,6), (7,8,9))

This obviously has quite a footprint and iteration is expensive. I have
previously converted it into a primitive c array, but really need it in
NSData format for archiving purposes and smaller memory footprint.

I've looked at the documentation, but am unclear as to how I should make the
conversion. I'd like to index and enumerate through the NSData object as
though each sequence of bytes were a struct:

struct vertex {
   GLfloat x, y, z;
};

equivalent to this fictional accessor-type:

Vector *v = [NSData bytesAtIndex:index*sizeof(vertex)];



Any advice is much appreciated.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Prev by Date: Using webview to display flash
  • Next by Date: Change password on DMG
  • Previous by thread: Using webview to display flash
  • Next by thread: Re: NSData and Nested Arrays
  • Index(es):
    • Date
    • Thread