17 #ifndef __STDC_LIMIT_MACROS
18 # define __STDC_LIMIT_MACROS
20 #ifndef __STDC_CONSTANT_MACROS
21 # define __STDC_CONSTANT_MACROS
28 #import "OFSerialization.h"
29 #import "OFJSONRepresentation.h"
33 typedef uint32_t of_unichar_t;
38 typedef enum of_string_encoding_t {
39 OF_STRING_ENCODING_UTF_8,
40 OF_STRING_ENCODING_ASCII,
41 OF_STRING_ENCODING_ISO_8859_1,
42 OF_STRING_ENCODING_ISO_8859_15,
43 OF_STRING_ENCODING_WINDOWS_1252,
44 OF_STRING_ENCODING_AUTODETECT = 0xFF
45 } of_string_encoding_t;
48 OF_STRING_SEARCH_BACKWARDS = 1,
49 OF_STRING_SKIP_EMPTY = 2
53 #define OF_STRING_ENCODING_NATIVE OF_STRING_ENCODING_UTF_8
56 typedef void (^of_string_line_enumeration_block_t)(
OFString *line, BOOL *stop);
62 extern int of_string_utf8_check(
const char*,
size_t,
size_t*);
63 extern size_t of_string_utf8_encode(of_unichar_t,
char*);
64 extern size_t of_string_utf8_decode(
const char*,
size_t, of_unichar_t*);
65 extern size_t of_string_utf8_get_index(
const char*,
size_t);
66 extern size_t of_string_utf8_get_position(
const char*,
size_t,
size_t);
67 extern size_t of_unicode_string_length(
const of_unichar_t*);
68 extern size_t of_utf16_string_length(
const uint16_t*);
87 #ifdef OF_HAVE_PROPERTIES
88 @property (readonly)
size_t length;
96 + (instancetype)
string;
104 + (instancetype)stringWithUTF8String: (
const char*)UTF8String;
114 + (instancetype)stringWithUTF8String: (
const char*)UTF8String
124 + (instancetype)stringWithCString: (
const char*)cString
125 encoding: (of_string_encoding_t)encoding;
136 + (instancetype)stringWithCString: (
const char*)cString
137 encoding: (of_string_encoding_t)encoding
138 length: (
size_t)cStringLength;
154 + (instancetype)stringWithUnicodeString: (
const of_unichar_t*)
string;
164 + (instancetype)stringWithUnicodeString: (
const of_unichar_t*)
string
165 byteOrder: (of_byte_order_t)byteOrder;
175 + (instancetype)stringWithUnicodeString: (
const of_unichar_t*)
string
187 + (instancetype)stringWithUnicodeString: (
const of_unichar_t*)
string
188 byteOrder: (of_byte_order_t)byteOrder
197 + (instancetype)stringWithUTF16String: (
const uint16_t*)
string;
207 + (instancetype)stringWithUTF16String: (
const uint16_t*)
string
208 byteOrder: (of_byte_order_t)byteOrder;
218 + (instancetype)stringWithUTF16String: (
const uint16_t*)
string
231 + (instancetype)stringWithUTF16String: (
const uint16_t*)
string
232 byteOrder: (of_byte_order_t)byteOrder
252 + (instancetype)stringWithPath: (
OFString*)firstComponent, ...;
261 + (instancetype)stringWithContentsOfFile: (
OFString*)path;
271 + (instancetype)stringWithContentsOfFile: (
OFString*)path
272 encoding: (of_string_encoding_t)encoding;
286 + (instancetype)stringWithContentsOfURL: (
OFURL*)URL;
296 + (instancetype)stringWithContentsOfURL: (
OFURL*)URL
297 encoding: (of_string_encoding_t)encoding;
306 - initWithUTF8String: (
const char*)UTF8String;
316 - initWithUTF8String: (
const char*)UTF8String
330 - initWithUTF8StringNoCopy: (
const char*)UTF8String
331 freeWhenDone: (BOOL)freeWhenDone;
341 - initWithCString: (
const char*)cString
342 encoding: (of_string_encoding_t)encoding;
353 - initWithCString: (
const char*)cString
354 encoding: (of_string_encoding_t)encoding
355 length: (size_t)cStringLength;
363 - initWithString: (
OFString*)
string;
371 - initWithUnicodeString: (
const of_unichar_t*)
string;
381 - initWithUnicodeString: (
const of_unichar_t*)
string
382 byteOrder: (of_byte_order_t)byteOrder;
392 - initWithUnicodeString: (
const of_unichar_t*)
string
405 - initWithUnicodeString: (
const of_unichar_t*)
string
406 byteOrder: (of_byte_order_t)byteOrder
415 - initWithUTF16String: (
const uint16_t*)
string;
425 - initWithUTF16String: (
const uint16_t*)
string
426 byteOrder: (of_byte_order_t)byteOrder;
436 - initWithUTF16String: (
const uint16_t*)
string
449 - initWithUTF16String: (
const uint16_t*)
string
450 byteOrder: (of_byte_order_t)byteOrder
475 arguments: (va_list)arguments;
484 - initWithPath: (
OFString*)firstComponent, ...;
494 - initWithPath: (
OFString*)firstComponent
495 arguments: (va_list)arguments;
504 - initWithContentsOfFile: (
OFString*)path;
514 - initWithContentsOfFile: (
OFString*)path
515 encoding: (of_string_encoding_t)encoding;
530 - initWithContentsOfURL: (
OFURL*)URL;
540 - initWithContentsOfURL: (
OFURL*)URL
541 encoding: (of_string_encoding_t)encoding;
564 - (
const char*)cStringWithEncoding: (of_string_encoding_t)encoding
588 - (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding;
597 - (of_comparison_result_t)caseInsensitiveCompare: (
OFString*)otherString;
605 - (of_unichar_t)characterAtIndex: (
size_t)index;
614 - (void)getCharacters: (of_unichar_t*)buffer
636 options: (int)options;
649 options: (int)options
716 options: (
int)options
772 - (BOOL)hasPrefix: (
OFString*)prefix;
780 - (BOOL)hasSuffix: (
OFString*)suffix;
799 options: (int)options;
899 - (void)writeToFile: (
OFString*)path;
901 #ifdef OF_HAVE_BLOCKS
907 - (void)enumerateLinesUsingBlock: (of_string_line_enumeration_block_t)block;
911 #import "OFConstantString.h"
912 #import "OFMutableString.h"
913 #import "OFString+Hashing.h"
914 #import "OFString+JSONValue.h"
915 #import "OFString+Serialization.h"
916 #import "OFString+URLEncoding.h"
917 #import "OFString+XMLEscaping.h"
918 #import "OFString+XMLUnescaping.h"
920 #ifndef NSINTEGER_DEFINED
922 @compatibility_alias NSString
OFString;