Nana C++ Library. Reference for users.
What we need to use nana
|
An intelligent charset class for character code conversion. Example: More...
Public Member Functions | |
charset (const charset &) | |
charset & | operator= (const charset &) |
charset (charset &&) | |
charset & | operator= (charset &&) |
charset (const std::string &) | |
Attempt to convert a multibytes string. More... | |
charset (std::string &&) | |
Attempt to convert a multibytes string. More... | |
charset (const std::string &, unicode) | |
Attempt to convert a unicode string in byte sequence. More... | |
charset (std::string &&, unicode) | |
Attempt to convert a unicode string in byte sequence. More... | |
charset (const std::wstring &) | |
Attempt to convert a UCS2/UCS4 string. More... | |
charset (std::wstring &&) | |
Attempt to convert a UCS2/UCS4 string. More... | |
~charset () | |
operator std::string () const | |
Converts the string to multibytes string. More... | |
operator std::string && () | |
Converts the string to multibytes string. More... | |
operator std::wstring () const | |
Converts the string to UCS2/UCS4 string. More... | |
operator std::wstring && () | |
Converts the string to UCS2/UCS4 string. More... | |
std::string | to_bytes (unicode) const |
Converts the string to a unicode in bytes sequenece width a specified unicode transformation format. More... | |
An intelligent charset class for character code conversion. Example:
1. A UTF-8 string from the socket. int len = ::recv(sd, buf, buflen, 0); textbox.caption(nana::charset(std::string(buf, len), nana::unicode::utf8)); 2. Send the string in text to the socket as UTF-8. std::string utf8str = nana::charset(textbox.caption()).to_bytes(nana::unicode::utf8); ::send(sd, utf8str.c_str(), utf8str.size(), 0); 3, Convert a string to the specified multi-byte character code.
Convert to a multibytes string through default system language. std::string mbstr = nana::charset(a_wstring);
If the default system language is English and convert a Chinese unicode string to multibytes string through GB2312 std::setlocale(LC_CTYPE, "zh_CN.GB2312"); set::setlocale(LC_CTYPE, ".936"); call it in Windows std::string mbstr = nana::charset(a_wstring_with_chinese);
nana::charset::charset | ( | const charset & | rhs | ) |
nana::charset::charset | ( | charset && | r | ) |
nana::charset::charset | ( | const std::string & | s | ) |
Attempt to convert a multibytes string.
nana::charset::charset | ( | std::string && | s | ) |
Attempt to convert a multibytes string.
nana::charset::charset | ( | const std::string & | s, |
unicode | encoding | ||
) |
Attempt to convert a unicode string in byte sequence.
nana::charset::charset | ( | std::string && | s, |
unicode | encoding | ||
) |
Attempt to convert a unicode string in byte sequence.
nana::charset::charset | ( | const std::wstring & | s | ) |
Attempt to convert a UCS2/UCS4 string.
nana::charset::charset | ( | std::wstring && | s | ) |
Attempt to convert a UCS2/UCS4 string.
nana::charset::~charset | ( | ) |
nana::charset::operator std::string | ( | ) | const |
Converts the string to multibytes string.
nana::charset::operator std::string && | ( | ) |
Converts the string to multibytes string.
nana::charset::operator std::wstring | ( | ) | const |
Converts the string to UCS2/UCS4 string.
nana::charset::operator std::wstring && | ( | ) |
Converts the string to UCS2/UCS4 string.
std::string nana::charset::to_bytes | ( | unicode | encoding | ) | const |
Converts the string to a unicode in bytes sequenece width a specified unicode transformation format.