Differences From Artifact [9aa19fe6df]:
- File src/OFString.h — part of check-in [2969086342] at 2021-04-07 21:14:36 on branch trunk — Rename OFCryptoHash -> OFCryptographicHash (user: js, size: 43121) [annotate] [blame] [check-ins using] [more...]
To Artifact [e4caed5e17]:
- File
src/OFString.h
— part of check-in
[2fcf5a3052]
at
2021-04-29 23:24:22
on branch trunk
— Clean up struct and enum typedefs
With TYPEDEF_HIDES_STRUCT set, Doxygen properly handles anonymous
structs and enums that are typedef'd. (user: js, size: 42489) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
50 51 52 53 54 55 56 | @class OFConstantString; @class OFString; #else typedef void OFString; #endif #if defined(__cplusplus) && __cplusplus >= 201103L | | | | | | | | | | | | | | | | | | | | | | | > > > > > | > | > | < > > > > > > > > > | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | @class OFConstantString; @class OFString; #else typedef void OFString; #endif #if defined(__cplusplus) && __cplusplus >= 201103L typedef char16_t OFChar16; typedef char32_t OFChar32; #else typedef uint_least16_t OFChar16; typedef uint_least32_t OFChar32; #endif typedef OFChar32 OFUnichar; /** * @brief The encoding of a string. */ typedef enum { /* * UTF-8 *has* to be 0, so that if the current @ref OFLocale is * `nil`, `[OFLocale encoding]` returns UTF-8. */ /** UTF-8 */ OFStringEncodingUTF8, /** ASCII */ OFStringEncodingASCII, /** ISO 8859-1 */ OFStringEncodingISO8859_1, /** ISO 8859-2 */ OFStringEncodingISO8859_2, /** ISO 8859-3 */ OFStringEncodingISO8859_3, /** ISO 8859-15 */ OFStringEncodingISO8859_15, /** Windows-1251 */ OFStringEncodingWindows1251, /** Windows-1252 */ OFStringEncodingWindows1252, /** Codepage 437 */ OFStringEncodingCodepage437, /** Codepage 850 */ OFStringEncodingCodepage850, /** Codepage 858 */ OFStringEncodingCodepage858, /** Mac OS Roman */ OFStringEncodingMacRoman, /** KOI8-R */ OFStringEncodingKOI8R, /** KOI8-U */ OFStringEncodingKOI8U, /** Try to automatically detect the encoding */ OFStringEncodingAutodetect = 0xFF } OFStringEncoding; /** * @brief Options for searching in strings. * * This is a bit mask. */ typedef enum { /** Search backwards in the string */ OFStringSearchBackwards = 1 } OFStringSearchOptions; /** * @brief Options for separating strings. * * This is a bit mask. */ typedef enum { /** Skip empty components */ OFStringSkipEmptyComponents = 1 } OFStringSeparationOptions; #ifdef OF_HAVE_BLOCKS /** * @brief A block for enumerating the lines of a string. * * @param line The current line * @param stop A pointer to a variable that can be set to true to stop the * enumeration */ typedef void (^OFStringLineEnumerationBlock)(OFString *line, bool *stop); #endif #ifdef __OBJC__ @class OFArray OF_GENERIC(ObjectType); @class OFCharacterSet; @class OFURL; |
︙ | ︙ | |||
213 214 215 216 217 218 219 | /** * @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. */ | | | | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | /** * @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 * copy it. */ @property (readonly, nonatomic) const OFChar16 *UTF16String OF_RETURNS_INNER_POINTER; /** * @brief The length of the string in UTF-16 characters. */ @property (readonly, nonatomic) size_t UTF16StringLength; /** * @brief The string in UTF-32 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 * copy it. */ @property (readonly, nonatomic) const OFChar32 *UTF32String OF_RETURNS_INNER_POINTER; /** * @brief The string with leading whitespaces deleted. */ @property (readonly, nonatomic) OFString *stringByDeletingLeadingWhitespaces; |
︙ | ︙ | |||
347 348 349 350 351 352 353 | * @brief Creates a new OFString from a C string with the specified encoding. * * @param cString A C string to initialize the OFString with * @param encoding The encoding of the C string * @return A new autoreleased OFString */ + (instancetype)stringWithCString: (const char *)cString | | | | | | | | | | | | | | | | | | | | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | * @brief Creates a new OFString from a C string with the specified encoding. * * @param cString A C string to initialize the OFString with * @param encoding The encoding of the C string * @return A new autoreleased OFString */ + (instancetype)stringWithCString: (const char *)cString encoding: (OFStringEncoding)encoding; /** * @brief Creates a new OFString from a C string with the specified encoding * and length. * * @param cString A C string to initialize the OFString with * @param encoding The encoding of the C string * @param cStringLength The length of the C string * @return A new autoreleased OFString */ + (instancetype)stringWithCString: (const char *)cString encoding: (OFStringEncoding)encoding length: (size_t)cStringLength; /** * @brief Creates a new OFString from OFData with the specified encoding. * * @param data OFData with the contents of the string * @param encoding The encoding in which the string is stored in the OFData * @return An new autoreleased OFString */ + (instancetype)stringWithData: (OFData *)data encoding: (OFStringEncoding)encoding; /** * @brief Creates a new OFString from another string. * * @param string A string to initialize the OFString with * @return A new autoreleased OFString */ + (instancetype)stringWithString: (OFString *)string; /** * @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 */ + (instancetype)stringWithUTF16String: (const OFChar16 *)string; /** * @brief Creates a new OFString from a UTF-16 encoded string with the * specified length. * * @param string The UTF-16 string * @param length The length of the UTF-16 string * @return A new autoreleased OFString */ + (instancetype)stringWithUTF16String: (const OFChar16 *)string length: (size_t)length; /** * @brief Creates a new OFString from a UTF-16 encoded string, assuming the * specified byte order if no byte order mark is found. * * @param string The UTF-16 string * @param byteOrder The byte order to assume if there is no byte order mark * @return A new autoreleased OFString */ + (instancetype)stringWithUTF16String: (const OFChar16 *)string byteOrder: (OFByteOrder)byteOrder; /** * @brief Creates a new OFString from a UTF-16 encoded string with the * specified length, assuming the specified byte order if no byte order * mark is found. * * @param string The UTF-16 string * @param length The length of the UTF-16 string * @param byteOrder The byte order to assume if there is no byte order mark * @return A new autoreleased OFString */ + (instancetype)stringWithUTF16String: (const OFChar16 *)string length: (size_t)length byteOrder: (OFByteOrder)byteOrder; /** * @brief Creates a new OFString from a UTF-32 encoded string. * * @param string The UTF-32 string * @return A new autoreleased OFString */ + (instancetype)stringWithUTF32String: (const OFChar32 *)string; /** * @brief Creates a new OFString from a UTF-32 encoded string with the * specified length. * * @param string The UTF-32 string * @param length The length of the UTF-32 string * @return A new autoreleased OFString */ + (instancetype)stringWithUTF32String: (const OFChar32 *)string length: (size_t)length; /** * @brief Creates a new OFString from a UTF-32 encoded string, assuming the * specified byte order if no byte order mark is found. * * @param string The UTF-32 string * @param byteOrder The byte order to assume if there is no byte order mark * @return A new autoreleased OFString */ + (instancetype)stringWithUTF32String: (const OFChar32 *)string byteOrder: (OFByteOrder)byteOrder; /** * @brief Creates a new OFString from a UTF-32 encoded string with the * specified length, assuming the specified byte order if no byte order * mark is found. * * @param string The UTF-32 string * @param length The length of the UTF-32 string * @param byteOrder The byte order to assume if there is no byte order mark * @return A new autoreleased OFString */ + (instancetype)stringWithUTF32String: (const OFChar32 *)string 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 |
︙ | ︙ | |||
510 511 512 513 514 515 516 | * specified encoding. * * @param path The path to the file * @param encoding The encoding of the file * @return A new autoreleased OFString */ + (instancetype)stringWithContentsOfFile: (OFString *)path | | | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | * specified encoding. * * @param path The path to the file * @param encoding The encoding of the file * @return A new autoreleased OFString */ + (instancetype)stringWithContentsOfFile: (OFString *)path encoding: (OFStringEncoding)encoding; # endif /** * @brief Creates a new OFString with the contents of the specified URL. * * If the URL's scheme is file, it tries UTF-8 encoding. * |
︙ | ︙ | |||
536 537 538 539 540 541 542 | * specified encoding. * * @param URL The URL to the contents for the string * @param encoding The encoding to assume * @return A new autoreleased OFString */ + (instancetype)stringWithContentsOfURL: (OFURL *)URL | | | 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | * specified encoding. * * @param URL The URL to the contents for the string * @param encoding The encoding to assume * @return A new autoreleased OFString */ + (instancetype)stringWithContentsOfURL: (OFURL *)URL encoding: (OFStringEncoding)encoding; /** * @brief Initializes an already allocated OFString from a UTF-8 encoded C * string. * * @param UTF8String A UTF-8 encoded C string to initialize the OFString with * @return An initialized OFString |
︙ | ︙ | |||
604 605 606 607 608 609 610 | * specified encoding. * * @param cString A C string to initialize the OFString with * @param encoding The encoding of the C string * @return An initialized OFString */ - (instancetype)initWithCString: (const char *)cString | | | | | | | | | | | | | | | | | | | | | | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 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 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | * specified encoding. * * @param cString A C string to initialize the OFString with * @param encoding The encoding of the C string * @return An initialized OFString */ - (instancetype)initWithCString: (const char *)cString encoding: (OFStringEncoding)encoding; /** * @brief Initializes an already allocated OFString from a C string with the * specified encoding and length. * * @param cString A C string to initialize the OFString with * @param encoding The encoding of the C string * @param cStringLength The length of the C string * @return An initialized OFString */ - (instancetype)initWithCString: (const char *)cString encoding: (OFStringEncoding)encoding length: (size_t)cStringLength; /** * @brief Initializes an already allocated OFString from OFData with the * specified encoding. * * @param data OFData with the contents of the string * @param encoding The encoding in which the string is stored in the OFData * @return An initialized OFString */ - (instancetype)initWithData: (OFData *)data encoding: (OFStringEncoding)encoding; /** * @brief Initializes an already allocated OFString with another string. * * @param string A string to initialize the OFString with * @return An initialized OFString */ - (instancetype)initWithString: (OFString *)string; /** * @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 */ - (instancetype)initWithUTF16String: (const OFChar16 *)string; /** * @brief Initializes an already allocated OFString with a UTF-16 string with * the specified length. * * @param string The UTF-16 string * @param length The length of the UTF-16 string * @return An initialized OFString */ - (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length; /** * @brief Initializes an already allocated OFString with a UTF-16 string, * assuming the specified byte order if no byte order mark is found. * * @param string The UTF-16 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ - (instancetype)initWithUTF16String: (const OFChar16 *)string byteOrder: (OFByteOrder)byteOrder; /** * @brief Initializes an already allocated OFString with a UTF-16 string with * the specified length, assuming the specified byte order if no byte * order mark is found. * * @param string The UTF-16 string * @param length The length of the UTF-16 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ - (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length byteOrder: (OFByteOrder)byteOrder; /** * @brief Initializes an already allocated OFString with a UTF-32 string. * * @param string The UTF-32 string * @return An initialized OFString */ - (instancetype)initWithUTF32String: (const OFChar32 *)string; /** * @brief Initializes an already allocated OFString with a UTF-32 string with * the specified length * * @param string The UTF-32 string * @param length The length of the UTF-32 string * @return An initialized OFString */ - (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length; /** * @brief Initializes an already allocated OFString with a UTF-32 string, * assuming the specified byte order if no byte order mark is found. * * @param string The UTF-32 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ - (instancetype)initWithUTF32String: (const OFChar32 *)string byteOrder: (OFByteOrder)byteOrder; /** * @brief Initializes an already allocated OFString with a UTF-32 string with * the specified length, assuming the specified byte order if no byte * order mark is found. * * @param string The UTF-32 string * @param length The length of the UTF-32 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ - (instancetype)initWithUTF32String: (const OFChar32 *)string 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; |
︙ | ︙ | |||
782 783 784 785 786 787 788 | * specified file in the specified encoding. * * @param path The path to the file * @param encoding The encoding of the file * @return An initialized OFString */ - (instancetype)initWithContentsOfFile: (OFString *)path | | | 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 | * specified file in the specified encoding. * * @param path The path to the file * @param encoding The encoding of the file * @return An initialized OFString */ - (instancetype)initWithContentsOfFile: (OFString *)path encoding: (OFStringEncoding)encoding; # endif /** * @brief Initializes an already allocated OFString with the contents of the * specified URL. * * If the URL's scheme is file, it tries UTF-8 encoding. |
︙ | ︙ | |||
809 810 811 812 813 814 815 | * specified URL in the specified encoding. * * @param URL The URL to the contents for the string * @param encoding The encoding to assume * @return An initialized OFString */ - (instancetype)initWithContentsOfURL: (OFURL *)URL | | | | | | | | | | | | | | < < < < | | > | < < < < | | | | | | < < < < | | | < < < < | | | | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 | * specified URL in the specified encoding. * * @param URL The URL to the contents for the string * @param encoding The encoding to assume * @return An initialized OFString */ - (instancetype)initWithContentsOfURL: (OFURL *)URL encoding: (OFStringEncoding)encoding; /** * @brief Writes the OFString into the specified C string with the specified * encoding. * * @param cString The C string to write into * @param maxLength The maximum number of bytes to write into the C string, * including the terminating zero * @param encoding The encoding to use for writing into the C string * @return The number of bytes written into the C string, without the * terminating zero */ - (size_t)getCString: (char *)cString maxLength: (size_t)maxLength encoding: (OFStringEncoding)encoding; /** * @brief Writes the OFString into the specified C string with the specified * encoding, replacing characters that cannot be represented in the * specified encoding with a question mark. * * @param cString The C string to write into * @param maxLength The maximum number of bytes to write into the C string, * including the terminating zero * @param encoding The encoding to use for writing into the C string * @return The number of bytes written into the C string, without the * terminating zero */ - (size_t)getLossyCString: (char *)cString maxLength: (size_t)maxLength encoding: (OFStringEncoding)encoding; /** * @brief Returns the OFString as a C string in the specified encoding. * * 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. * * @param encoding The encoding for the C string * @return The OFString as a C string in the specified encoding */ - (const char *)cStringWithEncoding: (OFStringEncoding)encoding OF_RETURNS_INNER_POINTER; /** * @brief Returns the OFString as a C string in the specified encoding, * replacing characters that cannot be represented in the specified * encoding with a question mark. * * 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. * * @param encoding The encoding for the C string * @return The OFString as a C string in the specified encoding */ - (const char *)lossyCStringWithEncoding: (OFStringEncoding)encoding OF_RETURNS_INNER_POINTER; /** * @brief Returns the number of bytes the string needs in the specified * encoding. * * @param encoding The encoding for the string * @return The number of bytes the string needs in the specified encoding. */ - (size_t)cStringLengthWithEncoding: (OFStringEncoding)encoding; /** * @brief Compares the string to another string. * * @param string The string to compare the string to * @return The result of the comparison */ - (OFComparisonResult)compare: (OFString *)string; /** * @brief Compares the string to another string without caring about the case. * * @param string The string to compare the string to * @return The result of the comparison */ - (OFComparisonResult)caseInsensitiveCompare: (OFString *)string; /** * @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 */ - (OFRange)rangeOfString: (OFString *)string; /** * @brief Returns the range of the string. * * @param string The string to search * @param options Options modifying search behavior * @return The range of the first occurrence of the string or a range with * `OFNotFound` as start position if it was not found */ - (OFRange)rangeOfString: (OFString *)string options: (OFStringSearchOptions)options; /** * @brief Returns the range of the string in the specified range. * * @param string The string to search * @param options Options modifying search behaviour * @param range The range in which 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 */ - (OFRange)rangeOfString: (OFString *)string options: (OFStringSearchOptions)options range: (OFRange)range; /** * @brief Returns the index of the first character from the set. * * @param characterSet The set of characters to search for * @return The index of the first occurrence of a character from the set or * `OFNotFound` if it was not found */ - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet; /** * @brief Returns the index of the first character from the set. * * @param characterSet The set of characters to search for * @param options Options modifying search behaviour * @return The index of the first occurrence of a character from the set or * `OFNotFound` if it was not found */ - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (OFStringSearchOptions)options; /** * @brief Returns the index of the first character from the set. * * @param characterSet The set of characters to search for * @param options Options modifying search behaviour * @param range The range in which to search * @return The index of the first occurrence of a character from the set or * `OFNotFound` if it was not found */ - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (OFStringSearchOptions)options range: (OFRange)range; /** * @brief Returns whether the string contains the specified string. * * @param string The string to search * @return Whether the string contains the specified string */ |
︙ | ︙ | |||
1023 1024 1025 1026 1027 1028 1029 | /** * @brief Creates a substring with the specified range. * * @param range The range of the substring * @return The substring as a new autoreleased OFString */ | | | 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 | /** * @brief Creates a substring with the specified range. * * @param range The range of the substring * @return The substring as a new autoreleased OFString */ - (OFString *)substringWithRange: (OFRange)range; /** * @brief The value of the string in the specified base as a `long long`. * * Leading and trailing whitespaces are ignored. * * If the string contains any non-number characters, an |
︙ | ︙ | |||
1124 1125 1126 1127 1128 1129 1130 | * * None yet * @param range The range in which to replace the string * @return A new string with the occurrences of the specified string replaced */ - (OFString *)stringByReplacingOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options | | | 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 | * * None yet * @param range The range in which to replace the string * @return A new string with the occurrences of the specified string replaced */ - (OFString *)stringByReplacingOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options range: (OFRange)range; /** * @brief Checks whether the string has the specified prefix. * * @param prefix The prefix to check for * @return A boolean whether the string has the specified prefix */ |
︙ | ︙ | |||
1157 1158 1159 1160 1161 1162 1163 | componentsSeparatedByString: (OFString *)delimiter; /** * @brief Separates the string into an array of strings, split by the specified * delimiter. * * @param delimiter The delimiter for separating | | < < < < | | < < < < | | | | | | | > > > > > > > > > > > | > > > > > > | | > > | | | | 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 | componentsSeparatedByString: (OFString *)delimiter; /** * @brief Separates the string into an array of strings, split by the specified * delimiter. * * @param delimiter The delimiter for separating * @param options Options according to which the string should be separated * @return An autoreleased OFArray with the separated string */ - (OFArray OF_GENERIC(OFString *) *) componentsSeparatedByString: (OFString *)delimiter options: (OFStringSeparationOptions)options; /** * @brief Separates the string into an array of strings, split by characters in * the specified set. * * @param characterSet The character set for separating * @return An autoreleased OFArray with the separated string */ - (OFArray OF_GENERIC(OFString *) *) componentsSeparatedByCharactersInSet: (OFCharacterSet *)characterSet; /** * @brief Separates the string into an array of strings, split by characters in * the specified set. * * @param characterSet The character set for separating * @param options Options according to which the string should be separated * @return An autoreleased OFArray with the separated string */ - (OFArray OF_GENERIC(OFString *) *) componentsSeparatedByCharactersInSet: (OFCharacterSet *)characterSet options: (OFStringSeparationOptions)options; /** * @brief Returns the string in UTF-16 encoding with the specified 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 * copy it. * * @param byteOrder The byte order for the UTF-16 encoding * @return The string in UTF-16 encoding with the specified byte order */ - (const OFChar16 *)UTF16StringWithByteOrder: (OFByteOrder)byteOrder OF_RETURNS_INNER_POINTER; /** * @brief Returns the string in UTF-32 encoding with the specified 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 * copy it. * * @param byteOrder The byte order for the UTF-32 encoding * @return The string in UTF-32 encoding with the specified byte order */ - (const OFChar32 *)UTF32StringWithByteOrder: (OFByteOrder)byteOrder OF_RETURNS_INNER_POINTER; /** * @brief Returns the string as OFData with the specified encoding. * * @param encoding The encoding to use for the returned OFData * @return The string as OFData with the specified encoding */ - (OFData *)dataWithEncoding: (OFStringEncoding)encoding; # ifdef OF_HAVE_FILES /** * @brief Writes the string into the specified file using UTF-8 encoding. * * @param path The path of the file to write to */ - (void)writeToFile: (OFString *)path; /** * @brief Writes the string into the specified file using the specified * encoding. * * @param path The path of the file to write to * @param encoding The encoding to use to write the string into the file */ - (void)writeToFile: (OFString *)path encoding: (OFStringEncoding)encoding; # endif /** * @brief Writes the string to the specified URL using UTF-8 encoding. * * @param URL The URL to write to */ - (void)writeToURL: (OFURL *)URL; /** * @brief Writes the string to the specified URL using the specified encoding. * * @param URL The URL to write to * @param encoding The encoding to use to write the string to the URL */ - (void)writeToURL: (OFURL *)URL encoding: (OFStringEncoding)encoding; # ifdef OF_HAVE_BLOCKS /** * Enumerates all lines in the receiver using the specified block. * * @brief block The block to call for each line */ - (void)enumerateLinesUsingBlock: (OFStringLineEnumerationBlock)block; # endif @end #endif #ifdef __cplusplus extern "C" { #endif /** * @brief Parses the specified string encoding name and returns the * OFStringEncoding for it. * * Throws @ref OFInvalidArgumentException if the specified name is not a valid * encoding name. * * @param name The name to parse as a string encoding * @return The OFStringEncoding for the specified name */ extern OFStringEncoding OFStringEncodingParseName(OFString *name); /** * @brief Returns the name of the specified OFStringEncoding. * * @param encoding The encoding for which to return the name * @return The name of the specified OFStringEncoding */ extern OFString *_Nullable OFStringEncodingName(OFStringEncoding encoding); extern char *_Nullable OFStrDup(const char *_Nonnull); extern size_t OFUTF8StringEncode(OFUnichar, char *); extern ssize_t OFUTF8StringDecode(const char *, size_t, OFUnichar *); extern size_t OFUTF16StringLength(const OFChar16 *); extern size_t OFUTF32StringLength(const OFChar32 *); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END #include "OFConstantString.h" |
︙ | ︙ |