17 #ifndef __STDC_LIMIT_MACROS 18 # define __STDC_LIMIT_MACROS 20 #ifndef __STDC_CONSTANT_MACROS 21 # define __STDC_CONSTANT_MACROS 24 #import "objfw-defs.h" 26 #ifdef OF_HAVE_SYS_TYPES_H 27 # include <sys/types.h> 34 #import "OFSerialization.h" 35 #import "OFJSONRepresentation.h" 36 #import "OFMessagePackRepresentation.h" 38 OF_ASSUME_NONNULL_BEGIN
44 #if !defined(__cplusplus) || __cplusplus < 201103L 45 typedef uint_least16_t char16_t;
46 typedef uint_least32_t char32_t;
48 typedef char32_t of_unichar_t;
91 OF_STRING_SEARCH_BACKWARDS = 1,
92 OF_STRING_SKIP_EMPTY = 2
106 @class OFArray OF_GENERIC(ObjectType);
129 + (instancetype)stringWithUTF8String: (const
char *)UTF8String;
139 + (instancetype)stringWithUTF8String: (const
char *)UTF8String
140 length: (
size_t)UTF8StringLength;
151 + (instancetype)stringWithUTF8StringNoCopy: (
char *)UTF8String
152 freeWhenDone: (
bool)freeWhenDone;
161 + (instancetype)stringWithCString: (const
char *)cString
173 + (instancetype)stringWithCString: (const
char *)cString
175 length: (
size_t)cStringLength;
184 + (instancetype)stringWithData: (
OFData *)data
193 + (instancetype)stringWithString: (
OFString *)string;
203 + (instancetype)stringWithCharacters: (const of_unichar_t *)characters
204 length: (
size_t)length;
212 + (instancetype)stringWithUTF16String: (const char16_t *)string;
222 + (instancetype)stringWithUTF16String: (const char16_t *)string
223 length: (
size_t)length;
233 + (instancetype)stringWithUTF16String: (const char16_t *)string
246 + (instancetype)stringWithUTF16String: (const char16_t *)string
247 length: (
size_t)length
256 + (instancetype)stringWithUTF32String: (const char32_t *)string;
266 + (instancetype)stringWithUTF32String: (const char32_t *)string
267 length: (
size_t)length;
277 + (instancetype)stringWithUTF32String: (const char32_t *)string
290 + (instancetype)stringWithUTF32String: (const char32_t *)string
291 length: (
size_t)length
314 + (instancetype)stringWithContentsOfFile: (
OFString *)path;
324 + (instancetype)stringWithContentsOfFile: (
OFString *)path
328 #if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) 341 + (instancetype)stringWithContentsOfURL: (
OFURL *)URL;
351 + (instancetype)stringWithContentsOfURL: (
OFURL *)URL
370 - initWithUTF8String: (const
char *)UTF8String;
380 - initWithUTF8String: (const
char *)UTF8String
381 length: (
size_t)UTF8StringLength;
394 - initWithUTF8StringNoCopy: (
char *)UTF8String
395 freeWhenDone: (
bool)freeWhenDone;
405 - initWithCString: (const
char *)cString
417 - initWithCString: (const
char *)cString
419 length: (
size_t)cStringLength;
429 - initWithData: (
OFData *)data
438 - initWithString: (
OFString *)string;
448 - initWithCharacters: (const of_unichar_t *)characters
449 length: (
size_t)length;
457 - initWithUTF16String: (const char16_t *)string;
467 - initWithUTF16String: (const char16_t *)string
468 length: (
size_t)length;
478 - initWithUTF16String: (const char16_t *)string
491 - initWithUTF16String: (const char16_t *)string
492 length: (
size_t)length
501 - initWithUTF32String: (const char32_t *)string;
511 - initWithUTF32String: (const char32_t *)string
512 length: (
size_t)length;
522 - initWithUTF32String: (const char32_t *)string
535 - initWithUTF32String: (const char32_t *)string
536 length: (
size_t)length
563 arguments: (va_list)arguments;
573 - initWithContentsOfFile: (
OFString *)path;
583 - initWithContentsOfFile: (
OFString *)path
587 #if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) 601 - initWithContentsOfURL: (
OFURL *)URL;
611 - initWithContentsOfURL: (
OFURL *)URL
626 - (size_t)getCString: (
char *)cString
627 maxLength: (
size_t)maxLength
642 - (size_t)getLossyCString: (
char *)cString
643 maxLength: (
size_t)maxLength
657 OF_RETURNS_INNER_POINTER;
672 OF_RETURNS_INNER_POINTER;
683 - (const
char *)
UTF8String OF_RETURNS_INNER_POINTER;
723 - (of_unichar_t)characterAtIndex: (
size_t)index;
732 - (void)getCharacters: (of_unichar_t *)buffer
757 options: (
int)options;
773 options: (
int)options
782 - (bool)containsString: (
OFString *)string;
816 arguments: (va_list)arguments;
843 withString: (
OFString *)replacement;
859 options: (
int)options
915 - (bool)hasPrefix: (
OFString *)prefix;
923 - (bool)hasSuffix: (
OFString *)suffix;
946 componentsSeparatedByString: (
OFString *)delimiter
947 options: (
int)options;
1075 - (const of_unichar_t *)
characters OF_RETURNS_INNER_POINTER;
1086 - (const char16_t *)
UTF16String OF_RETURNS_INNER_POINTER;
1098 - (const char16_t *)UTF16StringWithByteOrder: (
of_byte_order_t)byteOrder
1099 OF_RETURNS_INNER_POINTER;
1117 - (const char32_t *)
UTF32String OF_RETURNS_INNER_POINTER;
1129 - (const char32_t *)UTF32StringWithByteOrder: (
of_byte_order_t)byteOrder
1130 OF_RETURNS_INNER_POINTER;
1140 #ifdef OF_HAVE_UNICODE_TABLES 1156 #ifdef OF_HAVE_FILES 1162 - (void)writeToFile: (
OFString *)path;
1171 - (void)writeToFile: (
OFString *)path
1175 #ifdef OF_HAVE_BLOCKS 1189 extern size_t of_string_utf8_encode(of_unichar_t,
char *);
1190 extern ssize_t of_string_utf8_decode(
const char *,
size_t, of_unichar_t *);
1191 extern size_t of_string_utf16_length(
const char16_t *);
1192 extern size_t of_string_utf32_length(
const char32_t *);
1197 OF_ASSUME_NONNULL_END
1199 #import "OFConstantString.h" 1200 #import "OFMutableString.h" 1201 #import "OFString+CryptoHashing.h" 1202 #import "OFString+JSONValue.h" 1203 #import "OFString+Serialization.h" 1204 #import "OFString+URLEncoding.h" 1205 #import "OFString+XMLEscaping.h" 1208 #if !defined(NSINTEGER_DEFINED) && !__has_feature(modules) const char32_t * UTF32String()
Returns the string in UTF-32 encoding with native byte order.
Definition: OFString.m:2751
uintmax_t hexadecimalValue()
Returns the hexadecimal value of the string as an uintmax_t.
Definition: OFString.m:2456
const of_unichar_t * characters()
Returns the string as an array of Unicode characters.
Definition: OFString.m:2666
OFString * stringByDeletingTrailingWhitespaces()
Creates a new string by deleting trailing whitespaces.
Definition: OFString.m:2070
Definition: OFString.h:67
instancetype string()
Creates a new OFString.
Definition: OFString.m:644
A protocol for the creation of mutable copies.
Definition: OFObject.h:935
OFString * stringByStandardizingURLPath()
Returns the URL path with relative sub paths resolved.
Definition: OFString.m:2401
Definition: OFString.h:83
const char * UTF8String()
Returns the OFString as a UTF-8 encoded C string.
Definition: OFString.m:1428
Definition: OFString.h:59
A class for handling strings.
Definition: OFString.h:114
Definition: OFString.h:69
A protocol implemented by classes that support encoding to a JSON representation. ...
Definition: OFJSONRepresentation.h:38
OFString * lastPathComponent()
Returns the last component of the path.
Definition: OFString.m:2259
Definition: OFString.h:85
intmax_t decimalValue()
Returns the decimal value of the string as an intmax_t.
Definition: OFString.m:2407
float floatValue()
Returns the float value of the string as a float.
Definition: OFString.m:2566
Definition: OFString.h:79
OFString * stringByDeletingEnclosingWhitespaces()
Creates a new string by deleting leading and trailing whitespaces.
Definition: OFString.m:2081
Definition: OFString.h:77
OFString * stringByDeletingLeadingWhitespaces()
Creates a new string by deleting leading whitespaces.
Definition: OFString.m:2059
Definition: OFString.h:61
A class for parsing URLs and accessing parts of it.
Definition: OFURL.h:29
size_t length()
Returns the length of the string in Unicode codepoints.
Definition: OFString.m:1433
A protocol implemented by classes that support encoding to a MessagePack representation.
Definition: OFMessagePackRepresentation.h:30
uintmax_t octalValue()
Returns the octal value of the string as an uintmax_t.
Definition: OFString.m:2519
double doubleValue()
Returns the double value of the string as a double.
Definition: OFString.m:2616
OFString * capitalizedString()
Returns the string capitalized.
Definition: OFString.m:2048
A protocol for the creation of copies.
Definition: OFObject.h:914
OFString * stringByStandardizingPath()
Returns the path with relative sub paths resolved.
Definition: OFString.m:2394
A protocol for comparing objects.
Definition: OFString.h:65
The root class for all other classes inside ObjFW.
Definition: OFObject.h:379
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:37
OFString * stringByDeletingPathExtension()
Returns a new string with the file extension of the path removed.
Definition: OFString.m:2362
A range.
Definition: OFObject.h:66
size_t UTF8StringLength()
Returns the number of bytes the string needs in UTF-8 encoding.
Definition: OFString.m:1479
of_comparison_result_t
A result of a comparison.
Definition: OFObject.h:42
Definition: OFString.h:75
An abstract class for storing objects in an array.
Definition: OFArray.h:89
const char16_t * UTF16String()
Returns the string in UTF-16 encoding with native byte order.
Definition: OFString.m:2680
OFString * lowercaseString()
Returns the string in lowercase.
Definition: OFString.m:2037
of_string_encoding_t
The encoding of a string.
Definition: OFString.h:53
A protocol for serializing objects.
Definition: OFSerialization.h:30
OFString * decomposedStringWithCanonicalMapping()
Returns the string in Unicode Normalization Form D (NFD).
Definition: OFString.m:2790
Definition: OFString.h:73
Definition: OFString.h:63
A class for storing arbitrary data in an array.
Definition: OFData.h:34
OFArray * pathComponents()
Returns the components of the path.
Definition: OFString.m:2211
void(^ of_string_line_enumeration_block_t)(OFString *line, bool *stop)
A block for enumerating the lines of a string.
Definition: OFString.h:103
Definition: OFString.h:87
Definition: OFString.h:81
Definition: OFString.h:71
OFString * stringByDeletingLastPathComponent()
Returns the directory name of the path.
Definition: OFString.m:2324
OFString * uppercaseString()
Returns the string in uppercase.
Definition: OFString.m:2026
OFString * pathExtension()
Returns the file extension of the path.
Definition: OFString.m:2304
size_t UTF16StringLength()
Returns the length of the string in UTF-16 characters.
Definition: OFString.m:2737
OFString * decomposedStringWithCompatibilityMapping()
Returns the string in Unicode Normalization Form KD (NFKD).
Definition: OFString.m:2796
of_byte_order_t
An enum for storing endianess.
Definition: OFObject.h:54