29 #ifndef JUCE_CHARPOINTER_UTF16_H_INCLUDED 30 #define JUCE_CHARPOINTER_UTF16_H_INCLUDED 42 #if JUCE_NATIVE_WCHAR_IS_UTF16 49 : data (const_cast <CharType*> (rawPointer))
66 data = const_cast <CharType*> (text);
82 inline operator const CharType*()
const noexcept {
return data; }
92 if (n >= 0xd800 && n <= 0xdfff && ((
uint32) (
uint16) data[1]) >= 0xdc00)
93 n = 0x10000 + (((n - 0xd800) << 10) | (((
uint32) (
uint16) data[1]) - 0xdc00));
103 if (n >= 0xd800 && n <= 0xdfff && ((
uint32) (
uint16) *data) >= 0xdc00)
114 if (n >= 0xdc00 && n <= 0xdfff)
126 if (n >= 0xd800 && n <= 0xdfff && ((
uint32) (
uint16) *data) >= 0xdc00)
127 n = 0x10000 + ((((n - 0xd800) << 10) | (((
uint32) (
uint16) *data++) - 0xdc00)));
145 while (++numToSkip <= 0)
150 while (--numToSkip >= 0)
188 if (charToWrite >= 0x10000)
190 charToWrite -= 0x10000;
191 *data++ = (
CharType) (0xd800 + (charToWrite >> 10));
192 *data++ = (
CharType) (0xdc00 + (charToWrite & 0x3ff));
209 const CharType* d = data;
216 if (n >= 0xd800 && n <= 0xdfff)
247 return sizeof (
CharType) * (findNullIndex (data) + 1);
255 return (charToWrite >= 0x10000) ? (
sizeof (
CharType) * 2) :
sizeof (
CharType);
262 template <
class CharPo
inter>
268 while ((n = text.getAndAdvance()) != 0)
277 const CharType* t = data;
286 template <
typename CharPo
inter>
295 const CharType* s = src.data;
297 while ((*data = *s) != 0)
308 template <
typename CharPo
inter>
318 template <
typename CharPo
inter>
325 template <
typename CharPo
inter>
332 template <
typename CharPo
inter>
339 template <
typename CharPo
inter>
346 template <
typename CharPo
inter>
352 #if JUCE_MSVC && ! DOXYGEN 355 return _wcsicmp (data, other.data);
360 return _wcsnicmp (data, other.data, (
size_t) maxChars);
365 const CharType*
const t = wcsstr (data, stringToFind.
getAddress());
366 return t ==
nullptr ? -1 : (
int) (t - data);
371 template <
typename CharPo
inter>
414 return CharacterFunctions::getIntValue <int, CharPointer_UTF16> (*this);
422 return _wtoi64 (data);
424 return CharacterFunctions::getIntValue <int64, CharPointer_UTF16> (*this);
437 return ((
unsigned int) character) < (
unsigned int) 0x10ffff
438 && (((
unsigned int) character) < 0xd800 || ((
unsigned int) character) > 0xdfff);
444 maxBytesToRead /= (
int)
sizeof (CharType);
446 while (--maxBytesToRead >= 0 && *dataToTest != 0)
462 if (nextChar < 0xdc00 || nextChar > 0xdfff)
491 jassert (possibleByteOrder !=
nullptr);
492 const uint8*
const c =
static_cast<const uint8*
> (possibleByteOrder);
503 jassert (possibleByteOrder !=
nullptr);
504 const uint8*
const c =
static_cast<const uint8*
> (possibleByteOrder);
513 static unsigned int findNullIndex (
const CharType*
const t)
noexcept 525 #endif // JUCE_CHARPOINTER_UTF16_H_INCLUDED bool isDigit() const noexcept
Definition: juce_CharPointer_UTF16.h:393
CharPointer_UTF16(const CharType *const rawPointer) noexcept
Definition: juce_CharPointer_UTF16.h:48
static size_t lengthUpTo(CharPointerType text, const size_t maxCharsToCount) noexcept
Definition: juce_CharacterFunctions.h:307
static bool isByteOrderMarkBigEndian(const void *possibleByteOrder) noexcept
Definition: juce_CharPointer_UTF16.h:489
double getDoubleValue() const noexcept
Definition: juce_CharPointer_UTF16.h:429
static bool isByteOrderMarkLittleEndian(const void *possibleByteOrder) noexcept
Definition: juce_CharPointer_UTF16.h:501
CharPointer_UTF16 operator--() noexcept
Definition: juce_CharPointer_UTF16.h:110
CharPointer_UTF16 operator-(const int numToSkip) const noexcept
Definition: juce_CharPointer_UTF16.h:178
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_CharPointer_UTF16.h:39
Definition: juce_Atomic.h:41
signed short int16
Definition: juce_MathsFunctions.h:45
static juce_wchar toLowerCase(juce_wchar character) noexcept
Definition: juce_CharacterFunctions.cpp:40
void operator-=(int numToSkip) noexcept
Definition: juce_CharPointer_UTF16.h:156
int indexOf(const juce_wchar charToFind) const noexcept
Definition: juce_CharPointer_UTF16.h:378
unsigned short uint16
Definition: juce_MathsFunctions.h:47
juce_wchar getAndAdvance() noexcept
Definition: juce_CharPointer_UTF16.h:122
static int compare(CharPointerType1 s1, CharPointerType2 s2) noexcept
Definition: juce_CharacterFunctions.h:393
static Type findEndOfWhitespace(Type text) noexcept
Definition: juce_CharacterFunctions.h:586
size_t lengthUpTo(const size_t maxCharsToCount) const noexcept
Definition: juce_CharPointer_UTF16.h:231
TOUCHINPUT int
Definition: juce_win32_Windowing.cpp:123
static double getDoubleValue(CharPointerType text) noexcept
Definition: juce_CharacterFunctions.h:253
CharPointer_UTF16 atomicSwap(const CharPointer_UTF16 newValue)
Definition: juce_CharPointer_UTF16.h:472
size_t length() const noexcept
Definition: juce_CharPointer_UTF16.h:207
bool isEmpty() const noexcept
Definition: juce_CharPointer_UTF16.h:85
bool operator>(CharPointer_UTF16 other) const noexcept
Definition: juce_CharPointer_UTF16.h:76
CharPointer_UTF16 findEndOfWhitespace() const noexcept
Definition: juce_CharPointer_UTF16.h:432
void writeAll(const CharPointer_UTF16 src) noexcept
Definition: juce_CharPointer_UTF16.h:293
static bool isDigit(char character) noexcept
Definition: juce_CharacterFunctions.cpp:78
static bool isLetterOrDigit(char character) noexcept
Definition: juce_CharacterFunctions.cpp:99
void write(juce_wchar charToWrite) noexcept
Definition: juce_CharPointer_UTF16.h:186
static bool isWhitespace(char character) noexcept
Definition: juce_CharacterFunctions.cpp:68
static juce_wchar toUpperCase(juce_wchar character) noexcept
Definition: juce_CharacterFunctions.cpp:35
static bool isLetter(char character) noexcept
Definition: juce_CharacterFunctions.cpp:88
static int indexOf(CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
Definition: juce_CharacterFunctions.h:467
static void copyAll(DestCharPointerType &dest, SrcCharPointerType src) noexcept
Definition: juce_CharacterFunctions.h:332
CharPointer_UTF16(const CharPointer_UTF16 &other) noexcept
Definition: juce_CharPointer_UTF16.h:53
static size_t copyWithDestByteLimit(DestCharPointerType &dest, SrcCharPointerType src, size_t maxBytesToWrite) noexcept
Definition: juce_CharacterFunctions.h:350
bool isLowerCase() const noexcept
Definition: juce_CharPointer_UTF16.h:401
size_t writeWithDestByteLimit(const CharPointer src, const size_t maxDestBytes) noexcept
Definition: juce_CharPointer_UTF16.h:309
Definition: juce_CharPointer_UTF16.h:480
void writeNull() const noexcept
Definition: juce_CharPointer_UTF16.h:201
void writeWithCharLimit(const CharPointer src, const int maxChars) noexcept
Definition: juce_CharPointer_UTF16.h:319
bool operator<=(CharPointer_UTF16 other) const noexcept
Definition: juce_CharPointer_UTF16.h:73
bool isLetterOrDigit() const noexcept
Definition: juce_CharPointer_UTF16.h:397
unsigned int uint32
Definition: juce_MathsFunctions.h:51
bool operator==(CharPointer_UTF16 other) const noexcept
Definition: juce_CharPointer_UTF16.h:71
juce_wchar operator[](const int characterIndex) const noexcept
Definition: juce_CharPointer_UTF16.h:162
static void copyWithCharLimit(DestCharPointerType &dest, SrcCharPointerType src, int maxChars) noexcept
Definition: juce_CharacterFunctions.h:377
bool operator>=(CharPointer_UTF16 other) const noexcept
Definition: juce_CharPointer_UTF16.h:75
CharPointer_UTF16 findTerminatingNull() const noexcept
Definition: juce_CharPointer_UTF16.h:275
int64 getIntValue64() const noexcept
Definition: juce_CharPointer_UTF16.h:419
bool operator!=(CharPointer_UTF16 other) const noexcept
Definition: juce_CharPointer_UTF16.h:72
static int compareIgnoreCase(CharPointerType1 s1, CharPointerType2 s2) noexcept
Definition: juce_CharacterFunctions.h:427
long long int64
Definition: juce_MathsFunctions.h:60
size_t lengthUpTo(const CharPointer_UTF16 end) const noexcept
Definition: juce_CharPointer_UTF16.h:237
static bool canRepresent(juce_wchar character) noexcept
Definition: juce_CharPointer_UTF16.h:435
CharPointer_UTF16 operator+(const int numToSkip) const noexcept
Definition: juce_CharPointer_UTF16.h:170
int compare(const CharPointer other) const noexcept
Definition: juce_CharPointer_UTF16.h:326
bool isLetter() const noexcept
Definition: juce_CharPointer_UTF16.h:395
static int indexOfChar(Type text, const juce_wchar charToFind) noexcept
Definition: juce_CharacterFunctions.h:544
static bool isValidString(const CharType *dataToTest, int maxBytesToRead)
Definition: juce_CharPointer_UTF16.h:442
int16 CharType
Definition: juce_CharPointer_UTF16.h:45
static size_t getBytesRequiredFor(const juce_wchar charToWrite) noexcept
Definition: juce_CharPointer_UTF16.h:253
static int compareUpTo(CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept
Definition: juce_CharacterFunctions.h:410
int compareUpTo(const CharPointer other, const int maxChars) const noexcept
Definition: juce_CharPointer_UTF16.h:333
static int indexOfCharIgnoreCase(Type text, juce_wchar charToFind) noexcept
Definition: juce_CharacterFunctions.h:564
bool operator<(CharPointer_UTF16 other) const noexcept
Definition: juce_CharPointer_UTF16.h:74
static bool isLowerCase(juce_wchar character) noexcept
Definition: juce_CharacterFunctions.cpp:54
int compareIgnoreCase(const CharPointer other) const noexcept
Definition: juce_CharPointer_UTF16.h:340
juce_wchar operator*() const noexcept
Definition: juce_CharPointer_UTF16.h:88
int indexOf(const juce_wchar charToFind, const bool ignoreCase) const noexcept
Definition: juce_CharPointer_UTF16.h:384
static bool isUpperCase(juce_wchar character) noexcept
Definition: juce_CharacterFunctions.cpp:45
Definition: juce_CharPointer_UTF16.h:483
size_t sizeInBytes() const noexcept
Definition: juce_CharPointer_UTF16.h:245
static int compareIgnoreCaseUpTo(CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept
Definition: juce_CharacterFunctions.h:446
Definition: juce_CharPointer_UTF16.h:482
Definition: juce_CharPointer_UTF16.h:481
static size_t getBytesRequiredFor(CharPointer text) noexcept
Definition: juce_CharPointer_UTF16.h:263
juce_wchar toUpperCase() const noexcept
Definition: juce_CharPointer_UTF16.h:404
unsigned char uint8
Definition: juce_MathsFunctions.h:43
int compareIgnoreCaseUpTo(const CharPointer other, const int maxChars) const noexcept
Definition: juce_CharPointer_UTF16.h:347
void operator+=(int numToSkip) noexcept
Definition: juce_CharPointer_UTF16.h:141
juce_wchar toLowerCase() const noexcept
Definition: juce_CharPointer_UTF16.h:406
wchar_t juce_wchar
Definition: juce_CharacterFunctions.h:49
CharType * getAddress() const noexcept
Definition: juce_CharPointer_UTF16.h:79
bool isWhitespace() const noexcept
Definition: juce_CharPointer_UTF16.h:391
CharPointer_UTF16 operator++() noexcept
Definition: juce_CharPointer_UTF16.h:99
int indexOf(const CharPointer stringToFind) const noexcept
Definition: juce_CharPointer_UTF16.h:372
CharPointer_UTF16 operator=(CharPointer_UTF16 other) noexcept
Definition: juce_CharPointer_UTF16.h:58
void writeAll(const CharPointer src) noexcept
Definition: juce_CharPointer_UTF16.h:287
bool isUpperCase() const noexcept
Definition: juce_CharPointer_UTF16.h:399
int getIntValue32() const noexcept
Definition: juce_CharPointer_UTF16.h:409