@@ -23,21 +23,23 @@ #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" @implementation OFXMLComment -+ (instancetype)commentWithString: (OFString *)string +@synthesize text = _text; + ++ (instancetype)commentWithText: (OFString *)text { - return [[[self alloc] initWithString: string] autorelease]; + return [[[self alloc] initWithText: text] autorelease]; } -- (instancetype)initWithString: (OFString *)string +- (instancetype)initWithText: (OFString *)text { self = [super of_init]; @try { - _comment = [string copy]; + _text = [text copy]; } @catch (id e) { [self release]; @throw e; } @@ -53,11 +55,11 @@ if (![element.name isEqual: self.className] || ![element.namespace isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException exception]; - _comment = [element.stringValue copy]; + _text = [element.stringValue copy]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; @@ -66,11 +68,11 @@ return self; } - (void)dealloc { - [_comment release]; + [_text release]; [super dealloc]; } - (bool)isEqual: (id)object @@ -83,31 +85,31 @@ if (![object isKindOfClass: [OFXMLComment class]]) return false; comment = object; - return ([comment->_comment isEqual: _comment]); + return ([comment->_text isEqual: _text]); } - (unsigned long)hash { - return _comment.hash; + return _text.hash; } - (OFString *)stringValue { return @""; } - (OFString *)XMLString { - return [OFString stringWithFormat: @"", _comment]; + return [OFString stringWithFormat: @"", _text]; } - (OFString *)XMLStringWithIndentation: (unsigned int)indentation { - return [OFString stringWithFormat: @"", _comment]; + return [OFString stringWithFormat: @"", _text]; } - (OFString *)XMLStringWithIndentation: (unsigned int)indentation level: (unsigned int)level { @@ -118,28 +120,27 @@ memset(whitespaces, ' ', level * indentation); whitespaces[level * indentation] = 0; @try { ret = [OFString stringWithFormat: @"%s", - whitespaces, - _comment]; + whitespaces, _text]; } @finally { free(whitespaces); } } else - ret = [OFString stringWithFormat: @"", _comment]; + ret = [OFString stringWithFormat: @"", _text]; return ret; } - (OFString *)description { - return [OFString stringWithFormat: @"", _comment]; + return [OFString stringWithFormat: @"", _text]; } - (OFXMLElement *)XMLElementBySerializing { return [OFXMLElement elementWithName: self.className namespace: OF_SERIALIZATION_NS - stringValue: _comment]; + stringValue: _text]; } @end