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;
147@property (readonly, nonatomic)
size_t length;
277#if defined(OF_WINDOWS) || defined(DOXYGEN)
281@property (readonly, nonatomic)
299+ (instancetype)stringWithUTF8String: (const
char *)UTF8String;
310+ (instancetype)stringWithUTF8String: (const
char *)UTF8String
311 length: (
size_t)UTF8StringLength;
328+ (instancetype)stringWithUTF8StringNoCopy: (
char *)UTF8String
329 freeWhenDone: (
bool)freeWhenDone;
347+ (instancetype)stringWithUTF8StringNoCopy: (
char *)UTF8String
348 length: (
size_t)UTF8StringLength
349 freeWhenDone: (
bool)freeWhenDone;
359+ (instancetype)stringWithCString: (const
char *)cString
372+ (instancetype)stringWithCString: (const
char *)cString
374 length: (
size_t)cStringLength;
384+ (instancetype)stringWithData: (
OFData *)data
393+ (instancetype)stringWithString: (
OFString *)string;
403+ (instancetype)stringWithCharacters: (const OFUnichar *)characters
404 length: (
size_t)length;
413+ (instancetype)stringWithUTF16String: (const OFChar16 *)string;
424+ (instancetype)stringWithUTF16String: (const OFChar16 *)string
425 length: (
size_t)length;
436+ (instancetype)stringWithUTF16String: (const OFChar16 *)string
450+ (instancetype)stringWithUTF16String: (const OFChar16 *)string
451 length: (
size_t)length
460+ (instancetype)stringWithUTF32String: (const OFChar32 *)string;
470+ (instancetype)stringWithUTF32String: (const OFChar32 *)string
471 length: (
size_t)length;
481+ (instancetype)stringWithUTF32String: (const OFChar32 *)string
494+ (instancetype)stringWithUTF32String: (const OFChar32 *)string
495 length: (
size_t)length
522+ (instancetype)stringWithContentsOfFile: (
OFString *)path;
533+ (instancetype)stringWithContentsOfFile: (
OFString *)path
550+ (instancetype)stringWithContentsOfIRI: (
OFIRI *)IRI;
561+ (instancetype)stringWithContentsOfIRI: (
OFIRI *)IRI
569- (instancetype)
init OF_DESIGNATED_INITIALIZER;
579- (instancetype)initWithUTF8String: (const
char *)UTF8String;
590- (instancetype)initWithUTF8String: (const
char *)UTF8String
591 length: (
size_t)UTF8StringLength;
608- (instancetype)initWithUTF8StringNoCopy: (
char *)UTF8String
609 freeWhenDone: (
bool)freeWhenDone;
628- (instancetype)initWithUTF8StringNoCopy: (
char *)UTF8String
629 length: (
size_t)UTF8StringLength
630 freeWhenDone: (
bool)freeWhenDone;
641- (instancetype)initWithCString: (const
char *)cString
654- (instancetype)initWithCString: (const
char *)cString
656 length: (
size_t)cStringLength;
667- (instancetype)initWithData: (
OFData *)data
676- (instancetype)initWithString: (
OFString *)string;
686- (instancetype)initWithCharacters: (const OFUnichar *)characters
687 length: (
size_t)length;
696- (instancetype)initWithUTF16String: (const OFChar16 *)string;
707- (instancetype)initWithUTF16String: (const OFChar16 *)string
708 length: (
size_t)length;
719- (instancetype)initWithUTF16String: (const OFChar16 *)string
733- (instancetype)initWithUTF16String: (const OFChar16 *)string
734 length: (
size_t)length
743- (instancetype)initWithUTF32String: (const OFChar32 *)string;
753- (instancetype)initWithUTF32String: (const OFChar32 *)string
754 length: (
size_t)length;
764- (instancetype)initWithUTF32String: (const OFChar32 *)string
777- (instancetype)initWithUTF32String: (const OFChar32 *)string
778 length: (
size_t)length
811 arguments: (va_list)arguments;
822- (instancetype)initWithContentsOfFile: (
OFString *)path;
833- (instancetype)initWithContentsOfFile: (
OFString *)path
851- (instancetype)initWithContentsOfIRI: (
OFIRI *)IRI;
862- (instancetype)initWithContentsOfIRI: (
OFIRI *)IRI
878- (size_t)getCString: (
char *)cString
879 maxLength: (
size_t)maxLength
894- (size_t)getLossyCString: (
char *)cString
895 maxLength: (
size_t)maxLength
972- (OFUnichar)characterAtIndex: (
size_t)index;
981- (void)getCharacters: (OFUnichar *)buffer inRange: (
OFRange)range;
1023- (size_t)indexOfCharacterFromSet: (
OFCharacterSet *)characterSet;
1055- (bool)containsString: (
OFString *)string;
1063- (
OFString *)substringFromIndex: (
size_t)idx;
1071- (
OFString *)substringToIndex: (
size_t)idx;
1100- (
long long)longLongValueWithBase: (
unsigned char)base;
1124- (
unsigned long long)unsignedLongLongValueWithBase: (
unsigned char)base;
1156 arguments: (va_list)arguments;
1167 withString: (
OFString *)replacement;
1182 withString: (
OFString *)replacement
1183 options: (
int)options
1192- (bool)hasPrefix: (
OFString *)prefix;
1200- (bool)hasSuffix: (
OFString *)suffix;
1210 componentsSeparatedByString: (
OFString *)delimiter;
1221 componentsSeparatedByString: (
OFString *)delimiter
1232 componentsSeparatedByCharactersInSet: (
OFCharacterSet *)characterSet;
1243 componentsSeparatedByCharactersInSet: (
OFCharacterSet *)characterSet
1259- (const OFChar16 *)UTF16StringWithByteOrder: (
OFByteOrder)byteOrder;
1273- (const OFChar32 *)UTF32StringWithByteOrder: (
OFByteOrder)byteOrder;
1291- (void)writeToFile: (
OFString *)path;
1310- (void)writeToIRI: (
OFIRI *)IRI;
1322#ifdef OF_HAVE_BLOCKS
1374OF_ASSUME_NONNULL_END
1376#import "OFConstantString.h"
1377#import "OFMutableString.h"
1378#import "OFString+CryptographicHashing.h"
1379#import "OFString+JSONParsing.h"
1381# import "OFString+PathAdditions.h"
1383#import "OFString+PercentEncoding.h"
1384#import "OFString+PropertyListParsing.h"
1385#import "OFString+XMLEscaping.h"
1388#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:349
OFStringEncoding OFStringEncodingParseName(OFString *name)
Parses the specified string encoding name and returns the OFStringEncoding for it.
Definition OFString.m:168
size_t OFUTF32StringLength(const OFChar32 *string)
Returns the length of the specified UTF-32 string.
Definition OFString.m:360
OFStringSeparationOptions
Options for separating strings.
Definition OFString.h:121
@ OFStringSkipEmptyComponents
Definition OFString.h:123
OFStringSearchOptions
Options for searching in strings.
Definition OFString.h:111
@ OFStringSearchBackwards
Definition OFString.h:113
OFString * OFStringEncodingName(OFStringEncoding encoding)
Returns the name of the specified OFStringEncoding.
Definition OFString.m:230
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:103
@ OFStringEncodingCodepage858
Definition OFString.h:91
@ OFStringEncodingWindows1250
Definition OFString.h:99
@ OFStringEncodingCodepage852
Definition OFString.h:101
@ 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:134
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:143
instancetype init()
Initializes an already allocated OFString to be empty.
Definition OFString.m:902
const OFUnichar * characters
The string as an array of Unicode characters.
Definition OFString.h:233
OFString * stringByDeletingEnclosingWhitespaces
The string with leading and trailing whitespaces deleted.
Definition OFString.h:275
const char * UTF8String
The OFString as a UTF-8 encoded C string.
Definition OFString.h:156
const OFChar16 * UTF16String
The string in UTF-16 encoding with native byte order.
Definition OFString.h:244
OFString * lowercaseString
The string in lowercase.
Definition OFString.h:171
unsigned long long unsignedLongLongValue
The decimal value of the string as an unsigned long long.
Definition OFString.h:206
size_t UTF16StringLength
The length of the string in UTF-16 characters.
Definition OFString.h:249
double doubleValue
The double value of the string as a double.
Definition OFString.h:222
OFString * uppercaseString
The string in uppercase.
Definition OFString.h:166
float floatValue
The float value of the string as a float.
Definition OFString.h:214
OFString * stringByDeletingTrailingWhitespaces
The string with trailing whitespaces deleted.
Definition OFString.h:270
size_t UTF8StringLength
The number of bytes the string needs in UTF-8 encoding.
Definition OFString.h:161
const OFChar32 * UTF32String
The string in UTF-32 encoding with native byte order.
Definition OFString.h:260
size_t length
The length of the string in Unicode code points.
Definition OFString.h:147
OFString * stringByExpandingWindowsEnvironmentStrings
The string with the Windows Environment Strings expanded.
Definition OFString.h:282
long long longLongValue
The decimal value of the string as a long long.
Definition OFString.h:193
OFString * capitalizedString
The string in capitalized form.
Definition OFString.h:180
instancetype string()
Creates a new OFString.
Definition OFString.m:736
OFString * stringByDeletingLeadingWhitespaces
The string with leading whitespaces deleted.
Definition OFString.h:265
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:49
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