Index: src/OFXMLAttribute.h ================================================================== --- src/OFXMLAttribute.h +++ src/OFXMLAttribute.h @@ -35,31 +35,51 @@ @property (readonly, copy) OFString *stringValue; #endif /*! * @brief Creates a new XML attribute. + * + * @param name The name of the attribute + * @param stringValue The string value of the attribute + * @return A new autoreleased OFXMLAttribute with the specified parameters + */ ++ (instancetype)attributeWithName: (OFString*)name + stringValue: (OFString*)stringValue; + +/*! + * @brief Creates a new XML attribute. * * @param name The name of the attribute * @param ns The namespace of the attribute - * @param value The string value of the attribute + * @param stringValue The string value of the attribute * @return A new autoreleased OFXMLAttribute with the specified parameters */ + (instancetype)attributeWithName: (OFString*)name namespace: (OFString*)ns - stringValue: (OFString*)value; + stringValue: (OFString*)stringValue; + +/*! + * @brief Initializes an already allocated OFXMLAttribute. + * + * @param name The name of the attribute + * @param stringValue The string value of the attribute + * @return An initialized OFXMLAttribute with the specified parameters + */ +- initWithName: (OFString*)name + stringValue: (OFString*)stringValue; /*! * @brief Initializes an already allocated OFXMLAttribute. * * @param name The name of the attribute * @param ns The namespace of the attribute - * @param value The string value of the attribute + * @param stringValue The string value of the attribute * @return An initialized OFXMLAttribute with the specified parameters */ - initWithName: (OFString*)name namespace: (OFString*)ns - stringValue: (OFString*)value; + stringValue: (OFString*)stringValue; /*! * @brief Returns the name of the attribute as an autoreleased OFString. * * @return The name of the attribute as an autoreleased OFString Index: src/OFXMLAttribute.m ================================================================== --- src/OFXMLAttribute.m +++ src/OFXMLAttribute.m @@ -27,27 +27,42 @@ #import "macros.h" @implementation OFXMLAttribute + (instancetype)attributeWithName: (OFString*)name namespace: (OFString*)ns - stringValue: (OFString*)value + stringValue: (OFString*)stringValue { return [[[self alloc] initWithName: name namespace: ns - stringValue: value] autorelease]; + stringValue: stringValue] autorelease]; +} + ++ (instancetype)attributeWithName: (OFString*)name + stringValue: (OFString*)stringValue +{ + return [[[self alloc] initWithName: name + stringValue: stringValue] autorelease]; +} + +- initWithName: (OFString*)name_ + stringValue: (OFString*)stringValue_ +{ + return [self initWithName: name_ + namespace: nil + stringValue: stringValue_]; } - initWithName: (OFString*)name_ namespace: (OFString*)ns_ - stringValue: (OFString*)value + stringValue: (OFString*)stringValue_ { self = [super init]; @try { name = [name_ copy]; ns = [ns_ copy]; - stringValue = [value copy]; + stringValue = [stringValue_ copy]; } @catch (id e) { [self release]; @throw e; }