niftyLib::STR::conv allows the codeconvetion between different std::basic_string objects. I use the std::codecvt facet to transcode characters.
Signature:
template<iCharT,xCharT,TraitsT=std::char_traits<iCharT> class conv;
Usefull typedef:
typedef niftyLib::STR::conv<wchar_t,char> wc_conv;
Example:
std::wstring = niftyLib::STR::wc_conv("en_US.utf-8").in("Hello 世界");
Uses the codecvt facet of locale std::locale("en_US.utf-8") to transform the external string representation (expected to hold a valid utf-8 string) into it's internat wchar_t unicode representation.
Data Structures | |
struct | basic_conv_base |
The base class of all basic_conv variants. More... | |
class | basic_conv |
A code conversion class for std::basic_string<CharT> objects. More... | |
class | basic_conv< iCharT, iCharT, std::char_traits< iCharT > > |
conv<iCharT,xCharT> specialization for cases where iCharT==xCharT. More... | |
Typedefs | |
typedef niftyLib::Exception | Exception |
typedef basic_conv< wchar_t, char > | wc_conv |
A convenient tyedef for the most obvious case of code transformation. |
typedef basic_conv<wchar_t,char> niftyLib::STR::wc_conv |
A convenient tyedef for the most obvious case of code transformation.
Internal wchar_t transformation to extrenal char convrsion e.g. utf-8, latin1,.. etc.