NSUnarchiver question
NSUnarchiver question
- Subject: NSUnarchiver question
- From: Alex Rice <email@hidden>
- Date: Tue, 2 Oct 2001 01:21:10 -0600
[sorry if this is a duplicate post- my mail.app hung while sending]
Is there a way to "rollback" a NSCoder? I'm growing a very ad-hoc
document format created with NSDocuments writing with NSArchiver
archivedDataWithRootObject:.
What I'd like to do is something like this code fragment below. Is this
possible? I can't see anything in NSCoder or NSUnarchiver to support
this. There must be some design pattern I'm unaware of for doing this
type of thing with serialized objects.
-initWithCoder: coder
{
// in a class deep within the object graph &
// in a galaxy far far away
// document features added after document version 1.0
NS_DURING
// v1.1 feature:
[coder decodeValueOfObjCType:@encode(typeof(feature)) at:&(feature)];
NS_HANDLER
feature = MyDefault;
NSLog(@"failed to read feature");
[coder rollback]; //?
NS_ENDHANDLER
// now the next object in the graph can be safely initWithCoder'd
}
TIA again
Alex Rice <email@hidden>
Mindlube Software
http://www.mindlube.com/