Differences From Artifact [c87ea13e1e]:
- File
src/OFXMLAttribute.m
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 4061) [annotate] [blame] [check-ins using]
To Artifact [08b89a1a1d]:
- File
src/OFXMLAttribute.m
— part of check-in
[4af49a13c3]
at
2017-05-07 20:10:13
on branch trunk
— Small code style change
Casts are now written like types in variable declarations. (user: js, size: 4076) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
22 23 24 25 26 27 28 | #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" @implementation OFXMLAttribute @synthesize name = _name, namespace = _namespace; | | | | | | | | | | | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" @implementation OFXMLAttribute @synthesize name = _name, namespace = _namespace; + (instancetype)attributeWithName: (OFString *)name namespace: (OFString *)namespace stringValue: (OFString *)stringValue { return [[[self alloc] initWithName: name namespace: namespace 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 *)namespace stringValue: (OFString *)stringValue { self = [super init]; @try { _name = [name copy]; _namespace = [namespace copy]; _stringValue = [stringValue copy]; } @catch (id e) { [self release]; @throw e; } return self; } - initWithSerialization: (OFXMLElement *)element { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); if (![[element name] isEqual: [self className]] || |
︙ | ︙ | |||
100 101 102 103 104 105 106 | [_name release]; [_namespace release]; [_stringValue release]; [super dealloc]; } | | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | [_name release]; [_namespace release]; [_stringValue release]; [super dealloc]; } - (OFString *)stringValue { return [[_stringValue copy] autorelease]; } - (void)setStringValue: (OFString *)stringValue { OFString *old = _stringValue; _stringValue = [stringValue copy]; [old release]; } - (bool)isEqual: (id)object |
︙ | ︙ | |||
147 148 149 150 151 152 153 | OF_HASH_ADD_HASH(hash, [_stringValue hash]); OF_HASH_FINALIZE(hash); return hash; } | | | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | OF_HASH_ADD_HASH(hash, [_stringValue hash]); OF_HASH_FINALIZE(hash); return hash; } - (OFXMLElement *)XMLElementBySerializing { void *pool = objc_autoreleasePoolPush(); OFXMLElement *element; element = [OFXMLElement elementWithName: [self className] namespace: OF_SERIALIZATION_NS]; |
︙ | ︙ | |||
172 173 174 175 176 177 178 | [element retain]; objc_autoreleasePoolPop(pool); return [element autorelease]; } | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | [element retain]; objc_autoreleasePoolPop(pool); return [element autorelease]; } - (OFString *)description { return [OFString stringWithFormat: @"<OFXMLAttribute: name=%@, " @"namespace=%@, stringValue=%@>", _name, _namespace, _stringValue]; } @end |