20#ifndef __STDC_LIMIT_MACROS
21# define __STDC_LIMIT_MACROS
23#ifndef __STDC_CONSTANT_MACROS
24# define __STDC_CONSTANT_MACROS
27#include "objfw-defs.h"
29#ifdef OF_HAVE_SYS_TYPES_H
30# include <sys/types.h>
35#ifdef OF_HAVE_INTTYPES_H
40#import "OFJSONRepresentation.h"
41#import "OFMessagePackRepresentation.h"
43OF_ASSUME_NONNULL_BEGIN
47@class OFArray OF_GENERIC(ObjectType);
53#if defined(__cplusplus) && __cplusplus >= 201103L
54typedef char16_t OFChar16;
55typedef char32_t OFChar32;
57typedef uint_least16_t OFChar16;
58typedef uint_least32_t OFChar32;
60typedef OFChar32 OFUnichar;
143@property (readonly, nonatomic)
size_t length;
273#if defined(OF_WINDOWS) || defined(DOXYGEN)
277@property (readonly, nonatomic)
295+ (instancetype)stringWithUTF8String: (const
char *)UTF8String;
306+ (instancetype)stringWithUTF8String: (const
char *)UTF8String
307 length: (
size_t)UTF8StringLength;
324+ (instancetype)stringWithUTF8StringNoCopy: (
char *)UTF8String
325 freeWhenDone: (
bool)freeWhenDone;
343+ (instancetype)stringWithUTF8StringNoCopy: (
char *)UTF8String
344 length: (
size_t)UTF8StringLength
345 freeWhenDone: (
bool)freeWhenDone;
355+ (instancetype)stringWithCString: (const
char *)cString
368+ (instancetype)stringWithCString: (const
char *)cString
370 length: (
size_t)cStringLength;
380+ (instancetype)stringWithData: (
OFData *)data
389+ (instancetype)stringWithString: (
OFString *)string;
399+ (instancetype)stringWithCharacters: (const OFUnichar *)characters
400 length: (
size_t)length;
409+ (instancetype)stringWithUTF16String: (const OFChar16 *)string;
420+ (instancetype)stringWithUTF16String: (const OFChar16 *)string
421 length: (
size_t)length;
432+ (instancetype)stringWithUTF16String: (const OFChar16 *)string
446+ (instancetype)stringWithUTF16String: (const OFChar16 *)string
447 length: (
size_t)length
456+ (instancetype)stringWithUTF32String: (const OFChar32 *)string;
466+ (instancetype)stringWithUTF32String: (const OFChar32 *)string
467 length: (
size_t)length;
477+ (instancetype)stringWithUTF32String: (const OFChar32 *)string
490+ (instancetype)stringWithUTF32String: (const OFChar32 *)string
491 length: (
size_t)length
518+ (instancetype)stringWithContentsOfFile: (
OFString *)path;
529+ (instancetype)stringWithContentsOfFile: (
OFString *)path
546+ (instancetype)stringWithContentsOfIRI: (
OFIRI *)IRI;
557+ (instancetype)stringWithContentsOfIRI: (
OFIRI *)IRI
565- (instancetype)
init OF_DESIGNATED_INITIALIZER;
575- (instancetype)initWithUTF8String: (const
char *)UTF8String;
586- (instancetype)initWithUTF8String: (const
char *)UTF8String
587 length: (
size_t)UTF8StringLength;
604- (instancetype)initWithUTF8StringNoCopy: (
char *)UTF8String
605 freeWhenDone: (
bool)freeWhenDone;
624- (instancetype)initWithUTF8StringNoCopy: (
char *)UTF8String
625 length: (
size_t)UTF8StringLength
626 freeWhenDone: (
bool)freeWhenDone;
637- (instancetype)initWithCString: (const
char *)cString
650- (instancetype)initWithCString: (const
char *)cString
652 length: (
size_t)cStringLength;
663- (instancetype)initWithData: (
OFData *)data
672- (instancetype)initWithString: (
OFString *)string;
682- (instancetype)initWithCharacters: (const OFUnichar *)characters
683 length: (
size_t)length;
692- (instancetype)initWithUTF16String: (const OFChar16 *)string;
703- (instancetype)initWithUTF16String: (const OFChar16 *)string
704 length: (
size_t)length;
715- (instancetype)initWithUTF16String: (const OFChar16 *)string
729- (instancetype)initWithUTF16String: (const OFChar16 *)string
730 length: (
size_t)length
739- (instancetype)initWithUTF32String: (const OFChar32 *)string;
749- (instancetype)initWithUTF32String: (const OFChar32 *)string
750 length: (
size_t)length;
760- (instancetype)initWithUTF32String: (const OFChar32 *)string
773- (instancetype)initWithUTF32String: (const OFChar32 *)string
774 length: (
size_t)length
807 arguments: (va_list)arguments;
818- (instancetype)initWithContentsOfFile: (
OFString *)path;
829- (instancetype)initWithContentsOfFile: (
OFString *)path
847- (instancetype)initWithContentsOfIRI: (
OFIRI *)IRI;
858- (instancetype)initWithContentsOfIRI: (
OFIRI *)IRI
874- (size_t)getCString: (
char *)cString
875 maxLength: (
size_t)maxLength
890- (size_t)getLossyCString: (
char *)cString
891 maxLength: (
size_t)maxLength
955- (OFUnichar)characterAtIndex: (
size_t)index;
964- (void)getCharacters: (OFUnichar *)buffer inRange: (
OFRange)range;
1006- (size_t)indexOfCharacterFromSet: (
OFCharacterSet *)characterSet;
1038- (bool)containsString: (
OFString *)string;
1046- (
OFString *)substringFromIndex: (
size_t)idx;
1054- (
OFString *)substringToIndex: (
size_t)idx;
1083- (
long long)longLongValueWithBase: (
unsigned char)base;
1107- (
unsigned long long)unsignedLongLongValueWithBase: (
unsigned char)base;
1139 arguments: (va_list)arguments;
1150 withString: (
OFString *)replacement;
1165 withString: (
OFString *)replacement
1166 options: (
int)options
1175- (bool)hasPrefix: (
OFString *)prefix;
1183- (bool)hasSuffix: (
OFString *)suffix;
1193 componentsSeparatedByString: (
OFString *)delimiter;
1204 componentsSeparatedByString: (
OFString *)delimiter
1215 componentsSeparatedByCharactersInSet: (
OFCharacterSet *)characterSet;
1226 componentsSeparatedByCharactersInSet: (
OFCharacterSet *)characterSet
1242- (const OFChar16 *)UTF16StringWithByteOrder: (
OFByteOrder)byteOrder;
1256- (const OFChar32 *)UTF32StringWithByteOrder: (
OFByteOrder)byteOrder;
1274- (void)writeToFile: (
OFString *)path;
1293- (void)writeToIRI: (
OFIRI *)IRI;
1305#ifdef OF_HAVE_BLOCKS
1354extern char *_Nullable _OFStrDup(
const char *_Nonnull) OF_VISIBILITY_HIDDEN;
1355extern size_t _OFUTF8StringEncode(OFUnichar,
char *) OF_VISIBILITY_HIDDEN;
1356extern ssize_t _OFUTF8StringDecode(
const char *,
size_t, OFUnichar *)
1357 OF_VISIBILITY_HIDDEN;
1362OF_ASSUME_NONNULL_END
1364#import "OFConstantString.h"
1365#import "OFMutableString.h"
1366#import "OFString+CryptographicHashing.h"
1367#import "OFString+JSONParsing.h"
1369# import "OFString+PathAdditions.h"
1371#import "OFString+PercentEncoding.h"
1372#import "OFString+PropertyListParsing.h"
1373#import "OFString+XMLEscaping.h"
1376#if !defined(NSINTEGER_DEFINED) && !__has_feature(modules)
OFComparisonResult
A result of a comparison.
Definition OFObject.h:58
OFByteOrder
An enum for representing endianness.
Definition OFObject.h:92
size_t OFUTF16StringLength(const OFChar16 *string)
Returns the length of the specified UTF-16 string.
Definition OFString.m:322
OFStringEncoding OFStringEncodingParseName(OFString *name)
Parses the specified string encoding name and returns the OFStringEncoding for it.
Definition OFString.m:152
size_t OFUTF32StringLength(const OFChar32 *string)
Returns the length of the specified UTF-32 string.
Definition OFString.m:333
OFStringSeparationOptions
Options for separating strings.
Definition OFString.h:117
@ OFStringSkipEmptyComponents
Definition OFString.h:119
OFStringSearchOptions
Options for searching in strings.
Definition OFString.h:107
@ OFStringSearchBackwards
Definition OFString.h:109
OFString * OFStringEncodingName(OFStringEncoding encoding)
Returns the name of the specified OFStringEncoding.
Definition OFString.m:207
OFStringEncoding
The encoding of a string.
Definition OFString.h:65
@ OFStringEncodingWindows1251
Definition OFString.h:83
@ OFStringEncodingKOI8R
Definition OFString.h:95
@ OFStringEncodingISO8859_2
Definition OFString.h:77
@ OFStringEncodingISO8859_3
Definition OFString.h:79
@ OFStringEncodingASCII
Definition OFString.h:73
@ OFStringEncodingISO8859_1
Definition OFString.h:75
@ OFStringEncodingWindows1252
Definition OFString.h:85
@ OFStringEncodingMacRoman
Definition OFString.h:93
@ OFStringEncodingCodepage437
Definition OFString.h:87
@ OFStringEncodingCodepage850
Definition OFString.h:89
@ OFStringEncodingAutodetect
Definition OFString.h:99
@ OFStringEncodingCodepage858
Definition OFString.h:91
@ OFStringEncodingUTF8
Definition OFString.h:71
@ OFStringEncodingISO8859_15
Definition OFString.h:81
@ OFStringEncodingKOI8U
Definition OFString.h:97
void(^ OFStringLineEnumerationBlock)(OFString *line, bool *stop)
A block for enumerating the lines of a string.
Definition OFString.h:130
An abstract class for storing objects in an array.
Definition OFArray.h:109
A class cluster representing a character set.
Definition OFCharacterSet.h:33
A class for storing constant strings using the @"" literal.
Definition OFConstantString.h:42
A class for storing arbitrary data in an array.
Definition OFData.h:46
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition OFIRI.h:41
The root class for all other classes inside ObjFW.
Definition OFObject.h:692
A class for handling strings.
Definition OFString.h:139
instancetype init()
Initializes an already allocated OFString to be empty.
Definition OFString.m:769
const OFUnichar * characters
The string as an array of Unicode characters.
Definition OFString.h:229
OFString * stringByDeletingEnclosingWhitespaces
The string with leading and trailing whitespaces deleted.
Definition OFString.h:271
const char * UTF8String
The OFString as a UTF-8 encoded C string.
Definition OFString.h:152
const OFChar16 * UTF16String
The string in UTF-16 encoding with native byte order.
Definition OFString.h:240
OFString * lowercaseString
The string in lowercase.
Definition OFString.h:167
unsigned long long unsignedLongLongValue
The decimal value of the string as an unsigned long long.
Definition OFString.h:202
size_t UTF16StringLength
The length of the string in UTF-16 characters.
Definition OFString.h:245
double doubleValue
The double value of the string as a double.
Definition OFString.h:218
OFString * uppercaseString
The string in uppercase.
Definition OFString.h:162
float floatValue
The float value of the string as a float.
Definition OFString.h:210
OFString * stringByDeletingTrailingWhitespaces
The string with trailing whitespaces deleted.
Definition OFString.h:266
size_t UTF8StringLength
The number of bytes the string needs in UTF-8 encoding.
Definition OFString.h:157
const OFChar32 * UTF32String
The string in UTF-32 encoding with native byte order.
Definition OFString.h:256
size_t length
The length of the string in Unicode code points.
Definition OFString.h:143
OFString * stringByExpandingWindowsEnvironmentStrings
The string with the Windows Environment Strings expanded.
Definition OFString.h:278
long long longLongValue
The decimal value of the string as a long long.
Definition OFString.h:189
OFString * capitalizedString
The string in capitalized form.
Definition OFString.h:176
instancetype string()
Creates a new OFString.
Definition OFString.m:603
OFString * stringByDeletingLeadingWhitespaces
The string with leading whitespaces deleted.
Definition OFString.h:261
A protocol for comparing objects.
Definition OFObject.h:1388
A protocol for the creation of copies.
Definition OFObject.h:1350
A protocol implemented by classes that support encoding to a JSON representation.
Definition OFJSONRepresentation.h:48
A protocol implemented by classes that support encoding to a MessagePack representation.
Definition OFMessagePackRepresentation.h:33
A protocol for the creation of mutable copies.
Definition OFObject.h:1371
A range.
Definition OFObject.h:110