feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
#include <cstddef>
|
||||
#include <string_view>
|
||||
|
||||
/**
|
||||
* \file
|
||||
|
|
@ -306,6 +307,76 @@ inline OldUChar *toOldUCharPtr(char16_t *p) {
|
|||
return reinterpret_cast<OldUChar *>(p);
|
||||
}
|
||||
|
||||
#ifndef U_FORCE_HIDE_INTERNAL_API
|
||||
/**
|
||||
* Is T convertible to a std::u16string_view or some other 16-bit string view?
|
||||
* @internal
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr bool ConvertibleToU16StringView =
|
||||
std::is_convertible_v<T, std::u16string_view>
|
||||
#if !U_CHAR16_IS_TYPEDEF && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 180000)
|
||||
|| std::is_convertible_v<T, std::basic_string_view<uint16_t>>
|
||||
#endif
|
||||
#if U_SIZEOF_WCHAR_T==2
|
||||
|| std::is_convertible_v<T, std::wstring_view>
|
||||
#endif
|
||||
;
|
||||
|
||||
namespace internal {
|
||||
/**
|
||||
* Pass-through overload.
|
||||
* @internal
|
||||
*/
|
||||
inline std::u16string_view toU16StringView(std::u16string_view sv) { return sv; }
|
||||
|
||||
#if !U_CHAR16_IS_TYPEDEF && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 180000)
|
||||
/**
|
||||
* Basically undefined behavior but sometimes necessary conversion
|
||||
* from std::basic_string_view<uint16_t> to std::u16string_view.
|
||||
* @internal
|
||||
*/
|
||||
inline std::u16string_view toU16StringView(std::basic_string_view<uint16_t> sv) {
|
||||
return { ConstChar16Ptr(sv.data()), sv.length() };
|
||||
}
|
||||
#endif
|
||||
|
||||
#if U_SIZEOF_WCHAR_T==2
|
||||
/**
|
||||
* Basically undefined behavior but sometimes necessary conversion
|
||||
* from std::wstring_view to std::u16string_view.
|
||||
* @internal
|
||||
*/
|
||||
inline std::u16string_view toU16StringView(std::wstring_view sv) {
|
||||
return { ConstChar16Ptr(sv.data()), sv.length() };
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Pass-through overload.
|
||||
* @internal
|
||||
*/
|
||||
template <typename T,
|
||||
typename = typename std::enable_if_t<!std::is_pointer_v<std::remove_reference_t<T>>>>
|
||||
inline std::u16string_view toU16StringViewNullable(const T& text) {
|
||||
return toU16StringView(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* In case of nullptr, return an empty view.
|
||||
* @internal
|
||||
*/
|
||||
template <typename T,
|
||||
typename = typename std::enable_if_t<std::is_pointer_v<std::remove_reference_t<T>>>,
|
||||
typename = void>
|
||||
inline std::u16string_view toU16StringViewNullable(const T& text) {
|
||||
if (text == nullptr) return {}; // For backward compatibility.
|
||||
return toU16StringView(text);
|
||||
}
|
||||
|
||||
} // internal
|
||||
#endif // U_FORCE_HIDE_INTERNAL_API
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* U_SHOW_CPLUSPLUS_API */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue