37 #if JUCE_NATIVE_WCHAR_IS_UTF16
40 using CharType = int16;
58 data =
const_cast<CharType*
> (text);
65 inline bool operator<= (CharPointer_UTF16 other)
const noexcept {
return data <= other.data; }
66 inline bool operator< (CharPointer_UTF16 other)
const noexcept {
return data < other.data; }
67 inline bool operator>= (CharPointer_UTF16 other)
const noexcept {
return data >= other.data; }
68 inline bool operator> (CharPointer_UTF16 other)
const noexcept {
return data > other.data; }
74 inline operator const CharType*()
const noexcept {
return data; }
87 if (n >= 0xd800 && n <= 0xdfff && ((
uint32) (
uint16) data[1]) >= 0xdc00)
88 n = 0x10000 + (((n - 0xd800) << 10) | (((
uint32) (
uint16) data[1]) - 0xdc00));
98 if (n >= 0xd800 && n <= 0xdfff && ((
uint32) (
uint16) *data) >= 0xdc00)
109 if (n >= 0xdc00 && n <= 0xdfff)
121 if (n >= 0xd800 && n <= 0xdfff && ((
uint32) (
uint16) *data) >= 0xdc00)
122 n = 0x10000 + ((((n - 0xd800) << 10) | (((
uint32) (
uint16) *data++) - 0xdc00)));
186 *data++ = (CharType) (0xd800 + (
charToWrite >> 10));
187 *data++ = (CharType) (0xdc00 + (
charToWrite & 0x3ff));
211 if (n >= 0xd800 && n <= 0xdfff)
242 return sizeof (CharType) * (findNullIndex (data) + 1);
250 return (
charToWrite >= 0x10000) ? (
sizeof (CharType) * 2) :
sizeof (CharType);
257 template <
class CharPo
inter>
263 while ((n = text.getAndAdvance()) != 0)
281 template <
typename CharPo
inter>
292 while ((*data = *s) != 0)
303 template <
typename CharPo
inter>
313 template <
typename CharPo
inter>
320 template <
typename CharPo
inter>
327 template <
typename CharPo
inter>
334 template <
typename CharPo
inter>
341 template <
typename CharPo
inter>
347 #if JUCE_MSVC && ! DOXYGEN
355 return _wcsnicmp (data, other.data, (
size_t) maxChars);
358 int indexOf (CharPointer_UTF16 stringToFind)
const noexcept
360 const CharType*
const t = wcsstr (data, stringToFind.getAddress());
361 return t ==
nullptr ? -1 : (int) (t - data);
366 template <
typename CharPo
inter>
409 return CharacterFunctions::getIntValue<int, CharPointer_UTF16> (*
this);
419 return CharacterFunctions::getIntValue<int64, CharPointer_UTF16> (*
this);
475 byteOrderMarkBE1 = 0xfe,
476 byteOrderMarkBE2 = 0xff,
477 byteOrderMarkLE1 = 0xff,
478 byteOrderMarkLE2 = 0xfe
489 return c[0] == (
uint8) byteOrderMarkBE1
490 &&
c[1] == (
uint8) byteOrderMarkBE2;
501 return c[0] == (
uint8) byteOrderMarkLE1
502 &&
c[1] == (
uint8) byteOrderMarkLE2;
508 static unsigned int findNullIndex (
const CharType*
t)
noexcept
ElementType * data() noexcept
juce_wchar toUpperCase() const noexcept
int getIntValue32() const noexcept
juce_wchar operator*() const noexcept
CharPointer_UTF16 operator-(int numToSkip) const noexcept
bool isNotEmpty() const noexcept
CharPointer_UTF16 operator++() noexcept
size_t writeWithDestByteLimit(CharPointer src, size_t maxDestBytes) noexcept
static size_t getBytesRequiredFor(juce_wchar charToWrite) noexcept
void writeAll(CharPointer src) noexcept
static bool canRepresent(juce_wchar character) noexcept
bool operator==(CharPointer_UTF16 other) const noexcept
void writeNull() const noexcept
juce_wchar toLowerCase() const noexcept
bool isUpperCase() const noexcept
int compareIgnoreCaseUpTo(CharPointer other, int maxChars) const noexcept
int64 getIntValue64() const noexcept
int compare(CharPointer other) const noexcept
bool isLetter() const noexcept
size_t lengthUpTo(size_t maxCharsToCount) const noexcept
CharPointer_UTF16 atomicSwap(CharPointer_UTF16 newValue)
static size_t getBytesRequiredFor(CharPointer text) noexcept
CharPointer_UTF16 operator--() noexcept
juce_wchar operator[](int characterIndex) const noexcept
double getDoubleValue() const noexcept
size_t length() const noexcept
CharPointer_UTF16 findTerminatingNull() const noexcept
size_t lengthUpTo(CharPointer_UTF16 end) const noexcept
int compareIgnoreCase(CharPointer other) const noexcept
CharType * getAddress() const noexcept
size_t sizeInBytes() const noexcept
static bool isByteOrderMarkBigEndian(const void *possibleByteOrder) noexcept
CharPointer_UTF16 operator+(int numToSkip) const noexcept
CharPointer_UTF16 findEndOfWhitespace() const noexcept
juce_wchar getAndAdvance() noexcept
bool isDigit() const noexcept
int compareUpTo(CharPointer other, int maxChars) const noexcept
void writeAll(CharPointer_UTF16 src) noexcept
bool isLowerCase() const noexcept
bool isEmpty() const noexcept
int indexOf(juce_wchar charToFind) const noexcept
void writeWithCharLimit(CharPointer src, int maxChars) noexcept
bool isLetterOrDigit() const noexcept
int indexOf(CharPointer stringToFind) const noexcept
void write(juce_wchar charToWrite) noexcept
static bool isValidString(const CharType *dataToTest, int maxBytesToRead)
bool isWhitespace() const noexcept
void operator-=(int numToSkip) noexcept
static bool isByteOrderMarkLittleEndian(const void *possibleByteOrder) noexcept
void operator+=(int numToSkip) noexcept
int indexOf(juce_wchar charToFind, bool ignoreCase) const noexcept
static int compare(juce_wchar char1, juce_wchar char2) noexcept
static juce_wchar toLowerCase(juce_wchar character) noexcept
static size_t copyWithDestByteLimit(DestCharPointerType &dest, SrcCharPointerType src, size_t maxBytesToWrite) noexcept
static int indexOfCharIgnoreCase(Type text, juce_wchar charToFind) noexcept
static bool isDigit(char character) noexcept
static int compareIgnoreCaseUpTo(CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept
static int indexOfChar(Type text, const juce_wchar charToFind) noexcept
static int compareIgnoreCase(juce_wchar char1, juce_wchar char2) noexcept
static bool isLowerCase(juce_wchar character) noexcept
static bool isLetter(char character) noexcept
static int indexOf(CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
static size_t lengthUpTo(CharPointerType text, const size_t maxCharsToCount) noexcept
static Type findEndOfWhitespace(Type text) noexcept
static void copyWithCharLimit(DestCharPointerType &dest, SrcCharPointerType src, int maxChars) noexcept
static bool isWhitespace(char character) noexcept
static bool isLetterOrDigit(char character) noexcept
static juce_wchar toUpperCase(juce_wchar character) noexcept
static bool isUpperCase(juce_wchar character) noexcept
static double getDoubleValue(CharPointerType text) noexcept
static void copyAll(DestCharPointerType &dest, SrcCharPointerType src) noexcept
static int compareUpTo(CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept