ScummVM API documentation
Common::U32String Class Reference
Inheritance diagram for Common::U32String:
Common::BaseString< u32char_type_t >

Public Types

typedef uint32 unsigned_type
 
- Public Types inherited from Common::BaseString< u32char_type_t >
typedef u32char_type_t value_type
 
typedef u32char_type_titerator
 
typedef const u32char_type_tconst_iterator
 

Public Member Functions

constexpr U32String ()
 
 U32String (const value_type *str)
 
 U32String (const value_type *str, uint32 len)
 
 U32String (const uint32 *str)
 
 U32String (const uint32 *str, uint32 len)
 
 U32String (const uint32 *beginP, const uint32 *endP)
 
 U32String (const value_type *beginP, const value_type *endP)
 
 U32String (const U32String &str)
 
 U32String (U32String &&str)
 
 U32String (const char *str, CodePage page=kUtf8)
 
 U32String (const char *str, uint32 len, CodePage page=kUtf8)
 
 U32String (const char *beginP, const char *endP, CodePage page=kUtf8)
 
 U32String (const String &str, CodePage page=kUtf8)
 
 U32String (value_type c)
 
U32Stringoperator= (const U32String &str)
 
U32Stringoperator= (U32String &&str)
 
U32Stringoperator= (const String &str)
 
U32Stringoperator= (const value_type *str)
 
U32Stringoperator= (const char *str)
 
U32Stringoperator= (value_type c)
 
U32Stringoperator+= (const U32String &str)
 
U32Stringoperator+= (const value_type *str)
 
U32Stringoperator+= (value_type c)
 
bool operator== (const String &x) const
 
bool operator== (const char *x) const
 
bool operator!= (const String &x) const
 
bool operator!= (const char *x) const
 
String encode (CodePage page=kUtf8) const
 
StringEncodingResult encode (String &outString, CodePage page, char errorChar) const
 
U32String substr (size_t pos=0, size_t len=npos) const
 
const uint32 * u32_str () const
 
uint16 * encodeUTF16BE (uint *len=nullptr) const
 
uint16 * encodeUTF16LE (uint *len=nullptr) const
 
uint16 * encodeUTF16Native (uint *len=nullptr) const
 
U32String transcodeChineseT2S () const
 
- Public Member Functions inherited from Common::BaseString< u32char_type_t >
constexpr BaseString ()
 
 BaseString (const BaseString &str)
 
 BaseString (BaseString &&str)
 
 BaseString (const value_type *str)
 
 BaseString (const value_type *str, uint32 len)
 
 BaseString (const value_type *beginP, const value_type *endP)
 
bool operator== (const BaseString &x) const
 
bool operator== (const value_type *x) const
 
bool operator!= (const BaseString &x) const
 
bool operator!= (const value_type *x) const
 
bool operator< (const BaseString &x) const
 
bool operator< (const value_type *x) const
 
bool operator<= (const BaseString &x) const
 
bool operator<= (const value_type *x) const
 
bool operator> (const BaseString &x) const
 
bool operator> (const value_type *x) const
 
bool operator>= (const BaseString &x) const
 
bool operator>= (const value_type *x) const
 
bool equals (const BaseString &x) const
 
bool equals (const value_type *x) const
 
bool equalsC (const char *x) const
 
int compareTo (const BaseString &x) const
 
int compareTo (const value_type *x) const
 
int compareToC (const char *x) const
 
void setChar (value_type c, uint32 p)
 
void deleteChar (uint32 p)
 
void deleteLastChar ()
 
void erase (uint32 p, uint32 len=npos)
 
iterator erase (iterator it)
 
void chop (uint32 len=1)
 
void clear ()
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
const value_type * c_str () const
 
uint size () const
 
bool empty () const
 
value_type firstChar () const
 
value_type lastChar () const
 
value_type operator[] (int idx) const
 
bool contains (const BaseString &otherString) const
 
bool contains (value_type x) const
 
void insertChar (value_type c, uint32 p)
 
void insertString (const value_type *s, uint32 p)
 
void insertString (const BaseString &s, uint32 p)
 
uint32 find (value_type x, uint32 pos=0) const
 
size_t find (const value_type *s, uint32 pos=0) const
 
uint32 find (const BaseString &str, uint32 pos=0) const
 
size_t rfind (const value_type *s) const
 
size_t rfind (const BaseString &s) const
 
size_t rfind (value_type c, size_t pos=npos) const
 
size_t findFirstOf (value_type c, size_t pos=0) const
 
size_t findFirstOf (const value_type *chars, size_t pos=0) const
 
size_t findFirstOf (const BaseString &chars, size_t pos=0) const
 
size_t findLastOf (value_type c, size_t pos=npos) const
 
size_t findLastOf (const value_type *chars, size_t pos=npos) const
 
size_t findLastOf (const BaseString &chars, size_t pos=npos) const
 
size_t findFirstNotOf (value_type c, size_t pos=0) const
 
size_t findFirstNotOf (const value_type *chars, size_t pos=0) const
 
size_t findFirstNotOf (const BaseString &chars, size_t pos=0) const
 
size_t findLastNotOf (value_type c) const
 
size_t findLastNotOf (const value_type *chars) const
 
size_t findLastNotOf (const BaseString &chars) const
 
void replace (value_type from, value_type to)
 
void append (const value_type *begin, const value_type *end)
 
void wordWrap (const uint32 maxLength)
 
uint64 asUint64 () const
 
uint64 asUint64Ext () const
 
void toLowercase ()
 
void toUppercase ()
 
void trim ()
 
uint hash () const
 
void replace (uint32 pos, uint32 count, const BaseString &str)
 
void replace (uint32 pos, uint32 count, const value_type *str)
 
void replace (iterator begin, iterator end, const BaseString &str)
 
void replace (iterator begin, iterator end, const value_type *str)
 
void replace (uint32 posOri, uint32 countOri, const BaseString &str, uint32 posDest, uint32 countDest)
 
void replace (uint32 posOri, uint32 countOri, const value_type *str, uint32 posDest, uint32 countDest)
 

Static Public Member Functions

template<class... TParam>
static U32String format (const U32String &fmt, TParam... param)
 
static U32String format (const char *fmt,...)
 
static int vformat (const value_type *fmt, const value_type *fmtEnd, U32String &output, va_list args)
 
static Common::U32String decodeUTF16BE (const uint16 *start, uint len)
 
static Common::U32String decodeUTF16LE (const uint16 *start, uint len)
 
static Common::U32String decodeUTF16Native (const uint16 *start, uint len)
 
- Static Public Member Functions inherited from Common::BaseString< u32char_type_t >
static void releaseMemoryPoolMutex ()
 

Additional Inherited Members

- Public Attributes inherited from Common::BaseString< u32char_type_t >
value_type _storage [_builtinCapacity]
 
int * _refCount
 
uint32 _capacity
 
struct {
   int *   _refCount
 
   uint32   _capacity
 
_extern
 
- Static Public Attributes inherited from Common::BaseString< u32char_type_t >
static const uint32 npos
 
- Protected Member Functions inherited from Common::BaseString< u32char_type_t >
bool isStorageIntern () const
 
void makeUnique ()
 
void ensureCapacity (uint32 new_size, bool keep_old)
 
void incRefCount () const
 
void decRefCount (int *oldRefCount)
 
void initWithValueTypeStr (const value_type *str, uint32 len)
 
void assignInsert (const value_type *str, uint32 p)
 
void assignInsert (value_type c, uint32 p)
 
void assignInsert (const BaseString &str, uint32 p)
 
void assignAppend (const value_type *str)
 
void assignAppend (value_type c)
 
void assignAppend (const BaseString &str)
 
void assign (const BaseString &str)
 
void assign (BaseString &&str)
 
void assign (value_type c)
 
void assign (const value_type *str)
 
bool pointerInOwnBuffer (const value_type *str) const
 
uint getUnsignedValue (uint pos) const
 
void toCase (int(*caseChangeFunc)(int))
 
- Static Protected Member Functions inherited from Common::BaseString< u32char_type_t >
static uint32 cStrLen (const value_type *str)
 
static const value_type * cMemChr (const value_type *ptr, value_type c, size_t count)
 
static value_type * cMemChr (value_type *ptr, value_type c, size_t count)
 
static int cMemCmp (const value_type *ptr1, const value_type *ptr2, size_t count)
 
- Protected Attributes inherited from Common::BaseString< u32char_type_t >
uint32 _size
 
value_type * _str
 
union {
   value_type   _storage [_builtinCapacity]
 
   struct {
      int *   _refCount
 
      uint32   _capacity
 
   }   _extern
 
}; 
 
- Static Protected Attributes inherited from Common::BaseString< u32char_type_t >
static const uint32 _builtinCapacity
 

Member Typedef Documentation

◆ unsigned_type

Unsigned version of the underlying type.

Constructor & Destructor Documentation

◆ U32String() [1/11]

constexpr Common::U32String::U32String ( )
inline

Construct a new empty string.

◆ U32String() [2/11]

Common::U32String::U32String ( const value_type *  str)
inlineexplicit

Construct a new string from the given null-terminated C string.

◆ U32String() [3/11]

Common::U32String::U32String ( const value_type *  str,
uint32  len 
)
inline

Construct a new string containing exactly len characters read from address str.

◆ U32String() [4/11]

Common::U32String::U32String ( const value_type *  beginP,
const value_type *  endP 
)
inline

Construct a new string containing the characters between beginP (including) and endP (excluding).

◆ U32String() [5/11]

Common::U32String::U32String ( const U32String str)
inline

Construct a copy of the given string.

◆ U32String() [6/11]

Common::U32String::U32String ( U32String &&  str)
inline

Construct a string by moving an existing string.

◆ U32String() [7/11]

Common::U32String::U32String ( const char *  str,
CodePage  page = kUtf8 
)
explicit

Construct a new string from the given null-terminated C string that uses the given page encoding.

◆ U32String() [8/11]

Common::U32String::U32String ( const char *  str,
uint32  len,
CodePage  page = kUtf8 
)

Construct a new string containing exactly len characters read from address str.

◆ U32String() [9/11]

Common::U32String::U32String ( const char *  beginP,
const char *  endP,
CodePage  page = kUtf8 
)

Construct a new string containing the characters between beginP (including) and endP (excluding).

◆ U32String() [10/11]

Common::U32String::U32String ( const String str,
CodePage  page = kUtf8 
)

Construct a copy of the given string.

◆ U32String() [11/11]

Common::U32String::U32String ( value_type  c)
explicit

Construct a string consisting of the given character.

Member Function Documentation

◆ operator=() [1/6]

U32String& Common::U32String::operator= ( const U32String str)

Assign a given string to this string.

◆ operator=() [2/6]

U32String& Common::U32String::operator= ( U32String &&  str)

Move a given string to this string.

◆ operator=() [3/6]

U32String& Common::U32String::operator= ( const String str)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ operator=() [4/6]

U32String& Common::U32String::operator= ( const value_type *  str)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ operator=() [5/6]

U32String& Common::U32String::operator= ( const char *  str)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ operator=() [6/6]

U32String& Common::U32String::operator= ( value_type  c)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ operator+=() [1/3]

U32String& Common::U32String::operator+= ( const U32String str)

Append the given string to this string.

◆ operator+=() [2/3]

U32String& Common::U32String::operator+= ( const value_type *  str)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ operator+=() [3/3]

U32String& Common::U32String::operator+= ( value_type  c)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ operator==() [1/2]

bool Common::U32String::operator== ( const String x) const

Check whether this string is identical to string x.

◆ operator==() [2/2]

bool Common::U32String::operator== ( const char *  x) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ operator!=() [1/2]

bool Common::U32String::operator!= ( const String x) const

Check whether this string is different than string x.

◆ operator!=() [2/2]

bool Common::U32String::operator!= ( const char *  x) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ encode() [1/2]

String Common::U32String::encode ( CodePage  page = kUtf8) const

Convert the string to the given page encoding and return the result as a new String.

◆ encode() [2/2]

StringEncodingResult Common::U32String::encode ( String outString,
CodePage  page,
char  errorChar 
) const

Convert the string to the given page encoding and output in string outString, replacing invalid characters with errorChar.

◆ format()

static U32String Common::U32String::format ( const char *  fmt,
  ... 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ vformat()

static int Common::U32String::vformat ( const value_type *  fmt,
const value_type *  fmtEnd,
U32String output,
va_list  args 
)
static

Print formatted data into a U32String object. The method takes in the output by reference and works with iterators.

◆ substr()

U32String Common::U32String::substr ( size_t  pos = 0,
size_t  len = npos 
) const

Return a substring of this string

◆ u32_str()

const uint32* Common::U32String::u32_str ( ) const
inline

< Return the string as a UTF-32 pointer.

◆ decodeUTF16BE()

static Common::U32String Common::U32String::decodeUTF16BE ( const uint16 *  start,
uint  len 
)
static

Decode a big endian UTF-16 string into a U32String.

◆ decodeUTF16LE()

static Common::U32String Common::U32String::decodeUTF16LE ( const uint16 *  start,
uint  len 
)
static

Decode a little endian UTF-16 string into a U32String.

◆ decodeUTF16Native()

static Common::U32String Common::U32String::decodeUTF16Native ( const uint16 *  start,
uint  len 
)
static

Decode a native UTF-16 string into a U32String.

◆ encodeUTF16BE()

uint16* Common::U32String::encodeUTF16BE ( uint *  len = nullptr) const

Transform a U32String into UTF-16 representation (big endian). The result must be freed.

◆ encodeUTF16LE()

uint16* Common::U32String::encodeUTF16LE ( uint *  len = nullptr) const

Transform a U32String into UTF-16 representation (native endian). The result must be freed.

◆ encodeUTF16Native()

uint16* Common::U32String::encodeUTF16Native ( uint *  len = nullptr) const

Transform a U32String into UTF-16 representation (native encoding). The result must be freed.

◆ transcodeChineseT2S()

U32String Common::U32String::transcodeChineseT2S ( ) const

Transform Traditional Chinese string into Simplified.


The documentation for this class was generated from the following file: