mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Revert ABI breakage
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34410 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cbf50c0e7e
commit
7b7faac752
8 changed files with 75 additions and 78 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2012-01-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSXMLDocument.m:
|
||||
* Source/NSXMLNode.m:
|
||||
* Source/NSXMLElement.m:
|
||||
* Headers/Foundation/NSXMLDocument.h:
|
||||
* Headers/Foundation/NSXMLNode.h:
|
||||
* Headers/Foundation/NSXMLDTD.h:
|
||||
* Headers/Foundation/NSXMLElement.h:
|
||||
Revert latest changes to restore scheme for preventing ABI breakage
|
||||
and supporting both fragile and non-fragile ABIs..
|
||||
|
||||
2012-01-04 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/Foundation/NSXMLDocument.h,
|
||||
|
|
|
@ -46,7 +46,7 @@ extern "C" {
|
|||
//NSString *_name;
|
||||
NSString *_publicID;
|
||||
NSString *_systemID;
|
||||
//NSArray *_children;
|
||||
NSArray *_children;
|
||||
BOOL _childrenHaveMutated;
|
||||
BOOL _modified;
|
||||
NSMutableDictionary *_entities;
|
||||
|
|
|
@ -79,9 +79,11 @@ typedef NSUInteger NSXMLDocumentContentKind;
|
|||
NSString *_encoding;
|
||||
NSString *_version;
|
||||
NSXMLDTD *_docType;
|
||||
NSArray *_children;
|
||||
BOOL _childrenHaveMutated;
|
||||
BOOL _standalone;
|
||||
NSXMLElement *_rootElement;
|
||||
//NSString *_URI;
|
||||
NSString *_URI;
|
||||
NSString *_MIMEType;
|
||||
NSUInteger _fidelityMask;
|
||||
NSXMLDocumentContentKind _contentKind;
|
||||
|
|
|
@ -43,6 +43,8 @@ extern "C" {
|
|||
@protected
|
||||
NSMutableDictionary *_attributes;
|
||||
NSMutableArray *_namespaces;
|
||||
NSMutableArray *_children;
|
||||
BOOL _childrenHaveMutated;
|
||||
NSInteger _prefixIndex;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -80,20 +80,29 @@ typedef NSUInteger NSXMLNodeKind;
|
|||
*/
|
||||
@interface NSXMLNode : NSObject <NSCopying>
|
||||
{
|
||||
#if GS_EXPOSE(NSXMLNode)
|
||||
@protected
|
||||
void *_handle;
|
||||
NSXMLNodeKind _kind;
|
||||
NSXMLNode *_parent;
|
||||
NSUInteger _index;
|
||||
id _objectValue;
|
||||
NSString *_stringValue;
|
||||
NSString *_name;
|
||||
NSString *_URI;
|
||||
NSMutableArray *_children;
|
||||
NSUInteger _childCount;
|
||||
NSXMLNode *_previousSibling;
|
||||
NSXMLNode *_nextSibling;
|
||||
NSUInteger _options;
|
||||
void *_handle;
|
||||
NSXMLNodeKind _kind;
|
||||
NSXMLNode *_parent;
|
||||
NSUInteger _index;
|
||||
id _objectValue;
|
||||
NSString *_stringValue;
|
||||
NSString *_name;
|
||||
NSString *_URI;
|
||||
#endif
|
||||
#if GS_NONFRAGILE
|
||||
# if defined(GS_NSXMLNode_IVARS)
|
||||
@public GS_NSXMLNode_IVARS
|
||||
# endif
|
||||
#else
|
||||
/* Pointer to private additional data used to avoid breaking ABI
|
||||
* when we don't have the non-fragile ABI available.
|
||||
* Use this mechanism rather than changing the instance variable
|
||||
* layout (see Source/GSInternal.h for details).
|
||||
*/
|
||||
@private id _internal GS_UNUSED_IVAR;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
RELEASE(_encoding);
|
||||
RELEASE(_version);
|
||||
RELEASE(_docType);
|
||||
RELEASE(_children);
|
||||
RELEASE(_URI);
|
||||
RELEASE(_MIMEType);
|
||||
RELEASE(_elementStack);
|
||||
|
@ -89,16 +90,13 @@
|
|||
if (parser != nil)
|
||||
{
|
||||
_standalone = YES;
|
||||
_children = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
_elementStack = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
ASSIGN(_xmlData, data);
|
||||
[parser setDelegate: self];
|
||||
[parser parse];
|
||||
RELEASE(parser);
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -112,13 +110,9 @@
|
|||
element,
|
||||
self];
|
||||
}
|
||||
self = [self init];
|
||||
self = [self initWithData: nil options: 0 error: 0];
|
||||
if (self != nil)
|
||||
{
|
||||
_standalone = YES;
|
||||
_children = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
_elementStack = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
|
||||
[self setRootElement: (NSXMLNode*)element];
|
||||
}
|
||||
return self;
|
||||
|
@ -205,7 +199,7 @@
|
|||
{
|
||||
[child setParent: self];
|
||||
[(NSMutableArray *)_children insertObject: child atIndex: index];
|
||||
// _childrenHaveMutated = YES;
|
||||
_childrenHaveMutated = YES;
|
||||
}
|
||||
|
||||
- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index
|
||||
|
@ -221,8 +215,8 @@
|
|||
|
||||
- (void) removeChildAtIndex: (NSUInteger)index
|
||||
{
|
||||
[_children removeObjectAtIndex: index];
|
||||
// _childrenHaveMutated = YES;
|
||||
[(NSMutableArray *)_children removeObjectAtIndex: index];
|
||||
_childrenHaveMutated = YES;
|
||||
}
|
||||
|
||||
- (void) setChildren: (NSArray*)children
|
||||
|
@ -288,26 +282,6 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *) XMLStringWithOptions: (NSUInteger)options
|
||||
{
|
||||
NSMutableString *string = [NSMutableString string];
|
||||
NSEnumerator *en = [_children objectEnumerator];
|
||||
id obj = nil;
|
||||
|
||||
[string appendString: @"<?xml version=\"1.0\""];
|
||||
if(_standalone == YES)
|
||||
{
|
||||
[string appendString: @" standalone=\"yes\""];
|
||||
}
|
||||
[string appendString: @"?>\n"];
|
||||
|
||||
while((obj = [en nextObject]) != nil)
|
||||
{
|
||||
[string appendString: [obj XMLStringWithOptions: options]];
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSXMLDocument (NSXMLParserDelegate)
|
||||
|
@ -318,11 +292,9 @@
|
|||
qualifiedName: (NSString *)qualifiedName
|
||||
attributes: (NSDictionary *)attributeDict
|
||||
{
|
||||
NSXMLElement *lastElement = [_elementStack lastObject];
|
||||
NSXMLElement *currentElement =
|
||||
[[NSXMLElement alloc] initWithName: elementName];
|
||||
|
||||
[lastElement addChild: currentElement];
|
||||
[_elementStack addObject: currentElement];
|
||||
if (_rootElement == nil)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
{
|
||||
[_attributes release];
|
||||
[_namespaces release];
|
||||
[_children release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -104,15 +105,7 @@
|
|||
|
||||
- (void) setAttributesAsDictionary: (NSDictionary*)attributes
|
||||
{
|
||||
NSString *key = nil;
|
||||
NSEnumerator *en = [attributes keyEnumerator];
|
||||
|
||||
while((key = [en nextObject]) != nil)
|
||||
{
|
||||
NSXMLNode *attribute = [NSXMLNode attributeWithName: key
|
||||
stringValue: [attributes objectForKey: key]];
|
||||
[self addAttribute: attribute];
|
||||
}
|
||||
ASSIGN(_attributes, [attributes mutableCopy]);
|
||||
}
|
||||
|
||||
- (NSArray*) attributes
|
||||
|
@ -198,14 +191,13 @@
|
|||
- (void) setChildren: (NSArray*)children
|
||||
{
|
||||
ASSIGN(_children, [children mutableCopy]);
|
||||
// _childrenHaveMutated = YES;
|
||||
_childrenHaveMutated = YES;
|
||||
}
|
||||
|
||||
- (void) addChild: (NSXMLNode*)child
|
||||
{
|
||||
[child setParent: self];
|
||||
[_children addObject: child];
|
||||
// _childrenHaveMutated = YES;
|
||||
_childrenHaveMutated = YES;
|
||||
}
|
||||
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node
|
||||
|
|
|
@ -36,7 +36,17 @@
|
|||
* performance quite a bit. So we cache the siblings and update them when the
|
||||
* nodes are changed.
|
||||
*/
|
||||
#define GS_NSXMLNode_IVARS \
|
||||
NSMutableArray *children; \
|
||||
NSUInteger childCount; \
|
||||
NSXMLNode *previousSibling; \
|
||||
NSXMLNode *nextSibling; \
|
||||
NSUInteger options;
|
||||
|
||||
#define GSInternal NSXMLNodeInternal
|
||||
#include "GSInternal.h"
|
||||
@class NSXMLNode;
|
||||
GS_PRIVATE_INTERNAL(NSXMLNode)
|
||||
|
||||
#import "NSXMLPrivate.h"
|
||||
|
||||
|
@ -201,17 +211,17 @@
|
|||
|
||||
- (NSXMLNode*) childAtIndex: (NSUInteger)index
|
||||
{
|
||||
return [_children objectAtIndex: index];
|
||||
return [internal->children objectAtIndex: index];
|
||||
}
|
||||
|
||||
- (NSUInteger) childCount
|
||||
{
|
||||
return _childCount;
|
||||
return internal->childCount;
|
||||
}
|
||||
|
||||
- (NSArray*)children
|
||||
{
|
||||
return _children;
|
||||
return internal->children;
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
|
@ -222,8 +232,8 @@
|
|||
- (void) dealloc
|
||||
{
|
||||
[self detach];
|
||||
[_children release];
|
||||
[_URI release];
|
||||
[internal->children release];
|
||||
GS_DESTROY_INTERNAL(NSXMLNode);
|
||||
[_objectValue release];
|
||||
[_stringValue release];
|
||||
[super dealloc];
|
||||
|
@ -262,9 +272,7 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
// GS_CREATE_INTERNAL(NSXMLNode)
|
||||
_children = [[NSMutableArray alloc] initWithCapacity: 10];
|
||||
_childCount = 0;
|
||||
GS_CREATE_INTERNAL(NSXMLNode)
|
||||
|
||||
/*
|
||||
* We find the correct subclass for specific node kinds:
|
||||
|
@ -317,8 +325,8 @@
|
|||
*/
|
||||
|
||||
_kind = kind;
|
||||
_options = theOptions;
|
||||
_children = [NSMutableArray new];
|
||||
internal->options = theOptions;
|
||||
internal->children = [NSMutableArray new];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -356,14 +364,14 @@
|
|||
NSXMLNode *candidate = nil;
|
||||
|
||||
/* Node walking is a depth-first thingy. Hence, we consider children first: */
|
||||
if (0 != _childCount)
|
||||
if (0 != internal->childCount)
|
||||
{
|
||||
NSUInteger theIndex = 0;
|
||||
if (NO == forward)
|
||||
{
|
||||
theIndex = (_childCount) - 1;
|
||||
theIndex = (internal->childCount) - 1;
|
||||
}
|
||||
candidate = [_children objectAtIndex: theIndex];
|
||||
candidate = [internal->children objectAtIndex: theIndex];
|
||||
}
|
||||
|
||||
/* If there are no children, we move on to siblings: */
|
||||
|
@ -371,11 +379,11 @@
|
|||
{
|
||||
if (forward)
|
||||
{
|
||||
candidate = _nextSibling;
|
||||
candidate = internal->nextSibling;
|
||||
}
|
||||
else
|
||||
{
|
||||
candidate = _previousSibling;
|
||||
candidate = internal->previousSibling;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -417,7 +425,7 @@
|
|||
|
||||
- (NSXMLNode*) nextSibling
|
||||
{
|
||||
return _nextSibling;
|
||||
return internal->nextSibling;
|
||||
}
|
||||
|
||||
- (id) objectValue
|
||||
|
@ -442,7 +450,7 @@
|
|||
|
||||
- (NSXMLNode*) previousSibling
|
||||
{
|
||||
return _previousSibling;
|
||||
return internal->previousSibling;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue