E-MailRelay
|
A static class which provides string encoding conversion functions. More...
#include <gconvert.h>
Classes | |
struct | ThrowOnError |
Holds context information which convert() adds to the exception when it fails. More... | |
struct | utf8 |
A string wrapper that indicates UTF-8 encoding. More... | |
Public Types | |
using | tstring = std::basic_string< TCHAR > |
Static Public Member Functions | |
static void | convert (utf8 &utf_out, const std::string &in_) |
Converts between string types/encodings: ansi to utf8. More... | |
static void | convert (utf8 &utf_out, const utf8 &in_) |
Converts between string types/encodings: utf8 to utf8. More... | |
static void | convert (utf8 &utf_out, const std::wstring &in_) |
Converts between string types/encodings: utf16 to utf8. More... | |
static void | convert (std::string &ansi_out, const std::string &in_) |
Converts between string types/encodings: ansi to ansi. More... | |
static void | convert (std::string &ansi_out, const utf8 &in_, const ThrowOnError &) |
Converts between string types/encodings: utf8 to ansi. More... | |
static void | convert (std::string &ansi_out, const std::wstring &in_, const ThrowOnError &) |
Converts between string types/encodings: utf16 to ansi. More... | |
static void | convert (std::wstring &wide_out, const std::string &ansi_in) |
Converts between string types/encodings: ansi to utf16. More... | |
static void | convert (std::wstring &wide_out, const utf8 &utf_in) |
Converts between string types/encodings: utf8 to utf16. More... | |
static void | convert (std::wstring &wide_out, const std::wstring &wide_in) |
Converts between string types/encodings: utf16 to utf16. More... | |
static void | convert (std::string &ansi_out, const std::string &in_, const ThrowOnError &) |
An overload for TCHAR shenanigans on windows. More... | |
A static class which provides string encoding conversion functions.
Supported encodings are ISO-8859-15 eight-bit char, UTF-16 wchar, and UTF-8 multi-byte char.
On Windows the eight-bit char encoding uses the 'active code page', typically CP-1252, rather than ISO-8859-15. Note that the active code page is also used by the Win32 API "A()" functions when they have to convert from 'ansi' to UTF-16 (UCS-2) wide characters (see GetACP()).
Conversions that can fail take a ThrowOnError parameter which is used to add context information to the G::Convert::Error exception that is thrown.
Eg:
Definition at line 61 of file gconvert.h.
using G::Convert::tstring = std::basic_string<TCHAR> |
Definition at line 65 of file gconvert.h.
|
static |
Converts between string types/encodings: ansi to ansi.
Definition at line 29 of file gconvert.cpp.
|
static |
An overload for TCHAR shenanigans on windows.
Note that a TCHAR can sometimes be a char, depending on the build options, so this three-parameter overload allows for the input to be a basic_string<TCHAR>, whatever the build.
Converts between string types/encodings: ansi to ansi.
Definition at line 34 of file gconvert.cpp.
|
static |
Converts between string types/encodings: utf16 to ansi.
Definition at line 59 of file gconvert.cpp.
|
static |
Converts between string types/encodings: utf8 to ansi.
Definition at line 54 of file gconvert.cpp.
|
static |
Converts between string types/encodings: ansi to utf16.
Definition at line 64 of file gconvert.cpp.
|
static |
Converts between string types/encodings: utf16 to utf16.
Definition at line 39 of file gconvert.cpp.
|
static |
Converts between string types/encodings: utf8 to utf16.
Definition at line 69 of file gconvert.cpp.
|
static |
Converts between string types/encodings: ansi to utf8.
Definition at line 44 of file gconvert.cpp.
|
static |
Converts between string types/encodings: utf16 to utf8.
Definition at line 49 of file gconvert.cpp.
Converts between string types/encodings: utf8 to utf8.
Definition at line 24 of file gconvert.cpp.