| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -540,3 +540,29 @@ publicity pertaining to distribution of the software without specific, | |||
| 540 | 540 | written prior permission. M.I.T. makes no representations about the | |
| 541 | 541 | suitability of this software for any purpose. It is provided "as is" | |
| 542 | 542 | without express or implied warranty. | |
| 543 | + | ||
| 544 | + ---------------------------------------------------------------------- | ||
| 545 | + | ||
| 546 | + File: sorttable.js (only for ICU4J) | ||
| 547 | + | ||
| 548 | + The MIT Licence, for code from kryogenix.org | ||
| 549 | + | ||
| 550 | + Code downloaded from the Browser Experiments section of kryogenix.org is | ||
| 551 | + licenced under the so-called MIT licence. The licence is below. | ||
| 552 | + | ||
| 553 | + Copyright (c) 1997-date Stuart Langridge | ||
| 554 | + | ||
| 555 | + Permission is hereby granted, free of charge, to any person obtaining a | ||
| 556 | + copy of this software and associated documentation files (the "Software"), | ||
| 557 | + to deal in the Software without restriction, including without limitation | ||
| 558 | + the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 559 | + and/or sell copies of the Software, and to permit persons to whom the | ||
| 560 | + Software is furnished to do so, subject to the following conditions: | ||
| 561 | + | ||
| 562 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 563 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 564 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 565 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 566 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 567 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 568 | + SOFTWARE. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,8 @@ | |||
| 1 | 1 | ICU sources - auto generated by shrink-icu-src.py | |
| 2 | 2 | ||
| 3 | 3 | This directory contains the ICU subset used by --with-intl=full-icu | |
| 4 | - It is a strict subset of ICU 77 source files with the following exception(s): | ||
| 5 | - * deps/icu-small/source/data/in/icudt77l.dat.bz2 : compressed data file | ||
| 4 | + It is a strict subset of ICU 78 source files with the following exception(s): | ||
| 5 | + * deps/icu-small/source/data/in/icudt78l.dat.bz2 : compressed data file | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 8 | To rebuild this directory, see ../../tools/icu/README.md | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,6 +64,7 @@ cc_library( | |||
| 64 | 64 | "umutex.cpp", | |
| 65 | 65 | "sharedobject.cpp", | |
| 66 | 66 | "utrace.cpp", | |
| 67 | + "fixedstring.cpp", | ||
| 67 | 68 | ], | |
| 68 | 69 | deps = [ | |
| 69 | 70 | ":headers", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -121,11 +121,9 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st | |||
| 121 | 121 | ||
| 122 | 122 | // If there is a result, set the valid locale and actual locale, and the kind | |
| 123 | 123 | if (U_SUCCESS(status) && result != nullptr) { | |
| 124 | - U_LOCALE_BASED(locBased, *(BreakIterator*)result); | ||
| 125 | - | ||
| 126 | - locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status), | ||
| 127 | - actual.data(), status); | ||
| 128 | - LocaleBased::setLocaleID(loc.getName(), result->requestLocale, status); | ||
| 124 | + result->actualLocale = Locale(actual.data()); | ||
| 125 | + result->validLocale = Locale(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status)); | ||
| 126 | + result->requestLocale = loc; | ||
| 129 | 127 | } | |
| 130 | 128 | ||
| 131 | 129 | ures_close(b); | |
@@ -204,33 +202,28 @@ BreakIterator::getAvailableLocales(int32_t& count) | |||
| 204 | 202 | //------------------------------------------- | |
| 205 | 203 | ||
| 206 | 204 | BreakIterator::BreakIterator() | |
| 205 | + : actualLocale(Locale::getRoot()), validLocale(Locale::getRoot()), requestLocale(Locale::getRoot()) | ||
| 207 | 206 | { | |
| 208 | 207 | } | |
| 209 | 208 | ||
| 210 | - BreakIterator::BreakIterator(const BreakIterator &other) : UObject(other) { | ||
| 211 | - UErrorCode status = U_ZERO_ERROR; | ||
| 212 | - U_LOCALE_BASED(locBased, *this); | ||
| 213 | - locBased.setLocaleIDs(other.validLocale, other.actualLocale, status); | ||
| 214 | - LocaleBased::setLocaleID(other.requestLocale, requestLocale, status); | ||
| 215 | - U_ASSERT(U_SUCCESS(status)); | ||
| 209 | + BreakIterator::BreakIterator(const BreakIterator &other) | ||
| 210 | + : UObject(other), | ||
| 211 | + actualLocale(other.actualLocale), | ||
| 212 | + validLocale(other.validLocale), | ||
| 213 | + requestLocale(other.requestLocale) { | ||
| 216 | 214 | } | |
| 217 | 215 | ||
| 218 | 216 | BreakIterator &BreakIterator::operator =(const BreakIterator &other) { | |
| 219 | 217 | if (this != &other) { | |
| 220 | - UErrorCode status = U_ZERO_ERROR; | ||
| 221 | - U_LOCALE_BASED(locBased, *this); | ||
| 222 | - locBased.setLocaleIDs(other.validLocale, other.actualLocale, status); | ||
| 223 | - LocaleBased::setLocaleID(other.requestLocale, requestLocale, status); | ||
| 224 | - U_ASSERT(U_SUCCESS(status)); | ||
| 218 | + actualLocale = other.actualLocale; | ||
| 219 | + validLocale = other.validLocale; | ||
| 220 | + requestLocale = other.requestLocale; | ||
| 225 | 221 | } | |
| 226 | 222 | return *this; | |
| 227 | 223 | } | |
| 228 | 224 | ||
| 229 | 225 | BreakIterator::~BreakIterator() | |
| 230 | 226 | { | |
| 231 | - delete validLocale; | ||
| 232 | - delete actualLocale; | ||
| 233 | - delete requestLocale; | ||
| 234 | 227 | } | |
| 235 | 228 | ||
| 236 | 229 | // ------------------------------------------ | |
@@ -398,8 +391,8 @@ BreakIterator::createInstance(const Locale& loc, int32_t kind, UErrorCode& statu | |||
| 398 | 391 | // THIS LONG is a sign of bad code -- so the action item is to | |
| 399 | 392 | // revisit this in ICU 3.0 and clean it up/fix it/remove it. | |
| 400 | 393 | if (U_SUCCESS(status) && (result != nullptr) && *actualLoc.getName() != 0) { | |
| 401 | - U_LOCALE_BASED(locBased, *result); | ||
| 402 | - locBased.setLocaleIDs(actualLoc.getName(), actualLoc.getName(), status); | ||
| 394 | + result->actualLocale = actualLoc; | ||
| 395 | + result->validLocale = actualLoc; | ||
| 403 | 396 | } | |
| 404 | 397 | return result; | |
| 405 | 398 | } | |
@@ -506,8 +499,7 @@ BreakIterator::getLocale(ULocDataLocaleType type, UErrorCode& status) const { | |||
| 506 | 499 | return Locale::getRoot(); | |
| 507 | 500 | } | |
| 508 | 501 | if (type == ULOC_REQUESTED_LOCALE) { | |
| 509 | - return requestLocale == nullptr ? | ||
| 510 | - Locale::getRoot() : Locale(requestLocale->data()); | ||
| 502 | + return requestLocale; | ||
| 511 | 503 | } | |
| 512 | 504 | return LocaleBased::getLocale(validLocale, actualLocale, type, status); | |
| 513 | 505 | } | |
@@ -518,7 +510,7 @@ BreakIterator::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const { | |||
| 518 | 510 | return nullptr; | |
| 519 | 511 | } | |
| 520 | 512 | if (type == ULOC_REQUESTED_LOCALE) { | |
| 521 | - return requestLocale == nullptr ? "" : requestLocale->data(); | ||
| 513 | + return requestLocale.getName(); | ||
| 522 | 514 | } | |
| 523 | 515 | return LocaleBased::getLocaleID(validLocale, actualLocale, type, status); | |
| 524 | 516 | } | |
@@ -546,11 +538,8 @@ int32_t BreakIterator::getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UE | |||
| 546 | 538 | return 1; | |
| 547 | 539 | } | |
| 548 | 540 | ||
| 549 | - BreakIterator::BreakIterator (const Locale& valid, const Locale& actual) { | ||
| 550 | - UErrorCode status = U_ZERO_ERROR; | ||
| 551 | - U_LOCALE_BASED(locBased, (*this)); | ||
| 552 | - locBased.setLocaleIDs(valid.getName(), actual.getName(), status); | ||
| 553 | - U_ASSERT(U_SUCCESS(status)); | ||
| 541 | + BreakIterator::BreakIterator(const Locale& valid, const Locale& actual) | ||
| 542 | + : actualLocale(actual), validLocale(valid), requestLocale(Locale::getRoot()) { | ||
| 554 | 543 | } | |
| 555 | 544 | ||
| 556 | 545 | U_NAMESPACE_END | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,12 +21,6 @@ | |||
| 21 | 21 | ||
| 22 | 22 | U_NAMESPACE_BEGIN | |
| 23 | 23 | ||
| 24 | - // Windows needs us to DLL-export the MaybeStackArray template specialization, | ||
| 25 | - // but MacOS X cannot handle it. Same as in digitlst.h. | ||
| 26 | - #if !U_PLATFORM_IS_DARWIN_BASED | ||
| 27 | - template class U_COMMON_API MaybeStackArray<char, 40>; | ||
| 28 | - #endif | ||
| 29 | - | ||
| 30 | 24 | /** | |
| 31 | 25 | * ICU-internal char * string class. | |
| 32 | 26 | * This class does not assume or enforce any particular character encoding. | |
@@ -38,56 +32,56 @@ template class U_COMMON_API MaybeStackArray<char, 40>; | |||
| 38 | 32 | * For example: | |
| 39 | 33 | * cs.data()[5]='a'; // no need for setCharAt(5, 'a') | |
| 40 | 34 | */ | |
| 41 | - class U_COMMON_API CharString : public UMemory { | ||
| 35 | + class U_COMMON_API_CLASS CharString : public UMemory { | ||
| 42 | 36 | public: | |
| 43 | - CharString() : len(0) { buffer[0]=0; } | ||
| 44 | - CharString(StringPiece s, UErrorCode &errorCode) : len(0) { | ||
| 37 | + U_COMMON_API CharString() : len(0) { buffer[0]=0; } | ||
| 38 | + U_COMMON_API CharString(StringPiece s, UErrorCode &errorCode) : len(0) { | ||
| 45 | 39 | buffer[0]=0; | |
| 46 | 40 | append(s, errorCode); | |
| 47 | 41 | } | |
| 48 | - CharString(const CharString &s, UErrorCode &errorCode) : len(0) { | ||
| 42 | + U_COMMON_API CharString(const CharString &s, UErrorCode &errorCode) : len(0) { | ||
| 49 | 43 | buffer[0]=0; | |
| 50 | 44 | append(s, errorCode); | |
| 51 | 45 | } | |
| 52 | - CharString(const char *s, int32_t sLength, UErrorCode &errorCode) : len(0) { | ||
| 46 | + U_COMMON_API CharString(const char *s, int32_t sLength, UErrorCode &errorCode) : len(0) { | ||
| 53 | 47 | buffer[0]=0; | |
| 54 | 48 | append(s, sLength, errorCode); | |
| 55 | 49 | } | |
| 56 | - ~CharString() {} | ||
| 50 | + U_COMMON_API ~CharString() {} | ||
| 57 | 51 | ||
| 58 | 52 | /** | |
| 59 | 53 | * Move constructor; might leave src in an undefined state. | |
| 60 | 54 | * This string will have the same contents and state that the source string had. | |
| 61 | 55 | */ | |
| 62 | - CharString(CharString &&src) noexcept; | ||
| 56 | + U_COMMON_API CharString(CharString &&src) noexcept; | ||
| 63 | 57 | /** | |
| 64 | 58 | * Move assignment operator; might leave src in an undefined state. | |
| 65 | 59 | * This string will have the same contents and state that the source string had. | |
| 66 | 60 | * The behavior is undefined if *this and src are the same object. | |
| 67 | 61 | */ | |
| 68 | - CharString &operator=(CharString &&src) noexcept; | ||
| 62 | + U_COMMON_API CharString &operator=(CharString &&src) noexcept; | ||
| 69 | 63 | ||
| 70 | 64 | /** | |
| 71 | 65 | * Replaces this string's contents with the other string's contents. | |
| 72 | 66 | * CharString does not support the standard copy constructor nor | |
| 73 | 67 | * the assignment operator, to make copies explicit and to | |
| 74 | 68 | * use a UErrorCode where memory allocations might be needed. | |
| 75 | 69 | */ | |
| 76 | - CharString ©From(const CharString &other, UErrorCode &errorCode); | ||
| 77 | - CharString ©From(StringPiece s, UErrorCode &errorCode); | ||
| 70 | + U_COMMON_API CharString ©From(const CharString &other, UErrorCode &errorCode); | ||
| 71 | + U_COMMON_API CharString ©From(StringPiece s, UErrorCode &errorCode); | ||
| 78 | 72 | ||
| 79 | - UBool isEmpty() const { return len==0; } | ||
| 80 | - int32_t length() const { return len; } | ||
| 81 | - char operator[](int32_t index) const { return buffer[index]; } | ||
| 82 | - StringPiece toStringPiece() const { return StringPiece(buffer.getAlias(), len); } | ||
| 73 | + U_COMMON_API UBool isEmpty() const { return len==0; } | ||
| 74 | + U_COMMON_API int32_t length() const { return len; } | ||
| 75 | + U_COMMON_API char operator[](int32_t index) const { return buffer[index]; } | ||
| 76 | + U_COMMON_API StringPiece toStringPiece() const { return StringPiece(buffer.getAlias(), len); } | ||
| 83 | 77 | ||
| 84 | - const char *data() const { return buffer.getAlias(); } | ||
| 85 | - char *data() { return buffer.getAlias(); } | ||
| 78 | + U_COMMON_API const char *data() const { return buffer.getAlias(); } | ||
| 79 | + U_COMMON_API char *data() { return buffer.getAlias(); } | ||
| 86 | 80 | /** | |
| 87 | 81 | * Allocates length()+1 chars and copies the NUL-terminated data(). | |
| 88 | 82 | * The caller must uprv_free() the result. | |
| 89 | 83 | */ | |
| 90 | - char *cloneData(UErrorCode &errorCode) const; | ||
| 84 | + U_COMMON_API char *cloneData(UErrorCode &errorCode) const; | ||
| 91 | 85 | /** | |
| 92 | 86 | * Copies the contents of the string into dest. | |
| 93 | 87 | * Checks if there is enough space in dest, extracts the entire string if possible, | |
@@ -103,40 +97,40 @@ class U_COMMON_API CharString : public UMemory { | |||
| 103 | 97 | * @param errorCode ICU error code. | |
| 104 | 98 | * @return length() | |
| 105 | 99 | */ | |
| 106 | - int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const; | ||
| 100 | + U_COMMON_API int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const; | ||
| 107 | 101 | ||
| 108 | - bool operator==(const CharString& other) const { | ||
| 102 | + U_COMMON_API bool operator==(const CharString& other) const { | ||
| 109 | 103 | return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0); | |
| 110 | 104 | } | |
| 111 | - bool operator!=(const CharString& other) const { | ||
| 105 | + U_COMMON_API bool operator!=(const CharString& other) const { | ||
| 112 | 106 | return !operator==(other); | |
| 113 | 107 | } | |
| 114 | 108 | ||
| 115 | - bool operator==(StringPiece other) const { | ||
| 109 | + U_COMMON_API bool operator==(StringPiece other) const { | ||
| 116 | 110 | return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0); | |
| 117 | 111 | } | |
| 118 | - bool operator!=(StringPiece other) const { | ||
| 112 | + U_COMMON_API bool operator!=(StringPiece other) const { | ||
| 119 | 113 | return !operator==(other); | |
| 120 | 114 | } | |
| 121 | 115 | ||
| 122 | 116 | /** @return last index of c, or -1 if c is not in this string */ | |
| 123 | - int32_t lastIndexOf(char c) const; | ||
| 117 | + U_COMMON_API int32_t lastIndexOf(char c) const; | ||
| 124 | 118 | ||
| 125 | - bool contains(StringPiece s) const; | ||
| 119 | + U_COMMON_API bool contains(StringPiece s) const; | ||
| 126 | 120 | ||
| 127 | - CharString &clear() { len=0; buffer[0]=0; return *this; } | ||
| 128 | - CharString &truncate(int32_t newLength); | ||
| 121 | + U_COMMON_API CharString &clear() { len=0; buffer[0]=0; return *this; } | ||
| 122 | + U_COMMON_API CharString &truncate(int32_t newLength); | ||
| 129 | 123 | ||
| 130 | - CharString &append(char c, UErrorCode &errorCode); | ||
| 131 | - CharString &append(StringPiece s, UErrorCode &errorCode) { | ||
| 124 | + U_COMMON_API CharString &append(char c, UErrorCode &errorCode); | ||
| 125 | + U_COMMON_API CharString &append(StringPiece s, UErrorCode &errorCode) { | ||
| 132 | 126 | return append(s.data(), s.length(), errorCode); | |
| 133 | 127 | } | |
| 134 | - CharString &append(const CharString &s, UErrorCode &errorCode) { | ||
| 128 | + U_COMMON_API CharString &append(const CharString &s, UErrorCode &errorCode) { | ||
| 135 | 129 | return append(s.data(), s.length(), errorCode); | |
| 136 | 130 | } | |
| 137 | - CharString &append(const char *s, int32_t sLength, UErrorCode &status); | ||
| 131 | + U_COMMON_API CharString &append(const char *s, int32_t sLength, UErrorCode &status); | ||
| 138 | 132 | ||
| 139 | - CharString &appendNumber(int64_t number, UErrorCode &status); | ||
| 133 | + U_COMMON_API CharString &appendNumber(int64_t number, UErrorCode &status); | ||
| 140 | 134 | ||
| 141 | 135 | /** | |
| 142 | 136 | * Returns a writable buffer for appending and writes the buffer's capacity to | |
@@ -158,26 +152,28 @@ class U_COMMON_API CharString : public UMemory { | |||
| 158 | 152 | * @param errorCode in/out error code | |
| 159 | 153 | * @return a buffer with resultCapacity>=min_capacity | |
| 160 | 154 | */ | |
| 161 | - char *getAppendBuffer(int32_t minCapacity, | ||
| 162 | - int32_t desiredCapacityHint, | ||
| 163 | - int32_t &resultCapacity, | ||
| 164 | - UErrorCode &errorCode); | ||
| 155 | + U_COMMON_API char *getAppendBuffer(int32_t minCapacity, | ||
| 156 | + int32_t desiredCapacityHint, | ||
| 157 | + int32_t &resultCapacity, | ||
| 158 | + UErrorCode &errorCode); | ||
| 165 | 159 | ||
| 166 | - CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode); | ||
| 167 | - CharString &appendInvariantChars(const char16_t* uchars, int32_t ucharsLen, UErrorCode& errorCode); | ||
| 160 | + U_COMMON_API CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode); | ||
| 161 | + U_COMMON_API CharString &appendInvariantChars(const char16_t* uchars, | ||
| 162 | + int32_t ucharsLen, | ||
| 163 | + UErrorCode& errorCode); | ||
| 168 | 164 | ||
| 169 | 165 | /** | |
| 170 | 166 | * Appends a filename/path part, e.g., a directory name. | |
| 171 | 167 | * First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary. | |
| 172 | 168 | * Does nothing if s is empty. | |
| 173 | 169 | */ | |
| 174 | - CharString &appendPathPart(StringPiece s, UErrorCode &errorCode); | ||
| 170 | + U_COMMON_API CharString &appendPathPart(StringPiece s, UErrorCode &errorCode); | ||
| 175 | 171 | ||
| 176 | 172 | /** | |
| 177 | 173 | * Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty | |
| 178 | 174 | * and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR. | |
| 179 | 175 | */ | |
| 180 | - CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode); | ||
| 176 | + U_COMMON_API CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode); | ||
| 181 | 177 | ||
| 182 | 178 | private: | |
| 183 | 179 | MaybeStackArray<char, 40> buffer; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -334,9 +334,7 @@ class MaybeStackArray { | |||
| 334 | 334 | // No heap allocation. Use only on the stack. | |
| 335 | 335 | static void* U_EXPORT2 operator new(size_t) noexcept = delete; | |
| 336 | 336 | static void* U_EXPORT2 operator new[](size_t) noexcept = delete; | |
| 337 | - #if U_HAVE_PLACEMENT_NEW | ||
| 338 | 337 | static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete; | |
| 339 | - #endif | ||
| 340 | 338 | ||
| 341 | 339 | /** | |
| 342 | 340 | * Default constructor initializes with internal T[stackCapacity] buffer. | |
@@ -570,9 +568,7 @@ class MaybeStackHeaderAndArray { | |||
| 570 | 568 | // No heap allocation. Use only on the stack. | |
| 571 | 569 | static void* U_EXPORT2 operator new(size_t) noexcept = delete; | |
| 572 | 570 | static void* U_EXPORT2 operator new[](size_t) noexcept = delete; | |
| 573 | - #if U_HAVE_PLACEMENT_NEW | ||
| 574 | 571 | static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete; | |
| 575 | - #endif | ||
| 576 | 572 | ||
| 577 | 573 | /** | |
| 578 | 574 | * Default constructor initializes with internal H+T[stackCapacity] buffer. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,11 +43,11 @@ | |||
| 43 | 43 | ||
| 44 | 44 | U_NAMESPACE_BEGIN | |
| 45 | 45 | ||
| 46 | - class U_COMMON_API CStr : public UMemory { | ||
| 46 | + class U_COMMON_API_CLASS CStr : public UMemory { | ||
| 47 | 47 | public: | |
| 48 | - CStr(const UnicodeString &in); | ||
| 49 | - ~CStr(); | ||
| 50 | - const char * operator ()() const; | ||
| 48 | + U_COMMON_API CStr(const UnicodeString &in); | ||
| 49 | + U_COMMON_API ~CStr(); | ||
| 50 | + U_COMMON_API const char * operator ()() const; | ||
| 51 | 51 | ||
| 52 | 52 | private: | |
| 53 | 53 | CharString s; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,29 @@ | |||
| 1 | + // © 2025 and later: Unicode, Inc. and others. | ||
| 2 | + // License & terms of use: https://www.unicode.org/copyright.html | ||
| 3 | + | ||
| 4 | + #include "fixedstring.h" | ||
| 5 | + | ||
| 6 | + #include "unicode/unistr.h" | ||
| 7 | + #include "unicode/utypes.h" | ||
| 8 | + | ||
| 9 | + U_NAMESPACE_BEGIN | ||
| 10 | + | ||
| 11 | + U_EXPORT void copyInvariantChars(const UnicodeString& src, FixedString& dst, UErrorCode& status) { | ||
| 12 | + if (U_FAILURE(status)) { | ||
| 13 | + return; | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + if (src.isEmpty()) { | ||
| 17 | + dst.clear(); | ||
| 18 | + return; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + int32_t length = src.length(); | ||
| 22 | + if (!dst.reserve(length + 1)) { | ||
| 23 | + status = U_MEMORY_ALLOCATION_ERROR; | ||
| 24 | + return; | ||
| 25 | + } | ||
| 26 | + src.extract(0, length, dst.getAlias(), length + 1, US_INV); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + U_NAMESPACE_END | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments