![]() |
C++ Library Extensions 2022.12.09
To help learn modern C++ programming
|
String conversions are implemented. More...
Functions | |
void | load_default_locale (bool ShowLocaleName=false) |
Load system default locale for string conversion. More... | |
std::string | wstring_to_string (const std::wstring &wstr, unsigned int codepage=CP_UTF8) |
Converts from std::wstring to std::string with codepage. More... | |
std::wstring | string_to_wstring (const std::string &str, unsigned int codepage=CP_UTF8) |
Converts std::string to std::wstring using codepage. More... | |
std::string | utf16_to_utf8 (const std::wstring &utf16str) |
Converts UTF16 std::wstring to UTF8 std::string. More... | |
std::wstring | utf8_to_utf16 (const std::string &utf8str) |
Converts UTF8 std::string to UTF16 std::wstring. More... | |
std::string | utf16_to_utf8 (const wchar_t *utf16str) |
Converts UTF16 (const wchar_t*) to UTF8 (std::string) More... | |
std::wstring | utf8_to_utf16 (const char *utf8str) |
Converts UTF8 string (const char*) to UTF16 (std::wstring) More... | |
char | utf16_to_utf8 (const wchar_t utf16_char) |
Converts UTF16 wchar_t to UFT8 char. More... | |
wchar_t | utf8_to_utf16 (const char utf8_char) |
Converts UTF8 char to UTF16 char. More... | |
std::wstring | windows_codepage_to_utf16 (const std::string &codepage_string) |
Converts Windows codepage std::string to utf16 std::wstring. More... | |
std::string | utf16_to_windows_codepage (const std::wstring &utf16_string) |
Converts UTF16 std::wstring to Windows codepage std::string. More... | |
std::wstring | windows_codepage_to_utf16 (const char *codepage_string) |
Converts Windows codepage const char* to UTF16 std::wstring. More... | |
std::string | utf16_to_windows_codepage (const wchar_t *utf16_string) |
Converts UTF16 const wchar_t* to Windows codepage std::string. More... | |
std::string | windows_codepage_to_utf8 (const std::string &codepage_string) |
Converts Windows codepage std::string to UTF8 std::string. More... | |
std::string | windows_codepage_to_utf8 (const char *codepage_string) |
Converts Windows codepage const char* to UTF8 std::string. More... | |
std::string | utf8_to_windows_codepage (const std::string &utf8_string) |
Converts UTF8 std::string to Windows codepage string. More... | |
std::string | utf8_to_windows_codepage (const char *utf8_string) |
Converts UTF8 const char* to Windows codepage std::string. More... | |
template<typename TargetCharType , typename SourceCharType > | |
decltype(auto) | source_to_target (const std::basic_string< SourceCharType > &str) |
Converts from source to target. More... | |
std::string | smart_encode (const char *arg) |
std::string | smart_encode (const wchar_t *arg) |
String conversions are implemented.
|
inline |
Load system default locale for string conversion.
Definition at line 59 of file tpf_conversion.hpp.
|
inline |
Definition at line 444 of file tpf_conversion.hpp.
|
inline |
decltype(auto) tpf::conversion::source_to_target | ( | const std::basic_string< SourceCharType > & | str | ) |
Converts from source to target.
TargetCharType | |
SourceCharType |
str |
Definition at line 428 of file tpf_conversion.hpp.
|
inline |
Converts std::string to std::wstring using codepage.
If fails, returns empty string, std::wstring(L"")
str | for string to convert |
codepage | for Code Page (default CP_UTF8) |
Definition at line 146 of file tpf_conversion.hpp.
|
inline |
Converts UTF16 std::wstring to UTF8 std::string.
If fails, returns empty string, std::string("")
utf16str | for UTF16 std::wstring to convert |
Definition at line 181 of file tpf_conversion.hpp.
|
inline |
Converts UTF16 (const wchar_t*) to UTF8 (std::string)
This function converts zero terminated UTF16 or const wchar_t* to UTF8 std::string. If conversion fails, returns empty string "".
utf16str | for UTF16 string to convert to UTF8 |
Definition at line 216 of file tpf_conversion.hpp.
|
inline |
Converts UTF16 wchar_t to UFT8 char.
If fails, returns '\0'
utf16_char | for UTF16 wchar_t to convert |
Definition at line 259 of file tpf_conversion.hpp.
|
inline |
Converts UTF16 std::wstring to Windows codepage std::string.
If fails, returns empty string, std::string("")
utf16_string | for UTF16 std::wstring to convert |
Definition at line 309 of file tpf_conversion.hpp.
|
inline |
Converts UTF16 const wchar_t* to Windows codepage std::string.
If fails, returns empty string, std::string("")
utf16_string | for UTF16 const wchar_t* to convert |
Definition at line 340 of file tpf_conversion.hpp.
|
inline |
Converts UTF8 string (const char*) to UTF16 (std::wstring)
If fails, returns empty string or L"".
utf8str | for UTF8 (const char*) to convert |
Definition at line 237 of file tpf_conversion.hpp.
|
inline |
Converts UTF8 char to UTF16 char.
If fails, returns L'\0'
utf8_char | for UTF8 char to convert |
Definition at line 276 of file tpf_conversion.hpp.
|
inline |
Converts UTF8 std::string to UTF16 std::wstring.
If fails, returns empty string, std::wstring(L"")
utf8str | for UTF8 std::string to convert |
Definition at line 197 of file tpf_conversion.hpp.
|
inline |
Converts UTF8 const char* to Windows codepage std::string.
If fails, returns empty string, std::string("")
utf8_string | for UTF8 const char* to convert |
Definition at line 410 of file tpf_conversion.hpp.
|
inline |
Converts UTF8 std::string to Windows codepage string.
If fails, returns empty string, std::string("")
utf8_string | for UTF8 std::string to convert |
Definition at line 393 of file tpf_conversion.hpp.
|
inline |
Converts Windows codepage const char* to UTF16 std::wstring.
If fails, returns empty string, std::wstring(L"")
codepage_string | for Windows codepage const char* to convert |
Definition at line 323 of file tpf_conversion.hpp.
|
inline |
Converts Windows codepage std::string to utf16 std::wstring.
If fails, returns empty string, std::wstring(L"")
codepage_string | for Windows codepage std::string to convert |
Definition at line 295 of file tpf_conversion.hpp.
|
inline |
Converts Windows codepage const char* to UTF8 std::string.
If fails, return empty string, std::string("")
codepage_string | for Windows codepage const char* to convert |
Definition at line 375 of file tpf_conversion.hpp.
|
inline |
Converts Windows codepage std::string to UTF8 std::string.
If fails, returns empty string, std::string("")
codepage_string | for Windows codepage std::string to convert |
Definition at line 358 of file tpf_conversion.hpp.
|
inline |
Converts from std::wstring to std::string with codepage.
If fails, returns empty string, std::string("")
wstr | for std::wstring to convert |
codepage | for Code Page, default = CP_UTF8 |
Definition at line 100 of file tpf_conversion.hpp.