![]() |
OpenXcom
1.0
Open-source clone of the original X-Com
|
Functions for dealing with encoding, strings, text and all related operations. More...
Functions | |
| void | getUtf8Locale () |
| Store a UTF-8 locale to use when dealing with character conversions. More... | |
| UString | convUtf8ToUtf32 (const std::string &src) |
| Takes a Unicode 32-bit string and converts it to a 8-bit string encoded in UTF-8. More... | |
| std::string | convUtf32ToUtf8 (const UString &src) |
| Takes a Unicode 32-bit string and converts it to a 8-bit string encoded in UTF-8. More... | |
| std::string | convWcToMb (const std::wstring &src, unsigned int cp) |
| Takes a wide-character string and converts it to a multibyte 8-bit string in a given encoding. More... | |
| std::wstring | convMbToWc (const std::string &src, unsigned int cp) |
| Takes a multibyte 8-bit string in a given encoding and converts it to a wide-character string. More... | |
| std::string | convPathToUtf8 (const std::string &src) |
| Takes a filesystem path and converts it to a UTF-8 string. More... | |
| std::string | convUtf8ToPath (const std::string &src) |
| Takes a UTF-8 string and converts it to a filesystem path. More... | |
| bool | naturalCompare (const std::string &a, const std::string &b) |
| Compares two UTF-8 strings using natural human ordering. More... | |
| bool | caseCompare (const std::string &a, const std::string &b) |
| Compares two UTF-8 strings ignoring case. More... | |
| bool | caseFind (const std::string &haystack, const std::string &needle) |
| Searches for a substring in another string ignoring case. More... | |
| void | upperCase (std::string &s) |
| Uppercases a UTF-8 string, modified in place. More... | |
| void | lowerCase (std::string &s) |
| Lowercases a UTF-8 string, modified in place. More... | |
| void | replace (std::string &str, const std::string &find, const std::string &replace) |
| Replaces every instance of a substring. More... | |
| std::string | formatNumber (int64_t value, const std::string ¤cy) |
| Takes an integer value and formats it as number with separators (spacing the thousands). More... | |
| std::string | formatFunding (int64_t funds) |
| Takes an integer value and formats it as currency, spacing the thousands and adding a $ sign to the front. More... | |
| std::string | formatPercentage (int value) |
| Takes an integer value and formats it as percentage, adding a % sign. More... | |
| bool | isLinebreak (UCode c) |
| non-breaking space More... | |
| bool | isSpace (UCode c) |
| Checks if a character is a blank space (includes non-breaking spaces). | |
| bool | isSeparator (UCode c) |
| Checks if a character is a word separator. | |
| bool | isPrintable (UCode c) |
| Checks if a character is visible to the user. | |
Variables | |
| const char | TOK_COLOR_FLIP = 1 |
| line break and change to small font | |
| const unsigned char | TOK_NBSP = 0xA0 |
| alternate between primary and secondary color | |
Functions for dealing with encoding, strings, text and all related operations.
| bool OpenXcom::Unicode::caseCompare | ( | const std::string & | a, |
| const std::string & | b | ||
| ) |
Compares two UTF-8 strings ignoring case.
Compares two strings case-insensitive.
| a | String A. |
| b | String B. |
| bool OpenXcom::Unicode::caseFind | ( | const std::string & | haystack, |
| const std::string & | needle | ||
| ) |
Searches for a substring in another string ignoring case.
Find a string in another case-insensitive.
| haystack | String to search. |
| needle | String to find. |
| std::wstring OpenXcom::Unicode::convMbToWc | ( | const std::string & | src, |
| unsigned int | cp | ||
| ) |
Takes a multibyte 8-bit string in a given encoding and converts it to a wide-character string.
Used for Win32 APIs.
| src | Multibyte string. |
| cp | Codepage of the source string. |
| std::string OpenXcom::Unicode::convPathToUtf8 | ( | const std::string & | src | ) |
Takes a filesystem path and converts it to a UTF-8 string.
Converts a path to a UTF-8 string.
On Windows the C paths use the local ANSI codepage. Used for SDL APIs.
| src | Filesystem path. |
| std::string OpenXcom::Unicode::convUtf32ToUtf8 | ( | const UString & | src | ) |
Takes a Unicode 32-bit string and converts it to a 8-bit string encoded in UTF-8.
Converts a UTF-32 string to UTF-8.
Used for rendering text.
| src | Unicode string. |
| std::string OpenXcom::Unicode::convUtf8ToPath | ( | const std::string & | src | ) |
Takes a UTF-8 string and converts it to a filesystem path.
Converts a UTF-8 string to a path.
On Windows the C paths use the local ANSI codepage. Used for SDL APIs.
| src | UTF-8 string. |
| UString OpenXcom::Unicode::convUtf8ToUtf32 | ( | const std::string & | src | ) |
Takes a Unicode 32-bit string and converts it to a 8-bit string encoded in UTF-8.
Converts a UTF-8 string to UTF-32.
Used for rendering text.
| src | UTF-8 string. |
| std::string OpenXcom::Unicode::convWcToMb | ( | const std::wstring & | src, |
| unsigned int | cp | ||
| ) |
Takes a wide-character string and converts it to a multibyte 8-bit string in a given encoding.
Used for Win32 APIs.
| src | Wide-character string. |
| cp | Codepage of the destination string. |
| std::string OpenXcom::Unicode::formatFunding | ( | int64_t | funds | ) |
Takes an integer value and formats it as currency, spacing the thousands and adding a $ sign to the front.
Formats an integer value as currency.
| funds | The funding value. |
| std::string OpenXcom::Unicode::formatNumber | ( | int64_t | value, |
| const std::string & | currency | ||
| ) |
Takes an integer value and formats it as number with separators (spacing the thousands).
Formats an integer value as number with separators.
| value | The value. |
| currency | Currency symbol. |
| std::string OpenXcom::Unicode::formatPercentage | ( | int | value | ) |
Takes an integer value and formats it as percentage, adding a % sign.
Formats an integer value as percentage.
| value | The percentage value. |
| void OpenXcom::Unicode::getUtf8Locale | ( | ) |
Store a UTF-8 locale to use when dealing with character conversions.
Find a UTF-8 locale.
Windows doesn't have a UTF-8 locale so we just use its APIs directly.
|
inline |
non-breaking space
Checks if a character is a linebreak.
| void OpenXcom::Unicode::lowerCase | ( | std::string & | s | ) |
Lowercases a UTF-8 string, modified in place.
Lowercases a string in place.
Used for case-insensitive comparisons.
| s | Source string. |
| bool OpenXcom::Unicode::naturalCompare | ( | const std::string & | a, |
| const std::string & | b | ||
| ) |
Compares two UTF-8 strings using natural human ordering.
Compares two strings by natural order.
| a | String A. |
| b | String B. |
| void OpenXcom::Unicode::replace | ( | std::string & | str, |
| const std::string & | find, | ||
| const std::string & | replace | ||
| ) |
Replaces every instance of a substring.
Replaces a substring.
| str | The string to modify. |
| find | The substring to find. |
| replace | The substring to replace it with. |
| void OpenXcom::Unicode::upperCase | ( | std::string & | s | ) |
Uppercases a UTF-8 string, modified in place.
Uppercases a string in place.
Used for case-insensitive comparisons.
| s | Source string. |
1.8.14