ObjFW  Diff

Differences From Artifact [3da081c65e]:

To Artifact [8c8a66350c]:


61
62
63
64
65
66
67
68

69
70
71

72
73
74
75
76

77
78
79
80

81
82
83
84
85
86
87

88
89

90
91
92

93
94

95
96
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
61
62
63
64
65
66
67

68
69
70

71
72
73
74
75

76
77
78
79

80
81
82
83
84
85
86

87
88

89
90
91

92
93

94
95
96
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







-
+


-
+




-
+



-
+






-
+

-
+


-
+

-
+





-
-
+
+


-
-
+
+





-
+


-
+




-
+


-
+




-
+


-
+







 * \return A new autoreleased OFString
 */
+ string;

/**
 * Creates a new OFString from a UTF-8 encoded C string.
 *
 * \param str A UTF-8 encoded C string to initialize the OFString with
 * \param string A UTF-8 encoded C string to initialize the OFString with
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)str;
+ stringWithCString: (const char*)string;

/**
 * Creates a new OFString from a C string with the specified encoding.
 *
 * \param str A C string to initialize the OFString with
 * \param string A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)str
+ stringWithCString: (const char*)string
	   encoding: (of_string_encoding_t)encoding;

/**
 * Creates a new OFString from a C string with the specified encoding and
 * length.
 *
 * \param str A C string to initialize the OFString with
 * \param string A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \param len The length of the C string
 * \param length The length of the C string
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)str
+ stringWithCString: (const char*)string
	   encoding: (of_string_encoding_t)encoding
	     length: (size_t)len;
	     length: (size_t)length;

/**
 * Creates a new OFString from a UTF-8 encoded C string with the specified
 * length.
 *
 * \param str A UTF-8 encoded C string to initialize the OFString with
 * \param len The length of the UTF-8 encoded C string
 * \param string A UTF-8 encoded C string to initialize the OFString with
 * \param length The length of the UTF-8 encoded C string
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)str
	     length: (size_t)len;
+ stringWithCString: (const char*)string
	     length: (size_t)length;

/**
 * Creates a new OFString from a format string.
 * See printf for the format syntax.
 *
 * \param fmt A string used as format to initialize the OFString
 * \param format A string used as format to initialize the OFString
 * \return A new autoreleased OFString
 */
+ stringWithFormat: (OFString*)fmt, ...;
+ stringWithFormat: (OFString*)format, ...;

/**
 * Creates a new OFString containing the constructed specified path.
 *
 * \param first The first component of the path
 * \param firstComponent The first component of the path
 * \return A new autoreleased OFString
 */
+ stringWithPath: (OFString*)first, ...;
+ stringWithPath: (OFString*)firstComponent, ...;

/**
 * Creates a new OFString from another string.
 *
 * \param str A string to initialize the OFString with
 * \param string A string to initialize the OFString with
 * \return A new autoreleased OFString
 */
+ stringWithString: (OFString*)str;
+ stringWithString: (OFString*)string;

/**
 * Creates a new OFString with the contents of the specified UTF-8 encoded file.
 *
 * \param path The path to the file
 * \return A new autoreleased OFString
 */
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
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
227
228


229
230
231
232


233
234
235
236
237
238

239
240
241

242
243
244
245
246
247
248


249
250
251
252


253
254
255
256
257

258
259
260

261
262
263
264
265
266
267
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
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


227
228
229
230


231
232
233
234
235
236
237

238
239
240

241
242
243
244
245
246


247
248
249
250


251
252
253
254
255
256

257
258
259

260
261
262
263
264
265
266
267







-
+


-
+





-
+



-
+





-
+


-
+





-
+



-
+






-
+

-
+


-
+

-
+





-
-
+
+


-
-
+
+





-
+


-
+





-
-
+
+


-
-
+
+





-
+


-
+





-
-
+
+


-
-
+
+




-
+


-
+







+ stringWithContentsOfFile: (OFString*)path
		  encoding: (of_string_encoding_t)encoding;

/**
 * Creates a new OFString with the contents of the specified URL, assuming
 * UTF-8 encoding.
 *
 * \param url The URL to the contents for the string
 * \param URL The URL to the contents for the string
 * \return A new autoreleased OFString
 */
