37 class StringThreadTest;
39 #ifndef U_COMPARE_CODE_POINT_ORDER
46 #define U_COMPARE_CODE_POINT_ORDER 0x8000
61 #ifndef U_STRING_CASE_MAPPER_DEFINED
62 #define U_STRING_CASE_MAPPER_DEFINED
70 UChar *dest, int32_t destCapacity,
71 const UChar *src, int32_t srcLength,
80 class StringCharacterIterator;
81 class UnicodeStringAppendable;
95 #define US_INV icu::UnicodeString::kInvariant
114 #if defined(U_DECLARE_UTF16)
115 # define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const UChar *)U_DECLARE_UTF16(cs), _length)
116 #elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
117 # define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const UChar *)L ## cs, _length)
118 #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
119 # define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const UChar *)cs, _length)
121 # define UNICODE_STRING(cs, _length) icu::UnicodeString(cs, _length, US_INV)
137 #define UNICODE_STRING_SIMPLE(cs) UNICODE_STRING(cs, -1)
146 #ifndef UNISTR_FROM_CHAR_EXPLICIT
147 # if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION)
149 # define UNISTR_FROM_CHAR_EXPLICIT explicit
152 # define UNISTR_FROM_CHAR_EXPLICIT
166 #ifndef UNISTR_FROM_STRING_EXPLICIT
167 # if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION)
169 # define UNISTR_FROM_STRING_EXPLICIT explicit
172 # define UNISTR_FROM_STRING_EXPLICIT
353 inline int8_t compare(int32_t start,
374 inline int8_t compare(int32_t start,
378 int32_t srcLength)
const;
392 inline int8_t compare(
const UChar *srcChars,
393 int32_t srcLength)
const;
409 inline int8_t compare(int32_t start,
411 const UChar *srcChars)
const;
430 inline int8_t compare(int32_t start,
432 const UChar *srcChars,
434 int32_t srcLength)
const;
453 inline int8_t compareBetween(int32_t start,
457 int32_t srcLimit)
const;
476 inline int8_t compareCodePointOrder(
const UnicodeString& text)
const;
497 inline int8_t compareCodePointOrder(int32_t start,
522 inline int8_t compareCodePointOrder(int32_t start,
526 int32_t srcLength)
const;
546 inline int8_t compareCodePointOrder(
const UChar *srcChars,
547 int32_t srcLength)
const;
568 inline int8_t compareCodePointOrder(int32_t start,
570 const UChar *srcChars)
const;
593 inline int8_t compareCodePointOrder(int32_t start,
595 const UChar *srcChars,
597 int32_t srcLength)
const;
620 inline int8_t compareCodePointOrderBetween(int32_t start,
624 int32_t srcLimit)
const;
644 inline int8_t caseCompare(
const UnicodeString& text, uint32_t options)
const;
666 inline int8_t caseCompare(int32_t start,
669 uint32_t options)
const;
693 inline int8_t caseCompare(int32_t start,
698 uint32_t options)
const;
719 inline int8_t caseCompare(
const UChar *srcChars,
721 uint32_t options)
const;
743 inline int8_t caseCompare(int32_t start,
745 const UChar *srcChars,
746 uint32_t options)
const;
770 inline int8_t caseCompare(int32_t start,
772 const UChar *srcChars,
775 uint32_t options)
const;
799 inline int8_t caseCompareBetween(int32_t start,
804 uint32_t options)
const;
827 int32_t srcLength)
const;
837 inline UBool startsWith(
const UChar *srcChars,
838 int32_t srcLength)
const;
849 inline UBool startsWith(
const UChar *srcChars,
851 int32_t srcLength)
const;
874 int32_t srcLength)
const;
885 int32_t srcLength)
const;
899 int32_t srcLength)
const;
924 int32_t start)
const;
939 int32_t length)
const;
961 int32_t length)
const;
974 inline int32_t indexOf(
const UChar *srcChars,
976 int32_t start)
const;
990 inline int32_t indexOf(
const UChar *srcChars,
993 int32_t length)
const;
1011 int32_t indexOf(
const UChar *srcChars,
1015 int32_t length)
const;
1024 inline int32_t indexOf(
UChar c)
const;
1034 inline int32_t indexOf(
UChar32 c)
const;
1044 inline int32_t indexOf(
UChar c,
1045 int32_t start)
const;
1056 inline int32_t indexOf(
UChar32 c,
1057 int32_t start)
const;
1069 inline int32_t indexOf(
UChar c,
1071 int32_t length)
const;
1084 inline int32_t indexOf(
UChar32 c,
1086 int32_t length)
const;
1096 inline int32_t lastIndexOf(
const UnicodeString& text)
const;
1108 int32_t start)
const;
1123 int32_t length)
const;
1145 int32_t length)
const;
1157 inline int32_t lastIndexOf(
const UChar *srcChars,
1159 int32_t start)
const;
1173 inline int32_t lastIndexOf(
const UChar *srcChars,
1176 int32_t length)
const;
1194 int32_t lastIndexOf(
const UChar *srcChars,
1198 int32_t length)
const;
1207 inline int32_t lastIndexOf(
UChar c)
const;
1217 inline int32_t lastIndexOf(
UChar32 c)
const;
1227 inline int32_t lastIndexOf(
UChar c,
1228 int32_t start)
const;
1239 inline int32_t lastIndexOf(
UChar32 c,
1240 int32_t start)
const;
1252 inline int32_t lastIndexOf(
UChar c,
1254 int32_t length)
const;
1267 inline int32_t lastIndexOf(
UChar32 c,
1269 int32_t length)
const;
1291 inline UChar operator[] (int32_t offset)
const;
1321 int32_t getChar32Start(int32_t offset)
const;
1339 int32_t getChar32Limit(int32_t offset)
const;
1391 int32_t moveIndex32(int32_t index, int32_t delta)
const;
1410 inline void extract(int32_t start,
1413 int32_t dstStart = 0)
const;
1437 extract(
UChar *dest, int32_t destCapacity,
1450 inline void extract(int32_t start,
1468 int32_t dstStart = 0)
const;
1504 int32_t extract(int32_t start,
1505 int32_t startLength,
1507 int32_t targetCapacity,
1508 enum EInvariant inv)
const;
1510 #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
1531 int32_t extract(int32_t start,
1532 int32_t startLength,
1534 uint32_t targetLength)
const;
1538 #if !UCONFIG_NO_CONVERSION
1565 inline int32_t extract(int32_t start,
1566 int32_t startLength,
1568 const char *codepage = 0)
const;
1599 int32_t extract(int32_t start,
1600 int32_t startLength,
1602 uint32_t targetLength,
1603 const char *codepage)
const;
1622 int32_t extract(
char *dest, int32_t destCapacity,
1668 #if U_HAVE_STD_STRING
1682 template<
typename StringClass>
1718 inline int32_t
length(
void)
const;
1734 countChar32(int32_t start=0, int32_t length=
INT32_MAX)
const;
1760 hasMoreChar32Than(int32_t start, int32_t length, int32_t number)
const;
1767 inline UBool isEmpty(
void)
const;
1778 inline int32_t getCapacity(
void)
const;
1787 inline int32_t hashCode(
void)
const;
1801 inline UBool isBogus(
void)
const;
1958 int32_t textLength);
1981 int32_t buffCapacity);
2183 const UChar *srcChars,
2197 const UChar *srcChars,
2283 const UChar *srcChars,
2301 const UChar *srcChars,
2401 virtual void copy(int32_t start, int32_t limit, int32_t dest);
2514 UBool padLeading(int32_t targetLength,
2515 UChar padChar = 0x0020);
2528 UBool padTrailing(int32_t targetLength,
2529 UChar padChar = 0x0020);
2537 inline UBool truncate(int32_t targetLength);
2601 #if !UCONFIG_NO_BREAK_ITERATION
2757 UChar *getBuffer(int32_t minCapacity);
2779 void releaseBuffer(int32_t newLength=-1);
2811 inline const UChar *getBuffer()
const;
2846 const UChar *getTerminatedBuffer();
2912 int32_t textLength);
2938 int32_t textLength);
2960 #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION
2991 UnicodeString(
const char *codepageData, int32_t dataLength);
2995 #if !UCONFIG_NO_CONVERSION
3014 UnicodeString(
const char *codepageData,
const char *codepage);
3033 UnicodeString(
const char *codepageData, int32_t dataLength,
const char *codepage);
3057 const char *src, int32_t srcLength,
3087 UnicodeString(
const char *src, int32_t length,
enum EInvariant inv);
3222 UChar32 unescapeAt(int32_t &offset)
const;
3229 static UClassID U_EXPORT2 getStaticClassID();
3272 toUTF8(int32_t start, int32_t len,
3273 char *target, int32_t capacity)
const;
3282 doCompare(int32_t start,
3286 int32_t srcLength)
const;
3288 int8_t doCompare(int32_t start,
3290 const UChar *srcChars,
3292 int32_t srcLength)
const;
3295 doCompareCodePointOrder(int32_t start,
3299 int32_t srcLength)
const;
3301 int8_t doCompareCodePointOrder(int32_t start,
3303 const UChar *srcChars,
3305 int32_t srcLength)
const;
3308 doCaseCompare(int32_t start,
3313 uint32_t options)
const;
3316 doCaseCompare(int32_t start,
3318 const UChar *srcChars,
3321 uint32_t options)
const;
3323 int32_t doIndexOf(
UChar c,
3325 int32_t length)
const;
3329 int32_t length)
const;
3331 int32_t doLastIndexOf(
UChar c,
3333 int32_t length)
const;
3335 int32_t doLastIndexOf(
UChar32 c,
3337 int32_t length)
const;
3339 void doExtract(int32_t start,
3342 int32_t dstStart)
const;
3344 inline void doExtract(int32_t start,
3348 inline UChar doCharAt(int32_t offset)
const;
3358 const UChar *srcChars,
3366 int32_t doHashCode(
void)
const;
3370 inline UChar* getArrayStart(
void);
3371 inline const UChar* getArrayStart(
void)
const;
3375 inline UBool isWritable()
const;
3378 inline UBool isBufferWritable()
const;
3381 inline void setLength(int32_t len);
3382 inline void setToEmpty();
3383 inline void setArray(
UChar *array, int32_t len, int32_t capacity);
3389 UBool allocate(int32_t capacity);
3392 void releaseArray(
void);
3401 inline void pinIndex(int32_t& start)
const;
3402 inline void pinIndices(int32_t& start,
3403 int32_t& length)
const;
3405 #if !UCONFIG_NO_CONVERSION
3408 int32_t doExtract(int32_t start, int32_t length,
3409 char *dest, int32_t destCapacity,
3423 void doCodepageCreate(
const char *codepageData,
3425 const char *codepage);
3432 doCodepageCreate(
const char *codepageData,
3450 UBool cloneArrayIfNeeded(int32_t newCapacity = -1,
3451 int32_t growCapacity = -1,
3453 int32_t **pBufferToDelete = 0,
3466 int32_t removeRef(
void);
3467 int32_t refCount(
void)
const;
3473 US_STACKBUF_SIZE=
sizeof(
void *)==4 ? 13 : 15,
3474 kInvalidUChar=0xffff,
3481 kUsingStackBuffer=2,
3483 kBufferIsReadonly=8,
3488 kShortString=kUsingStackBuffer,
3489 kLongString=kRefCounted,
3490 kReadonlyAlias=kBufferIsReadonly,
3494 friend class StringThreadTest;
3497 union StackBufferOrFields;
3498 friend union StackBufferOrFields;
3535 union StackBufferOrFields {
3538 UChar fStackBuffer[8];
3545 UChar fRestOfStackBuffer[US_STACKBUF_SIZE-8];
3546 int8_t fShortLength;
3559 operator+ (
const UnicodeString &s1,
const UnicodeString &s2);
3570 UnicodeString::pinIndex(int32_t& start)
const
3575 }
else if(start >
length()) {
3581 UnicodeString::pinIndices(int32_t& start,
3582 int32_t& _length)
const
3588 }
else if(start > len) {
3593 }
else if(_length > (len - start)) {
3594 _length = (len - start);
3599 UnicodeString::getArrayStart()
3600 {
return (fFlags&kUsingStackBuffer) ? fUnion.fStackBuffer : fUnion.fFields.fArray; }
3603 UnicodeString::getArrayStart()
const
3604 {
return (fFlags&kUsingStackBuffer) ? fUnion.fStackBuffer : fUnion.fFields.fArray; }
3613 fFlags(kShortString)
3621 {
return fShortLength>=0 ? fShortLength : fUnion.fFields.fLength; }
3625 {
return (fFlags&kUsingStackBuffer) ? US_STACKBUF_SIZE : fUnion.fFields.fCapacity; }
3629 {
return doHashCode(); }
3633 {
return (
UBool)(fFlags & kIsBogus); }
3636 UnicodeString::isWritable()
const
3637 {
return (
UBool)!(fFlags&(kOpenGetBuffer|kIsBogus)); }
3640 UnicodeString::isBufferWritable()
const
3643 !(fFlags&(kOpenGetBuffer|kIsBogus|kBufferIsReadonly)) &&
3644 (!(fFlags&kRefCounted) || refCount()==1));
3647 inline const UChar *
3649 if(fFlags&(kIsBogus|kOpenGetBuffer)) {
3651 }
else if(fFlags&kUsingStackBuffer) {
3652 return fUnion.fStackBuffer;
3654 return fUnion.fFields.fArray;
3662 UnicodeString::doCompare(int32_t start,
3666 int32_t srcLength)
const
3671 srcText.pinIndices(srcStart, srcLength);
3672 return doCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength);
3683 return !text.
isBogus() && len == textLength && doEquals(text, len);
3689 {
return (!
operator==(text)); }
3693 {
return doCompare(0,
length(), text, 0, text.
length()) == 1; }
3697 {
return doCompare(0,
length(), text, 0, text.
length()) == -1; }
3701 {
return doCompare(0,
length(), text, 0, text.
length()) != -1; }
3705 {
return doCompare(0,
length(), text, 0, text.
length()) != 1; }
3709 {
return doCompare(0,
length(), text, 0, text.
length()); }
3715 {
return doCompare(start, _length, srcText, 0, srcText.
length()); }
3719 int32_t srcLength)
const
3720 {
return doCompare(0,
length(), srcChars, 0, srcLength); }
3727 int32_t srcLength)
const
3728 {
return doCompare(start, _length, srcText, srcStart, srcLength); }
3733 const UChar *srcChars)
const
3734 {
return doCompare(start, _length, srcChars, 0, _length); }
3739 const UChar *srcChars,
3741 int32_t srcLength)
const
3742 {
return doCompare(start, _length, srcChars, srcStart, srcLength); }
3749 int32_t srcLimit)
const
3750 {
return doCompare(start, limit - start,
3751 srcText, srcStart, srcLimit - srcStart); }
3754 UnicodeString::doCompareCodePointOrder(int32_t start,
3758 int32_t srcLength)
const
3763 srcText.pinIndices(srcStart, srcLength);
3764 return doCompareCodePointOrder(start, thisLength, srcText.getArrayStart(), srcStart, srcLength);
3770 {
return doCompareCodePointOrder(0,
length(), text, 0, text.
length()); }
3776 {
return doCompareCodePointOrder(start, _length, srcText, 0, srcText.
length()); }
3780 int32_t srcLength)
const
3781 {
return doCompareCodePointOrder(0,
length(), srcChars, 0, srcLength); }
3788 int32_t srcLength)
const
3789 {
return doCompareCodePointOrder(start, _length, srcText, srcStart, srcLength); }
3794 const UChar *srcChars)
const
3795 {
return doCompareCodePointOrder(start, _length, srcChars, 0, _length); }
3800 const UChar *srcChars,
3802 int32_t srcLength)
const
3803 {
return doCompareCodePointOrder(start, _length, srcChars, srcStart, srcLength); }
3810 int32_t srcLimit)
const
3811 {
return doCompareCodePointOrder(start, limit - start,
3812 srcText, srcStart, srcLimit - srcStart); }
3815 UnicodeString::doCaseCompare(int32_t start,
3820 uint32_t options)
const
3825 srcText.pinIndices(srcStart, srcLength);
3826 return doCaseCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength, options);
3832 return doCaseCompare(0,
length(), text, 0, text.
length(), options);
3839 uint32_t options)
const {
3840 return doCaseCompare(start, _length, srcText, 0, srcText.
length(), options);
3846 uint32_t options)
const {
3847 return doCaseCompare(0,
length(), srcChars, 0, srcLength, options);
3856 uint32_t options)
const {
3857 return doCaseCompare(start, _length, srcText, srcStart, srcLength, options);
3863 const UChar *srcChars,
3864 uint32_t options)
const {
3865 return doCaseCompare(start, _length, srcChars, 0, _length, options);
3871 const UChar *srcChars,
3874 uint32_t options)
const {
3875 return doCaseCompare(start, _length, srcChars, srcStart, srcLength, options);
3884 uint32_t options)
const {
3885 return doCaseCompare(start, limit - start, srcText, srcStart, srcLimit - srcStart, options);
3893 int32_t _length)
const
3896 srcText.pinIndices(srcStart, srcLength);
3898 return indexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length);
3910 int32_t start)
const {
3918 int32_t _length)
const
3924 int32_t start)
const {
3926 return indexOf(srcChars, 0, srcLength, start,
length() - start);
3933 int32_t _length)
const
3934 {
return indexOf(srcChars, 0, srcLength, start, _length); }
3939 int32_t _length)
const
3940 {
return doIndexOf(c, start, _length); }
3945 int32_t _length)
const
3946 {
return doIndexOf(c, start, _length); }
3950 {
return doIndexOf(c, 0,
length()); }
3958 int32_t start)
const {
3960 return doIndexOf(c, start,
length() - start);
3965 int32_t start)
const {
3974 int32_t _length)
const
3975 {
return lastIndexOf(srcChars, 0, srcLength, start, _length); }
3980 int32_t start)
const {
3990 int32_t _length)
const
3993 srcText.pinIndices(srcStart, srcLength);
3995 return lastIndexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length);
4004 int32_t _length)
const
4009 int32_t start)
const {
4021 int32_t _length)
const
4022 {
return doLastIndexOf(c, start, _length); }
4027 int32_t _length)
const {
4028 return doLastIndexOf(c, start, _length);
4033 {
return doLastIndexOf(c, 0,
length()); }
4042 int32_t start)
const {
4044 return doLastIndexOf(c, start,
length() - start);
4049 int32_t start)
const {
4061 int32_t srcLength)
const
4062 {
return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; }
4069 return doCompare(0, srcLength, srcChars, 0, srcLength) == 0;
4077 return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0;
4083 text, 0, text.
length()) == 0; }
4088 int32_t srcLength)
const {
4089 srcText.pinIndices(srcStart, srcLength);
4090 return doCompare(
length() - srcLength, srcLength,
4091 srcText, srcStart, srcLength) == 0;
4096 int32_t srcLength)
const {
4100 return doCompare(
length() - srcLength, srcLength,
4101 srcChars, 0, srcLength) == 0;
4107 int32_t srcLength)
const {
4109 srcLength =
u_strlen(srcChars + srcStart);
4111 return doCompare(
length() - srcLength, srcLength,
4112 srcChars, srcStart, srcLength) == 0;
4122 {
return doReplace(start, _length, srcText, 0, srcText.
length()); }
4130 {
return doReplace(start, _length, srcText, srcStart, srcLength); }
4135 const UChar *srcChars,
4137 {
return doReplace(start, _length, srcChars, 0, srcLength); }
4142 const UChar *srcChars,
4145 {
return doReplace(start, _length, srcChars, srcStart, srcLength); }
4151 {
return doReplace(start, _length, &srcChar, 0, 1); }
4157 {
return doReplace(start, limit - start, srcText, 0, srcText.
length()); }
4165 {
return doReplace(start, limit - start, srcText, srcStart, srcLimit - srcStart); }
4171 newText, 0, newText.
length()); }
4179 newText, 0, newText.
length()); }
4185 UnicodeString::doExtract(int32_t start,
4188 { target.
replace(0, target.
length(), *
this, start, _length); }
4194 int32_t targetStart)
const
4195 { doExtract(start, _length, target, targetStart); }
4201 { doExtract(start, _length, target); }
4203 #if !UCONFIG_NO_CONVERSION
4209 const char *codepage)
const
4213 return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage);
4222 int32_t dstStart)
const {
4225 doExtract(start, limit - start, dst, dstStart);
4234 UnicodeString::doCharAt(int32_t offset)
const
4236 if((uint32_t)offset < (uint32_t)
length()) {
4237 return getArrayStart()[offset];
4239 return kInvalidUChar;
4245 {
return doCharAt(offset); }
4249 {
return doCharAt(offset); }
4253 return fShortLength == 0;
4260 UnicodeString::setLength(int32_t len) {
4262 fShortLength = (int8_t)len;
4264 fShortLength = (int8_t)-1;
4265 fUnion.fFields.fLength = len;
4270 UnicodeString::setToEmpty() {
4272 fFlags = kShortString;
4276 UnicodeString::setArray(
UChar *array, int32_t len, int32_t capacity) {
4278 fUnion.fFields.fArray = array;
4279 fUnion.fFields.fCapacity = capacity;
4282 inline UnicodeString&
4284 {
return doReplace(0,
length(), &ch, 0, 1); }
4296 return doReplace(0,
length(), srcText, srcStart, srcLength);
4304 srcText.pinIndex(srcStart);
4305 return doReplace(0,
length(), srcText, srcStart, srcText.
length() - srcStart);
4311 return copyFrom(srcText);
4319 return doReplace(0,
length(), srcChars, 0, srcLength);
4326 return doReplace(0,
length(), &srcChar, 0, 1);
4340 {
return doReplace(
length(), 0, srcText, srcStart, srcLength); }
4344 {
return doReplace(
length(), 0, srcText, 0, srcText.
length()); }
4350 {
return doReplace(
length(), 0, srcChars, srcStart, srcLength); }
4355 {
return doReplace(
length(), 0, srcChars, 0, srcLength); }
4359 {
return doReplace(
length(), 0, &srcChar, 0, 1); }
4363 {
return doReplace(
length(), 0, &ch, 0, 1); }
4372 {
return doReplace(
length(), 0, srcText, 0, srcText.
length()); }
4379 {
return doReplace(start, 0, srcText, srcStart, srcLength); }
4384 {
return doReplace(start, 0, srcText, 0, srcText.
length()); }
4388 const UChar *srcChars,
4391 {
return doReplace(start, 0, srcChars, srcStart, srcLength); }
4395 const UChar *srcChars,
4397 {
return doReplace(start, 0, srcChars, 0, srcLength); }
4402 {
return doReplace(start, 0, &srcChar, 0, 1); }
4407 {
return replace(start, 0, srcChar); }
4426 if(start <= 0 && _length ==
INT32_MAX) {
4430 return doReplace(start, _length,
NULL, 0, 0);
4436 {
return doReplace(start, limit - start,
NULL, 0, 0); }
4441 return doReplace(0, start,
NULL, 0, 0);
4447 if(
isBogus() && targetLength == 0) {
4451 }
else if((uint32_t)targetLength < (uint32_t)
length()) {
4452 setLength(targetLength);
4461 {
return doReverse(0,
length()); }
4466 {
return doReverse(start, _length); }
UnicodeString & reverse(void)
Reverse this UnicodeString in place.
virtual Replaceable * clone() const
Clone this object, an instance of a subclass of Replaceable.
int32_t UStringCaseMapper(const UCaseMap *csm, UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode)
Internal string case mapping function type.
UChar charAt(int32_t offset) const
Returns the 16-bit code unit at the given offset into the text.
UChar charAt(int32_t offset) const
Return the code unit at offset offset.
UnicodeString & setTo(const UnicodeString &srcText, int32_t srcStart)
Set the text in the UnicodeString object to the characters in srcText in the range [srcStart...
An Appendable implementation which writes to a UnicodeString.
C API: Unicode case mapping functions using a UCaseMap service object.
EInvariant
Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor which constructs a ...
UChar operator[](int32_t offset) const
Return the code unit at offset offset.
virtual UChar getCharAt(int32_t offset) const =0
Virtual version of charAt().
UChar32 char32At(int32_t offset) const
Returns the 32-bit code point at the given 16-bit offset into the text.
int8_t caseCompare(const UnicodeString &text, uint32_t options) const
Compare two strings case-insensitively using full case folding.
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
UBool operator<=(const UnicodeString &text) const
Less than or equal operator.
virtual UBool hasMetaData() const
Returns true if this object contains metadata.
int32_t lastIndexOf(const UnicodeString &text) const
Locate in this the last occurrence of the characters in text, using bitwise comparison.
virtual void copy(int32_t start, int32_t limit, int32_t dest)=0
Copies a substring of this object, retaining metadata.
UnicodeString & retainBetween(int32_t start, int32_t limit=INT32_MAX)
Retain only the characters in the range [start, limit) from the UnicodeString object.
UBool isBogus(void) const
Determine if this object contains a valid string.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
const UChar * getBuffer() const
Get a read-only pointer to the internal buffer.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
struct UCaseMap UCaseMap
C typedef for struct UCaseMap.
int8_t compareCodePointOrderBetween(int32_t start, int32_t limit, const UnicodeString &srcText, int32_t srcStart, int32_t srcLimit) const
Compare two Unicode strings in code point order.
UBool operator==(const UnicodeString &text) const
Equality operator.
virtual void extractBetween(int32_t start, int32_t limit, UnicodeString &target) const =0
Copies characters in the range [start, limit) into the UnicodeString target.
UnicodeString & findAndReplace(const UnicodeString &oldText, const UnicodeString &newText)
Replace all occurrences of characters in oldText with the characters in newText.
A ByteSink can be filled with bytes.
virtual UChar32 getChar32At(int32_t offset) const =0
Virtual version of char32At().
UBool operator!=(const UnicodeString &text) const
Inequality operator.
UBool operator>(const UnicodeString &text) const
Greater than operator.
UnicodeString & removeBetween(int32_t start, int32_t limit=(int32_t) INT32_MAX)
Remove the characters in the range [start, limit) from the UnicodeString object.
UnicodeString tempSubStringBetween(int32_t start, int32_t limit=INT32_MAX) const
Create a temporary substring for the specified range.
C++ API: StringPiece: Read-only byte string wrapper class.
Replaceable is an abstract base class representing a string of characters that supports the replaceme...
#define UNISTR_FROM_CHAR_EXPLICIT
This can be defined to be empty or "explicit".
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
StringClass & toUTF8String(StringClass &result) const
Convert the UnicodeString to UTF-8 and append the result to a standard string.
C++ API: Interface for writing bytes, and implementation classes.
UBool truncate(int32_t targetLength)
Truncate this UnicodeString to the targetLength.
U_COMMON_API UnicodeString operator+(const UnicodeString &s1, const UnicodeString &s2)
Create a new UnicodeString with the concatenation of two others.
virtual int32_t getLength() const =0
Virtual version of length().
UnicodeString & remove(void)
Remove all characters from the UnicodeString object.
UnicodeString()
Construct an empty UnicodeString.
int32_t getCapacity(void) const
Return the capacity of the internal buffer of the UnicodeString object.
UnicodeString & insert(int32_t start, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength)
Insert the characters in srcText in the range [srcStart, srcStart + srcLength) into the UnicodeString...
The BreakIterator class implements methods for finding the location of boundaries in text...
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
UnicodeString tempSubString(int32_t start=0, int32_t length=INT32_MAX) const
Create a temporary substring for the specified range.
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
#define NULL
Define NULL if necessary, to 0 for C++ and to ((void *)0) for C.
UnicodeString & replaceBetween(int32_t start, int32_t limit, const UnicodeString &srcText)
Replace the characters in the range [start, limit) with the characters in srcText.
C++ API: Central ICU header for including the C++ standard <string> header and for related definition...
UnicodeString & append(const UnicodeString &srcText, int32_t srcStart, int32_t srcLength)
Append the characters in srcText in the range [srcStart, srcStart + srcLength) to the UnicodeString o...
UBool isEmpty(void) const
Determine if this string is empty.
#define TRUE
The TRUE value of a UBool.
int8_t compareBetween(int32_t start, int32_t limit, const UnicodeString &srcText, int32_t srcStart, int32_t srcLimit) const
Compare the characters bitwise in the range [start, limit) with the characters in srcText in the rang...
UBool operator>=(const UnicodeString &text) const
Greater than or equal operator.
int8_t caseCompareBetween(int32_t start, int32_t limit, const UnicodeString &srcText, int32_t srcStart, int32_t srcLimit, uint32_t options) const
Compare two strings case-insensitively using full case folding.
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
int8_t compareCodePointOrder(const UnicodeString &text) const
Compare two Unicode strings in code point order.
UBool startsWith(const UnicodeString &text) const
Determine if this starts with the characters in text
void extractBetween(int32_t start, int32_t limit, UChar *dst, int32_t dstStart=0) const
Copy the characters in the range [start, limit) into the array dst, beginning at dstStart.
struct UConverter UConverter
#define INT32_MAX
The largest value a 32 bit signed integer can hold.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
UnicodeString & operator=(const UnicodeString &srcText)
Assignment operator.
int32_t indexOf(const UnicodeString &text) const
Locate in this the first occurrence of the characters in text, using bitwise comparison.
int8_t compare(const UnicodeString &text) const
Compare the characters bitwise in this UnicodeString to the characters in text.
void extract(int32_t start, int32_t length, UChar *dst, int32_t dstStart=0) const
Copy the characters in the range [start, start + length) into the array dst, beginning at dstStart...
virtual void handleReplaceBetween(int32_t start, int32_t limit, const UnicodeString &text)=0
Replaces a substring of this object with the given text.
Basic definitions for ICU, for both C and C++ APIs.
Implementation of ByteSink that writes to a "string".
UBool operator<(const UnicodeString &text) const
Less than operator.
int32_t hashCode(void) const
Generate a hash code for this object.
int32_t u_strlen(const UChar *s)
Determine the length of an array of UChar.
#define FALSE
The FALSE value of a UBool.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
int32_t length() const
Returns the number of 16-bit code units in the text.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
#define UNISTR_FROM_STRING_EXPLICIT
This can be defined to be empty or "explicit".
UBool endsWith(const UnicodeString &text) const
Determine if this ends with the characters in text
A string-like object that points to a sized piece of memory.
UnicodeString & replace(int32_t start, int32_t length, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength)
Replace the characters in the range [start, start + length) with the characters in srcText in the ran...
int32_t length(void) const
Return the length of the UnicodeString object.
UnicodeString & operator+=(UChar ch)
Append operator.
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
int8_t UBool
The ICU boolean type.
A Locale object represents a specific geographical, political, or cultural region.
C++ API: Replaceable String.