Differences From Artifact [97c02a6c42]:
- File
src/OFString_UTF8.m
— part of check-in
[50916b8dbe]
at
2013-01-11 12:41:54
on branch trunk
— OFString: Improve API for characters / UTF-32.
With this change, there is a clear separation between characters and
UTF-32 strings now. Characters are just an array of characters in the
native endianess, with no BOM prepended. UTF-32 on the other hand may
have a BOM and can be swapped and is optionally zero-terminated.This also fixes a few missing UTF-16 init methods in OFMutableString. (user: js, size: 30904) [annotate] [blame] [check-ins using]
To Artifact [c16c78a6d7]:
- File
src/OFString_UTF8.m
— part of check-in
[9ddd33a258]
at
2013-01-12 17:29:24
on branch trunk
— Rename *UsingEncoding: to *WithEncoding:.
This reverts 5362941.
Even though *UsingEncoding: is what Foundation uses, *WithEncoding: is
more natural and is more consistent with the rest. Also, this means this
restores it to the API of 0.7. (user: js, size: 30900) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
772 773 774 775 776 777 778 | { if (s != NULL && s->freeWhenDone != NULL) free(s->freeWhenDone); [super dealloc]; } | | | | | | 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | { if (s != NULL && s->freeWhenDone != NULL) free(s->freeWhenDone); [super dealloc]; } - (const char*)cStringWithEncoding: (of_string_encoding_t)encoding { switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cString; case OF_STRING_ENCODING_ASCII: if (s->isUTF8) @throw [OFInvalidEncodingException exceptionWithClass: [self class]]; return s->cString; default: return [super cStringWithEncoding: encoding]; } } - (const char*)UTF8String { return s->cString; } - (size_t)length { return s->length; } - (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding { switch (encoding) { case OF_STRING_ENCODING_UTF_8: case OF_STRING_ENCODING_ASCII: return s->cStringLength; default: return [super cStringLengthWithEncoding: encoding]; } } - (size_t)UTF8StringLength { return s->cStringLength; } |
︙ | ︙ |