mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-03 10:00:51 +00:00
Tidy xml output format.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18466 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
325da251d2
commit
fb301fc9f3
2 changed files with 136 additions and 146 deletions
|
@ -3,6 +3,7 @@
|
||||||
* Source/NSKeyedArchiver.m:
|
* Source/NSKeyedArchiver.m:
|
||||||
* Source/NSKeyedUnarchiver.m:
|
* Source/NSKeyedUnarchiver.m:
|
||||||
Added NSPoint, NSRect, and NSSize coding methods.
|
Added NSPoint, NSRect, and NSSize coding methods.
|
||||||
|
* Source/NSMSoperamulti_test.m: Sort dictionary items in xml output
|
||||||
|
|
||||||
2004-01-23 Richard Frith-Macdonald <rfm@gnu.org>
|
2004-01-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -1552,7 +1552,7 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
|
||||||
{
|
{
|
||||||
[dest appendBytes: "<real>" length: 6];
|
[dest appendBytes: "<real>" length: 6];
|
||||||
XString([obj stringValue], dest);
|
XString([obj stringValue], dest);
|
||||||
[dest appendBytes: "</real>" length: 7];
|
[dest appendBytes: "</real>\n" length: 8];
|
||||||
}
|
}
|
||||||
else if (x == NSPropertyListGNUStepFormat)
|
else if (x == NSPropertyListGNUStepFormat)
|
||||||
{
|
{
|
||||||
|
@ -1721,6 +1721,15 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
|
||||||
{
|
{
|
||||||
const char *iBaseString;
|
const char *iBaseString;
|
||||||
const char *iSizeString;
|
const char *iSizeString;
|
||||||
|
SEL objSel = @selector(objectForKey:);
|
||||||
|
IMP myObj = [obj methodForSelector: objSel];
|
||||||
|
unsigned i;
|
||||||
|
NSArray *keyArray = [obj allKeys];
|
||||||
|
unsigned numKeys = [keyArray count];
|
||||||
|
NSString *plists[numKeys];
|
||||||
|
NSString *keys[numKeys];
|
||||||
|
BOOL canCompare = YES;
|
||||||
|
Class lastClass = 0;
|
||||||
unsigned level = lev;
|
unsigned level = lev;
|
||||||
|
|
||||||
if (level*step < sizeof(indentStrings)/sizeof(id))
|
if (level*step < sizeof(indentStrings)/sizeof(id))
|
||||||
|
@ -1743,40 +1752,6 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
|
||||||
= indentStrings[sizeof(indentStrings)/sizeof(id)-1];
|
= indentStrings[sizeof(indentStrings)/sizeof(id)-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x == NSPropertyListXMLFormat_v1_0)
|
|
||||||
{
|
|
||||||
NSEnumerator *e;
|
|
||||||
id key;
|
|
||||||
|
|
||||||
[dest appendBytes: "<dict>\n" length: 7];
|
|
||||||
e = [obj keyEnumerator];
|
|
||||||
while ((key = [e nextObject]))
|
|
||||||
{
|
|
||||||
id val;
|
|
||||||
|
|
||||||
val = [obj objectForKey: key];
|
|
||||||
[dest appendBytes: iSizeString length: strlen(iSizeString)];
|
|
||||||
[dest appendBytes: "<key>" length: 5];
|
|
||||||
XString(key, dest);
|
|
||||||
[dest appendBytes: "</key>\n" length: 7];
|
|
||||||
[dest appendBytes: iSizeString length: strlen(iSizeString)];
|
|
||||||
OAppend(val, loc, level, step, x, dest);
|
|
||||||
}
|
|
||||||
[dest appendBytes: iBaseString length: strlen(iBaseString)];
|
|
||||||
[dest appendBytes: "</dict>\n" length: 8];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SEL objSel = @selector(objectForKey:);
|
|
||||||
IMP myObj = [obj methodForSelector: objSel];
|
|
||||||
unsigned i;
|
|
||||||
NSArray *keyArray = [obj allKeys];
|
|
||||||
unsigned numKeys = [keyArray count];
|
|
||||||
NSString *plists[numKeys];
|
|
||||||
NSString *keys[numKeys];
|
|
||||||
BOOL canCompare = YES;
|
|
||||||
Class lastClass = 0;
|
|
||||||
|
|
||||||
[keyArray getObjects: keys];
|
[keyArray getObjects: keys];
|
||||||
|
|
||||||
for (i = 0; i < numKeys; i++)
|
for (i = 0; i < numKeys; i++)
|
||||||
|
@ -1878,7 +1853,22 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
|
||||||
plists[i] = (*myObj)(obj, objSel, keys[i]);
|
plists[i] = (*myObj)(obj, objSel, keys[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loc == nil)
|
if (x == NSPropertyListXMLFormat_v1_0)
|
||||||
|
{
|
||||||
|
[dest appendBytes: "<dict>\n" length: 7];
|
||||||
|
for (i = 0; i < numKeys; i++)
|
||||||
|
{
|
||||||
|
[dest appendBytes: iSizeString length: strlen(iSizeString)];
|
||||||
|
[dest appendBytes: "<key>" length: 5];
|
||||||
|
XString(keys[i], dest);
|
||||||
|
[dest appendBytes: "</key>\n" length: 7];
|
||||||
|
[dest appendBytes: iSizeString length: strlen(iSizeString)];
|
||||||
|
OAppend(plists[i], loc, level, step, x, dest);
|
||||||
|
}
|
||||||
|
[dest appendBytes: iBaseString length: strlen(iBaseString)];
|
||||||
|
[dest appendBytes: "</dict>\n" length: 8];
|
||||||
|
}
|
||||||
|
else if (loc == nil)
|
||||||
{
|
{
|
||||||
[dest appendBytes: "{" length: 1];
|
[dest appendBytes: "{" length: 1];
|
||||||
for (i = 0; i < numKeys; i++)
|
for (i = 0; i < numKeys; i++)
|
||||||
|
@ -1905,7 +1895,6 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
|
||||||
[dest appendBytes: "}" length: 1];
|
[dest appendBytes: "}" length: 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (x == NSPropertyListXMLFormat_v1_0)
|
if (x == NSPropertyListXMLFormat_v1_0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue