ObjFW  Diff

Differences From Artifact [c87ea13e1e]:

To Artifact [08b89a1a1d]:


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]] ||







|
|
|






|
|





|
|






|
|
|















|







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
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







|




|







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
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];








|







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
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







|






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