OpenShot Library | libopenshot-audio  0.2.0
juce_CharPointer_UTF8.h
1 
2 /** @weakgroup juce_core-text
3  * @{
4  */
5 /*
6  ==============================================================================
7 
8  This file is part of the JUCE library.
9  Copyright (c) 2017 - ROLI Ltd.
10 
11  JUCE is an open source library subject to commercial or open-source
12  licensing.
13 
14  The code included in this file is provided under the terms of the ISC license
15  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16  To use, copy, modify, and/or distribute this software for any purpose with or
17  without fee is hereby granted provided that the above copyright notice and
18  this permission notice appear in all copies.
19 
20  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22  DISCLAIMED.
23 
24  ==============================================================================
25 */
26 
27 namespace juce
28 {
29 
30 //==============================================================================
31 /**
32  Wraps a pointer to a null-terminated UTF-8 character string, and provides
33  various methods to operate on the data.
34  @see CharPointer_UTF16, CharPointer_UTF32
35 
36  @tags{Core}
37 */
38 class CharPointer_UTF8 final
39 {
40 public:
41  using CharType = char;
42 
43  inline explicit CharPointer_UTF8 (const CharType* rawPointer) noexcept
44  : data (const_cast<CharType*> (rawPointer))
45  {
46  }
47 
48  inline CharPointer_UTF8 (const CharPointer_UTF8& other) = default;
49 
50  inline CharPointer_UTF8 operator= (CharPointer_UTF8 other) noexcept
51  {
52  data = other.data;
53  return *this;
54  }
55 
56  inline CharPointer_UTF8 operator= (const CharType* text) noexcept
57  {
58  data = const_cast<CharType*> (text);
59  return *this;
60  }
61 
62  /** This is a pointer comparison, it doesn't compare the actual text. */
63  inline bool operator== (CharPointer_UTF8 other) const noexcept { return data == other.data; }
64  inline bool operator!= (CharPointer_UTF8 other) const noexcept { return data != other.data; }
65  inline bool operator<= (CharPointer_UTF8 other) const noexcept { return data <= other.data; }
66  inline bool operator< (CharPointer_UTF8 other) const noexcept { return data < other.data; }
67  inline bool operator>= (CharPointer_UTF8 other) const noexcept { return data >= other.data; }
68  inline bool operator> (CharPointer_UTF8 other) const noexcept { return data > other.data; }
69 
70  /** Returns the address that this pointer is pointing to. */
71  inline CharType* getAddress() const noexcept { return data; }
72 
73  /** Returns the address that this pointer is pointing to. */
74  inline operator const CharType*() const noexcept { return data; }
75 
76  /** Returns true if this pointer is pointing to a null character. */
77  inline bool isEmpty() const noexcept { return *data == 0; }
78 
79  /** Returns true if this pointer is not pointing to a null character. */
80  inline bool isNotEmpty() const noexcept { return *data != 0; }
81 
82  /** Returns the unicode character that this pointer is pointing to. */
83  juce_wchar operator*() const noexcept
84  {
85  auto byte = (signed char) *data;
86 
87  if (byte >= 0)
88  return (juce_wchar) (uint8) byte;
89 
90  uint32 n = (uint32) (uint8) byte;
91  uint32 mask = 0x7f;
92  uint32 bit = 0x40;
93  int numExtraValues = 0;
94 
95  while ((n & bit) != 0 && bit > 0x8)
96  {
97  mask >>= 1;
98  ++numExtraValues;
99  bit >>= 1;
100  }
101 
102  n &= mask;
103 
104  for (int i = 1; i <= numExtraValues; ++i)
105  {
106  auto nextByte = (uint32) (uint8) data[i];
107 
108  if ((nextByte & 0xc0) != 0x80)
109  break;
110 
111  n <<= 6;
112  n |= (nextByte & 0x3f);
113  }
114 
115  return (juce_wchar) n;
116  }
117 
118  /** Moves this pointer along to the next character in the string. */
120  {
121  jassert (*data != 0); // trying to advance past the end of the string?
122  auto n = (signed char) *data++;
123 
124  if (n < 0)
125  {
126  uint8 bit = 0x40;
127 
128  while ((static_cast<uint8> (n) & bit) != 0 && bit > 0x8)
129  {
130  ++data;
131  bit >>= 1;
132  }
133  }
134 
135  return *this;
136  }
137 
138  /** Moves this pointer back to the previous character in the string. */
140  {
141  int count = 0;
142 
143  while ((*--data & 0xc0) == 0x80 && ++count < 4)
144  {}
145 
146  return *this;
147  }
148 
149  /** Returns the character that this pointer is currently pointing to, and then
150  advances the pointer to point to the next character. */
151  juce_wchar getAndAdvance() noexcept
152  {
153  auto byte = (signed char) *data++;
154 
155  if (byte >= 0)
156  return (juce_wchar) (uint8) byte;
157 
158  uint32 n = (uint32) (uint8) byte;
159  uint32 mask = 0x7f;
160  uint32 bit = 0x40;
161  int numExtraValues = 0;
162 
163  while ((n & bit) != 0 && bit > 0x8)
164  {
165  mask >>= 1;
166  ++numExtraValues;
167  bit >>= 1;
168  }
169 
170  n &= mask;
171 
172  while (--numExtraValues >= 0)
173  {
174  auto nextByte = (uint32) (uint8) *data;
175 
176  if ((nextByte & 0xc0) != 0x80)
177  break;
178 
179  ++data;
180  n <<= 6;
181  n |= (nextByte & 0x3f);
182  }
183 
184  return (juce_wchar) n;
185  }
186 
187  /** Moves this pointer along to the next character in the string. */
189  {
190  CharPointer_UTF8 temp (*this);
191  ++*this;
192  return temp;
193  }
194 
195  /** Moves this pointer forwards by the specified number of characters. */
196  void operator+= (int numToSkip) noexcept
197  {
198  if (numToSkip < 0)
199  {
200  while (++numToSkip <= 0)
201  --*this;
202  }
203  else
204  {
205  while (--numToSkip >= 0)
206  ++*this;
207  }
208  }
209 
210  /** Moves this pointer backwards by the specified number of characters. */
211  void operator-= (int numToSkip) noexcept
212  {
213  operator+= (-numToSkip);
214  }
215 
216  /** Returns the character at a given character index from the start of the string. */
217  juce_wchar operator[] (int characterIndex) const noexcept
218  {
219  auto p (*this);
220  p += characterIndex;
221  return *p;
222  }
223 
224  /** Returns a pointer which is moved forwards from this one by the specified number of characters. */
225  CharPointer_UTF8 operator+ (int numToSkip) const noexcept
226  {
227  auto p (*this);
228  p += numToSkip;
229  return p;
230  }
231 
232  /** Returns a pointer which is moved backwards from this one by the specified number of characters. */
233  CharPointer_UTF8 operator- (int numToSkip) const noexcept
234  {
235  auto p (*this);
236  p += -numToSkip;
237  return p;
238  }
239 
240  /** Returns the number of characters in this string. */
241  size_t length() const noexcept
242  {
243  auto* d = data;
244  size_t count = 0;
245 
246  for (;;)
247  {
248  auto n = (uint32) (uint8) *d++;
249 
250  if ((n & 0x80) != 0)
251  {
252  while ((*d & 0xc0) == 0x80)
253  ++d;
254  }
255  else if (n == 0)
256  break;
257 
258  ++count;
259  }
260 
261  return count;
262  }
263 
264  /** Returns the number of characters in this string, or the given value, whichever is lower. */
265  size_t lengthUpTo (const size_t maxCharsToCount) const noexcept
266  {
267  return CharacterFunctions::lengthUpTo (*this, maxCharsToCount);
268  }
269 
270  /** Returns the number of characters in this string, or up to the given end pointer, whichever is lower. */
271  size_t lengthUpTo (const CharPointer_UTF8 end) const noexcept
272  {
273  return CharacterFunctions::lengthUpTo (*this, end);
274  }
275 
276  /** Returns the number of bytes that are used to represent this string.
277  This includes the terminating null character.
278  */
279  size_t sizeInBytes() const noexcept
280  {
281  jassert (data != nullptr);
282  return strlen (data) + 1;
283  }
284 
285  /** Returns the number of bytes that would be needed to represent the given
286  unicode character in this encoding format.
287  */
288  static size_t getBytesRequiredFor (const juce_wchar charToWrite) noexcept
289  {
290  size_t num = 1;
291  auto c = (uint32) charToWrite;
292 
293  if (c >= 0x80)
294  {
295  ++num;
296  if (c >= 0x800)
297  {
298  ++num;
299  if (c >= 0x10000)
300  ++num;
301  }
302  }
303 
304  return num;
305  }
306 
307  /** Returns the number of bytes that would be needed to represent the given
308  string in this encoding format.
309  The value returned does NOT include the terminating null character.
310  */
311  template <class CharPointer>
312  static size_t getBytesRequiredFor (CharPointer text) noexcept
313  {
314  size_t count = 0;
315 
316  while (auto n = text.getAndAdvance())
317  count += getBytesRequiredFor (n);
318 
319  return count;
320  }
321 
322  /** Returns a pointer to the null character that terminates this string. */
324  {
325  return CharPointer_UTF8 (data + strlen (data));
326  }
327 
328  /** Writes a unicode character to this string, and advances this pointer to point to the next position. */
329  void write (const juce_wchar charToWrite) noexcept
330  {
331  auto c = (uint32) charToWrite;
332 
333  if (c >= 0x80)
334  {
335  int numExtraBytes = 1;
336  if (c >= 0x800)
337  {
338  ++numExtraBytes;
339  if (c >= 0x10000)
340  ++numExtraBytes;
341  }
342 
343  *data++ = (CharType) ((uint32) (0xff << (7 - numExtraBytes)) | (c >> (numExtraBytes * 6)));
344 
345  while (--numExtraBytes >= 0)
346  *data++ = (CharType) (0x80 | (0x3f & (c >> (numExtraBytes * 6))));
347  }
348  else
349  {
350  *data++ = (CharType) c;
351  }
352  }
353 
354  /** Writes a null character to this string (leaving the pointer's position unchanged). */
355  inline void writeNull() const noexcept
356  {
357  *data = 0;
358  }
359 
360  /** Copies a source string to this pointer, advancing this pointer as it goes. */
361  template <typename CharPointer>
362  void writeAll (const CharPointer src) noexcept
363  {
364  CharacterFunctions::copyAll (*this, src);
365  }
366 
367  /** Copies a source string to this pointer, advancing this pointer as it goes. */
368  void writeAll (const CharPointer_UTF8 src) noexcept
369  {
370  auto* s = src.data;
371 
372  while ((*data = *s) != 0)
373  {
374  ++data;
375  ++s;
376  }
377  }
378 
379  /** Copies a source string to this pointer, advancing this pointer as it goes.
380  The maxDestBytes parameter specifies the maximum number of bytes that can be written
381  to the destination buffer before stopping.
382  */
383  template <typename CharPointer>
384  size_t writeWithDestByteLimit (const CharPointer src, const size_t maxDestBytes) noexcept
385  {
386  return CharacterFunctions::copyWithDestByteLimit (*this, src, maxDestBytes);
387  }
388 
389  /** Copies a source string to this pointer, advancing this pointer as it goes.
390  The maxChars parameter specifies the maximum number of characters that can be
391  written to the destination buffer before stopping (including the terminating null).
392  */
393  template <typename CharPointer>
394  void writeWithCharLimit (const CharPointer src, const int maxChars) noexcept
395  {
396  CharacterFunctions::copyWithCharLimit (*this, src, maxChars);
397  }
398 
399  /** Compares this string with another one. */
400  template <typename CharPointer>
401  int compare (const CharPointer other) const noexcept
402  {
403  return CharacterFunctions::compare (*this, other);
404  }
405 
406  /** Compares this string with another one, up to a specified number of characters. */
407  template <typename CharPointer>
408  int compareUpTo (const CharPointer other, const int maxChars) const noexcept
409  {
410  return CharacterFunctions::compareUpTo (*this, other, maxChars);
411  }
412 
413  /** Compares this string with another one. */
414  template <typename CharPointer>
415  int compareIgnoreCase (const CharPointer other) const noexcept
416  {
417  return CharacterFunctions::compareIgnoreCase (*this, other);
418  }
419 
420  /** Compares this string with another one. */
421  int compareIgnoreCase (const CharPointer_UTF8 other) const noexcept
422  {
423  return CharacterFunctions::compareIgnoreCase (*this, other);
424  }
425 
426  /** Compares this string with another one, up to a specified number of characters. */
427  template <typename CharPointer>
428  int compareIgnoreCaseUpTo (const CharPointer other, const int maxChars) const noexcept
429  {
430  return CharacterFunctions::compareIgnoreCaseUpTo (*this, other, maxChars);
431  }
432 
433  /** Returns the character index of a substring, or -1 if it isn't found. */
434  template <typename CharPointer>
435  int indexOf (const CharPointer stringToFind) const noexcept
436  {
437  return CharacterFunctions::indexOf (*this, stringToFind);
438  }
439 
440  /** Returns the character index of a unicode character, or -1 if it isn't found. */
441  int indexOf (const juce_wchar charToFind) const noexcept
442  {
443  return CharacterFunctions::indexOfChar (*this, charToFind);
444  }
445 
446  /** Returns the character index of a unicode character, or -1 if it isn't found. */
447  int indexOf (const juce_wchar charToFind, const bool ignoreCase) const noexcept
448  {
449  return ignoreCase ? CharacterFunctions::indexOfCharIgnoreCase (*this, charToFind)
450  : CharacterFunctions::indexOfChar (*this, charToFind);
451  }
452 
453  /** Returns true if the first character of this string is whitespace. */
454  bool isWhitespace() const noexcept { const CharType c = *data; return c == ' ' || (c <= 13 && c >= 9); }
455  /** Returns true if the first character of this string is a digit. */
456  bool isDigit() const noexcept { const CharType c = *data; return c >= '0' && c <= '9'; }
457  /** Returns true if the first character of this string is a letter. */
458  bool isLetter() const noexcept { return CharacterFunctions::isLetter (operator*()) != 0; }
459  /** Returns true if the first character of this string is a letter or digit. */
460  bool isLetterOrDigit() const noexcept { return CharacterFunctions::isLetterOrDigit (operator*()) != 0; }
461  /** Returns true if the first character of this string is upper-case. */
462  bool isUpperCase() const noexcept { return CharacterFunctions::isUpperCase (operator*()) != 0; }
463  /** Returns true if the first character of this string is lower-case. */
464  bool isLowerCase() const noexcept { return CharacterFunctions::isLowerCase (operator*()) != 0; }
465 
466  /** Returns an upper-case version of the first character of this string. */
467  juce_wchar toUpperCase() const noexcept { return CharacterFunctions::toUpperCase (operator*()); }
468  /** Returns a lower-case version of the first character of this string. */
469  juce_wchar toLowerCase() const noexcept { return CharacterFunctions::toLowerCase (operator*()); }
470 
471  /** Parses this string as a 32-bit integer. */
472  int getIntValue32() const noexcept { return atoi (data); }
473 
474  /** Parses this string as a 64-bit integer. */
475  int64 getIntValue64() const noexcept
476  {
477  #if JUCE_WINDOWS && ! JUCE_MINGW
478  return _atoi64 (data);
479  #else
480  return atoll (data);
481  #endif
482  }
483 
484  /** Parses this string as a floating point double. */
485  double getDoubleValue() const noexcept { return CharacterFunctions::getDoubleValue (*this); }
486 
487  /** Returns the first non-whitespace character in the string. */
489 
490  /** Returns true if the given unicode character can be represented in this encoding. */
491  static bool canRepresent (juce_wchar character) noexcept
492  {
493  return ((uint32) character) < (uint32) 0x10ffff;
494  }
495 
496  /** Returns true if this data contains a valid string in this encoding. */
497  static bool isValidString (const CharType* dataToTest, int maxBytesToRead)
498  {
499  while (--maxBytesToRead >= 0 && *dataToTest != 0)
500  {
501  auto byte = (signed char) *dataToTest++;
502 
503  if (byte < 0)
504  {
505  int bit = 0x40;
506  int numExtraValues = 0;
507 
508  while ((byte & bit) != 0)
509  {
510  if (bit < 8)
511  return false;
512 
513  ++numExtraValues;
514  bit >>= 1;
515 
516  if (bit == 8 && (numExtraValues > maxBytesToRead
517  || *CharPointer_UTF8 (dataToTest - 1) > 0x10ffff))
518  return false;
519  }
520 
521  if (numExtraValues == 0)
522  return false;
523 
524  maxBytesToRead -= numExtraValues;
525  if (maxBytesToRead < 0)
526  return false;
527 
528  while (--numExtraValues >= 0)
529  if ((*dataToTest++ & 0xc0) != 0x80)
530  return false;
531  }
532  }
533 
534  return true;
535  }
536 
537  /** Atomically swaps this pointer for a new value, returning the previous value. */
539  {
540  return CharPointer_UTF8 (reinterpret_cast<Atomic<CharType*>&> (data).exchange (newValue.data));
541  }
542 
543  /** These values are the byte-order mark (BOM) values for a UTF-8 stream. */
544  enum
545  {
546  byteOrderMark1 = 0xef,
547  byteOrderMark2 = 0xbb,
548  byteOrderMark3 = 0xbf
549  };
550 
551  /** Returns true if the first three bytes in this pointer are the UTF8 byte-order mark (BOM).
552  The pointer must not be null, and must point to at least 3 valid bytes.
553  */
554  static bool isByteOrderMark (const void* possibleByteOrder) noexcept
555  {
556  jassert (possibleByteOrder != nullptr);
557  auto c = static_cast<const uint8*> (possibleByteOrder);
558 
559  return c[0] == (uint8) byteOrderMark1
560  && c[1] == (uint8) byteOrderMark2
561  && c[2] == (uint8) byteOrderMark3;
562  }
563 
564 private:
565  CharType* data;
566 };
567 
568 } // namespace juce
569 
570 /** @}*/
A simple wrapper around std::atomic.
Definition: juce_Atomic.h:45
static size_t getBytesRequiredFor(const juce_wchar charToWrite) noexcept
Returns the number of bytes that would be needed to represent the given unicode character in this enc...
bool isLetter() const noexcept
Returns true if the first character of this string is a letter.
juce_wchar toUpperCase() const noexcept
Returns an upper-case version of the first character of this string.
int indexOf(const juce_wchar charToFind) const noexcept
Returns the character index of a unicode character, or -1 if it isn&#39;t found.
static double getDoubleValue(CharPointerType text) noexcept
Parses a character string, to read a floating-point value.
static juce_wchar toUpperCase(juce_wchar character) noexcept
Converts a character to upper-case.
void writeWithCharLimit(const CharPointer src, const int maxChars) noexcept
Copies a source string to this pointer, advancing this pointer as it goes.
bool isLetterOrDigit() const noexcept
Returns true if the first character of this string is a letter or digit.
bool isDigit() const noexcept
Returns true if the first character of this string is a digit.
CharPointer_UTF8 & operator++() noexcept
Moves this pointer along to the next character in the string.
size_t length() const noexcept
Returns the number of characters in this string.
size_t lengthUpTo(const CharPointer_UTF8 end) const noexcept
Returns the number of characters in this string, or up to the given end pointer, whichever is lower...
int compareIgnoreCase(const CharPointer_UTF8 other) const noexcept
Compares this string with another one.
double getDoubleValue() const noexcept
Parses this string as a floating point double.
static int indexOfCharIgnoreCase(Type text, juce_wchar charToFind) noexcept
Finds the character index of a given character in another string, using a case-independent match...
static void copyAll(DestCharPointerType &dest, SrcCharPointerType src) noexcept
Copies null-terminated characters from one string to another.
juce_wchar operator*() const noexcept
Returns the unicode character that this pointer is pointing to.
bool isLowerCase() const noexcept
Returns true if the first character of this string is lower-case.
static int compareIgnoreCase(juce_wchar char1, juce_wchar char2) noexcept
Compares two characters, using a case-independant match.
void operator-=(int numToSkip) noexcept
Moves this pointer backwards by the specified number of characters.
bool isNotEmpty() const noexcept
Returns true if this pointer is not pointing to a null character.
bool isEmpty() const noexcept
Returns true if this pointer is pointing to a null character.
static Type findEndOfWhitespace(Type text) noexcept
Returns a pointer to the first non-whitespace character in a string.
size_t lengthUpTo(const size_t maxCharsToCount) const noexcept
Returns the number of characters in this string, or the given value, whichever is lower...
size_t writeWithDestByteLimit(const CharPointer src, const size_t maxDestBytes) noexcept
Copies a source string to this pointer, advancing this pointer as it goes.
static bool isValidString(const CharType *dataToTest, int maxBytesToRead)
Returns true if this data contains a valid string in this encoding.
CharPointer_UTF8 operator--() noexcept
Moves this pointer back to the previous character in the string.
CharPointer_UTF8 findEndOfWhitespace() const noexcept
Returns the first non-whitespace character in the string.
CharPointer_UTF8 operator+(int numToSkip) const noexcept
Returns a pointer which is moved forwards from this one by the specified number of characters...
static int indexOfChar(Type text, const juce_wchar charToFind) noexcept
Finds the character index of a given character in another string.
void writeAll(const CharPointer src) noexcept
Copies a source string to this pointer, advancing this pointer as it goes.
bool isWhitespace() const noexcept
Returns true if the first character of this string is whitespace.
static int compareIgnoreCaseUpTo(CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept
Compares two null-terminated character strings, using a case-independent match.
juce_wchar toLowerCase() const noexcept
Returns a lower-case version of the first character of this string.
int indexOf(const CharPointer stringToFind) const noexcept
Returns the character index of a substring, or -1 if it isn&#39;t found.
static bool isUpperCase(juce_wchar character) noexcept
Checks whether a unicode character is upper-case.
static size_t lengthUpTo(CharPointerType text, const size_t maxCharsToCount) noexcept
Counts the number of characters in a given string, stopping if the count exceeds a specified limit...
static size_t getBytesRequiredFor(CharPointer text) noexcept
Returns the number of bytes that would be needed to represent the given string in this encoding forma...
bool operator==(CharPointer_UTF8 other) const noexcept
This is a pointer comparison, it doesn&#39;t compare the actual text.
static size_t copyWithDestByteLimit(DestCharPointerType &dest, SrcCharPointerType src, size_t maxBytesToWrite) noexcept
Copies characters from one string to another, up to a null terminator or a given byte size limit...
bool isUpperCase() const noexcept
Returns true if the first character of this string is upper-case.
juce_wchar getAndAdvance() noexcept
Returns the character that this pointer is currently pointing to, and then advances the pointer to po...
CharType * getAddress() const noexcept
Returns the address that this pointer is pointing to.
int compareIgnoreCase(const CharPointer other) const noexcept
Compares this string with another one.
CharPointer_UTF8 findTerminatingNull() const noexcept
Returns a pointer to the null character that terminates this string.
int compareUpTo(const CharPointer other, const int maxChars) const noexcept
Compares this string with another one, up to a specified number of characters.
static juce_wchar toLowerCase(juce_wchar character) noexcept
Converts a character to lower-case.
int64 getIntValue64() const noexcept
Parses this string as a 64-bit integer.
static bool isByteOrderMark(const void *possibleByteOrder) noexcept
Returns true if the first three bytes in this pointer are the UTF8 byte-order mark (BOM)...
static bool isLetter(char character) noexcept
Checks whether a character is alphabetic.
static bool canRepresent(juce_wchar character) noexcept
Returns true if the given unicode character can be represented in this encoding.
CharPointer_UTF8 atomicSwap(const CharPointer_UTF8 newValue)
Atomically swaps this pointer for a new value, returning the previous value.
void operator+=(int numToSkip) noexcept
Moves this pointer forwards by the specified number of characters.
CharPointer_UTF8 operator-(int numToSkip) const noexcept
Returns a pointer which is moved backwards from this one by the specified number of characters...
int compareIgnoreCaseUpTo(const CharPointer other, const int maxChars) const noexcept
Compares this string with another one, up to a specified number of characters.
static int indexOf(CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
Finds the character index of a given substring in another string.
int compare(const CharPointer other) const noexcept
Compares this string with another one.
void writeNull() const noexcept
Writes a null character to this string (leaving the pointer&#39;s position unchanged).
int indexOf(const juce_wchar charToFind, const bool ignoreCase) const noexcept
Returns the character index of a unicode character, or -1 if it isn&#39;t found.
int getIntValue32() const noexcept
Parses this string as a 32-bit integer.
static bool isLowerCase(juce_wchar character) noexcept
Checks whether a unicode character is lower-case.
static bool isLetterOrDigit(char character) noexcept
Checks whether a character is alphabetic or numeric.
static int compareUpTo(CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept
Compares two null-terminated character strings, up to a given number of characters.
static void copyWithCharLimit(DestCharPointerType &dest, SrcCharPointerType src, int maxChars) noexcept
Copies characters from one string to another, up to a null terminator or a given maximum number of ch...
void writeAll(const CharPointer_UTF8 src) noexcept
Copies a source string to this pointer, advancing this pointer as it goes.
static int compare(juce_wchar char1, juce_wchar char2) noexcept
Compares two characters.
size_t sizeInBytes() const noexcept
Returns the number of bytes that are used to represent this string.
Wraps a pointer to a null-terminated UTF-8 character string, and provides various methods to operate ...
juce_wchar operator[](int characterIndex) const noexcept
Returns the character at a given character index from the start of the string.
void write(const juce_wchar charToWrite) noexcept
Writes a unicode character to this string, and advances this pointer to point to the next position...