73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
- (instancetype)initWithSerialization: (OFXMLElement *)element
{
self = [super of_init];
@try {
void *pool = objc_autoreleasePoolPush();
if (![[element name] isEqual: [self className]] ||
![[element namespace] isEqual: OF_SERIALIZATION_NS])
@throw [OFInvalidArgumentException exception];
_name = [[[element attributeForName: @"name"]
stringValue] copy];
_namespace = [[[element attributeForName: @"namespace"]
stringValue] copy];
_stringValue = [[[element attributeForName: @"stringValue"]
stringValue] copy];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
|
|
|
|
<
|
|
|
|
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
- (instancetype)initWithSerialization: (OFXMLElement *)element
{
self = [super of_init];
@try {
void *pool = objc_autoreleasePoolPush();
if (![element.name isEqual: self.className] ||
![element.namespace isEqual: OF_SERIALIZATION_NS])
@throw [OFInvalidArgumentException exception];
_name = [[element attributeForName: @"name"].stringValue copy];
_namespace = [[element attributeForName: @"namespace"]
.stringValue copy];
_stringValue = [[element attributeForName: @"stringValue"]
.stringValue copy];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
|
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
- (uint32_t)hash
{
uint32_t hash;
OF_HASH_INIT(hash);
OF_HASH_ADD_HASH(hash, [_name hash]);
OF_HASH_ADD_HASH(hash, [_namespace hash]);
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];
[element addAttributeWithName: @"name"
stringValue: _name];
if (_namespace != nil)
[element addAttributeWithName: @"namespace"
|
|
|
|
|
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
- (uint32_t)hash
{
uint32_t hash;
OF_HASH_INIT(hash);
OF_HASH_ADD_HASH(hash, _name.hash);
OF_HASH_ADD_HASH(hash, _namespace.hash);
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];
[element addAttributeWithName: @"name"
stringValue: _name];
if (_namespace != nil)
[element addAttributeWithName: @"namespace"
|