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:
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__
|
||||
|
||||
Reference in New Issue
Block a user