Evo C++ Library v0.5.1
ustring.h
Go to the documentation of this file.
1 // Evo C++ Library
2 /* Copyright 2019 Justin Crowell
3 Distributed under the BSD 2-Clause License -- see included file LICENSE.txt for details.
4 */
6 
7 #pragma once
8 #ifndef INCL_evo_ustring_h
9 #define INCL_evo_ustring_h
10 
11 #include "string.h"
12 
13 namespace evo {
16 
18 
82 class UnicodeString : public List<wchar16,StrSizeT> {
83 public:
86  typedef StrSizeT Size;
87 
90  { }
91 
97  UnicodeString(const UnicodeString& str) : List<wchar16,Size>(str)
98  { }
99 
107  UnicodeString(const wchar16* str, Size size)
108  { set(str, size); }
109 
116  UnicodeString(const wchar16* str)
117  { set(str); }
118 
123  { set(str); }
124 
129  UnicodeString(const char* str, Size size)
130  { set(str, size); }
131 
135  UnicodeString(const char* str)
136  { set(str); }
137 
146  if (str.ptr_ != NULL) {
147  const ulong len = utf16_strlen(str.ptr_);
148  assert( len < IntegerT<Size>::MAX );
149  copy(str.ptr_, (Size)len);
150  }
151  }
152 
153 #if defined(EVO_CPP11)
154 
157  UnicodeString(UnicodeString&& src) : List(std::move(src)) {
158  }
159 
169  UnicodeString(const char16_t* str, Size size) {
170  assert( sizeof(char16_t) == sizeof(wchar16) );
171  set((const wchar16*)str, size);
172  }
173 
182  UnicodeString(const char16_t* str) {
183  assert( sizeof(char16_t) == sizeof(wchar16) );
184  set((const wchar16*)str);
185  }
186 
192  List::operator=(std::move(src));
193  return *this;
194  }
195 
205  UnicodeString& operator=(const char16_t* str) {
206  assert( sizeof(char16_t) == sizeof(wchar16) );
207  set((const wchar16*)str);
208  return *this;
209  }
210 #endif
211 
212  // SET
213 
216  { return set(str); }
217 
226  { return set(str); }
227 
235  UnicodeString& operator=(const wchar16* str)
236  { return set(str); }
237 
243  { return set(str); }
244 
249  UnicodeString& operator=(const char* str)
250  { return set(str); }
251 
261  { return set(str); }
262 
267  { ListType::setempty(); return *this; }
268 
273  { ListType::set(); return *this; }
274 
282  UnicodeString& set(const ListType& str)
283  { ListType::set(str); return *this; }
284 
292  UnicodeString& set(const ListBaseType& str)
293  { ListType::set(str); return *this; }
294 
303  UnicodeString& set(const wchar16* str, Size size)
304  { ListType::set(str, size); return *this; }
305 
313  UnicodeString& set(const wchar16* str) {
314  if (str == NULL)
315  ListType::set();
316  else
317  set(str, utf16_strlen(str));
318  return *this;
319  }
320 
325  UnicodeString& set(const StringBase& str) {
326  set(str.data_, str.size_);
327  return *this;
328  }
329 
340  UnicodeString& set(const char* str, Size size, UtfMode mode=umREPLACE_INVALID) {
341  if (str == NULL) {
342  set();
343  } else {
344  setempty();
345  if (size > 0) {
346  const char* p = str;
347  const char* end = p + size;
348  ulong newsize = utf8_to16(p, end, NULL, 0, mode);
349  if (newsize > 0) {
350  wchar16* buf = advBuffer(++newsize);
351  const ulong written = utf8_to16(str, end, buf, newsize, mode);
352  if (written > 0)
353  advSize(written);
354  }
355  }
356  }
357  return *this;
358  }
359 
364  UnicodeString& set(const char* str) {
365  if (str == NULL)
366  ListType::set();
367  else
368  set(str, (Size)strlen(str));
369  return *this;
370  }
371 
380  UnicodeString& set(const PtrBase<wchar16>& str) {
381  if (str.ptr_ == NULL) {
382  set();
383  } else {
384  const ulong len = utf16_strlen(str.ptr_);
385  assert( len < IntegerT<Size>::MAX );
386  copy(str.ptr_, (Size)len);
387  }
388  return *this;
389  }
390 
391 #if defined(_WIN32) || defined(DOXYGEN)
392 
399  UnicodeString& operator=(const WCHAR* str)
400  { return set((const wchar16*)str); }
401 
410  UnicodeString& set(const WCHAR* str, Size size)
411  { return set((const wchar16*)str, size); }
412 
420  UnicodeString& set(const WCHAR* str)
421  { return set((const wchar16*)str); }
422 
431  UnicodeString& copy(const WCHAR* str, Size size)
432  { return copy((const wchar16*)str, size); }
433 
441  UnicodeString& copy(const WCHAR* str)
442  { return copy((const wchar16*)str); }
443 
453  UnicodeString& set_win32(const char* str, int size) {
454  if (str == NULL) {
455  set();
456  } else {
457  setempty();
458  if (size > 0) {
459  assert( size < IntegerT<Size>::MAX );
460  int newsize = ::MultiByteToWideChar(CP_UTF8, 0, str, size, NULL, 0);
461  if (newsize > 0) {
462  WCHAR* buf = (WCHAR*)advBuffer(++newsize); // leave a space for terminator
463  const int written = ::MultiByteToWideChar(CP_UTF8, 0, str, size, buf, newsize);
464  if (written >= 0)
465  advSize(written);
466  }
467  }
468  }
469  return *this;
470  }
471 
480  UnicodeString& set_win32(const char* str) {
481  if (str == NULL) {
482  set();
483  } else {
484  setempty();
485  if (*str != NULL) {
486  ulong size = (ulong)strlen(str);
487  assert( size < IntegerT<Size>::MAX );
488  int newsize = ::MultiByteToWideChar(CP_UTF8, 0, str, size, NULL, 0);
489  if (newsize > 0) {
490  WCHAR* buf = (WCHAR*)advBuffer(++newsize); // leave a space for terminator
491  const int written = ::MultiByteToWideChar(CP_UTF8, 0, str, size, buf, newsize);
492  if (written >= 0)
493  advSize(written);
494  }
495  }
496  }
497  return *this;
498  }
499 #endif
500 
501  // INFO
502 
509  const wchar16* data() const
510  { return data_; }
511 
521  const wchar16* cstr(UnicodeString& buffer) const {
522  static const wchar16 EMPTY = 0;
523  return (size_ > 0 ? buffer.set(*this).cstr() : &EMPTY);
524  }
525 
533  const wchar16* cstr() {
534  static const wchar16 EMPTY = 0;
535  const wchar16* result = &EMPTY;
536  if (size_ > 0) {
537  // Not empty
538  if (buf_.ptr != NULL) {
539  assert( buf_.header != NULL );
540  assert( data_ >= buf_.ptr );
541  assert( data_ < buf_.ptr+buf_.header->used );
542  if (size_ + (data_-buf_.ptr) < buf_.header->used)
543  // End is sliced off, jump to add terminator
544  goto add_term;
545  }
546 
547  // End not sliced
548  #if EVO_LIST_OPT_REFTERM
549  if (terminated_) {
550  // Already terminated
551  result = data_;
552  } else
553  #endif
554  {
555  // Add temporary terminator
556  add_term:
557  reserve(1);
558  data_[size_] = 0;
559  result = data_;
560  }
561  }
562  return result;
563  }
564 
570  const wchar16* cstrM() const {
571  static const wchar16 EMPTY = 0;
572  return (size_ > 0 ? const_cast<UnicodeString*>(this)->cstr() : &EMPTY);
573  }
574 
575  // COMPARE
576 
581  int compare(const ListBaseType& data) const
582  { return utf16_compare(data_, size_, data.data_, data.size_); }
583 
588  int compare(const StringBase& data) const
589  { return utf16_compare8(data_, size_, data.data_, data.size_); }
590 
591  using ListType::operator==;
592  using ListType::operator!=;
593 
598  bool operator==(const UnicodeString& str) const
599  { return ListType::operator==(str); }
600 
605  bool operator==(const wchar16* str) const
606  { return (utf16_compare(data_, size_, str) == 0); }
607 
612  bool operator==(const StringBase& str) const
613  { return (utf16_compare8(data_, size_, str.data_, str.size_) == 0); }
614 
619  bool operator==(const char* str) const
620  { return (utf16_compare8(data_, size_, str) == 0); }
621 
626  bool operator!=(const UnicodeString& str) const
627  { return ListType::operator!=(str); }
628 
633  bool operator!=(const wchar16* str) const
634  { return (utf16_compare(data_, size_, str) != 0); }
635 
640  bool operator!=(const StringBase& str) const
641  { return (utf16_compare8(data_, size_, str.data_, str.size_) != 0); }
642 
647  bool operator!=(const char* str) const
648  { return (utf16_compare8(data_, size_, str) != 0); }
649 
650  // COPY
651 
660  { ListType::copy(str); return *this; }
661 
670  UnicodeString& copy(const wchar16* str, Size size)
671  { ListType::copy(str, size); return *this; }
672 
680  UnicodeString& copy(const wchar16* str) {
681  if (str == NULL)
682  ListType::set();
683  else
684  ListType::copy(str, utf16_strlen(str));
685  return *this;
686  }
687 
688  // OVERRIDES
689 
692  { ListType::clear(); return *this; }
693 
695  UnicodeString& set2(const ListType& data, Key index1, Key index2)
696  { ListType::set2(data, index1, index2); return *this; }
697 
699  UnicodeString& set2(const ListBaseType& data, Key index1, Key index2)
700  { ListType::set2(data, index1, index2); return *this; }
701 
703  UnicodeString& triml(Size size)
704  { ListType::triml(size); return *this; }
705 
707  UnicodeString& trimr(Size size)
708  { ListType::trimr(size); return *this; }
709 
711  UnicodeString& truncate(Size size=0)
712  { ListType::truncate(size); return *this; }
713 
716  { ListType::slice(index); return *this; }
717 
719  UnicodeString& slice(Key index, Size size)
720  { ListType::slice(index, size); return *this; }
721 
723  UnicodeString& slice2(Key index1, Key index2)
724  { ListType::slice2(index1, index2); return *this; }
725 
728  { ListType::unslice(); return *this; }
729 
732  { ListType::capacity(size); return *this; }
733 
736  { ListType::capacitymin(min); return *this; }
737 
740  { ListType::capacitymax(max); return *this; }
741 
744  { ListType::compact(); return *this; }
745 
747  UnicodeString& reserve(Size size, bool prefer_realloc=false)
748  { ListType::reserve(size, prefer_realloc); return *this; }
749 
752  { ListType::unshare(); return *this; }
753 
755  UnicodeString& resize(Size size)
756  { ListType::resize(size); return *this; }
757 
759  UnicodeString& addnew(Size size=1)
760  { ListType::addnew(size); return *this; }
761 
763  UnicodeString& add(const Item* data, Size size)
764  { ListType::add(data, size); return *this; }
765 
768  { ListType::add(data); return *this; }
769 
772  { ListType::add(data); return *this; }
773 
776  { ListType::operator<<(data); return *this; }
777 
780  { ListType::operator<<(data); return *this; }
781 
784  { ListType::operator<<(val); return *this; }
785 
788  { ListType::operator<<(val); return *this; }
789 
791  UnicodeString& prependnew(Size size=1)
792  { ListType::prependnew(size); return *this; }
793 
795  UnicodeString& prepend(const Item* data, Size size)
796  { ListType::prepend(data, size); return *this; }
797 
800  { ListType::prepend(data); return *this; }
801 
804  { ListType::prepend(data); return *this; }
805 
807  UnicodeString& fill(const Item& item, Key index=0, Size size=ALL)
808  { ListType::fill(item, index, size); return *this; }
809 
811  UnicodeString& replace(Key index, Size rsize, const Item* data, Size size)
812  { ListType::replace(index, rsize, data, size); return *this; }
813 
816  { ListType::advResize(size); return *this; }
817 
818 private:
819  UnicodeString& reverse() EVO_ONCPP11(= delete);
820 };
821 
823 
824 }
825 #endif
ListType & unslice()
Clean and remove hidden items previously removed via slicing (modifier).
Definition: list.h:1427
ListType & add(const Item *data, Size size)
Append new items copied from data pointer (modifier).
Definition: list.h:2019
UnicodeString & addnew(Size size=1)
Append new items (modifier).
Definition: ustring.h:759
ulong utf8_to16(const char *&str, const char *end, wchar16 *outbuf=NULL, ulong outsize=0, UtfMode mode=umREPLACE_INVALID)
Convert UTF-8 string to UTF-16 string.
Definition: str.h:543
UnicodeString & add(const ListBaseType &data)
Append new items copied from another list (modifier).
Definition: ustring.h:767
Size size() const
Get size.
Definition: list.h:759
T & max(T &a, T &b)
Returns highest of given values.
Definition: alg.h:47
UnicodeString & capacity(Size size)
Set new capacity (modifier).
Definition: ustring.h:731
int compare(const StringBase &data) const
Comparison against UTF-8 string.
Definition: ustring.h:588
Size capacity() const
Get capacity.
Definition: list.h:777
UnicodeString & slice2(Key index1, Key index2)
Slice to given sublist using start/end positions.
Definition: ustring.h:723
UnicodeString & operator=(const StringBase &str)
Assignment operator to convert from UTF-8 string base type.
Definition: ustring.h:242
const wchar16 * cstr(UnicodeString &buffer) const
Get terminated string pointer, using given string buffer if needed (const).
Definition: ustring.h:521
UnicodeString(const char16_t *str)
Constructor for UTF-16 string pointer (C++11).
Definition: ustring.h:182
int compare(const ListBaseType &data) const
Comparison.
Definition: ustring.h:581
bool operator==(const wchar16 *str) const
Equality operator.
Definition: ustring.h:605
Evo String container.
UnicodeString & prependnew(Size size=1)
Prepend new items (modifier).
Definition: ustring.h:791
ValEmpty
Special empty value type, pass as vEMPTY.
Definition: sys.h:1101
ListType & operator=(ListType &&src)
Move assignment operator (C++11).
Definition: list.h:496
UnicodeString & reserve(Size size, bool prefer_realloc=false)
Reserve capacity for additional items (modifier).
Definition: ustring.h:747
StrSizeT Size
Size type.
Definition: ustring.h:86
void advSize(Size size)
Advanced: Set new size after writing directly to buffer.
Definition: list.h:2754
wchar16 Item
Item type (same as Value)
Definition: list.h:250
ListType & set2(const ListType &data, Key index1, Key index2)
Set from subset of another list using start/end positions.
Definition: list.h:700
UnicodeString & set2(const ListType &data, Key index1, Key index2)
Set from subset of another list using start/end positions.
Definition: ustring.h:695
bool operator!=(const UnicodeString &str) const
Inequality operator.
Definition: ustring.h:626
ListType & reserve(Size size, bool prefer_realloc=false)
Reserve capacity for additional items (modifier).
Definition: list.h:1703
UnicodeString & set()
Set as null and empty.
Definition: ustring.h:272
ListType & slice2(Key index1, Key index2)
Slice to given sublist using start/end positions.
Definition: list.h:1418
ValNull
Unique null value type and value (vNULL).
Definition: sys.h:1096
ListType & fill(const Item &item, Key index=0, Size size=ALL)
Fill using item (modifier).
Definition: list.h:2291
UnicodeString & operator<<(const ValEmpty &val)
Append operator to set as empty but not null.
Definition: ustring.h:787
UnicodeString(const wchar16 *str, Size size)
Constructor for string pointer.
Definition: ustring.h:107
#define EVO_ONCPP11(EXPR)
Compile EXPR only if C++11 support is detected, otherwise this is a no-op.
Definition: sys.h:259
void move(Key dest, Key index)
Move item to position (modifier).
Definition: list.h:2338
UnicodeString & add(const Item *data, Size size)
Append new items copied from data pointer (modifier).
Definition: ustring.h:763
bool operator==(const StringBase &str) const
Equality operator to compare against UTF-8 string.
Definition: ustring.h:612
UnicodeString & add(const Item &data)
Append new item (modifier).
Definition: ustring.h:771
ListType & prepend(const Item *data, Size size)
Prepend new items copied from data pointer (modifier).
Definition: list.h:2125
UnicodeString & copy(const ListBaseType &str)
Copy from base list type.
Definition: ustring.h:659
ulong utf16_strlen(const wchar16 *str)
Find terminated UTF-16 string length.
Definition: str.h:946
UnicodeString & resize(Size size)
Resize while preserving existing data (modifier).
Definition: ustring.h:755
UnicodeString & operator=(const PtrBase< wchar16 > &str)
ASsignment operator for null terminated string from managed pointer.
Definition: ustring.h:260
UnicodeString & copy(const wchar16 *str)
Copy from terminated raw string pointer.
Definition: ustring.h:680
int utf16_compare(const wchar16 *str1, ulong len1, const wchar16 *str2, ulong len2)
Compare two non-terminated UTF-16 strings.
Definition: str.h:729
UnicodeString & copy(const WCHAR *str, Size size)
Copy from terminated Windows WCHAR string pointer (Windows only).
Definition: ustring.h:431
UnicodeString(const char *str, Size size)
Constructor to convert string from UTF-8.
Definition: ustring.h:129
UnicodeString & operator=(const char16_t *str)
Assignment operator for terminated UTF-16 string pointer (C++11).
Definition: ustring.h:205
UnicodeString & slice(Key index, Size size)
Slice to given sublist.
Definition: ustring.h:719
UnicodeString & fill(const Item &item, Key index=0, Size size=ALL)
Fill using item (modifier).
Definition: ustring.h:807
ListType & compact()
Reduce capacity to fit current size (modifier).
Definition: list.h:1686
UnicodeString & copy(const wchar16 *str, Size size)
Copy from raw string pointer.
Definition: ustring.h:670
ListType & capacitymin(Size min)
Set minimum capacity (modifier).
Definition: list.h:1650
Basic integer type.
Definition: type.h:980
UnicodeString(const char16_t *str, Size size)
Constructor for UTF-16 string pointer (C++11).
Definition: ustring.h:169
const Item & item(Key index) const
Get item at position (const).
Definition: list.h:804
List< wchar16, StrSizeT > ListType
List type
Definition: ustring.h:85
UnicodeString & operator=(const char *str)
Assignment operator to convert from terminated UTF-8 string.
Definition: ustring.h:249
UnicodeString & slice(Key index)
Slice beginning items.
Definition: ustring.h:715
UnicodeString & advResize(Size size)
Advanced: Resize while preserving existing data, POD items not initialized (modifier).
Definition: ustring.h:815
UnicodeString(const wchar16 *str)
Constructor for null terminated string.
Definition: ustring.h:116
UnicodeString & operator<<(const ListBaseType &data)
Append operator.
Definition: ustring.h:779
uint32 StrSizeT
Default Evo string size type.
Definition: sys.h:734
UnicodeString(const char *str)
Constructor to convert terminated string from UTF-8.
Definition: ustring.h:135
bool operator!=(const char *str) const
Inequality operator to compare against terminated UTF-8 string.
Definition: ustring.h:647
UnicodeString & unslice()
Clean and remove hidden items previously removed via slicing (modifier).
Definition: ustring.h:727
UnicodeString & set_win32(const char *str)
Set as UTF-16 string converted from terminated UTF-8 string (Windows only).
Definition: ustring.h:480
UnicodeString & capacitymin(Size min)
Set minimum capacity (modifier).
Definition: ustring.h:735
bool operator==(const UnicodeString &str) const
Equality operator.
Definition: ustring.h:598
UnicodeString & trimr(Size size)
Trim right (ending) items.
Definition: ustring.h:707
UnicodeString(const PtrBase< wchar16 > &str)
Constructor to copy null terminated string from managed pointer.
Definition: ustring.h:145
UnicodeString & operator=(const ListBaseType &str)
Assignment operator to copy from base list type.
Definition: ustring.h:225
UnicodeString(const UnicodeString &str)
Copy constructor.
Definition: ustring.h:97
ListType & triml(Size size)
Trim left (beginning) items.
Definition: list.h:1307
ListType & addnew(Size size=1)
Append new items (modifier).
Definition: list.h:1996
UnicodeString & capacitymax(Size max)
Set maximum capacity (modifier).
Definition: ustring.h:739
static const EndT ALL
Special integer value for indicating all items or all remaining items.
Definition: type.h:1839
UnicodeString ThisType
This string type.
Definition: ustring.h:84
UnicodeString & prepend(const ListBaseType &data)
Prepend new items copied from another list (modifier).
Definition: ustring.h:799
ListType & trimr(Size size)
Trim right (ending) items.
Definition: list.h:1323
const wchar16 * cstr()
Get terminated string pointer (const).
Definition: ustring.h:533
ListType & clear()
Clear by removing all items.
Definition: list.h:574
const wchar16 * data() const
Get string pointer (const).
Definition: ustring.h:509
UnicodeString & compact()
Reduce capacity to fit current size (modifier).
Definition: ustring.h:743
bool operator!=(const wchar16 *str) const
Inequality operator.
Definition: ustring.h:633
UnicodeString & operator<<(const Item &data)
Append operator.
Definition: ustring.h:775
IterM end()
Get iterator at end.
Definition: list.h:990
ListType & setempty()
Set as empty but not null.
Definition: list.h:735
Evo C++ Library namespace.
Definition: alg.h:11
ListType & prependnew(Size size=1)
Prepend new items (modifier).
Definition: list.h:2114
UnicodeString & triml(Size size)
Trim left (beginning) items.
Definition: ustring.h:703
UnicodeString()
Default constructor sets as null.
Definition: ustring.h:89
UnicodeString & set2(const ListBaseType &data, Key index1, Key index2)
Set as copy of sublist using start/end positions.
Definition: ustring.h:699
const wchar16 * cstrM() const
Get terminated string pointer (modifier).
Definition: ustring.h:570
bool operator!=(const StringBase &str) const
Inequality operator to compare against UTF-8 string.
Definition: ustring.h:640
UnicodeString & replace(Key index, Size rsize, const Item *data, Size size)
Replace items with new data (modifier).
Definition: ustring.h:811
Replace invalid characters with UNICODE_REPLACEMENT_CHAR.
Definition: str.h:138
UtfMode
UTF decoding mode used to set how to handle invalid character values.
Definition: str.h:136
bool operator==(const ListBaseType &data) const
Equality operator.
Definition: list.h:857
wchar16 * advBuffer()
Advanced: Get buffer pointer (modifier).
Definition: list.h:2743
Size Key
Key type (item index)
Definition: list.h:248
ListType & capacitymax(Size max)
Set maximum capacity (modifier).
Definition: list.h:1668
ListType & operator<<(const Item &data)
Append operator.
Definition: list.h:2054
bool operator==(const char *str) const
Equality operator to compare against terminated UTF-8 string.
Definition: ustring.h:619
UnicodeString & set_win32(const char *str, int size)
Set as UTF-16 string converted from UTF-8 string (Windows only).
Definition: ustring.h:453
UnicodeString & setempty()
Set as empty but not null.
Definition: ustring.h:266
Buf buf_
List buffer.
Definition: list.h:3136
ListType & resize(Size size)
Resize while preserving existing data (modifier).
Definition: list.h:1850
UnicodeString & unshare()
Make data unique by allocating new buffer, if needed (modifier).
Definition: ustring.h:751
wchar16 * data_
Data pointer, NULL if null.
Definition: sys.h:979
P ptr_
Pointer.
Definition: type.h:1566
ListType & set()
Set as null and empty.
Definition: list.h:620
Unicode string container using UTF-16.
Definition: ustring.h:82
UnicodeString & operator<<(const ValNull &val)
Append operator to set as null and empty.
Definition: ustring.h:783
UnicodeString(UnicodeString &&src)
Move constructor (C++11).
Definition: ustring.h:157
UnicodeString & operator=(const wchar16 *str)
Assignment operator for terminated UTF-16 string.
Definition: ustring.h:235
UnicodeString & operator=(const UnicodeString &str)
Assignment operator.
Definition: ustring.h:215
StrSizeT size_
Data size as item count, 0 if empty or null.
Definition: sys.h:980
Sequential list container with random access.
Definition: list.h:240
UnicodeString & prepend(const Item &data)
Prepend new item (modifier).
Definition: ustring.h:803
UnicodeString & copy(const WCHAR *str)
Copy from Windows WCHAR string pointer (Windows only).
Definition: ustring.h:441
ListType & unshare()
Make data unique by allocating new buffer, if needed (modifier).
Definition: list.h:1783
ListType & truncate(Size size=0)
Truncate to given size.
Definition: list.h:1342
UnicodeString & clear()
Clear by removing all items.
Definition: ustring.h:691
bool operator!=(const ListBaseType &data) const
Inequality operator.
Definition: list.h:874
UnicodeString & truncate(Size size=0)
Truncate to given size.
Definition: ustring.h:711
Base managed pointer.
Definition: type.h:1562
int utf16_compare8(const wchar16 *str1, ulong len1, const char *str2, ulong len2)
Compare a non-terminated UTF-16 string to a non-terminated UTF-8 string.
Definition: str.h:842
ListType & advResize(Size size)
Advanced: Resize while preserving existing data, POD items not initialized (modifier).
Definition: list.h:2552
Base for all Evo list types (used internally).
Definition: sys.h:976
ListType & replace(Key index, Size rsize, const Item *data, Size size)
Replace items with new data (modifier).
Definition: list.h:2316
T & min(T &a, T &b)
Returns lowest of given values.
Definition: alg.h:26
UnicodeString & operator=(const WCHAR *str)
Assignment operator for terminated Windows WCHAR string (Windows only).
Definition: ustring.h:399
ListType & copy(const Item *data, Size size)
Set as full (unshared) copy using data pointer (modifier).
Definition: list.h:1929
ListType & slice(Key index)
Slice beginning items.
Definition: list.h:1360
UnicodeString(const StringBase &str)
Constructor to convert string from UTF-8.
Definition: ustring.h:122
UnicodeString & prepend(const Item *data, Size size)
Prepend new items copied from data pointer (modifier).
Definition: ustring.h:795
UnicodeString & operator=(UnicodeString &&src)
Move assignment operator (C++11).
Definition: ustring.h:191