ScummVM API documentation
UTF-32 strings

Description

API for working with UTF-32 strings.

Classes

class  Common::U32String
 

Typedefs

typedef char32_t Common::u32char_type_t
 

Functions

U32String Common::operator+ (const U32String &x, const U32String &y)
 
U32String Common::operator+ (const U32String &x, U32String::value_type y)
 
U32String Common::toPrintable (const U32String &src, bool keepNewLines=true)
 
template<class... TParam>
static U32String Common::U32String::format (const U32String &fmt, TParam... param)
 

Typedef Documentation

◆ u32char_type_t

typedef char32_t Common::u32char_type_t

A simple string class for UTF-32 strings in ScummVM. The main intention behind this class is to feature a simple way of displaying UTF-32 strings through the Graphics::Font API.

Note that operations like equals, deleteCharacter, toUppercase, etc. are only simplified convenience operations. They might not fully work as you would expect for a proper UTF-32 string class.

The presence of \0 characters in the string will cause undefined behavior in some operations.

Function Documentation

◆ operator+() [1/2]

U32String Common::operator+ ( const U32String x,
const U32String y 
)

Concatenate strings x and y.

◆ operator+() [2/2]

U32String Common::operator+ ( const U32String x,
U32String::value_type  y 
)

Append the given y character to the given x string.

◆ toPrintable()

U32String Common::toPrintable ( const U32String src,
bool  keepNewLines = true 
)

Converts string with all non-printable characters properly escaped with use of C++ escape sequences. Unlike the String version, this does not escape characters with codepoints > 127.

Parameters
srcThe source string.
keepNewLinesWhether keep newlines or convert them to '
', default: true.
Returns
The converted string.

◆ format()

template<class... TParam>
U32String Common::U32String::format ( const U32String fmt,
TParam...  param 
)
inlinestatic

Print formatted data into a U32String object.

Similar to sprintf, except that it stores the result in a (variably sized) string instead of a fixed-size buffer.