ObjFW  Diff

Differences From Artifact [e59c8082fb]:

To Artifact [4e57f733e3]:


64
65
66
67
68
69
70


71
72
73
74
75
76
77
78
+ elementWithComment: (OFString*)comment
{
	return [[[self alloc] initWithComment: comment] autorelease];
}

- init
{


	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithName: (OFString*)name_
{
	return [self initWithName: name_
			namespace: nil







>
>
|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
+ elementWithComment: (OFString*)comment
{
	return [[[self alloc] initWithComment: comment] autorelease];
}

- init
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException newWithClass: c
					      selector: _cmd];
}

- initWithName: (OFString*)name_
{
	return [self initWithName: name_
			namespace: nil
97
98
99
100
101
102
103

104
105
106
107


108
109
110
111
112
113
114

115
116




117
118
119
120
121
122
123
124

125




126
127
128
129
130
131
132
133

134




135
136
137
138
139
140
141
142

143




144
145
146
147
148
149
150

- initWithName: (OFString*)name_
     namespace: (OFString*)ns_
   stringValue: (OFString*)stringval
{
	self = [super init];


	name = [name_ copy];
	ns = [ns_ copy];

	if (stringval != nil) {


		OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];;
		[self addChild:
		    [OFXMLElement elementWithCharacters: stringval]];
		[pool release];
	}

	namespaces = [[OFMutableDictionary alloc] initWithKeysAndObjects:

	    @"http://www.w3.org/XML/1998/namespace", @"xml",
	    @"http://www.w3.org/2000/xmlns/", @"xmlns", nil];





	return self;
}

- initWithCharacters: (OFString*)chars
{
	self = [super init];


	characters = [chars copy];





	return self;
}

- initWithCDATA: (OFString*)cdata_
{
	self = [super init];


	cdata = [cdata_ copy];





	return self;
}

- initWithComment: (OFString*)comment_
{
	self = [super init];


	comment = [comment_ copy];





	return self;
}

- (OFString*)name
{
	return [[name copy] autorelease];







>
|
|

|
>
>
|
|
|
|
|

|
>
|
|
>
>
>
>








>
|
>
>
>
>








>
|
>
>
>
>








>
|
>
>
>
>







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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
171
172
173
174
175

- initWithName: (OFString*)name_
     namespace: (OFString*)ns_
   stringValue: (OFString*)stringval
{
	self = [super init];

	@try {
		name = [name_ copy];
		ns = [ns_ copy];

		if (stringval != nil) {
			OFAutoreleasePool *pool;

			pool = [[OFAutoreleasePool alloc] init];;
			[self addChild:
			    [OFXMLElement elementWithCharacters: stringval]];
			[pool release];
		}

		namespaces = [[OFMutableDictionary alloc]
		    initWithKeysAndObjects:
		    @"http://www.w3.org/XML/1998/namespace", @"xml",
		    @"http://www.w3.org/2000/xmlns/", @"xmlns", nil];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- initWithCharacters: (OFString*)chars
{
	self = [super init];

	@try {
		characters = [chars copy];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- initWithCDATA: (OFString*)cdata_
{
	self = [super init];

	@try {
		cdata = [cdata_ copy];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- initWithComment: (OFString*)comment_
{
	self = [super init];

	@try {
		comment = [comment_ copy];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- (OFString*)name
{
	return [[name copy] autorelease];
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
		    (ns != nil ? ns : (OFString*)@"")]) == nil)
			@throw [OFUnboundNamespaceException newWithClass: isa
							       namespace: ns];
		len += [prefix cStringLength] + 1;
		@try {
			str_c = [self resizeMemory: str_c
					    toSize: len];
		} @catch (OFException *e) {
			[self freeMemory: str_c];
			@throw e;
		}

		memcpy(str_c + i, [prefix cString],
		    [prefix cStringLength]);
		i += [prefix cStringLength];







|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
		    (ns != nil ? ns : (OFString*)@"")]) == nil)
			@throw [OFUnboundNamespaceException newWithClass: isa
							       namespace: ns];
		len += [prefix cStringLength] + 1;
		@try {
			str_c = [self resizeMemory: str_c
					    toSize: len];
		} @catch (id e) {
			[self freeMemory: str_c];
			@throw e;
		}

		memcpy(str_c + i, [prefix cString],
		    [prefix cStringLength]);
		i += [prefix cStringLength];
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
		len += [attr_name cStringLength] +
		    (attr_prefix != nil ? [attr_prefix cStringLength] + 1 : 0) +
		    [tmp cStringLength] + 4;

		@try {
			str_c = [self resizeMemory: str_c
					    toSize: len];
		} @catch (OFException *e) {
			[self freeMemory: str_c];
			@throw e;
		}

		str_c[i++] = ' ';
		if (attr_prefix != nil) {
			memcpy(str_c + i, [attr_prefix cString],







|







288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
		len += [attr_name cStringLength] +
		    (attr_prefix != nil ? [attr_prefix cStringLength] + 1 : 0) +
		    [tmp cStringLength] + 4;

		@try {
			str_c = [self resizeMemory: str_c
					    toSize: len];
		} @catch (id e) {
			[self freeMemory: str_c];
			@throw e;
		}

		str_c[i++] = ' ';
		if (attr_prefix != nil) {
			memcpy(str_c + i, [attr_prefix cString],
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
			    _stringWithParentNamespaces: all_namespaces
			    parentDefaultNamespace: defaultNamespace] cString]);

		len += [tmp cStringLength] + [name cStringLength] + 2;
		@try {
			str_c = [self resizeMemory: str_c
					    toSize: len];
		} @catch (OFException *e) {
			[self freeMemory: str_c];
			@throw e;
		}

		str_c[i++] = '>';
		memcpy(str_c + i, [tmp cString], [tmp cStringLength]);
		i += [tmp cStringLength];
		str_c[i++] = '<';
		str_c[i++] = '/';
		if (prefix != nil) {
			len += [prefix cStringLength] + 1;
			@try {
				str_c = [self resizeMemory: str_c
						    toSize: len];
			} @catch (OFException *e) {
				[self freeMemory: str_c];
				@throw e;
			}

			memcpy(str_c + i, [prefix cString],
			    [prefix cStringLength]);
			i += [prefix cStringLength];







|














|







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
			    _stringWithParentNamespaces: all_namespaces
			    parentDefaultNamespace: defaultNamespace] cString]);

		len += [tmp cStringLength] + [name cStringLength] + 2;
		@try {
			str_c = [self resizeMemory: str_c
					    toSize: len];
		} @catch (id e) {
			[self freeMemory: str_c];
			@throw e;
		}

		str_c[i++] = '>';
		memcpy(str_c + i, [tmp cString], [tmp cStringLength]);
		i += [tmp cStringLength];
		str_c[i++] = '<';
		str_c[i++] = '/';
		if (prefix != nil) {
			len += [prefix cStringLength] + 1;
			@try {
				str_c = [self resizeMemory: str_c
						    toSize: len];
			} @catch (id e) {
				[self freeMemory: str_c];
				@throw e;
			}

			memcpy(str_c + i, [prefix cString],
			    [prefix cStringLength]);
			i += [prefix cStringLength];