Re: Saving "objects" & opening them up in a non-document based App
Re: Saving "objects" & opening them up in a non-document based App
- Subject: Re: Saving "objects" & opening them up in a non-document based App
- From: Aaron Boothello <email@hidden>
- Date: Sat, 17 Jan 2004 22:25:39 +0800
Hey there again,
i looked up the documentation, whatever i could find online regarding NSCoder, NSData , NSArchiver and NSUnarchiver and im still where i started out.i think i aught to explain my situation a bit better. My application is a non-document based Cocoa App.
My class heirachy:
level1:(all subclasses of NSData)
2D objects (verticces x,y,z)
Textures (imagedata and size)
3D objects (vertices,colors, angles, scale and offset, textures,2DObject)
level2:(subclass of NSData)
"Super3D" (array of 3DObjects).
So:
all information is stored as 'floats'(apart from textures) and 'BOOL's...im not using NSString, etc. And there's a heck of a lot of information.
Now, all i want to do is write the "Super3D" out to a file, and load it when i need. What is the best way to do this ? i'm really stumped here.
Cheers,
Aaron.
On Thursday, January 15, 2004, at 06:50PM, Louis C. Sacha <email@hidden> wrote:
>
Hello...
>
>
Take a look at the documentation for
>
NSKeyedArchiver/NSKeyedUnarchiver, and also there is a topic about
>
archiving in the Cocoa Conceptual documentation.
>
>
in 10.3 developer docs:
>
>
/Developer/Documentation/Cocoa/Conceptual/Archiving/index.html
>
/Developer/Documentation/Cocoa/Conceptual/Archiving/Tasks/codingobjects.html
>
>
in 10.2
>
>
/Documentation/Cocoa/TasksAndConcepts/ProgrammingTopics/Archiving/index.html
>
/Documentation/Cocoa/TasksAndConcepts/ProgrammingTopics/Archiving/Tasks/codingobjects.html
>
>
>
Essentially, you can implement the two methods from the <NSCoding>
>
protocol, encodeWithCoder: and initWithCoder:, and then use an
>
archiver/unarchiver to write/read from your class to a data file.
>
>
Hope that helps,
>
>
Louis
>
>
>
>I have a Cocoa application (non document based) and i want to save
>
>the data in a class i created (NSObject:myObject) to a file and be
>
>able to open it back up. ive browzed the net but all i find is stuff
>
>for document based apps. i really need some help, sample code or
>
>tutorials cause i have no idea where to begin.
>
>
>
>Aaron Boothello.
>
>_______________________________________________
>
>cocoa-dev mailing list | email@hidden
>
>Help/Unsubscribe/Archives:
>
>http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
>Do not post admin requests to the list. They will be ignored.
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.