27#if JUCE_WINDOWS && ! DOXYGEN
28 #define JUCE_NATIVE_WCHAR_IS_UTF8 0
29 #define JUCE_NATIVE_WCHAR_IS_UTF16 1
30 #define JUCE_NATIVE_WCHAR_IS_UTF32 0
33 #define JUCE_NATIVE_WCHAR_IS_UTF8 0
35 #define JUCE_NATIVE_WCHAR_IS_UTF16 0
37 #define JUCE_NATIVE_WCHAR_IS_UTF32 1
40#if JUCE_NATIVE_WCHAR_IS_UTF32 || DOXYGEN
42 using juce_wchar = wchar_t;
44 using juce_wchar = uint32;
49 #define JUCE_T(stringLiteral) (L##stringLiteral)
52#if JUCE_DEFINE_T_MACRO
60 #define T(stringLiteral) JUCE_T(stringLiteral)
69 template <
typename Type>
struct make_unsigned {
using type = Type; };
70 template <>
struct make_unsigned<signed char> {
using type =
unsigned char; };
71 template <>
struct make_unsigned<char> {
using type =
unsigned char; };
72 template <>
struct make_unsigned<short> {
using type =
unsigned short; };
73 template <>
struct make_unsigned<int> {
using type =
unsigned int; };
74 template <>
struct make_unsigned<long> {
using type =
unsigned long; };
75 template <>
struct make_unsigned<long long> {
using type =
unsigned long long; };
96 static juce_wchar toUpperCase (juce_wchar
character)
noexcept;
98 static juce_wchar toLowerCase (juce_wchar
character)
noexcept;
101 static bool isUpperCase (juce_wchar
character)
noexcept;
103 static bool isLowerCase (juce_wchar
character)
noexcept;
106 static bool isWhitespace (
char character)
noexcept;
108 static bool isWhitespace (juce_wchar
character)
noexcept;
111 static bool isDigit (
char character)
noexcept;
113 static bool isDigit (juce_wchar
character)
noexcept;
116 static bool isLetter (
char character)
noexcept;
118 static bool isLetter (juce_wchar
character)
noexcept;
121 static bool isLetterOrDigit (
char character)
noexcept;
123 static bool isLetterOrDigit (juce_wchar
character)
noexcept;
128 static bool isPrintable (
char character)
noexcept;
133 static bool isPrintable (juce_wchar
character)
noexcept;
136 static int getHexDigitValue (juce_wchar
digit)
noexcept;
139 static juce_wchar getUnicodeCharFromWindows1252Codepage (uint8
windows1252Char)
noexcept;
146 template <
typename CharPo
interType>
150 bool isNegative =
false;
154 char buffer[(
size_t) bufferSize] = {};
158 text = text.findEndOfWhitespace();
178 if ((text[1] ==
'a' || text[1] ==
'A') && (text[2] ==
'n' || text[2] ==
'N'))
179 return std::numeric_limits<double>::quiet_NaN();
184 if ((text[1] ==
'n' || text[1] ==
'N') && (text[2] ==
'f' || text[2] ==
'F'))
185 return std::numeric_limits<double>::infinity();
204 digit = (
int) text.getAndAdvance() -
'0';
225 while (text.isDigit())
254 while (text.isDigit())
281 while (text.isDigit())
292 return isNegative ? -r : r;
304 auto digit = (
int) text.getAndAdvance() -
'0';
368 while (text.isDigit())
370 auto digit = (
int) text.getAndAdvance() -
'0';
383 if (
exponent > std::numeric_limits<double>::max_exponent10)
384 return std::numeric_limits<double>::quiet_NaN();
410 template <
typename CharPo
interType>
413 return readDoubleValue (text);
418 template <
typename IntType,
typename CharPo
interType>
424 auto s = text.findEndOfWhitespace();
425 const bool isNeg = *s ==
'-';
432 auto c = s.getAndAdvance();
434 if (
c >=
'0' &&
c <=
'9')
444 template <
typename ResultType>
447 template <
typename CharPo
interType>
448 static ResultType parse (CharPointerType
t)
noexcept
454 auto hexValue = CharacterFunctions::getHexDigitValue (
t.getAndAdvance());
467 template <
typename CharPo
interType>
480 template <
typename CharPo
interType>
481 static size_t lengthUpTo (CharPointerType start,
const CharPointerType end)
noexcept
485 while (start < end && start.getAndAdvance() != 0)
492 template <
typename DestCharPo
interType,
typename SrcCharPo
interType>
495 while (
auto c =
src.getAndAdvance())
503 template <
typename DestCharPo
interType,
typename SrcCharPo
interType>
512 auto c =
src.getAndAdvance();
524 return (
size_t) getAddressDifference (dest.getAddress(),
startAddress)
525 +
sizeof (
typename DestCharPointerType::CharType);
530 template <
typename DestCharPo
interType,
typename SrcCharPo
interType>
535 auto c =
src.getAndAdvance();
549 if (
auto diff =
static_cast<int> (
char1) -
static_cast<int> (
char2))
550 return diff < 0 ? -1 : 1;
556 template <
typename CharPo
interType1,
typename CharPo
interType2>
561 auto c1 = s1.getAndAdvance();
563 if (
auto diff = compare (
c1, s2.getAndAdvance()))
574 template <
typename CharPo
interType1,
typename CharPo
interType2>
579 auto c1 = s1.getAndAdvance();
581 if (
auto diff = compare (
c1, s2.getAndAdvance()))
598 template <
typename CharPo
interType1,
typename CharPo
interType2>
603 auto c1 = s1.getAndAdvance();
605 if (
auto diff = compareIgnoreCase (
c1, s2.getAndAdvance()))
616 template <
typename CharPo
interType1,
typename CharPo
interType2>
621 auto c1 = s1.getAndAdvance();
623 if (
auto diff = compareIgnoreCase (
c1, s2.getAndAdvance()))
636 template <
typename CharPo
interType1,
typename CharPo
interType2>
658 template <
typename CharPo
interType1,
typename CharPo
interType2>
674 template <
typename CharPo
interType>
692 template <
typename CharPo
interType1,
typename CharPo
interType2>
713 template <
typename Type>
718 while (! text.isEmpty())
733 template <
typename Type>
739 while (! text.isEmpty())
755 template <
typename Type>
758 while (text.isWhitespace())
767 template <
typename Type,
typename BreakType>
772 while (! text.isEmpty())
774 auto c = text.getAndAdvance();
795 static double mulexp10 (
double value,
int exponent)
noexcept;
bool isEmpty() const noexcept
int indexOf(ParameterType elementToLookFor) const
static int indexOfIgnoreCase(CharPointerType1 haystack, const CharPointerType2 needle) noexcept
static int compare(juce_wchar char1, juce_wchar char2) noexcept
static size_t copyWithDestByteLimit(DestCharPointerType &dest, SrcCharPointerType src, size_t maxBytesToWrite) noexcept
static int indexOfCharIgnoreCase(Type text, juce_wchar charToFind) noexcept
static IntType getIntValue(const CharPointerType text) noexcept
static int compareIgnoreCaseUpTo(CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept
static int indexOfChar(Type text, const juce_wchar charToFind) noexcept
static int compare(CharPointerType1 s1, CharPointerType2 s2) noexcept
static int compareIgnoreCase(juce_wchar char1, juce_wchar char2) noexcept
static size_t lengthUpTo(CharPointerType start, const CharPointerType end) noexcept
static int indexOf(CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
static size_t lengthUpTo(CharPointerType text, const size_t maxCharsToCount) noexcept
static double readDoubleValue(CharPointerType &text) noexcept
static CharPointerType find(CharPointerType textToSearch, const juce_wchar charToLookFor) noexcept
static Type findEndOfWhitespace(Type text) noexcept
static void copyWithCharLimit(DestCharPointerType &dest, SrcCharPointerType src, int maxChars) noexcept
static Type findEndOfToken(Type text, BreakType breakCharacters, Type quoteCharacters)
static CharPointerType1 find(CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
static int compareIgnoreCase(CharPointerType1 s1, CharPointerType2 s2) 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