Archiving objects in a database
Archiving objects in a database
- Subject: Archiving objects in a database
- From: Keith Renz <email@hidden>
- Date: Tue, 14 Oct 2003 19:58:25 -0400
In my app, I have several hundred (~200-800) custom objects in a main
database (an NSArray). Documents in my app generally move/sort a subset
of these objects and then save/open this subset. Once a database is
created (monthly), the objects never change their order -- their
content may change, but not their order. When I save a document, I
don't need to archive the document's objects (since they're references
to objects in the main database). All I need to archive is the indexes
of the objects in the main database. But, on the other hand, when I
archive the main database, I do want to archive the objects.
I'm not sure how to go about doing this. It seems that I might be able
to use -replacementObjectForKeyedArchiver: but I only want to do this
for objects archived in a document. How would the object being archived
know if it's being archived into my database or my document? I'm
thinking that I could subclass NSKeyedArchiver, use this archiver for
documents only and check the archiver's class in
-replacementObjectForKeyedArchiver:. If it's my subclass, replace the
object with an index. This seems like a waste because my subclass
wouldn't do anything different than the superclass. It's simply using
the class as a flag. So, I think I'm missing something.
Thanks,
Keith
_______________________________________________
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.