Re: NSEnumerator ordering ?
Re: NSEnumerator ordering ?
- Subject: Re: NSEnumerator ordering ?
- From: Marcel Weiher <email@hidden>
- Date: Thu, 4 Jul 2002 00:12:40 +0200
On Wednesday, July 3, 2002, at 04:30 Uhr, Otto Poellath wrote:
Hmm, dictionaries are unordered by definition. But maybe you could
store the ordered keys in an NSArray and include it in the NSDictionary
as well?
Or just use the XML archiver/unarchiver in Objective-XML, especially if
you're actually trying to archive instance variables, not dictionaries
per-se.
This will give you output where the variable names are xml-tags and the
values contained within those tags. For example:
<NSFont id='3b'>
<fontName>Courier-BoldOblique</fontName>
<fontSize valuetype='f'>44.5</fontSize>
</NSFont>
This is the encoding of an NSFont object. To me, it seems
self-explanatory.
Here's a somewhat longer sample, which is an extract of a large
archive. It shows how an instance variable named "slots" that contains
a NSMutableArray is archived. I also shows how references to objects
are encoded using 'idref'.
<slots valuetype='@'>
<NSMutableArray id='1c'>
<count valuetype='i'>5</count>
<arrayelement valuetype='@'>
<?Class name="MPWRectSlot" version="3"?>
<MPWRectSlot id='1d'>
<original
idref=5/>
<name>epleblomster S HV lite</name>
<active
valuetype='c'>1</active>
<rect
valuetype='{_NSRect={_NSPoint=ff}{_NSSize=ff}}'>{{0, 0}, {624,
871}}</rect>
</MPWRectSlot>
</arrayelement>
<arrayelement valuetype='@'>
<MPWRectSlot id='1e'>
<original
idref=8/>
<name>(telebue_sort)-1</name>
<active
valuetype='c'>1</active>
<rect
valuetype='{_NSRect={_NSPoint=ff}{_NSSize=ff}}'>{{-462, 238}, {727,
181}}</rect>
</MPWRectSlot>
</arrayelement>
<arrayelement valuetype='@'>
<MPWRectSlot id='1f'>
<original
idref=a/>
<name>(Telehuset
negativ)-1</name>
<active
valuetype='c'>1</active>
<rect
valuetype='{_NSRect={_NSPoint=ff}{_NSSize=ff}}'>{{29, 338}, {551,
184}}</rect>
</MPWRectSlot>
</arrayelement>
<arrayelement valuetype='@'>
<MPWRectSlot id='20'>
<original
idref=c/>
<name>Body5110
(Page 1)-1</name>
<active
valuetype='c'>1</active>
<rect
valuetype='{_NSRect={_NSPoint=ff}{_NSSize=ff}}'>{{0, 0}, {162,
65}}</rect>
</MPWRectSlot>
</arrayelement>
<arrayelement valuetype='@'>
<MPWRectSlot id='21'>
<original
idref=e/>
<name>Headline5110 (Page 1)-1</name>
<active
valuetype='c'>1</active>
<rect
valuetype='{_NSRect={_NSPoint=ff}{_NSSize=ff}}'>{{0, 0}, {162,
65}}</rect>
</MPWRectSlot>
</arrayelement>
</NSMutableArray>
</slots>
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
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.