ObjFW  Diff

Differences From Artifact [eb3bef8a08]:

To Artifact [62c36464cb]:


1
2

3
4
5
6
7
8
9
1

2
3
4
5
6
7
8
9

-
+







/*
 * Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
29
30
31
32
33
34
35
36

37
38
39







40
41
42
43
44
45
46
29
30
31
32
33
34
35

36
37
38

39
40
41
42
43
44
45
46
47
48
49
50
51
52







-
+


-
+
+
+
+
+
+
+








#import "unicode.h"

static struct {
	Class isa;
} placeholder;

@interface OFMutableStringPlaceholder: OFMutableString
@interface OFPlaceholderMutableString: OFMutableString
@end

@implementation OFMutableStringPlaceholder
@implementation OFPlaceholderMutableString
#ifdef __clang__
/* We intentionally don't call into super, so silence the warning. */
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunknown-pragmas"
# pragma clang diagnostic ignored "-Wobjc-designated-initializers"
#endif
- (instancetype)init
{
	return (id)[[OFMutableUTF8String alloc] init];
}

- (instancetype)initWithUTF8String: (const char *)UTF8String
{
170
171
172
173
174
175
176
177

178
179

180
181
182

183
184
185
186

187
188
189

190
191
192
193
194

195
196
197
198
199

200
201

202
203
204

205
206
207
208
209
210
211
212
213
214
215
216
217
218

219

220
221
222
223
224
225
226
176
177
178
179
180
181
182

183
184

185
186
187

188
189
190
191

192
193
194

195





196





197


198



199








200
201
202
203
204
205
206

207
208
209
210
211
212
213
214







-
+

-
+


-
+



-
+


-
+
-
-
-
-
-
+
-
-
-
-
-
+
-
-
+
-
-
-
+
-
-
-
-
-
-
-
-






+
-
+







{
	return (id)[[OFMutableUTF8String alloc]
	    initWithContentsOfFile: path
			  encoding: encoding];
}
#endif

- (instancetype)initWithContentsOfURI: (OFURI *)URI
- (instancetype)initWithContentsOfIRI: (OFIRI *)IRI
{
	return (id)[[OFMutableUTF8String alloc] initWithContentsOfURI: URI];
	return (id)[[OFMutableUTF8String alloc] initWithContentsOfIRI: IRI];
}

- (instancetype)initWithContentsOfURI: (OFURI *)URI
- (instancetype)initWithContentsOfIRI: (OFIRI *)IRI
			     encoding: (OFStringEncoding)encoding
{
	return (id)[[OFMutableUTF8String alloc]
	    initWithContentsOfURI: URI
	    initWithContentsOfIRI: IRI
			 encoding: encoding];
}

#ifdef __clang__
- (instancetype)initWithSerialization: (OFXMLElement *)element
{
	return (id)[[OFMutableUTF8String alloc] initWithSerialization: element];
}

# pragma clang diagnostic pop
- (instancetype)retain
{
	return self;
}

#endif
- (instancetype)autorelease
{

	return self;
}

OF_SINGLETON_METHODS
- (void)release
{
}

- (void)dealloc
{
	OF_DEALLOC_UNSUPPORTED
}
@end

@implementation OFMutableString
+ (void)initialize
{
	if (self == [OFMutableString class])
		object_setClass((id)&placeholder,
		placeholder.isa = [OFMutableStringPlaceholder class];
		    [OFPlaceholderMutableString class]);
}

+ (instancetype)alloc
{
	if (self == [OFMutableString class])
		return (id)&placeholder;