12#if U_SHOW_CPLUSPLUS_API
30#ifdef U_ALIASING_BARRIER
32#elif (defined(__clang__) || defined(__GNUC__)) && U_PLATFORM != U_PF_BROWSER_NATIVE_CLIENT
33# define U_ALIASING_BARRIER(ptr) asm volatile("" : : "rm"(ptr) : "memory")
34#elif defined(U_IN_DOXYGEN)
35# define U_ALIASING_BARRIER(ptr)
50#if !U_CHAR16_IS_TYPEDEF
58#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
84 inline char16_t *
get()
const;
90 inline operator char16_t *()
const {
return get(); }
95#ifdef U_ALIASING_BARRIER
96 template<
typename T>
static char16_t *cast(T *t) {
98 return reinterpret_cast<char16_t *
>(t);
112#ifdef U_ALIASING_BARRIER
114Char16Ptr::Char16Ptr(
char16_t *p) : p_(p) {}
115#if !U_CHAR16_IS_TYPEDEF
116Char16Ptr::Char16Ptr(uint16_t *p) : p_(cast(p)) {}
118#if U_SIZEOF_WCHAR_T==2
119Char16Ptr::Char16Ptr(
wchar_t *p) : p_(cast(p)) {}
121Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {}
130Char16Ptr::Char16Ptr(
char16_t *p) { u_.cp = p; }
131#if !U_CHAR16_IS_TYPEDEF
132Char16Ptr::Char16Ptr(uint16_t *p) { u_.up = p; }
134#if U_SIZEOF_WCHAR_T==2
135Char16Ptr::Char16Ptr(
wchar_t *p) { u_.wp = p; }
137Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; }
157#if !U_CHAR16_IS_TYPEDEF
165#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
192 inline const char16_t *
get()
const;
198 inline operator const char16_t *()
const {
return get(); }
203#ifdef U_ALIASING_BARRIER
204 template<
typename T>
static const char16_t *cast(
const T *t) {
206 return reinterpret_cast<const char16_t *
>(t);
220#ifdef U_ALIASING_BARRIER
222ConstChar16Ptr::ConstChar16Ptr(
const char16_t *p) : p_(p) {}
223#if !U_CHAR16_IS_TYPEDEF
224ConstChar16Ptr::ConstChar16Ptr(
const uint16_t *p) : p_(cast(p)) {}
226#if U_SIZEOF_WCHAR_T==2
227ConstChar16Ptr::ConstChar16Ptr(
const wchar_t *p) : p_(cast(p)) {}
229ConstChar16Ptr::ConstChar16Ptr(
const std::nullptr_t p) : p_(p) {}
238ConstChar16Ptr::ConstChar16Ptr(
const char16_t *p) { u_.cp = p; }
239#if !U_CHAR16_IS_TYPEDEF
240ConstChar16Ptr::ConstChar16Ptr(
const uint16_t *p) { u_.up = p; }
242#if U_SIZEOF_WCHAR_T==2
243ConstChar16Ptr::ConstChar16Ptr(
const wchar_t *p) { u_.wp = p; }
245ConstChar16Ptr::ConstChar16Ptr(
const std::nullptr_t p) { u_.cp = p; }
261#ifdef U_ALIASING_BARRIER
264 return reinterpret_cast<const UChar *
>(p);
275#ifdef U_ALIASING_BARRIER
278 return reinterpret_cast<UChar *
>(p);
289#ifdef U_ALIASING_BARRIER
292 return reinterpret_cast<const OldUChar *
>(p);
303#ifdef U_ALIASING_BARRIER
306 return reinterpret_cast<OldUChar *
>(p);
#define U_ALIASING_BARRIER(ptr)
Barrier for pointer anti-aliasing optimizations even across function boundaries.
char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
Char16Ptr(std::nullptr_t p)
nullptr constructor.
Char16Ptr(uint16_t *p)
Converts the pointer to char16_t *.
Char16Ptr(wchar_t *p)
Converts the pointer to char16_t *.
Char16Ptr(char16_t *p)
Copies the pointer.
char16_t * get() const
Pointer access.
const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
ConstChar16Ptr(const char16_t *p)
Copies the pointer.
ConstChar16Ptr(const uint16_t *p)
Converts the pointer to char16_t *.
~ConstChar16Ptr()
Destructor.
const char16_t * get() const
Pointer access.
ConstChar16Ptr(const wchar_t *p)
Converts the pointer to char16_t *.
ConstChar16Ptr(const std::nullptr_t p)
nullptr constructor.
const OldUChar * toOldUCharPtr(const char16_t *p)
Converts from const char16_t * to const OldUChar *.
const UChar * toUCharPtr(const char16_t *p)
Converts from const char16_t * to const UChar *.
#define U_FINAL
Defined to the C++11 "final" keyword if available.
char16_t UChar
The base type for UTF-16 code units and pointers.
uint16_t OldUChar
Default ICU 58 definition of UChar.
Basic definitions for ICU, for both C and C++ APIs.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.