VoiceMan
Public Member Functions
Transcoding Class Reference

The class to perform character set translations for string objects.

List of all members.

Public Member Functions

std::string getIOCharset () const
 Returns the coding system used in the current environment for I/O operations.
 Transcoding ()
 The default constructor.
bool trDecodeUTF8 (const std::string &s, std::wstring &res) const
 Decodes UTF-8 string to standart UNICODE format.
std::string trEncodeUTF8 (const std::wstring &s) const
 Encodes UNICODE string with UTF-8 coding system.
std::wstring trIO2WString (const std::string &s) const
 Converts string from default I/O charset to UNICODE.
std::wstring trReadUTF8 (const std::string &s) const
 Decodes UTF-88 string with no error indications.
std::string trWString2IO (const std::wstring &s) const
 Converts UNICODE string to the default charset of I/O operations.
virtual ~Transcoding ()
 The destructor.

Constructor & Destructor Documentation

Transcoding::Transcoding ( )

This constructor explicitly calls exit() function on initialization errors and prints error information. This behavior was implemented to use this class as static object with automatic initialization.


Member Function Documentation

bool Transcoding::trDecodeUTF8 ( const std::string &  s,
std::wstring &  res 
) const
Parameters:
[in]sThe string to convert
[out]Theconverted string
Returns:
Non-zero if there no errors or zero if s is not a valid UTF-8 string
std::string Transcoding::trEncodeUTF8 ( const std::wstring &  s) const
Parameters:
[in]sThe string to encode
std::wstring Transcoding::trIO2WString ( const std::string &  s) const
Parameters:
[in]sThe string to translate
std::wstring Transcoding::trReadUTF8 ( const std::string &  s) const

This method decodes string and if the input value is not a valid UTF-8 sequence it will add questions marks in illegal places

Parameters:
[in]sThe string to decode