+ stringWithContentsOfURL: (OFURL*)url;
+ stringWithContentsOfURL: (OFURL*)URL;

/**
 * Creates a new OFString with the contents of the specified URL in the
 * specified encoding.
 *
 * \param url The URL to the contents for the string
 * \param URL The URL to the contents for the string
 * \param encoding The encoding to assume
 * \return A new autoreleased OFString
 */
+ stringWithContentsOfURL: (OFURL*)url
+ stringWithContentsOfURL: (OFURL*)URL
		 encoding: (of_string_encoding_t)encoding;

/**
 * Initializes an already allocated OFString from a UTF-8 encoded C string.
 *
 * \param str A UTF-8 encoded C string to initialize the OFString with
 * \param string A UTF-8 encoded C string to initialize the OFString with
 * \return An initialized OFString
 */
- initWithCString: (const char*)str;
- initWithCString: (const char*)string;

/**
 * Initializes an already allocated OFString from a C string with the specified
 * encoding.
 *
 * \param str A C string to initialize the OFString with
 * \param string A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \return An initialized OFString
 */
- initWithCString: (const char*)str
- initWithCString: (const char*)string
	 encoding: (of_string_encoding_t)encoding;

/**
 * Initializes an already allocated OFString from a C string with the specified
 * encoding and length.
 *
 * \param str A C string to initialize the OFString with
 * \param string A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \param len The length of the C string
 * \param length The length of the C string
 * \return An initialized OFString
 */
- initWithCString: (const char*)str
- initWithCString: (const char*)string
	 encoding: (of_string_encoding_t)encoding
	   length: (size_t)len;
	   length: (size_t)length;

/**
 * Initializes an already allocated OFString from a UTF-8 encoded C string with
 * the specified length.
 *
 * \param str A UTF-8 encoded C string to initialize the OFString with
 * \param len The length of the UTF-8 encoded C string
 * \param string A UTF-8 encoded C string to initialize the OFString with
 * \param length The length of the UTF-8 encoded C string
 * \return An initialized OFString
 */
- initWithCString: (const char*)str
	   length: (size_t)len;
- initWithCString: (const char*)string
	   length: (size_t)length;

/**
 * Initializes an already allocated OFString with a format string.
 * See printf for the format syntax.
 *
 * \param fmt A string used as format to initialize the OFString
 * \param format A string used as format to initialize the OFString
 * \return An initialized OFString
 */
- initWithFormat: (OFString*)fmt, ...;
- initWithFormat: (OFString*)format, ...;

/**
 * Initializes an already allocated OFString with a format string.
 * See printf for the format syntax.
 *
 * \param fmt A string used as format to initialize the OFString
 * \param args The arguments used in the format string
 * \param format A string used as format to initialize the OFString
 * \param arguments The arguments used in the format string
 * \return An initialized OFString
 */
- initWithFormat: (OFString*)fmt
       arguments: (va_list)args;
- initWithFormat: (OFString*)format
       arguments: (va_list)arguments;

/**
 * Initializes an already allocated OFString with the constructed specified
 * path.
 *
 * \param first The first component of the path
 * \param firstComponent The first component of the path
 * \return A new autoreleased OFString
 */
- initWithPath: (OFString*)first, ...;
- initWithPath: (OFString*)firstComponent, ...;

/**
 * Initializes an already allocated OFString with the constructed specified
 * path.
 *
 * \param first The first component of the path
 * \param args A va_list with the other components of the path
 * \param firstComponent The first component of the path
 * \param arguments A va_list with the other components of the path
 * \return A new autoreleased OFString
 */
- initWithPath: (OFString*)first
     arguments: (va_list)args;
- initWithPath: (OFString*)firstComponent
     arguments: (va_list)arguments;

/**
 * Initializes an already allocated OFString with another string.
 *
 * \param str A string to initialize the OFString with
 * \param string A string to initialize the OFString with
 * \return An initialized OFString
 */
- initWithString: (OFString*)str;
- initWithString: (OFString*)string;

/**
 * Initializes an already allocated OFString with the contents of the specified
 * file in the specified encoding.
 *
 * \param path The path to the file
 * \return An initialized OFString
279
280
281
282
283
284
285
286

287
288
289

290
291
292
293
294
295

296
297
298
299

300
301
302
303
304
305
306
279
280
281
282
283
284
285

286
287
288

289
290
291
292
293
294

295
296
297
298

299
300
301
302
303
304
305
306







-
+


-
+





-
+



-
+







- initWithContentsOfFile: (OFString*)path
		encoding: (of_string_encoding_t)encoding;

/**
 * Initializes an already allocated OFString with the contents of the specified
 * URL, assuming UTF-8 encoding.
 *
 * \param url The URL to the contents for the string
 * \param URL The URL to the contents for the string
 * \return An initialized OFString
 */
- initWithContentsOfURL: (OFURL*)url;
- initWithContentsOfURL: (OFURL*)URL;

/**
 * Initializes an already allocated OFString with the contents of the specified
 * URL in the specified encoding.
 *
 * \param url The URL to the contents for the string
 * \param URL The URL to the contents for the string
 * \param encoding The encoding to assume
 * \return An initialized OFString
 */
- initWithContentsOfURL: (OFURL*)url
- initWithContentsOfURL: (OFURL*)URL
	       encoding: (of_string_encoding_t)encoding;

/**
 * \return The OFString as a UTF-8 encoded C string
 */
- (const char*)cString;

317
318
319
320
321
322
323
324

325
326
327

328
329
330
331
332
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
363
364
365
366
367
368
369
370
371
372
373

374
375
376

377
378
379
380
381
382
383
317
318
319
320
321
322
323

324
325
326

327
328
329
330
331
332
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
363
364
365
366
367
368
369
370
371
372

373
374
375

376
377
378
379
380
381
382
383







-
+


-
+








-
+



-
+


-
+



-
+


-
+


-
+



















-
+


-
+







/// \cond internal
- (BOOL)isUTF8;
/// \endcond

/**
 * Compares the OFString to another OFString without caring about the case.
 *
 * \param str A string to compare with
 * \param otherString A string to compare with
 * \return An of_comparison_result_t
 */
- (of_comparison_result_t)caseInsensitiveCompare: (OFString*)str;
- (of_comparison_result_t)caseInsensitiveCompare: (OFString*)otherString;

/**
 * \param index The index of the Unicode character to return
 * \return The Unicode character at the specified index
 */
- (of_unichar_t)characterAtIndex: (size_t)index;

/**
 * \param str The string to search
 * \param string The string to search
 * \return The index of the first occurrence of the string or OF_INVALID_INDEX
 *	   if it was not found
 */
- (size_t)indexOfFirstOccurrenceOfString: (OFString*)str;
- (size_t)indexOfFirstOccurrenceOfString: (OFString*)string;

/**
 * \param str The string to search
 * \param string The string to search
 * \return The index of the last occurrence of the string or OF_INVALID_INDEX if
 *	   it was not found
 */
- (size_t)indexOfLastOccurrenceOfString: (OFString*)str;
- (size_t)indexOfLastOccurrenceOfString: (OFString*)string;

/**
 * \param str The string to search
 * \param string The string to search
 * \return Whether the string contains the specified string
 */
- (BOOL)containsString: (OFString*)str;
- (BOOL)containsString: (OFString*)string;

/**
 * \param start The index where the substring starts
 * \param end The index where the substring ends.
 *	      This points BEHIND the last character!
 * \return The substring as a new autoreleased OFString
 */
- (OFString*)substringFromIndex: (size_t)start
			toIndex: (size_t)end;

/**
 * \param range The range of the substring
 * \return The substring as a new autoreleased OFString
 */
- (OFString*)substringWithRange: (of_range_t)range;

/**
 * Creates a new string by appending another string.
 *
 * \param str The string to append
 * \param string The string to append
 * \return A new autoreleased OFString with the specified string appended
 */
- (OFString*)stringByAppendingString: (OFString*)str;
- (OFString*)stringByAppendingString: (OFString*)string;

/**
 * Creates a new string by deleting leading whitespaces.
 *
 * \return A new autoreleased OFString with leading whitespaces deleted
 */
- (OFString*)stringByDeletingLeadingWhitespaces;