274
275
276
277
278
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
|
274
275
276
277
278
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
|
-
-
-
+
+
+
-
-
-
+
+
+
|
size_t length;
void *storage;
length = strlen(UTF8String);
string = of_alloc_object([OFString_UTF8 class],
length + 1, 1, &storage);
return (id)[string _initWithUTF8String: UTF8String
length: length
storage: storage];
return (id)[string OF_initWithUTF8String: UTF8String
length: length
storage: storage];
}
- initWithUTF8String: (const char*)UTF8String
length: (size_t)UTF8StringLength
{
id string;
void *storage;
string = of_alloc_object([OFString_UTF8 class],
UTF8StringLength + 1, 1, &storage);
return (id)[string _initWithUTF8String: UTF8String
length: UTF8StringLength
storage: storage];
return (id)[string OF_initWithUTF8String: UTF8String
length: UTF8StringLength
storage: storage];
}
- initWithUTF8StringNoCopy: (const char*)UTF8String
freeWhenDone: (BOOL)freeWhenDone
{
return (id)[[OFString_UTF8 alloc]
initWithUTF8StringNoCopy: UTF8String
|
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
338
339
340
341
342
343
344
345
346
347
348
349
|
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
338
339
340
341
342
343
344
345
346
347
348
349
|
-
-
-
+
+
+
-
-
-
+
+
+
|
size_t length;
void *storage;
length = strlen(cString);
string = of_alloc_object([OFString_UTF8 class],
length + 1, 1, &storage);
return (id)[string _initWithUTF8String: cString
length: length
storage: storage];
return (id)[string OF_initWithUTF8String: cString
length: length
storage: storage];
}
return (id)[[OFString_UTF8 alloc] initWithCString: cString
encoding: encoding];
}
- initWithCString: (const char*)cString
encoding: (of_string_encoding_t)encoding
length: (size_t)cStringLength
{
if (encoding == OF_STRING_ENCODING_UTF_8) {
id string;
void *storage;
string = of_alloc_object([OFString_UTF8 class],
cStringLength + 1, 1, &storage);
return (id)[string _initWithUTF8String: cString
length: cStringLength
storage: storage];
return (id)[string OF_initWithUTF8String: cString
length: cStringLength
storage: storage];
}
return (id)[[OFString_UTF8 alloc] initWithCString: cString
encoding: encoding
length: cStringLength];
}
|