discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nuke libgmodel? (No!)


From: Erik M. Buck
Subject: Re: Nuke libgmodel? (No!)
Date: Tue, 6 Feb 2001 11:45:38 -0600

>The .gorm format is (like .nib) simply an archive of the objects in the
gui.
>It should be possible at any point to write an NSCoder subclass that
encodes
>data in (say) XML format rather than binary format.
>Once that is done, changing to XML is trivial, so I do not see the current
nature
>of the encoding format as a problem.

I have written an encoding system that can encode an arbitrary object graph
as human readable ASCII property lists and decode same.  Unfortunately you
can not just subclass NSCoder to do this if you want the file (XML or
properties) to be readable.  Not enough information is provided to NSCoder's
methods.

To be human readable and to enable good features such as backward and
forward file compatibility and the ability to hand edit the files, each
property must have a name as well as a value.  This applies to XML tags as
well as property lists.  NSCoder only allows programmers to specify the
value.


@implementation VPropertyCoder
/*"
     Instances of this class can be used to encode an entire graph of
inter-related objects into an ASCII "human-readable" property list.  Most of
the encoding capabilities of the NSArchiver class are also available here.
Multiple references to the same instance within a graph of objects only
result in a single encoding within the property list.  Conditional encoding
is implemented to be similar to the capabilities of NSArchiver.
     This class does not conform to the NSCoding protocol to which classes
such as NSArchiver conform.  In order to produce property lists that are
"human-readable" additional information beyond the information available
through the NSCoding protocol was needed.  Specifically, it is not
sufficient to output a property such as "1.23".  It is necessary to output
"width = 1.23" instead.  Besides making the meaning of the properties more
evident, using property names enables a wide spectrum of data file
compatibility between applications and application versions.  New versions
of an application can define new property names.  An older version can still
read the property list produced by the new version.  Unrecognized properties
could be ignored.
     See the VPropertyDecoder class.

     Exceptions raised by this class: VPropertyCodingOperationInvalid
"*/


This is the protocol to which classes must conform in order to be encoded or
decoded as properties.

@protocol VPropertyProtocol

- (id)initWithPropertyDecoder:(NSObject <VPropertyDecodingProtocol>
*)aManager;
- (void)encodeWithPropertyCoder:(NSObject <VPropertyCodingProtocol>
*)aManager;

@end







reply via email to

[Prev in Thread] Current Thread [Next in Thread]