You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-26 15:46:23 +00:00
ICU4C: Update to version 77.1
This commit is contained in:
8
thirdparty/icu4c/common/unicode/brkiter.h
vendored
8
thirdparty/icu4c/common/unicode/brkiter.h
vendored
@@ -58,6 +58,8 @@ U_NAMESPACE_END
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
class CharString;
|
||||
|
||||
/**
|
||||
* The BreakIterator class implements methods for finding the location
|
||||
* of boundaries in text. BreakIterator is an abstract base class.
|
||||
@@ -646,9 +648,9 @@ protected:
|
||||
private:
|
||||
|
||||
/** @internal (private) */
|
||||
char actualLocale[ULOC_FULLNAME_CAPACITY];
|
||||
char validLocale[ULOC_FULLNAME_CAPACITY];
|
||||
char requestLocale[ULOC_FULLNAME_CAPACITY];
|
||||
CharString* actualLocale = nullptr;
|
||||
CharString* validLocale = nullptr;
|
||||
CharString* requestLocale = nullptr;
|
||||
};
|
||||
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
|
||||
77
thirdparty/icu4c/common/unicode/char16ptr.h
vendored
77
thirdparty/icu4c/common/unicode/char16ptr.h
vendored
@@ -9,10 +9,13 @@
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
|
||||
#include <cstddef>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \file
|
||||
@@ -21,8 +24,6 @@
|
||||
* Also conversion functions from char16_t * to UChar * and OldUChar *.
|
||||
*/
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* \def U_ALIASING_BARRIER
|
||||
* Barrier for pointer anti-aliasing optimizations even across function boundaries.
|
||||
@@ -36,6 +37,11 @@ U_NAMESPACE_BEGIN
|
||||
# define U_ALIASING_BARRIER(ptr)
|
||||
#endif
|
||||
|
||||
// ICU DLL-exported
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
|
||||
* @stable ICU 59
|
||||
@@ -251,6 +257,60 @@ const char16_t *ConstChar16Ptr::get() const { return u_.cp; }
|
||||
#endif
|
||||
/// \endcond
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif // U_SHOW_CPLUSPLUS_API
|
||||
|
||||
// Usable in header-only definitions
|
||||
#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
|
||||
namespace U_ICU_NAMESPACE_OR_INTERNAL {
|
||||
|
||||
#ifndef U_FORCE_HIDE_INTERNAL_API
|
||||
/** @internal */
|
||||
template<typename T, typename = std::enable_if_t<std::is_same_v<T, UChar>>>
|
||||
inline const char16_t *uprv_char16PtrFromUChar(const T *p) {
|
||||
if constexpr (std::is_same_v<UChar, char16_t>) {
|
||||
return p;
|
||||
} else {
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
return ConstChar16Ptr(p).get();
|
||||
#else
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
U_ALIASING_BARRIER(p);
|
||||
#endif
|
||||
return reinterpret_cast<const char16_t *>(p);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if !U_CHAR16_IS_TYPEDEF && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 180000)
|
||||
/** @internal */
|
||||
inline const char16_t *uprv_char16PtrFromUint16(const uint16_t *p) {
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
return ConstChar16Ptr(p).get();
|
||||
#else
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
U_ALIASING_BARRIER(p);
|
||||
#endif
|
||||
return reinterpret_cast<const char16_t *>(p);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if U_SIZEOF_WCHAR_T==2
|
||||
/** @internal */
|
||||
inline const char16_t *uprv_char16PtrFromWchar(const wchar_t *p) {
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
return ConstChar16Ptr(p).get();
|
||||
#else
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
U_ALIASING_BARRIER(p);
|
||||
#endif
|
||||
return reinterpret_cast<const char16_t *>(p);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Converts from const char16_t * to const UChar *.
|
||||
* Includes an aliasing barrier if available.
|
||||
@@ -307,6 +367,15 @@ inline OldUChar *toOldUCharPtr(char16_t *p) {
|
||||
return reinterpret_cast<OldUChar *>(p);
|
||||
}
|
||||
|
||||
} // U_ICU_NAMESPACE_OR_INTERNAL
|
||||
|
||||
#endif // U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
|
||||
// ICU DLL-exported
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef U_FORCE_HIDE_INTERNAL_API
|
||||
/**
|
||||
* Is T convertible to a std::u16string_view or some other 16-bit string view?
|
||||
@@ -379,6 +448,6 @@ inline std::u16string_view toU16StringViewNullable(const T& text) {
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* U_SHOW_CPLUSPLUS_API */
|
||||
#endif // U_SHOW_CPLUSPLUS_API
|
||||
|
||||
#endif // __CHAR16PTR_H__
|
||||
|
||||
9
thirdparty/icu4c/common/unicode/locid.h
vendored
9
thirdparty/icu4c/common/unicode/locid.h
vendored
@@ -449,6 +449,11 @@ public:
|
||||
*/
|
||||
static Locale U_EXPORT2 createFromName(const char *name);
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/** @internal */
|
||||
static Locale U_EXPORT2 createFromName(StringPiece name);
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
/**
|
||||
* Creates a locale from the given string after canonicalizing
|
||||
* the string according to CLDR by calling uloc_canonicalize().
|
||||
@@ -1133,7 +1138,9 @@ private:
|
||||
* @param cLocaleID The new locale name.
|
||||
* @param canonicalize whether to call uloc_canonicalize on cLocaleID
|
||||
*/
|
||||
Locale& init(const char* cLocaleID, UBool canonicalize);
|
||||
Locale& init(const char* localeID, UBool canonicalize);
|
||||
/** @internal */
|
||||
Locale& init(StringPiece localeID, UBool canonicalize);
|
||||
|
||||
/*
|
||||
* Internal constructor to allow construction of a locale object with
|
||||
|
||||
2
thirdparty/icu4c/common/unicode/resbund.h
vendored
2
thirdparty/icu4c/common/unicode/resbund.h
vendored
@@ -450,7 +450,7 @@ public:
|
||||
* @return a Locale object
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
const Locale
|
||||
Locale
|
||||
getLocale(ULocDataLocaleType type, UErrorCode &status) const;
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/**
|
||||
|
||||
48
thirdparty/icu4c/common/unicode/uchar.h
vendored
48
thirdparty/icu4c/common/unicode/uchar.h
vendored
@@ -675,14 +675,14 @@ typedef enum UProperty {
|
||||
* @stable ICU 63
|
||||
*/
|
||||
UCHAR_VERTICAL_ORIENTATION=0x1018,
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Enumerated property Identifier_Status.
|
||||
* Used for UTS #39 General Security Profile for Identifiers
|
||||
* (https://www.unicode.org/reports/tr39/#General_Security_Profile).
|
||||
* @draft ICU 75
|
||||
* @stable ICU 75
|
||||
*/
|
||||
UCHAR_IDENTIFIER_STATUS=0x1019,
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Enumerated property Indic_Conjunct_Break.
|
||||
* Used in the grapheme cluster break algorithm in UAX #29.
|
||||
@@ -796,7 +796,6 @@ typedef enum UProperty {
|
||||
UCHAR_SCRIPT_EXTENSIONS=0x7000,
|
||||
/** First constant for Unicode properties with unusual value types. @stable ICU 4.6 */
|
||||
UCHAR_OTHER_PROPERTY_START=UCHAR_SCRIPT_EXTENSIONS,
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Miscellaneous property Identifier_Type.
|
||||
* Used for UTS #39 General Security Profile for Identifiers
|
||||
@@ -808,10 +807,9 @@ typedef enum UProperty {
|
||||
*
|
||||
* @see u_hasIDType
|
||||
* @see u_getIDTypes
|
||||
* @draft ICU 75
|
||||
* @stable ICU 75
|
||||
*/
|
||||
UCHAR_IDENTIFIER_TYPE=0x7001,
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the last constant for Unicode properties with unusual value types.
|
||||
@@ -2791,13 +2789,12 @@ typedef enum UVerticalOrientation {
|
||||
U_VO_UPRIGHT,
|
||||
} UVerticalOrientation;
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Identifier Status constants.
|
||||
* See https://www.unicode.org/reports/tr39/#Identifier_Status_and_Type.
|
||||
*
|
||||
* @see UCHAR_IDENTIFIER_STATUS
|
||||
* @draft ICU 75
|
||||
* @stable ICU 75
|
||||
*/
|
||||
typedef enum UIdentifierStatus {
|
||||
/*
|
||||
@@ -2806,9 +2803,9 @@ typedef enum UIdentifierStatus {
|
||||
* U_ID_STATUS_<Unicode Identifier_Status value name>
|
||||
*/
|
||||
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_STATUS_RESTRICTED,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_STATUS_ALLOWED,
|
||||
} UIdentifierStatus;
|
||||
|
||||
@@ -2817,7 +2814,7 @@ typedef enum UIdentifierStatus {
|
||||
* See https://www.unicode.org/reports/tr39/#Identifier_Status_and_Type.
|
||||
*
|
||||
* @see UCHAR_IDENTIFIER_TYPE
|
||||
* @draft ICU 75
|
||||
* @stable ICU 75
|
||||
*/
|
||||
typedef enum UIdentifierType {
|
||||
/*
|
||||
@@ -2826,32 +2823,31 @@ typedef enum UIdentifierType {
|
||||
* U_ID_TYPE_<Unicode Identifier_Type value name>
|
||||
*/
|
||||
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_NOT_CHARACTER,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_DEPRECATED,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_DEFAULT_IGNORABLE,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_NOT_NFKC,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_NOT_XID,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_EXCLUSION,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_OBSOLETE,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_TECHNICAL,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_UNCOMMON_USE,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_LIMITED_USE,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_INCLUSION,
|
||||
/** @draft ICU 75 */
|
||||
/** @stable ICU 75 */
|
||||
U_ID_TYPE_RECOMMENDED,
|
||||
} UIdentifierType;
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Check a binary Unicode property for a code point.
|
||||
@@ -4057,7 +4053,6 @@ u_isIDStart(UChar32 c);
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isIDPart(UChar32 c);
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Does the set of Identifier_Type values code point c contain the given type?
|
||||
*
|
||||
@@ -4069,7 +4064,7 @@ u_isIDPart(UChar32 c);
|
||||
* @param c code point
|
||||
* @param type Identifier_Type to check
|
||||
* @return true if type is in Identifier_Type(c)
|
||||
* @draft ICU 75
|
||||
* @stable ICU 75
|
||||
*/
|
||||
U_CAPI bool U_EXPORT2
|
||||
u_hasIDType(UChar32 c, UIdentifierType type);
|
||||
@@ -4104,11 +4099,10 @@ u_hasIDType(UChar32 c, UIdentifierType type);
|
||||
* function chaining. (See User Guide for details.)
|
||||
* @return number of values in c's Identifier_Type,
|
||||
* written to types unless U_BUFFER_OVERFLOW_ERROR indicates insufficient capacity
|
||||
* @draft ICU 75
|
||||
* @stable ICU 75
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
u_getIDTypes(UChar32 c, UIdentifierType *types, int32_t capacity, UErrorCode *pErrorCode);
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Determines if the specified character should be regarded
|
||||
|
||||
11
thirdparty/icu4c/common/unicode/uniset.h
vendored
11
thirdparty/icu4c/common/unicode/uniset.h
vendored
@@ -1173,10 +1173,12 @@ public:
|
||||
inline U_HEADER_NESTED_NAMESPACE::USetStrings strings() const {
|
||||
return U_HEADER_NESTED_NAMESPACE::USetStrings(toUSet());
|
||||
}
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Returns a C++ iterator for iterating over all of the elements of this set.
|
||||
* Convenient all-in one iteration, but creates a UnicodeString for each
|
||||
* Convenient all-in one iteration, but creates a std::u16string for each
|
||||
* code point or string.
|
||||
* (Similar to how Java UnicodeSet *is an* Iterable<String>.)
|
||||
*
|
||||
@@ -1185,13 +1187,14 @@ public:
|
||||
* \code
|
||||
* UnicodeSet set(u"[abcçカ🚴{}{abc}{de}]", errorCode);
|
||||
* for (auto el : set) {
|
||||
* UnicodeString us(el);
|
||||
* std::string u8;
|
||||
* printf("set.string length %ld \"%s\"\n", (long)el.length(), el.toUTF8String(u8).c_str());
|
||||
* printf("set.element length %ld \"%s\"\n", (long)us.length(), us.toUTF8String(u8).c_str());
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* @return an all-elements iterator.
|
||||
* @draft ICU 76
|
||||
* @draft ICU 77
|
||||
* @see end
|
||||
* @see codePoints
|
||||
* @see ranges
|
||||
@@ -1203,7 +1206,7 @@ public:
|
||||
|
||||
/**
|
||||
* @return an exclusive-end sentinel for iterating over all of the elements of this set.
|
||||
* @draft ICU 76
|
||||
* @draft ICU 77
|
||||
* @see begin
|
||||
* @see codePoints
|
||||
* @see ranges
|
||||
|
||||
92
thirdparty/icu4c/common/unicode/uset.h
vendored
92
thirdparty/icu4c/common/unicode/uset.h
vendored
@@ -32,12 +32,13 @@
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/uchar.h"
|
||||
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include "unicode/char16ptr.h"
|
||||
#include "unicode/localpointer.h"
|
||||
#include "unicode/unistr.h"
|
||||
#endif // U_SHOW_CPLUSPLUS_API
|
||||
#include "unicode/utf16.h"
|
||||
#endif
|
||||
|
||||
#ifndef USET_DEFINED
|
||||
|
||||
@@ -1392,8 +1393,8 @@ public:
|
||||
private:
|
||||
friend class USetCodePoints;
|
||||
|
||||
USetCodePointIterator(const USet *uset, int32_t rangeIndex, int32_t rangeCount)
|
||||
: uset(uset), rangeIndex(rangeIndex), rangeCount(rangeCount),
|
||||
USetCodePointIterator(const USet *pUset, int32_t nRangeIndex, int32_t nRangeCount)
|
||||
: uset(pUset), rangeIndex(nRangeIndex), rangeCount(nRangeCount),
|
||||
c(U_SENTINEL), end(U_SENTINEL) {
|
||||
// Fetch the first range.
|
||||
operator++();
|
||||
@@ -1429,7 +1430,7 @@ public:
|
||||
* Constructs a C++ "range" object over the code points of the USet.
|
||||
* @draft ICU 76
|
||||
*/
|
||||
USetCodePoints(const USet *uset) : uset(uset), rangeCount(uset_getRangeCount(uset)) {}
|
||||
USetCodePoints(const USet *pUset) : uset(pUset), rangeCount(uset_getRangeCount(pUset)) {}
|
||||
|
||||
/** @draft ICU 76 */
|
||||
USetCodePoints(const USetCodePoints &other) = default;
|
||||
@@ -1460,7 +1461,7 @@ struct CodePointRange {
|
||||
/** @draft ICU 76 */
|
||||
struct iterator {
|
||||
/** @draft ICU 76 */
|
||||
iterator(UChar32 c) : c(c) {}
|
||||
iterator(UChar32 aC) : c(aC) {}
|
||||
|
||||
/** @draft ICU 76 */
|
||||
bool operator==(const iterator &other) const { return c == other.c; }
|
||||
@@ -1573,8 +1574,8 @@ public:
|
||||
private:
|
||||
friend class USetRanges;
|
||||
|
||||
USetRangeIterator(const USet *uset, int32_t rangeIndex, int32_t rangeCount)
|
||||
: uset(uset), rangeIndex(rangeIndex), rangeCount(rangeCount) {}
|
||||
USetRangeIterator(const USet *pUset, int32_t nRangeIndex, int32_t nRangeCount)
|
||||
: uset(pUset), rangeIndex(nRangeIndex), rangeCount(nRangeCount) {}
|
||||
|
||||
const USet *uset;
|
||||
int32_t rangeIndex;
|
||||
@@ -1610,7 +1611,7 @@ public:
|
||||
* Constructs a C++ "range" object over the code point ranges of the USet.
|
||||
* @draft ICU 76
|
||||
*/
|
||||
USetRanges(const USet *uset) : uset(uset), rangeCount(uset_getRangeCount(uset)) {}
|
||||
USetRanges(const USet *pUset) : uset(pUset), rangeCount(uset_getRangeCount(pUset)) {}
|
||||
|
||||
/** @draft ICU 76 */
|
||||
USetRanges(const USetRanges &other) = default;
|
||||
@@ -1657,7 +1658,7 @@ public:
|
||||
int32_t length;
|
||||
const UChar *uchars = uset_getString(uset, index, &length);
|
||||
// assert uchars != nullptr;
|
||||
return {ConstChar16Ptr(uchars), static_cast<uint32_t>(length)};
|
||||
return {uprv_char16PtrFromUChar(uchars), static_cast<size_t>(length)};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@@ -1684,8 +1685,8 @@ public:
|
||||
private:
|
||||
friend class USetStrings;
|
||||
|
||||
USetStringIterator(const USet *uset, int32_t index, int32_t count)
|
||||
: uset(uset), index(index), count(count) {}
|
||||
USetStringIterator(const USet *pUset, int32_t nIndex, int32_t nCount)
|
||||
: uset(pUset), index(nIndex), count(nCount) {}
|
||||
|
||||
const USet *uset;
|
||||
int32_t index;
|
||||
@@ -1699,9 +1700,11 @@ private:
|
||||
* using U_HEADER_NESTED_NAMESPACE::USetStrings;
|
||||
* LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, &errorCode));
|
||||
* for (auto s : USetStrings(uset.getAlias())) {
|
||||
* UnicodeString us(s);
|
||||
* std::string u8;
|
||||
* printf("uset.string length %ld \"%s\"\n", (long)s.length(), us.toUTF8String(u8).c_str());
|
||||
* int32_t len32 = s.length();
|
||||
* char utf8[200];
|
||||
* u_strToUTF8WithSub(utf8, int32_t{sizeof(utf8) - 1}, nullptr,
|
||||
* s.data(), len32, 0xFFFD, nullptr, errorCode);
|
||||
* printf("uset.string length %ld \"%s\"\n", long{len32}, utf8);
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
@@ -1718,7 +1721,7 @@ public:
|
||||
* Constructs a C++ "range" object over the strings of the USet.
|
||||
* @draft ICU 76
|
||||
*/
|
||||
USetStrings(const USet *uset) : uset(uset), count(uset_getStringCount(uset)) {}
|
||||
USetStrings(const USet *pUset) : uset(pUset), count(uset_getStringCount(pUset)) {}
|
||||
|
||||
/** @draft ICU 76 */
|
||||
USetStrings(const USetStrings &other) = default;
|
||||
@@ -1737,17 +1740,19 @@ private:
|
||||
const USet *uset;
|
||||
int32_t count;
|
||||
};
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Iterator returned by USetElements.
|
||||
* @draft ICU 76
|
||||
* @draft ICU 77
|
||||
*/
|
||||
class USetElementIterator {
|
||||
public:
|
||||
/** @draft ICU 76 */
|
||||
/** @draft ICU 77 */
|
||||
USetElementIterator(const USetElementIterator &other) = default;
|
||||
|
||||
/** @draft ICU 76 */
|
||||
/** @draft ICU 77 */
|
||||
bool operator==(const USetElementIterator &other) const {
|
||||
// No need to compare rangeCount & end given private constructor
|
||||
// and assuming we don't compare iterators across the set being modified.
|
||||
@@ -1756,26 +1761,28 @@ public:
|
||||
return uset == other.uset && c == other.c && index == other.index;
|
||||
}
|
||||
|
||||
/** @draft ICU 76 */
|
||||
/** @draft ICU 77 */
|
||||
bool operator!=(const USetElementIterator &other) const { return !operator==(other); }
|
||||
|
||||
/** @draft ICU 76 */
|
||||
UnicodeString operator*() const {
|
||||
/** @draft ICU 77 */
|
||||
std::u16string operator*() const {
|
||||
if (c >= 0) {
|
||||
return UnicodeString(c);
|
||||
return c <= 0xffff ?
|
||||
std::u16string({static_cast<char16_t>(c)}) :
|
||||
std::u16string({U16_LEAD(c), U16_TRAIL(c)});
|
||||
} else if (index < totalCount) {
|
||||
int32_t length;
|
||||
const UChar *uchars = uset_getString(uset, index - rangeCount, &length);
|
||||
// assert uchars != nullptr;
|
||||
return UnicodeString(uchars, length);
|
||||
return {uprv_char16PtrFromUChar(uchars), static_cast<size_t>(length)};
|
||||
} else {
|
||||
return UnicodeString();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-increment.
|
||||
* @draft ICU 76
|
||||
* @draft ICU 77
|
||||
*/
|
||||
USetElementIterator &operator++() {
|
||||
if (c < end) {
|
||||
@@ -1800,7 +1807,7 @@ public:
|
||||
|
||||
/**
|
||||
* Post-increment.
|
||||
* @draft ICU 76
|
||||
* @draft ICU 77
|
||||
*/
|
||||
USetElementIterator operator++(int) {
|
||||
USetElementIterator result(*this);
|
||||
@@ -1811,8 +1818,8 @@ public:
|
||||
private:
|
||||
friend class USetElements;
|
||||
|
||||
USetElementIterator(const USet *uset, int32_t index, int32_t rangeCount, int32_t totalCount)
|
||||
: uset(uset), index(index), rangeCount(rangeCount), totalCount(totalCount),
|
||||
USetElementIterator(const USet *pUset, int32_t nIndex, int32_t nRangeCount, int32_t nTotalCount)
|
||||
: uset(pUset), index(nIndex), rangeCount(nRangeCount), totalCount(nTotalCount),
|
||||
c(U_SENTINEL), end(U_SENTINEL) {
|
||||
if (index < rangeCount) {
|
||||
// Fetch the first range.
|
||||
@@ -1840,7 +1847,7 @@ private:
|
||||
|
||||
/**
|
||||
* A C++ "range" for iterating over all of the elements of a USet.
|
||||
* Convenient all-in one iteration, but creates a UnicodeString for each
|
||||
* Convenient all-in one iteration, but creates a std::u16string for each
|
||||
* code point or string.
|
||||
*
|
||||
* Code points are returned first, then empty and multi-character strings.
|
||||
@@ -1849,15 +1856,18 @@ private:
|
||||
* using U_HEADER_NESTED_NAMESPACE::USetElements;
|
||||
* LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, &errorCode));
|
||||
* for (auto el : USetElements(uset.getAlias())) {
|
||||
* std::string u8;
|
||||
* printf("uset.string length %ld \"%s\"\n", (long)el.length(), el.toUTF8String(u8).c_str());
|
||||
* int32_t len32 = el.length();
|
||||
* char utf8[200];
|
||||
* u_strToUTF8WithSub(utf8, int32_t{sizeof(utf8) - 1}, nullptr,
|
||||
* el.data(), len32, 0xFFFD, nullptr, errorCode);
|
||||
* printf("uset.element length %ld \"%s\"\n", long{len32}, utf8);
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* C++ UnicodeSet has member functions for iteration, including begin() and end().
|
||||
*
|
||||
* @return an all-elements iterator.
|
||||
* @draft ICU 76
|
||||
* @draft ICU 77
|
||||
* @see USetCodePoints
|
||||
* @see USetRanges
|
||||
* @see USetStrings
|
||||
@@ -1866,21 +1876,21 @@ class USetElements {
|
||||
public:
|
||||
/**
|
||||
* Constructs a C++ "range" object over all of the elements of the USet.
|
||||
* @draft ICU 76
|
||||
* @draft ICU 77
|
||||
*/
|
||||
USetElements(const USet *uset)
|
||||
: uset(uset), rangeCount(uset_getRangeCount(uset)),
|
||||
stringCount(uset_getStringCount(uset)) {}
|
||||
USetElements(const USet *pUset)
|
||||
: uset(pUset), rangeCount(uset_getRangeCount(pUset)),
|
||||
stringCount(uset_getStringCount(pUset)) {}
|
||||
|
||||
/** @draft ICU 76 */
|
||||
/** @draft ICU 77 */
|
||||
USetElements(const USetElements &other) = default;
|
||||
|
||||
/** @draft ICU 76 */
|
||||
/** @draft ICU 77 */
|
||||
USetElementIterator begin() const {
|
||||
return USetElementIterator(uset, 0, rangeCount, rangeCount + stringCount);
|
||||
}
|
||||
|
||||
/** @draft ICU 76 */
|
||||
/** @draft ICU 77 */
|
||||
USetElementIterator end() const {
|
||||
return USetElementIterator(uset, rangeCount + stringCount, rangeCount, rangeCount + stringCount);
|
||||
}
|
||||
|
||||
4
thirdparty/icu4c/common/unicode/utf8.h
vendored
4
thirdparty/icu4c/common/unicode/utf8.h
vendored
@@ -124,7 +124,7 @@
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict);
|
||||
utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, int8_t strict);
|
||||
|
||||
/**
|
||||
* Function for handling "append code point" with error-checking.
|
||||
@@ -148,7 +148,7 @@ utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict);
|
||||
utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, int8_t strict);
|
||||
|
||||
/**
|
||||
* Function for handling "skip backward one code point" with error-checking.
|
||||
|
||||
3
thirdparty/icu4c/common/unicode/utypes.h
vendored
3
thirdparty/icu4c/common/unicode/utypes.h
vendored
@@ -598,12 +598,13 @@ typedef enum UErrorCode {
|
||||
U_MF_DUPLICATE_DECLARATION_ERROR, /**< The same variable is declared in more than one .local or .input declaration. @internal ICU 75 technology preview @deprecated This API is for technology preview only. */
|
||||
U_MF_OPERAND_MISMATCH_ERROR, /**< An operand provided to a function does not have the required form for that function @internal ICU 75 technology preview @deprecated This API is for technology preview only. */
|
||||
U_MF_DUPLICATE_VARIANT_ERROR, /**< A message includes a variant with the same key list as another variant. @internal ICU 76 technology preview @deprecated This API is for technology preview only. */
|
||||
U_MF_BAD_OPTION, /**< An option value provided to a function does not have the required form for that option. @internal ICU 77 technology preview @deprecated This API is for technology preview only. */
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal formatting API error code.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
U_FMT_PARSE_ERROR_LIMIT = 0x10120,
|
||||
U_FMT_PARSE_ERROR_LIMIT = 0x10121,
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
|
||||
/*
|
||||
|
||||
10
thirdparty/icu4c/common/unicode/uvernum.h
vendored
10
thirdparty/icu4c/common/unicode/uvernum.h
vendored
@@ -53,7 +53,7 @@
|
||||
* This value will change in the subsequent releases of ICU
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_ICU_VERSION_MAJOR_NUM 76
|
||||
#define U_ICU_VERSION_MAJOR_NUM 77
|
||||
|
||||
/** The current ICU minor version as an integer.
|
||||
* This value will change in the subsequent releases of ICU
|
||||
@@ -79,7 +79,7 @@
|
||||
* This value will change in the subsequent releases of ICU
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
#define U_ICU_VERSION_SUFFIX _76
|
||||
#define U_ICU_VERSION_SUFFIX _77
|
||||
|
||||
/**
|
||||
* \def U_DEF2_ICU_ENTRY_POINT_RENAME
|
||||
@@ -132,7 +132,7 @@
|
||||
* This value will change in the subsequent releases of ICU
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_ICU_VERSION "76.1"
|
||||
#define U_ICU_VERSION "77.1"
|
||||
|
||||
/**
|
||||
* The current ICU library major version number as a string, for library name suffixes.
|
||||
@@ -145,13 +145,13 @@
|
||||
*
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
#define U_ICU_VERSION_SHORT "76"
|
||||
#define U_ICU_VERSION_SHORT "77"
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/** Data version in ICU4C.
|
||||
* @internal ICU 4.4 Internal Use Only
|
||||
**/
|
||||
#define U_ICU_DATA_VERSION "76.1"
|
||||
#define U_ICU_DATA_VERSION "77.1"
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
19
thirdparty/icu4c/common/unicode/uversion.h
vendored
19
thirdparty/icu4c/common/unicode/uversion.h
vendored
@@ -125,7 +125,7 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
|
||||
U_NAMESPACE_USE
|
||||
# endif
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
#ifndef U_FORCE_HIDE_DRAFT_API
|
||||
/**
|
||||
* \def U_HEADER_NESTED_NAMESPACE
|
||||
* Nested namespace used inside U_ICU_NAMESPACE for header-only APIs.
|
||||
@@ -150,22 +150,37 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
|
||||
* @draft ICU 76
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_ICU_NAMESPACE_OR_INTERNAL
|
||||
* Namespace used for header-only APIs that used to be regular C++ APIs.
|
||||
* Different when used inside ICU to prevent public use of internal instantiations.
|
||||
* Similar to U_HEADER_ONLY_NAMESPACE, but the public definition is the same as U_ICU_NAMESPACE.
|
||||
* "U_ICU_NAMESPACE" or "U_ICU_NAMESPACE::internal".
|
||||
*
|
||||
* @draft ICU 77
|
||||
*/
|
||||
|
||||
// The first test is the same as for defining U_EXPORT for Windows.
|
||||
#if defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllexport__) && \
|
||||
UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__))
|
||||
# define U_HEADER_NESTED_NAMESPACE header
|
||||
# define U_ICU_NAMESPACE_OR_INTERNAL U_ICU_NAMESPACE
|
||||
#elif defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \
|
||||
defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \
|
||||
defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION)
|
||||
# define U_HEADER_NESTED_NAMESPACE internal
|
||||
# define U_ICU_NAMESPACE_OR_INTERNAL U_ICU_NAMESPACE::internal
|
||||
namespace U_ICU_NAMESPACE_OR_INTERNAL {}
|
||||
using namespace U_ICU_NAMESPACE_OR_INTERNAL;
|
||||
#else
|
||||
# define U_HEADER_NESTED_NAMESPACE header
|
||||
# define U_ICU_NAMESPACE_OR_INTERNAL U_ICU_NAMESPACE
|
||||
#endif
|
||||
|
||||
#define U_HEADER_ONLY_NAMESPACE U_ICU_NAMESPACE::U_HEADER_NESTED_NAMESPACE
|
||||
|
||||
namespace U_HEADER_ONLY_NAMESPACE {}
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
#endif // U_FORCE_HIDE_DRAFT_API
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user