︙ | | | ︙ | |
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#if defined(__cplusplus) && __cplusplus >= 201103L
typedef char16_t of_char16_t;
typedef char32_t of_char32_t;
#else
typedef uint_least16_t of_char16_t;
typedef uint_least32_t of_char32_t;
#endif
typedef of_char32_t of_unichar_t;
/**
* @brief The encoding of a string.
*/
typedef enum of_string_encoding_t {
/*
* UTF-8 *has* to be 0, so that if the current @ref OFLocale is
|
|
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#if defined(__cplusplus) && __cplusplus >= 201103L
typedef char16_t of_char16_t;
typedef char32_t of_char32_t;
#else
typedef uint_least16_t of_char16_t;
typedef uint_least32_t of_char32_t;
#endif
typedef of_char32_t OFUnichar;
/**
* @brief The encoding of a string.
*/
typedef enum of_string_encoding_t {
/*
* UTF-8 *has* to be 0, so that if the current @ref OFLocale is
|
︙ | | | ︙ | |
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
/**
* @brief The string as an array of Unicode characters.
*
* The result is valid until the autorelease pool is released. If you want to
* use the result outside the scope of the current autorelease pool, you have to
* copy it.
*/
@property (readonly, nonatomic) const of_unichar_t *characters
OF_RETURNS_INNER_POINTER;
/**
* @brief The string in UTF-16 encoding with native byte order.
*
* The result is valid until the autorelease pool is released. If you want to
* use the result outside the scope of the current autorelease pool, you have to
|
|
|
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
/**
* @brief The string as an array of Unicode characters.
*
* The result is valid until the autorelease pool is released. If you want to
* use the result outside the scope of the current autorelease pool, you have to
* copy it.
*/
@property (readonly, nonatomic) const OFUnichar *characters
OF_RETURNS_INNER_POINTER;
/**
* @brief The string in UTF-16 encoding with native byte order.
*
* The result is valid until the autorelease pool is released. If you want to
* use the result outside the scope of the current autorelease pool, you have to
|
︙ | | | ︙ | |
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
* @brief Creates a new OFString from a Unicode string with the specified
* length.
*
* @param characters An array of Unicode characters
* @param length The length of the Unicode character array
* @return A new autoreleased OFString
*/
+ (instancetype)stringWithCharacters: (const of_unichar_t *)characters
length: (size_t)length;
/**
* @brief Creates a new OFString from a UTF-16 encoded string.
*
* @param string The UTF-16 string
* @return A new autoreleased OFString
|
|
|
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
* @brief Creates a new OFString from a Unicode string with the specified
* length.
*
* @param characters An array of Unicode characters
* @param length The length of the Unicode character array
* @return A new autoreleased OFString
*/
+ (instancetype)stringWithCharacters: (const OFUnichar *)characters
length: (size_t)length;
/**
* @brief Creates a new OFString from a UTF-16 encoded string.
*
* @param string The UTF-16 string
* @return A new autoreleased OFString
|
︙ | | | ︙ | |
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
|
length: (size_t)length
byteOrder: (OFByteOrder)byteOrder;
/**
* @brief Creates a new OFString from a format string.
*
* See printf for the format syntax. As an addition, `%@` is available as
* format specifier for objects, `%C` for `of_unichar_t` and `%S` for
* `const of_unichar_t *`.
*
* @param format A string used as format to initialize the OFString
* @return A new autoreleased OFString
*/
+ (instancetype)stringWithFormat: (OFConstantString *)format, ...;
# ifdef OF_HAVE_FILES
|
|
|
|
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
|
length: (size_t)length
byteOrder: (OFByteOrder)byteOrder;
/**
* @brief Creates a new OFString from a format string.
*
* See printf for the format syntax. As an addition, `%@` is available as
* format specifier for objects, `%C` for `OFUnichar` and `%S` for
* `const OFUnichar *`.
*
* @param format A string used as format to initialize the OFString
* @return A new autoreleased OFString
*/
+ (instancetype)stringWithFormat: (OFConstantString *)format, ...;
# ifdef OF_HAVE_FILES
|
︙ | | | ︙ | |
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
|
* @brief Initializes an already allocated OFString with a Unicode string with
* the specified length.
*
* @param characters An array of Unicode characters
* @param length The length of the Unicode character array
* @return An initialized OFString
*/
- (instancetype)initWithCharacters: (const of_unichar_t *)characters
length: (size_t)length;
/**
* @brief Initializes an already allocated OFString with a UTF-16 string.
*
* @param string The UTF-16 string
* @return An initialized OFString
|
|
|
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
|
* @brief Initializes an already allocated OFString with a Unicode string with
* the specified length.
*
* @param characters An array of Unicode characters
* @param length The length of the Unicode character array
* @return An initialized OFString
*/
- (instancetype)initWithCharacters: (const OFUnichar *)characters
length: (size_t)length;
/**
* @brief Initializes an already allocated OFString with a UTF-16 string.
*
* @param string The UTF-16 string
* @return An initialized OFString
|
︙ | | | ︙ | |
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
|
length: (size_t)length
byteOrder: (OFByteOrder)byteOrder;
/**
* @brief Initializes an already allocated OFString with a format string.
*
* See printf for the format syntax. As an addition, `%@` is available as
* format specifier for objects, `%C` for `of_unichar_t` and `%S` for
* `const of_unichar_t *`.
*
* @param format A string used as format to initialize the OFString
* @return An initialized OFString
*/
- (instancetype)initWithFormat: (OFConstantString *)format, ...;
/**
* @brief Initializes an already allocated OFString with a format string.
*
* See printf for the format syntax. As an addition, `%@` is available as
* format specifier for objects, `%C` for `of_unichar_t` and `%S` for
* `const of_unichar_t *`.
*
* @param format A string used as format to initialize the OFString
* @param arguments The arguments used in the format string
* @return An initialized OFString
*/
- (instancetype)initWithFormat: (OFConstantString *)format
arguments: (va_list)arguments;
|
|
|
|
|
|
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
|
length: (size_t)length
byteOrder: (OFByteOrder)byteOrder;
/**
* @brief Initializes an already allocated OFString with a format string.
*
* See printf for the format syntax. As an addition, `%@` is available as
* format specifier for objects, `%C` for `OFUnichar` and `%S` for
* `const OFUnichar *`.
*
* @param format A string used as format to initialize the OFString
* @return An initialized OFString
*/
- (instancetype)initWithFormat: (OFConstantString *)format, ...;
/**
* @brief Initializes an already allocated OFString with a format string.
*
* See printf for the format syntax. As an addition, `%@` is available as
* format specifier for objects, `%C` for `OFUnichar` and `%S` for
* `const OFUnichar *`.
*
* @param format A string used as format to initialize the OFString
* @param arguments The arguments used in the format string
* @return An initialized OFString
*/
- (instancetype)initWithFormat: (OFConstantString *)format
arguments: (va_list)arguments;
|
︙ | | | ︙ | |
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
|
/**
* @brief Returns the Unicode character at the specified index.
*
* @param index The index of the Unicode character to return
* @return The Unicode character at the specified index
*/
- (of_unichar_t)characterAtIndex: (size_t)index;
/**
* @brief Copies the Unicode characters in the specified range to the specified
* buffer.
*
* @param buffer The buffer to store the Unicode characters
* @param range The range of the Unicode characters to copy
*/
- (void)getCharacters: (of_unichar_t *)buffer inRange: (OFRange)range;
/**
* @brief Returns the range of the first occurrence of the string.
*
* @param string The string to search
* @return The range of the first occurrence of the string or a range with
* `OFNotFound` as start position if it was not found
|
|
|
|
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
|
/**
* @brief Returns the Unicode character at the specified index.
*
* @param index The index of the Unicode character to return
* @return The Unicode character at the specified index
*/
- (OFUnichar)characterAtIndex: (size_t)index;
/**
* @brief Copies the Unicode characters in the specified range to the specified
* buffer.
*
* @param buffer The buffer to store the Unicode characters
* @param range The range of the Unicode characters to copy
*/
- (void)getCharacters: (OFUnichar *)buffer inRange: (OFRange)range;
/**
* @brief Returns the range of the first occurrence of the string.
*
* @param string The string to search
* @return The range of the first occurrence of the string or a range with
* `OFNotFound` as start position if it was not found
|
︙ | | | ︙ | |
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
|
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern of_string_encoding_t of_string_parse_encoding(OFString *);
extern OFString *_Nullable of_string_name_of_encoding(of_string_encoding_t);
extern size_t of_string_utf8_encode(of_unichar_t, char *);
extern ssize_t of_string_utf8_decode(const char *, size_t, of_unichar_t *);
extern size_t of_string_utf16_length(const of_char16_t *);
extern size_t of_string_utf32_length(const of_char32_t *);
#ifdef __cplusplus
}
#endif
OF_ASSUME_NONNULL_END
|
|
|
|
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
|
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern of_string_encoding_t of_string_parse_encoding(OFString *);
extern OFString *_Nullable of_string_name_of_encoding(of_string_encoding_t);
extern size_t of_string_utf8_encode(OFUnichar, char *);
extern ssize_t of_string_utf8_decode(const char *, size_t, OFUnichar *);
extern size_t of_string_utf16_length(const of_char16_t *);
extern size_t of_string_utf32_length(const of_char32_t *);
#ifdef __cplusplus
}
#endif
OF_ASSUME_NONNULL_END
|
︙ | | | ︙ | |