ObjFW  Diff

Differences From Artifact [56efcb0f4e]:

To Artifact [3b28f920b3]:


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


268
269
270
271
272
273
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
305
306
307
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
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
384



385
386
387
388
389
390
391
392
393
394
395
396

397
398
399
400
401
402
403
404
405


406
407
408
409
410
411
412
413
414
415
416


417
418
419
420
421
422
423
424
425
426
427



428
429
430
431
432
433
434
435
436
437
438
439

440
441
442
443
444
445
446
447
448
449
450

451
452
453
454
455
456
457
458
459
460
461
462
463
464


465
466
467
468
469
470
471
472
473


474
475
476
477
478
479
480
481
482
483
484


485
486
487
488
489
490
491
492
493


494
495
496
497
498
499
500
501
502
503
504


505
506
507
508
509
510
511
512
513
514
515
516
517
518
519


520
521
522
523
524
525
526
527
528


529
530
531
532
533


534
535
536
537
538


539
540
541
542
543
544


545
546
547
548
549
550
551


552
553
554
555
556
557


558
559
560
561
562
563
564


565
566
567
568
569
570
571


572
573
574
575
576
577


578
579
580
581
582
583
584

585
586
587
588
589
590
591
592

593
594
595
596
597
598
599
600
601


602
603
604
605
606
607
608
609
610


611
612
613
614
615


616
617
618
619
620
621

622
623
624
625
626
627
628

629
630
631
632
633
634
635

636
637
638
639
640
641
642
643

644
645
646
647
648
649
650
651

652
653
654
655
656
657
658
659

660
661
662
663
664
665
666


667
668
669
670
671


672
673
674
675
676


677
678
679
680
681
682

683

684



685
686
687
688
689
690
691
692
693
694

695

696



697
698
699
700
701
702
703
704
705
706
707




708
709
710
711
712
713
714
715




716
717
718
719
720
721
722

723
724
725
726
727
728
729
730
731
732
733

734
735
736
737
738
739
740
741
742
743
744
745
746
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
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
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
268
269
270


271
272
273
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
305
306

307
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
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
384
385
386
387
388


389
390
391
392
393
394
395
396
397
398
399
400
401
402

403
404
405
406
407
408
409
410


411
412
413
414
415
416
417
418
419
420
421


422
423
424
425
426
427
428
429
430
431
432


433
434
435
436
437
438
439
440
441
442
443
444
445
446

447
448
449
450
451
452
453
454
455
456
457

458
459
460
461
462
463
464
465
466
467
468
469
470


471
472
473
474
475
476
477
478
479


480
481
482
483
484
485
486
487
488
489
490


491
492
493
494
495
496
497
498
499


500
501
502
503
504
505
506
507
508
509
510


511
512
513
514
515
516
517
518
519
520
521
522
523
524
525


526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557

558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608

609
610
611
612
613
614
615
616

617
618
619
620
621
622
623
624


625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649

650
651
652
653
654
655
656

657
658
659
660
661
662
663

664
665
666
667
668
669
670
671

672
673
674
675
676
677
678
679

680
681
682
683
684
685
686
687

688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716

717

718
719
720
721
722
723
724
725
726
727
728
729
730
731

732

733
734
735
736
737
738
739
740
741
742
743
744
745
746


747
748
749
750
751
752
753
754
755
756


757
758
759
760
761
762
763
764
765
766

767
768
769
770
771
772
773
774
775
776
777

778
779
780
781
782
783
784
785
786
787
788
789
790
791







+
+
-
+




-
+







-
+









-
-
+
+











-
-
+
+









-
+







-
+







-
-
+
+









-
+
+









-
-
+
+











-
+







-
-
+
+









-
-
+
+









-
-
+
+
+











-
+










-
+







-
+
+







-
-
+
+









-
+













-
-
+
+









-
+
+







-
-
+
+









-
-
+
+











-
-
+
+









-
+







-
+







-
-
+
+









-
-
+
+









-
-
+
+
+











-
+







-
-
+
+









-
-
+
+









-
-
+
+
+











-
+










-
+












-
-
+
+







-
-
+
+









-
-
+
+







-
-
+
+









-
-
+
+













-
-
+
+









+
+





+
+





+
+





-
+
+







+
+






+
+







+
+







+
+






+
+






-
+







-
+







-
-
+
+









+
+





+
+





-
+






-
+






-
+







-
+







-
+







-
+







+
+





+
+





+
+





-
+
-
+

+
+
+









-
+
-
+

+
+
+









-
-
+
+
+
+






-
-
+
+
+
+






-
+










-
+













#ifdef OF_HAVE_PROPERTIES
@property (readonly) const char *cString;
@property (readonly) size_t cStringLength;
@property (readonly) size_t length;
#endif

/**
 * \brief Creates a new OFString.
 *
 * \return A new autoreleased OFString
 * \return A new, autoreleased OFString
 */
+ string;

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

/**
 * Creates a new OFString from a C string with the specified encoding.
 * \brief Creates a new OFString from a C string with the specified encoding.
 *
 * \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*)cString
	   encoding: (of_string_encoding_t)encoding;

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

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

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

/**
 * Creates a new OFString from a unicode string.
 * \brief Creates a new OFString from a unicode string.
 *
 * \param string The unicode string
 * \return A new autoreleased OFString
 */
+ stringWithUnicodeString: (of_unichar_t*)string;

/**
 * Creates a new OFString from a unicode string, assuming the specified byte
 * order if no BOM is found.
 * \brief Creates a new OFString from a unicode string, assuming the specified
 *	  byte order if no BOM is found.
 *
 * \param string The unicode string
 * \param byteOrder The byte order to assume if there is no BOM
 * \return A new autoreleased OFString
 */
+ stringWithUnicodeString: (of_unichar_t*)string
		byteOrder: (of_endianess_t)byteOrder;

/**
 * Creates a new OFString from a unicode string with the specified length.
 * \brief Creates a new OFString from a unicode string with the specified
 *	  length.
 *
 * \param string The unicode string
 * \param length The length of the unicode string
 * \return A new autoreleased OFString
 */
+ stringWithUnicodeString: (of_unichar_t*)string
		   length: (size_t)length;

/**
 * Creates a new OFString from a unicode string with the specified length,
 * assuming the specified byte order if no BOM is found.
 * \brief Creates a new OFString from a unicode string with the specified
 *	  length, assuming the specified byte order if no BOM is found.
 *
 * \param string The unicode string
 * \param byteOrder The byte order to assume if there is no BOM
 * \param length The length of the unicode string
 * \return A new autoreleased OFString
 */
+ stringWithUnicodeString: (of_unichar_t*)string
		byteOrder: (of_endianess_t)byteOrder
		   length: (size_t)length;

/**
 * Creates a new OFString from a UTF-16 encoded string.
 * \brief Creates a new OFString from a UTF-16 encoded string.
 *
 * \param string The UTF-16 string
 * \return A new autoreleased OFString
 */
+ stringWithUTF16String: (uint16_t*)string;

/**
 * Creates a new OFString from a UTF-16 encoded string, assuming the specified
 * byte order if no BOM is found.
 * \brief Creates a new OFString from a UTF-16 encoded string, assuming the
 *	  specified byte order if no BOM is found.
 *
 * \param string The UTF-16 string
 * \param byteOrder The byte order to assume if there is no BOM
 * \return A new autoreleased OFString
 */
+ stringWithUTF16String: (uint16_t*)string
	      byteOrder: (of_endianess_t)byteOrder;

/**
 * Creates a new OFString from a UTF-16 encoded string with the specified
 * length.
 * \brief Creates a new OFString from a UTF-16 encoded string with the specified
 *	  length.
 *
 * \param string The UTF-16 string
 * \param length The length of the unicode string
 * \return A new autoreleased OFString
 */
+ stringWithUTF16String: (uint16_t*)string
		 length: (size_t)length;

/**
 * Creates a new OFString from a UTF-16 encoded string with the specified
 * length, assuming the specified byte order if no BOM is found.
 * \brief Creates a new OFString from a UTF-16 encoded string with the
 *	  specified length, assuming the specified byte order if no BOM is
 *	  found.
 *
 * \param string The UTF-16 string
 * \param byteOrder The byte order to assume if there is no BOM
 * \param length The length of the unicode string
 * \return A new autoreleased OFString
 */
+ stringWithUTF16String: (uint16_t*)string
	      byteOrder: (of_endianess_t)byteOrder
		 length: (size_t)length;

/**
 * Creates a new OFString from a format string.
 * \brief Creates a new OFString from a format string.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects.
 *
 * \param format A string used as format to initialize the OFString
 * \return A new autoreleased OFString
 */
+ stringWithFormat: (OFConstantString*)format, ...;

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

/**
 * Creates a new OFString with the contents of the specified UTF-8 encoded file.
 * \brief 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
 */
+ stringWithContentsOfFile: (OFString*)path;

/**
 * Creates a new OFString with the contents of the specified file in the
 * specified encoding.
 * \brief Creates a new OFString with the contents of the specified file in the
 *	  specified encoding.
 *
 * \param path The path to the file
 * \param encoding The encoding of the file
 * \return A new autoreleased OFString
 */
+ stringWithContentsOfFile: (OFString*)path
		  encoding: (of_string_encoding_t)encoding;

/**
 * Creates a new OFString with the contents of the specified URL.
 * \brief Creates a new OFString with the contents of the specified URL.
 *
 * If the URL's scheme is file, it tries UTF-8 encoding.
 *
 * If the URL's scheme is http(s), it tries to detect the encoding from the HTTP
 * headers. If it could not detect the encoding using the HTTP headers, it tries
 * UTF-8.
 *
 * \param URL The URL to the contents for the string
 * \return A new autoreleased OFString
 */
+ stringWithContentsOfURL: (OFURL*)URL;

/**
 * Creates a new OFString with the contents of the specified URL in the
 * specified encoding.
 * \brief 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 encoding The encoding to assume
 * \return A new autoreleased OFString
 */
+ stringWithContentsOfURL: (OFURL*)URL
		 encoding: (of_string_encoding_t)encoding;

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

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

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

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

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

/**
 * Initializes an already allocated OFString with a unicode string.
 * \brief Initializes an already allocated OFString with a unicode string.
 *
 * \param string The unicode string
 * \return An initialized OFString
 */
- initWithUnicodeString: (of_unichar_t*)string;

/**
 * Initializes an already allocated OFString with a unicode string, assuming the
 * specified byte order if no BOM is found.
 * \brief Initializes an already allocated OFString with a unicode string,
 *	  assuming the specified byte order if no BOM is found.
 *
 * \param string The unicode string
 * \param byteOrder The byte order to assume if there is no BOM
 * \return An initialized OFString
 */
- initWithUnicodeString: (of_unichar_t*)string
	      byteOrder: (of_endianess_t)byteOrder;

/**
 * Initializes an already allocated OFString with a unicode string with the
 * specified length.
 * \brief Initializes an already allocated OFString with a unicode string with
 *	  the specified length.
 *
 * \param string The unicode string
 * \param length The length of the unicode string
 * \return An initialized OFString
 */
- initWithUnicodeString: (of_unichar_t*)string
		 length: (size_t)length;

/**
 * Initializes an already allocated OFString with a unicode string with the
 * specified length, assuming the specified byte order if no BOM is found.
 * \brief Initializes an already allocated OFString with a unicode string with
 *	  the specified length, assuming the specified byte order if no BOM is
 *	  found.
 *
 * \param string The unicode string
 * \param byteOrder The byte order to assume if there is no BOM
 * \param length The length of the unicode string
 * \return An initialized OFString
 */
- initWithUnicodeString: (of_unichar_t*)string
	      byteOrder: (of_endianess_t)byteOrder
		 length: (size_t)length;

/**
 * Initializes an already allocated OFString with a UTF-16 string.
 * \brief Initializes an already allocated OFString with a UTF-16 string.
 *
 * \param string The UTF-16 string
 * \return An initialized OFString
 */
- initWithUTF16String: (uint16_t*)string;

/**
 * Initializes an already allocated OFString with a UTF-16 string, assuming the
 * specified byte order if no BOM is found.
 * \brief Initializes an already allocated OFString with a UTF-16 string,
 *	  assuming the specified byte order if no BOM is found.
 *
 * \param string The UTF-16 string
 * \param byteOrder The byte order to assume if there is no BOM
 * \return An initialized OFString
 */
- initWithUTF16String: (uint16_t*)string
	    byteOrder: (of_endianess_t)byteOrder;

/**
 * Initializes an already allocated OFString with a UTF-16 string with the
 * specified length.
 * \brief Initializes an already allocated OFString with a UTF-16 string with
 *	  the specified length.
 *
 * \param string The UTF-16 string
 * \param length The length of the UTF-16 string
 * \return An initialized OFString
 */
- initWithUTF16String: (uint16_t*)string
	       length: (size_t)length;

/**
 * Initializes an already allocated OFString with a UTF-16 string with the
 * specified length, assuming the specified byte order if no BOM is found.
 * \brief Initializes an already allocated OFString with a UTF-16 string with
 *	  the specified length, assuming the specified byte order if no BOM is
 *	  found.
 *
 * \param string The UTF-16 string
 * \param byteOrder The byte order to assume if there is no BOM
 * \param length The length of the UTF-16 string
 * \return An initialized OFString
 */
- initWithUTF16String: (uint16_t*)string
	    byteOrder: (of_endianess_t)byteOrder
	       length: (size_t)length;

/**
 * Initializes an already allocated OFString with a format string.
 * \brief Initializes an already allocated OFString with a format string.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects.
 *
 * \param format A string used as format to initialize the OFString
 * \return An initialized OFString
 */
- initWithFormat: (OFConstantString*)format, ...;

/**
 * Initializes an already allocated OFString with a format string.
 * \brief Initializes an already allocated OFString with a format string.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects.
 *
 * \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: (OFConstantString*)format
       arguments: (va_list)arguments;

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

/**
 * Initializes an already allocated OFString with the constructed specified
 * path.
 * \brief Initializes an already allocated OFString with the constructed
 *	  specified 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*)firstComponent
     arguments: (va_list)arguments;

/**
 * Initializes an already allocated OFString with the contents of the specified
 * file in the specified encoding.
 * \brief 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
 */
- initWithContentsOfFile: (OFString*)path;

/**
 * Initializes an already allocated OFString with the contents of the specified
 * file in the specified encoding.
 * \brief Initializes an already allocated OFString with the contents of the
 *	  specified file in the specified encoding.
 *
 * \param path The path to the file
 * \param encoding The encoding of the file
 * \return An initialized OFString
 */
- initWithContentsOfFile: (OFString*)path
		encoding: (of_string_encoding_t)encoding;

/**
 * Initializes an already allocated OFString with the contents of the specified
 * URL.
 * \brief Initializes an already allocated OFString with the contents of the
 *	  specified URL.
 *
 * If the URL's scheme is file, it tries UTF-8 encoding.
 *
 * If the URL's scheme is http(s), it tries to detect the encoding from the HTTP
 * headers. If it could not detect the encoding using the HTTP headers, it tries
 * UTF-8.
 *
 * \param URL The URL to the contents for the string
 * \return An initialized OFString
 */
- initWithContentsOfURL: (OFURL*)URL;

/**
 * Initializes an already allocated OFString with the contents of the specified
 * URL in the specified encoding.
 * \brief 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 encoding The encoding to assume
 * \return An initialized OFString
 */
- initWithContentsOfURL: (OFURL*)URL
	       encoding: (of_string_encoding_t)encoding;

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

/**
 * \brief Returns the length of the string in Unicode characters.
 *
 * \return The length of the string in Unicode characters
 */
- (size_t)length;

/**
 * \brief Returns the length of the string which cString would return.
 *
 * \return The length of the string which cString would return
 */
- (size_t)cStringLength;

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

/**
 * \brief Returns the Unicode character at the specified index.
 *
 * \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;

/**
 * \brief Returns the index of the first occurrence of the string.
 *
 * \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*)string;

/**
 * \brief Returns the index of the last occurrence of the string.
 *
 * \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*)string;

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

/**
 * \brief Creates a substring with the specified range.
 *
 * \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.
 * \brief Creates a new string by appending another string.
 *
 * \param string The string to append
 * \return A new autoreleased OFString with the specified string appended
 */
- (OFString*)stringByAppendingString: (OFString*)string;

/**
 * Creates a new string by prepending another string.
 * \brief Creates a new string by prepending another string.
 *
 * \param string The string to prepend
 * \return A new autoreleased OFString with the specified string prepended
 */
- (OFString*)stringByPrependingString: (OFString*)string;

/**
 * Creates a new string by replacing the occurrences of the specified string
 * with the specified replacement.
 * \brief Creates a new string by replacing the occurrences of the specified
 *	  string with the specified replacement.
 *
 * \param string The string to replace
 * \param replacement The string with which it should be replaced
 * \return A new string with the occurrences of the specified string replaced
 */
