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;
156@property (readonly, nonatomic)
const char *
UTF8String OF_RETURNS_INNER_POINTER;
191@property (readonly, nonatomic)
signed char charValue;
202@property (readonly, nonatomic)
short shortValue;
213@property (readonly, nonatomic)
int intValue;
224@property (readonly, nonatomic)
long longValue;
298@property (readonly, nonatomic)
float floatValue;
317@property (readonly, nonatomic)
const OFUnichar *
characters
318 OF_RETURNS_INNER_POINTER;
329@property (readonly, nonatomic)
const OFChar16 *
UTF16String
330 OF_RETURNS_INNER_POINTER;
346@property (readonly, nonatomic)
const OFChar32 *
UTF32String
347 OF_RETURNS_INNER_POINTER;
364#if defined(OF_WINDOWS) || defined(DOXYGEN)
368@property (readonly, nonatomic)
386+ (instancetype)stringWithUTF8String: (const
char *)UTF8String;
397+ (instancetype)stringWithUTF8String: (const
char *)UTF8String
398 length: (
size_t)UTF8StringLength;
415+ (instancetype)stringWithUTF8StringNoCopy: (
char *)UTF8String
416 freeWhenDone: (
bool)freeWhenDone;
434+ (instancetype)stringWithUTF8StringNoCopy: (
char *)UTF8String
435 length: (
size_t)UTF8StringLength
436 freeWhenDone: (
bool)freeWhenDone;
446+ (instancetype)stringWithCString: (const
char *)cString
459+ (instancetype)stringWithCString: (const
char *)cString
461 length: (
size_t)cStringLength;
471+ (instancetype)stringWithData: (
OFData *)data
480+ (instancetype)stringWithString: (
OFString *)string;
490+ (instancetype)stringWithCharacters: (const OFUnichar *)characters
491 length: (
size_t)length;
500+ (instancetype)stringWithUTF16String: (const OFChar16 *)string;
511+ (instancetype)stringWithUTF16String: (const OFChar16 *)string
512 length: (
size_t)length;
523+ (instancetype)stringWithUTF16String: (const OFChar16 *)string
537+ (instancetype)stringWithUTF16String: (const OFChar16 *)string
538 length: (
size_t)length
547+ (instancetype)stringWithUTF32String: (const OFChar32 *)string;
557+ (instancetype)stringWithUTF32String: (const OFChar32 *)string
558 length: (
size_t)length;
568+ (instancetype)stringWithUTF32String: (const OFChar32 *)string
581+ (instancetype)stringWithUTF32String: (const OFChar32 *)string
582 length: (
size_t)length
609+ (instancetype)stringWithContentsOfFile: (
OFString *)path;
620+ (instancetype)stringWithContentsOfFile: (
OFString *)path
637+ (instancetype)stringWithContentsOfIRI: (
OFIRI *)IRI;
648+ (instancetype)stringWithContentsOfIRI: (
OFIRI *)IRI
656- (instancetype)
init OF_DESIGNATED_INITIALIZER;
666- (instancetype)initWithUTF8String: (const
char *)UTF8String;
677- (instancetype)initWithUTF8String: (const
char *)UTF8String
678 length: (
size_t)UTF8StringLength;
695- (instancetype)initWithUTF8StringNoCopy: (
char *)UTF8String
696 freeWhenDone: (
bool)freeWhenDone;
715- (instancetype)initWithUTF8StringNoCopy: (
char *)UTF8String
716 length: (
size_t)UTF8StringLength
717 freeWhenDone: (
bool)freeWhenDone;
728- (instancetype)initWithCString: (const
char *)cString
741- (instancetype)initWithCString: (const
char *)cString
743 length: (
size_t)cStringLength;
754- (instancetype)initWithData: (
OFData *)data
763- (instancetype)initWithString: (
OFString *)string;
773- (instancetype)initWithCharacters: (const OFUnichar *)characters
774 length: (
size_t)length;
783- (instancetype)initWithUTF16String: (const OFChar16 *)string;
794- (instancetype)initWithUTF16String: (const OFChar16 *)string
795 length: (
size_t)length;
806- (instancetype)initWithUTF16String: (const OFChar16 *)string
820- (instancetype)initWithUTF16String: (const OFChar16 *)string
821 length: (
size_t)length
830- (instancetype)initWithUTF32String: (const OFChar32 *)string;
840- (instancetype)initWithUTF32String: (const OFChar32 *)string
841 length: (
size_t)length;
851- (instancetype)initWithUTF32String: (const OFChar32 *)string
864- (instancetype)initWithUTF32String: (const OFChar32 *)string
865 length: (
size_t)length
898 arguments: (va_list)arguments;
909- (instancetype)initWithContentsOfFile: (
OFString *)path;
920- (instancetype)initWithContentsOfFile: (
OFString *)path
938- (instancetype)initWithContentsOfIRI: (
OFIRI *)IRI;
949- (instancetype)initWithContentsOfIRI: (
OFIRI *)IRI
965- (size_t)getCString: (
char *)cString
966 maxLength: (
size_t)maxLength
981- (size_t)getLossyCString: (
char *)cString
982 maxLength: (
size_t)maxLength
998 OF_RETURNS_INNER_POINTER;
1013 OF_RETURNS_INNER_POINTER;
1027 OF_RETURNS_INNER_POINTER;
1062- (OFUnichar)characterAtIndex: (
size_t)index;
1071- (void)getCharacters: (OFUnichar *)buffer inRange: (
OFRange)range;
1147 OF_DEPRECATED(ObjFW, 1, 3, "Use -[rangeOfCharacterFromSet:] instead");
1159 OF_DEPRECATED(ObjFW, 1, 3,
1160 "Use -[rangeOfCharacterFromSet:options:] instead");
1174 OF_DEPRECATED(ObjFW, 1, 3,
1175 "Use -[rangeOfCharacterFromSet:options:range:] instead");
1183- (bool)containsString: (
OFString *)string;
1191- (
OFString *)substringFromIndex: (
size_t)idx;
1199- (
OFString *)substringToIndex: (
size_t)idx;
1223- (
signed char)charValueWithBase: (
unsigned char)base;
1239- (short)shortValueWithBase: (
unsigned char)base;
1255- (int)intValueWithBase: (
unsigned char)base;
1271- (long)longValueWithBase: (
unsigned char)base;
1287- (
long long)longLongValueWithBase: (
unsigned char)base;
1303- (
unsigned char)unsignedCharValueWithBase: (
unsigned char)base;
1319- (
unsigned short)unsignedShortValueWithBase: (
unsigned char)base;
1335- (
unsigned int)unsignedIntValueWithBase: (
unsigned char)base;
1351- (
unsigned long)unsignedLongValueWithBase: (
unsigned char)base;
1368- (
unsigned long long)unsignedLongLongValueWithBase: (
unsigned char)base;
1400 arguments: (va_list)arguments;
1411 withString: (
OFString *)replacement;
1426 withString: (
OFString *)replacement
1427 options: (
int)options
1436- (bool)hasPrefix: (
OFString *)prefix;
1444- (bool)hasSuffix: (
OFString *)suffix;
1454 componentsSeparatedByString: (
OFString *)delimiter;
1465 componentsSeparatedByString: (
OFString *)delimiter
1476 componentsSeparatedByCharactersInSet: (
OFCharacterSet *)characterSet;
1487 componentsSeparatedByCharactersInSet: (
OFCharacterSet *)characterSet
1503- (const OFChar16 *)UTF16StringWithByteOrder: (
OFByteOrder)byteOrder;
1517- (const OFChar32 *)UTF32StringWithByteOrder: (
OFByteOrder)byteOrder;
1535- (void)writeToFile: (
OFString *)path;
1554- (void)writeToIRI: (
OFIRI *)IRI;
1566#ifdef OF_HAVE_BLOCKS
1618OF_ASSUME_NONNULL_END
1620#import "OFConstantString.h"
1621#import "OFMutableString.h"
1622#import "OFString+CryptographicHashing.h"
1623#import "OFString+JSONParsing.h"
1625# import "OFString+PathAdditions.h"
1627#import "OFString+PercentEncoding.h"
1628#import "OFString+PropertyListParsing.h"
1629#import "OFString+XMLEscaping.h"
1632#if !defined(NSINTEGER_DEFINED) && !__has_feature(objc_modules)
OFComparisonResult
A result of a comparison.
Definition OFObject.h:64
OFByteOrder
An enum for representing endianness.
Definition OFObject.h:98
size_t OFUTF16StringLength(const OFChar16 *string)
Returns the length of the specified UTF-16 string.
Definition OFString.m:356
OFStringEncoding OFStringEncodingParseName(OFString *name)
Parses the specified string encoding name and returns the OFStringEncoding for it.
Definition OFString.m:175
size_t OFUTF32StringLength(const OFChar32 *string)
Returns the length of the specified UTF-32 string.
Definition OFString.m:367
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:237
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:110
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:922
A class for handling strings.
Definition OFString.h:143
instancetype init()
Initializes an already allocated OFString to be empty.
Definition OFString.m:924
const OFUnichar * characters
The string as an array of Unicode characters.
Definition OFString.m:2820
OFString * stringByDeletingEnclosingWhitespaces
The string with leading and trailing whitespaces deleted.
Definition OFString.m:2251
const char * UTF8String
The OFString as a UTF-8 encoded C string.
Definition OFString.m:1593
const OFChar16 * UTF16String
The string in UTF-16 encoding with native byte order.
Definition OFString.m:2842
OFString * lowercaseString
The string in lowercase.
Definition OFString.m:2219
unsigned long long unsignedLongLongValue
The decimal value of the string as an unsigned long long.
Definition OFString.m:2676
size_t UTF16StringLength
The length of the string in UTF-16 characters.
Definition OFString.m:2909
double doubleValue
The double value of the string as a double.
Definition OFString.m:2753
unsigned long unsignedLongValue
The decimal value of the string as an unsigned long.
Definition OFString.m:2664
OFString * uppercaseString
The string in uppercase.
Definition OFString.m:2211
float floatValue
The float value of the string as a float.
Definition OFString.m:2686
OFString * stringByDeletingTrailingWhitespaces
The string with trailing whitespaces deleted.
Definition OFString.m:2243
size_t UTF8StringLength
The number of bytes the string needs in UTF-8 encoding.
Definition OFString.m:1651
const OFChar32 * UTF32String
The string in UTF-32 encoding with native byte order.
Definition OFString.m:2923
long longValue
The decimal value of the string as a long.
Definition OFString.m:2540
size_t length
The length of the string in Unicode code points.
Definition OFString.m:1600
unsigned int unsignedIntValue
The decimal value of the string as an unsigned int.
Definition OFString.m:2653
OFString * stringByExpandingWindowsEnvironmentStrings
The string with the Windows Environment Strings expanded.
Definition OFString.h:369
long long longLongValue
The decimal value of the string as a long long.
Definition OFString.m:2550
int intValue
The decimal value of the string as an int.
Definition OFString.m:2530
unsigned char unsignedCharValue
The decimal value of the string as an unsigned char.
Definition OFString.m:2629
unsigned short unsignedShortValue
The decimal value of the string as an unsigned short.
Definition OFString.m:2641
signed char charValue
The decimal value of the string as a char.
Definition OFString.m:2508
OFString * capitalizedString
The string in capitalized form.
Definition OFString.m:2227
short shortValue
The decimal value of the string as a short.
Definition OFString.m:2520
instancetype string()
Creates a new OFString.
Definition OFString.m:741
OFString * stringByDeletingLeadingWhitespaces
The string with leading whitespaces deleted.
Definition OFString.m:2235
A protocol for comparing objects.
Definition OFObject.h:1622
A protocol for the creation of copies.
Definition OFObject.h:1584
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:1605
A range.
Definition OFObject.h:116