@@ -54,12 +54,12 @@ OFXMLElement *_element; } @end @implementation OFXMLElement_OFXMLElementBuilderDelegate -- (void)elementBuilder: (OFXMLElementBuilder*)builder - didBuildElement: (OFXMLElement*)element +- (void)elementBuilder: (OFXMLElementBuilder *)builder + didBuildElement: (OFXMLElement *)element { if (_element == nil) _element = [element retain]; } @@ -81,50 +81,50 @@ charactersClass = [OFXMLCharacters class]; CDATAClass = [OFXMLCDATA class]; } } -+ (instancetype)elementWithName: (OFString*)name ++ (instancetype)elementWithName: (OFString *)name { return [[[self alloc] initWithName: name] autorelease]; } -+ (instancetype)elementWithName: (OFString*)name - stringValue: (OFString*)stringValue ++ (instancetype)elementWithName: (OFString *)name + stringValue: (OFString *)stringValue { return [[[self alloc] initWithName: name stringValue: stringValue] autorelease]; } -+ (instancetype)elementWithName: (OFString*)name - namespace: (OFString*)ns ++ (instancetype)elementWithName: (OFString *)name + namespace: (OFString *)ns { return [[[self alloc] initWithName: name namespace: ns] autorelease]; } -+ (instancetype)elementWithName: (OFString*)name - namespace: (OFString*)ns - stringValue: (OFString*)stringValue ++ (instancetype)elementWithName: (OFString *)name + namespace: (OFString *)ns + stringValue: (OFString *)stringValue { return [[[self alloc] initWithName: name namespace: ns stringValue: stringValue] autorelease]; } -+ (instancetype)elementWithElement: (OFXMLElement*)element ++ (instancetype)elementWithElement: (OFXMLElement *)element { return [[[self alloc] initWithElement: element] autorelease]; } -+ (instancetype)elementWithXMLString: (OFString*)string ++ (instancetype)elementWithXMLString: (OFString *)string { return [[[self alloc] initWithXMLString: string] autorelease]; } #ifdef OF_HAVE_FILES -+ (instancetype)elementWithFile: (OFString*)path ++ (instancetype)elementWithFile: (OFString *)path { return [[[self alloc] initWithFile: path] autorelease]; } #endif @@ -131,36 +131,36 @@ - init { OF_INVALID_INIT_METHOD } -- initWithName: (OFString*)name +- initWithName: (OFString *)name { return [self initWithName: name namespace: nil stringValue: nil]; } -- initWithName: (OFString*)name - stringValue: (OFString*)stringValue +- initWithName: (OFString *)name + stringValue: (OFString *)stringValue { return [self initWithName: name namespace: nil stringValue: stringValue]; } -- initWithName: (OFString*)name - namespace: (OFString*)namespace +- initWithName: (OFString *)name + namespace: (OFString *)namespace { return [self initWithName: name namespace: namespace stringValue: nil]; } -- initWithName: (OFString*)name - namespace: (OFString*)namespace - stringValue: (OFString*)stringValue +- initWithName: (OFString *)name + namespace: (OFString *)namespace + stringValue: (OFString *)stringValue { self = [super init]; @try { if (name == nil) @@ -182,11 +182,11 @@ } return self; } -- initWithElement: (OFXMLElement*)element +- initWithElement: (OFXMLElement *)element { self = [super init]; @try { if (element == nil) @@ -204,11 +204,11 @@ } return self; } -- initWithXMLString: (OFString*)string +- initWithXMLString: (OFString *)string { void *pool; OFXMLParser *parser; OFXMLElementBuilder *builder; OFXMLElement_OFXMLElementBuilderDelegate *delegate; @@ -239,11 +239,11 @@ return self; } #ifdef OF_HAVE_FILES -- initWithFile: (OFString*)path +- initWithFile: (OFString *)path { void *pool; OFXMLParser *parser; OFXMLElementBuilder *builder; OFXMLElement_OFXMLElementBuilderDelegate *delegate; @@ -271,11 +271,11 @@ return self; } #endif -- initWithSerialization: (OFXMLElement*)element +- initWithSerialization: (OFXMLElement *)element { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -370,38 +370,38 @@ [_children release]; [super dealloc]; } -- (OFArray*)attributes +- (OFArray *)attributes { return [[_attributes copy] autorelease]; } -- (void)setChildren: (OFArray*)children +- (void)setChildren: (OFArray *)children { OFArray *old = _children; _children = [children copy]; [old release]; } -- (OFArray*)children +- (OFArray *)children { return [[_children copy] autorelease]; } -- (void)setStringValue: (OFString*)stringValue +- (void)setStringValue: (OFString *)stringValue { void *pool = objc_autoreleasePoolPush(); [self setChildren: [OFArray arrayWithObject: [OFXMLCharacters charactersWithString: stringValue]]]; objc_autoreleasePoolPop(pool); } -- (OFString*)stringValue +- (OFString *)stringValue { OFMutableString *ret; if ([_children count] == 0) return @""; @@ -419,14 +419,14 @@ [ret makeImmutable]; return ret; } -- (OFString*)OF_XMLStringWithParent: (OFXMLElement*)parent - namespaces: (OFDictionary*)allNamespaces - indentation: (unsigned int)indentation - level: (unsigned int)level +- (OFString *)OF_XMLStringWithParent: (OFXMLElement *)parent + namespaces: (OFDictionary *)allNamespaces + indentation: (unsigned int)indentation + level: (unsigned int)level { void *pool; char *cString; size_t length, i; OFString *prefix, *parentPrefix; @@ -435,11 +435,11 @@ pool = objc_autoreleasePoolPush(); parentPrefix = [allNamespaces objectForKey: (parent != nil && parent->_namespace != nil - ? parent->_namespace : (OFString*)@"")]; + ? parent->_namespace : (OFString *)@"")]; /* Add the namespaces of the current element */ if (allNamespaces != nil) { OFEnumerator *keyEnumerator = [_namespaces keyEnumerator]; OFEnumerator *objectEnumerator = [_namespaces objectEnumerator]; @@ -456,11 +456,11 @@ allNamespaces = tmp; } else allNamespaces = _namespaces; prefix = [allNamespaces objectForKey: - (_namespace != nil ? _namespace : (OFString*)@"")]; + (_namespace != nil ? _namespace : (OFString *)@"")]; if (parent != nil && parent->_namespace != nil && parentPrefix == nil) defaultNS = parent->_namespace; else if (parent != nil && parent->_defaultNamespace != nil) defaultNS = parent->_defaultNamespace; @@ -587,11 +587,11 @@ if (ind) [tmp addItem: "\n"]; if ([child isKindOfClass: [OFXMLElement class]]) - childString = [(OFXMLElement*)child + childString = [(OFXMLElement *)child OF_XMLStringWithParent: self namespaces: allNamespaces indentation: ind level: level + 1]; else @@ -661,36 +661,36 @@ [self freeMemory: cString]; } return ret; } -- (OFString*)XMLString +- (OFString *)XMLString { return [self OF_XMLStringWithParent: nil namespaces: nil indentation: 0 level: 0]; } -- (OFString*)XMLStringWithIndentation: (unsigned int)indentation +- (OFString *)XMLStringWithIndentation: (unsigned int)indentation { return [self OF_XMLStringWithParent: nil namespaces: nil indentation: indentation level: 0]; } -- (OFString*)XMLStringWithIndentation: (unsigned int)indentation - level: (unsigned int)level +- (OFString *)XMLStringWithIndentation: (unsigned int)indentation + level: (unsigned int)level { return [self OF_XMLStringWithParent: nil namespaces: nil indentation: indentation level: level]; } -- (OFXMLElement*)XMLElementBySerializing +- (OFXMLElement *)XMLElementBySerializing { void *pool = objc_autoreleasePoolPush(); OFXMLElement *element; element = [OFXMLElement elementWithName: [self className] @@ -754,31 +754,31 @@ objc_autoreleasePoolPop(pool); return [element autorelease]; } -- (void)addAttribute: (OFXMLAttribute*)attribute +- (void)addAttribute: (OFXMLAttribute *)attribute { if (_attributes == nil) _attributes = [[OFMutableArray alloc] init]; if ([self attributeForName: attribute->_name namespace: attribute->_namespace] == nil) [_attributes addObject: attribute]; } -- (void)addAttributeWithName: (OFString*)name - stringValue: (OFString*)stringValue +- (void)addAttributeWithName: (OFString *)name + stringValue: (OFString *)stringValue { [self addAttributeWithName: name namespace: nil stringValue: stringValue]; } -- (void)addAttributeWithName: (OFString*)name - namespace: (OFString*)namespace - stringValue: (OFString*)stringValue +- (void)addAttributeWithName: (OFString *)name + namespace: (OFString *)namespace + stringValue: (OFString *)stringValue { void *pool = objc_autoreleasePoolPush(); [self addAttribute: [OFXMLAttribute attributeWithName: name namespace: namespace @@ -785,22 +785,22 @@ stringValue: stringValue]]; objc_autoreleasePoolPop(pool); } -- (OFXMLAttribute*)attributeForName: (OFString*)attributeName +- (OFXMLAttribute *)attributeForName: (OFString *)attributeName { for (OFXMLAttribute *attribute in _attributes) if (attribute->_namespace == nil && [attribute->_name isEqual: attributeName]) return [[attribute retain] autorelease]; return nil; } -- (OFXMLAttribute*)attributeForName: (OFString*)attributeName - namespace: (OFString*)attributeNS +- (OFXMLAttribute *)attributeForName: (OFString *)attributeName + namespace: (OFString *)attributeNS { if (attributeNS == nil) return [self attributeForName: attributeName]; for (OFXMLAttribute *attribute in _attributes) @@ -809,11 +809,11 @@ return [[attribute retain] autorelease]; return nil; } -- (void)removeAttributeForName: (OFString*)attributeName +- (void)removeAttributeForName: (OFString *)attributeName { OFXMLAttribute *const *objects = [_attributes objects]; size_t count = [_attributes count]; for (size_t i = 0; i < count; i++) { @@ -824,12 +824,12 @@ return; } } } -- (void)removeAttributeForName: (OFString*)attributeName - namespace: (OFString*)attributeNS +- (void)removeAttributeForName: (OFString *)attributeName + namespace: (OFString *)attributeNS { OFXMLAttribute *const *objects; size_t count; if (attributeNS == nil) { @@ -847,12 +847,12 @@ return; } } } -- (void)setPrefix: (OFString*)prefix - forNamespace: (OFString*)namespace +- (void)setPrefix: (OFString *)prefix + forNamespace: (OFString *)namespace { if ([prefix length] == 0) @throw [OFInvalidArgumentException exception]; if (namespace == nil) namespace = @""; @@ -859,21 +859,21 @@ [_namespaces setObject: prefix forKey: namespace]; } -- (void)bindPrefix: (OFString*)prefix - forNamespace: (OFString*)namespace +- (void)bindPrefix: (OFString *)prefix + forNamespace: (OFString *)namespace { [self setPrefix: prefix forNamespace: namespace]; [self addAttributeWithName: prefix namespace: @"http://www.w3.org/2000/xmlns/" stringValue: namespace]; } -- (void)addChild: (OFXMLNode*)child +- (void)addChild: (OFXMLNode *)child { if ([child isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; if (_children == nil) @@ -880,11 +880,11 @@ _children = [[OFMutableArray alloc] init]; [_children addObject: child]; } -- (void)insertChild: (OFXMLNode*)child +- (void)insertChild: (OFXMLNode *)child atIndex: (size_t)index { if ([child isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; @@ -893,11 +893,11 @@ [_children insertObject: child atIndex: index]; } -- (void)insertChildren: (OFArray*)children +- (void)insertChildren: (OFArray *)children atIndex: (size_t)index { for (OFXMLNode *node in children) if ([node isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; @@ -904,11 +904,11 @@ [_children insertObjectsFromArray: children atIndex: index]; } -- (void)removeChild: (OFXMLNode*)child +- (void)removeChild: (OFXMLNode *)child { if ([child isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; [_children removeObject: child]; @@ -917,12 +917,12 @@ - (void)removeChildAtIndex: (size_t)index { [_children removeObjectAtIndex: index]; } -- (void)replaceChild: (OFXMLNode*)child - withNode: (OFXMLNode*)node +- (void)replaceChild: (OFXMLNode *)child + withNode: (OFXMLNode *)node { if ([node isKindOfClass: [OFXMLAttribute class]] || [child isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; @@ -929,51 +929,51 @@ [_children replaceObject: child withObject: node]; } - (void)replaceChildAtIndex: (size_t)index - withNode: (OFXMLNode*)node + withNode: (OFXMLNode *)node { if ([node isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; [_children replaceObjectAtIndex: index withObject: node]; } -- (OFXMLElement*)elementForName: (OFString*)elementName +- (OFXMLElement *)elementForName: (OFString *)elementName { return [[self elementsForName: elementName] firstObject]; } -- (OFXMLElement*)elementForName: (OFString*)elementName - namespace: (OFString*)elementNS +- (OFXMLElement *)elementForName: (OFString *)elementName + namespace: (OFString *)elementNS { return [[self elementsForName: elementName namespace: elementNS] firstObject]; } -- (OFArray*)elements +- (OFArray *)elements { - OFMutableArray OF_GENERIC(OFXMLElement*) *ret = [OFMutableArray array]; + OFMutableArray OF_GENERIC(OFXMLElement *) *ret = [OFMutableArray array]; for (OFXMLNode *child in _children) if ([child isKindOfClass: [OFXMLElement class]]) - [ret addObject: (OFXMLElement*)child]; + [ret addObject: (OFXMLElement *)child]; [ret makeImmutable]; return ret; } -- (OFArray*)elementsForName: (OFString*)elementName +- (OFArray *)elementsForName: (OFString *)elementName { - OFMutableArray OF_GENERIC(OFXMLElement*) *ret = [OFMutableArray array]; + OFMutableArray OF_GENERIC(OFXMLElement *) *ret = [OFMutableArray array]; for (OFXMLNode *child in _children) { if ([child isKindOfClass: [OFXMLElement class]]) { - OFXMLElement *element = (OFXMLElement*)child; + OFXMLElement *element = (OFXMLElement *)child; if (element->_namespace == nil && [element->_name isEqual: elementName]) [ret addObject: element]; } @@ -982,17 +982,17 @@ [ret makeImmutable]; return ret; } -- (OFArray*)elementsForNamespace: (OFString*)elementNS +- (OFArray *)elementsForNamespace: (OFString *)elementNS { - OFMutableArray OF_GENERIC(OFXMLElement*) *ret = [OFMutableArray array]; + OFMutableArray OF_GENERIC(OFXMLElement *) *ret = [OFMutableArray array]; for (OFXMLNode *child in _children) { if ([child isKindOfClass: [OFXMLElement class]]) { - OFXMLElement *element = (OFXMLElement*)child; + OFXMLElement *element = (OFXMLElement *)child; if (element->_name != nil && [element->_namespace isEqual: elementNS]) [ret addObject: element]; } @@ -1001,23 +1001,23 @@ [ret makeImmutable]; return ret; } -- (OFArray*)elementsForName: (OFString*)elementName - namespace: (OFString*)elementNS +- (OFArray *)elementsForName: (OFString *)elementName + namespace: (OFString *)elementNS { - OFMutableArray OF_GENERIC(OFXMLElement*) *ret; + OFMutableArray OF_GENERIC(OFXMLElement *) *ret; if (elementNS == nil) return [self elementsForName: elementName]; ret = [OFMutableArray array]; for (OFXMLNode *child in _children) { if ([child isKindOfClass: [OFXMLElement class]]) { - OFXMLElement *element = (OFXMLElement*)child; + OFXMLElement *element = (OFXMLElement *)child; if ([element->_namespace isEqual: elementNS] && [element->_name isEqual: elementName]) [ret addObject: element]; }