- (OFString*)stringByReplacingOccurrencesOfString: (OFString*)string
				       withString: (OFString*)replacement;

/**
 * \brief Returns the string in uppercase.
 *
 * \return The string in uppercase
 */
- (OFString*)uppercaseString;

/**
 * \brief Returns the string in lowercase.
 *
 * \return The string in lowercase
 */
- (OFString*)lowercaseString;

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

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

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

/**
 * Checks whether the string has the specified prefix.
 * \brief Checks whether the string has the specified prefix.
 *
 * \param prefix The prefix to check for
 * \return A boolean whether the string has the specified prefix
 */
- (BOOL)hasPrefix: (OFString*)prefix;

/**
 * Checks whether the string has the specified suffix.
 * \brief Checks whether the string has the specified suffix.
 *
 * \param suffix The suffix to check for
 * \return A boolean whether the string has the specified suffix
 */
- (BOOL)hasSuffix: (OFString*)suffix;

/**
 * Splits an OFString into an OFArray of OFStrings.
 * \brief Splits an OFString into an OFArray of OFStrings.
 *
 * \param delimiter The delimiter for splitting
 * \return An autoreleased OFArray with the split string
 */
- (OFArray*)componentsSeparatedByString: (OFString*)delimiter;

/**
 * \brief Returns the components of the path.
 *
 * \return The components of the path
 */
- (OFArray*)pathComponents;

/**
 * \brief Returns the last component of the path.
 *
 * \return The last component of the path
 */
- (OFString*)lastPathComponent;

/**
 * \brief Returns the directory name of the path.
 *
 * \return The directory name of the path
 */
- (OFString*)stringByDeletingLastPathComponent;

/**
 * Returns the decimal value of the string as an intmax_t or throws an
 * \brief Returns the decimal value of the string as an intmax_t.
 * OFInvalidEncodingException if the string contains any non-number characters.
 *
 * Leading and trailing whitespaces are ignored.
 *
 * If the string contains any non-number characters, an
 * OFInvalidEncodingException is thrown.
 *
 * If the number is too big to fit into an intmax_t, an OFOutOfRangeException
 * is thrown.
 *
 * \return An intmax_t with the value of the string
 */
- (intmax_t)decimalValue;

/**
 * Returns the hexadecimal value of the string as an uintmax_t or throws an
 * \brief Returns the hexadecimal value of the string as an uintmax_t.
 * OFInvalidEncodingException if the string contains any non-number characters.
 *
 * Leading and trailing whitespaces are ignored.
 *
 * If the string contains any non-number characters, an
 * OFInvalidEncodingException is thrown.
 *
 * If the number is too big to fit into an uintmax_t, an OFOutOfRangeException
 * is thrown.
 *
 * \return A uintmax_t with the value of the string
 */
- (uintmax_t)hexadecimalValue;

/**
 * Returns the float value of the string as a float or throws an
 * OFInvalidEncodingException if the string contains any non-number characters.
 * \brief Returns the float value of the string as a float.
 *
 * If the string contains any non-number characters, an
 * OFInvalidEncodingException is thrown.
 *
 * \return A float with the value of the string
 */
- (float)floatValue;

/**
 * Returns the double value of the string as a float or throws an
 * OFInvalidEncodingException if the string contains any non-number characters.
 * \brief Returns the double value of the string as a double.
 *
 * If the string contains any non-number characters, an
 * OFInvalidEncodingException is thrown.
 *
 * \return A double with the value of the string
 */
- (double)doubleValue;

/**
 * Returns the string as an array of of_unichar_t.
 * \brief Returns the string as an array of of_unichar_ts.
 *
 * The result is valid until the autorelease pool is released. If you want to
 * use the result outside the scope of the current autorelease pool, you have to
 * copy it.
 *
 * \return The string as an array of Unicode characters
 */
- (of_unichar_t*)unicodeString;

/**
 * Writes the string into the specified file using UTF-8 encoding.
 * \brief Writes the string into the specified file using UTF-8 encoding.
 *
 * \param path The path of the file to write to
 */
- (void)writeToFile: (OFString*)path;
@end

#import "OFConstantString.h"
#import "OFMutableString.h"
#import "OFString+Hashing.h"
#import "OFString+Serialization.h"
#import "OFString+URLEncoding.h"
#import "OFString+XMLEscaping.h"
#import "OFString+XMLUnescaping.h"