9#ifndef mozilla_Char16_h
10#define mozilla_Char16_h
21# define MOZ_USE_CHAR16_WRAPPER
38 static_assert(
sizeof(char16_t) ==
sizeof(
wchar_t),
39 "char16_t and wchar_t sizes differ");
42 char16ptr_t(
const char16_t* aPtr) : mPtr(aPtr) {}
43 char16ptr_t(
const wchar_t* aPtr) :
44 mPtr(reinterpret_cast<const char16_t*>(aPtr))
48 constexpr char16ptr_t(
decltype(
nullptr)) : mPtr(nullptr) {}
50 operator const char16_t*()
const
54 operator const wchar_t*()
const
56 return reinterpret_cast<const wchar_t*
>(mPtr);
58 operator const void*()
const
64 return mPtr !=
nullptr;
68 explicit operator char16_t*()
const
70 return const_cast<char16_t*
>(mPtr);
72 explicit operator wchar_t*()
const
74 return const_cast<wchar_t*
>(
static_cast<const wchar_t*
>(*this));
76 explicit operator int()
const
78 return reinterpret_cast<intptr_t
>(mPtr);
80 explicit operator unsigned int()
const
82 return reinterpret_cast<uintptr_t
>(mPtr);
84 explicit operator long()
const
86 return reinterpret_cast<intptr_t
>(mPtr);
88 explicit operator unsigned long()
const
90 return reinterpret_cast<uintptr_t
>(mPtr);
92 explicit operator long long()
const
94 return reinterpret_cast<intptr_t
>(mPtr);
96 explicit operator unsigned long long()
const
98 return reinterpret_cast<uintptr_t
>(mPtr);
106 explicit operator const char*()
const
108 return reinterpret_cast<const char*
>(mPtr);
110 explicit operator const unsigned char*()
const
112 return reinterpret_cast<const unsigned char*
>(mPtr);
114 explicit operator unsigned char*()
const
117 const_cast<unsigned char*
>(
reinterpret_cast<const unsigned char*
>(mPtr));
119 explicit operator void*()
const
121 return const_cast<char16_t*
>(mPtr);
125 char16_t operator[](
size_t aIndex)
const
129 bool operator==(
const char16ptr_t& aOther)
const
131 return mPtr == aOther.mPtr;
135 return mPtr ==
nullptr;
137 bool operator!=(
const char16ptr_t& aOther)
const
139 return mPtr != aOther.mPtr;
143 return mPtr !=
nullptr;
147 return char16ptr_t(mPtr + aValue);
149 char16ptr_t
operator+(
unsigned int aValue)
const
151 return char16ptr_t(mPtr + aValue);
155 return char16ptr_t(mPtr + aValue);
157 char16ptr_t
operator+(
unsigned long aValue)
const
159 return char16ptr_t(mPtr + aValue);
161 char16ptr_t
operator+(
long long aValue)
const
163 return char16ptr_t(mPtr + aValue);
165 char16ptr_t
operator+(
unsigned long long aValue)
const
167 return char16ptr_t(mPtr + aValue);
169 ptrdiff_t
operator-(
const char16ptr_t& aOther)
const
171 return mPtr - aOther.mPtr;
175inline decltype((
char*)0-(
char*)0)
176operator-(
const char16_t* aX,
const char16ptr_t aY)
178 return aX -
static_cast<const char16_t*
>(aY);
183typedef const char16_t* char16ptr_t;
187static_assert(
sizeof(char16_t) == 2,
"Is char16_t type 16 bits?");
188static_assert(char16_t(-1) > char16_t(0),
"Is char16_t type unsigned?");
189static_assert(
sizeof(
u'A') == 2,
"Is unicode char literal 16 bits?");
190static_assert(
sizeof(
u""[0]) == 2,
"Is unicode string char 16 bits?");
std::deque< AttacherIndex_Impl > aIndex
std::enable_if< std::is_signed< T >::value, SwNodeOffset >::type operator-(SwNodeOffset a, T n)
std::enable_if< std::is_signed< T >::value, SwNodeOffset >::type operator+(SwNodeOffset a, T n)
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)