27#ifdef U_ALIASING_BARRIER
29#elif (defined(__clang__) || defined(__GNUC__)) && U_PLATFORM != U_PF_BROWSER_NATIVE_CLIENT
30# define U_ALIASING_BARRIER(ptr) asm volatile("" : : "rm"(ptr) : "memory")
45#if !U_CHAR16_IS_TYPEDEF
53#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
79 inline char16_t *get()
const;
85 inline operator char16_t *()
const {
return get(); }
90#ifdef U_ALIASING_BARRIER
91 template<
typename T>
static char16_t *cast(T *t) {
92 U_ALIASING_BARRIER(t);
93 return reinterpret_cast<char16_t *
>(t);
106#ifdef U_ALIASING_BARRIER
108Char16Ptr::Char16Ptr(
char16_t *p) : p_(p) {}
109#if !U_CHAR16_IS_TYPEDEF
110Char16Ptr::Char16Ptr(uint16_t *p) : p_(cast(p)) {}
112#if U_SIZEOF_WCHAR_T==2
113Char16Ptr::Char16Ptr(
wchar_t *p) : p_(cast(p)) {}
115Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {}
117 U_ALIASING_BARRIER(p_);
124Char16Ptr::Char16Ptr(
char16_t *p) { u_.cp = p; }
125#if !U_CHAR16_IS_TYPEDEF
126Char16Ptr::Char16Ptr(uint16_t *p) { u_.up = p; }
128#if U_SIZEOF_WCHAR_T==2
129Char16Ptr::Char16Ptr(
wchar_t *p) { u_.wp = p; }
131Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; }
150#if !U_CHAR16_IS_TYPEDEF
158#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
185 inline const char16_t *get()
const;
191 inline operator const char16_t *()
const {
return get(); }
196#ifdef U_ALIASING_BARRIER
197 template<
typename T>
static const char16_t *cast(
const T *t) {
198 U_ALIASING_BARRIER(t);
199 return reinterpret_cast<const char16_t *
>(t);
212#ifdef U_ALIASING_BARRIER
214ConstChar16Ptr::ConstChar16Ptr(
const char16_t *p) : p_(p) {}
215#if !U_CHAR16_IS_TYPEDEF
216ConstChar16Ptr::ConstChar16Ptr(
const uint16_t *p) : p_(cast(p)) {}
218#if U_SIZEOF_WCHAR_T==2
219ConstChar16Ptr::ConstChar16Ptr(
const wchar_t *p) : p_(cast(p)) {}
221ConstChar16Ptr::ConstChar16Ptr(
const std::nullptr_t p) : p_(p) {}
223 U_ALIASING_BARRIER(p_);
230ConstChar16Ptr::ConstChar16Ptr(
const char16_t *p) { u_.cp = p; }
231#if !U_CHAR16_IS_TYPEDEF
232ConstChar16Ptr::ConstChar16Ptr(
const uint16_t *p) { u_.up = p; }
234#if U_SIZEOF_WCHAR_T==2
235ConstChar16Ptr::ConstChar16Ptr(
const wchar_t *p) { u_.wp = p; }
237ConstChar16Ptr::ConstChar16Ptr(
const std::nullptr_t p) { u_.cp = p; }
252#ifdef U_ALIASING_BARRIER
253 U_ALIASING_BARRIER(p);
255 return reinterpret_cast<const UChar *
>(p);
266#ifdef U_ALIASING_BARRIER
267 U_ALIASING_BARRIER(p);
269 return reinterpret_cast<UChar *
>(p);
280#ifdef U_ALIASING_BARRIER
281 U_ALIASING_BARRIER(p);
283 return reinterpret_cast<const OldUChar *
>(p);
294#ifdef U_ALIASING_BARRIER
295 U_ALIASING_BARRIER(p);
297 return reinterpret_cast<OldUChar *
>(p);
char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
Char16Ptr(wchar_t *p)
Converts the pointer to char16_t *.
char16_t * get() const
Pointer access.
const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
~ConstChar16Ptr()
Destructor.
const char16_t * get() const
Pointer access.
ConstChar16Ptr(const wchar_t *p)
Converts the pointer to char16_t *.
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 *.
uint16_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.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.