This class deals with character encoding/decoding. More...
#include <CharEncodingConv.h>
Public Member Functions | |
CharEncodingConv (const CharEncoding &fromCode, const CharEncoding &toCode) | |
It prepare sthe conversion from a charset code to another one. More... | |
std::string | conv (const std::string &src) |
It converts the source string to a target charset. More... | |
~CharEncodingConv () | |
Destructor. More... | |
Static Public Member Functions | |
static std::string | convert (const std::string &src, const CharEncoding &fromCode, const CharEncoding &toCode) |
An static method that converts the source string to a target charset. More... | |
static std::string | getCharEncodingName (const CharEncoding &code) |
It returns the name of the given charset. More... | |
static CharEncoding | getCharEncodingType (const std::string &name) |
It returns the charset type of the given charset name. More... | |
static void | initialize () |
It initializes the CharEncoding Converter. More... | |
Private Member Functions | |
CharEncodingConv (const CharEncodingConv &rhs) | |
Copy constructor not allowed! More... | |
CharEncodingConv & | operator= (const CharEncodingConv &rhs) |
Assignment operator not allowed! More... | |
Private Attributes | |
iconv_t | m_cd |
The iconv state machine used to convert string from one character to another one. More... | |
const CharEncoding | m_fromCode |
The origin charset. More... | |
const CharEncoding | m_toCode |
The target charset. More... | |
Static Private Attributes | |
static std::map< CharEncoding, std::string > | sm_encodingNames |
Static map with the encoding names. More... | |
This class deals with character encoding/decoding.
Definition at line 80 of file CharEncodingConv.h.
te::common::CharEncodingConv::CharEncodingConv | ( | const CharEncoding & | fromCode, |
const CharEncoding & | toCode | ||
) |
It prepare sthe conversion from a charset code to another one.
The name of the origen charset of the string to be converted to destiny charset. The name of the destiny charset of the string to be converted.
Definition at line 51 of file CharEncodingConv.cpp.
References m_cd, m_fromCode, m_toCode, TE_TR, and te::common::UNKNOWN_CHAR_ENCODING.
te::common::CharEncodingConv::~CharEncodingConv | ( | ) |
|
private |
Copy constructor not allowed!
std::string te::common::CharEncodingConv::conv | ( | const std::string & | src | ) |
It converts the source string to a target charset.
src | The string in a source charset. |
Exception | It throws an exception if the conversion can not be done. |
Definition at line 79 of file CharEncodingConv.cpp.
References TE_CONVERSION_BUFFERSIZE_SIZE, and TE_TR.
Referenced by te::qt::widgets::DataSetTableModel::setData().
|
static |
An static method that converts the source string to a target charset.
src | The string in a source charset. |
fromCode | The name of the origen charset of the string to be converted to destiny charset. |
toCode | The name of the destiny charset of the string to be converted. |
Exception | It throws an exception if the conversion can not be done. |
Definition at line 132 of file CharEncodingConv.cpp.
References TE_CONVERSION_BUFFERSIZE_SIZE, TE_TR, and te::common::UNKNOWN_CHAR_ENCODING.
Referenced by te::qt::widgets::Convert2Qt(), and te::da::CharEncodingConverter::operator()().
|
static |
It returns the name of the given charset.
code | The charset code. |
Definition at line 190 of file CharEncodingConv.cpp.
Referenced by te::qt::plugins::pgis::PostGISCreatorDialog::passwordLineEditEditingFinished(), and te::qt::plugins::pgis::PostGISConnectorDialog::passwordLineEditEditingFinished().
|
static |
It returns the charset type of the given charset name.
name | The charset name. |
Definition at line 195 of file CharEncodingConv.cpp.
References te::common::UNKNOWN_CHAR_ENCODING.
Referenced by te::pgis::ConnectionPool::initialize(), and te::pgis::DataSource::open().
|
static |
It initializes the CharEncoding Converter.
Definition at line 205 of file CharEncodingConv.cpp.
References te::common::CP1250, te::common::CP1251, te::common::CP1252, te::common::CP1253, te::common::CP1254, te::common::CP1257, te::common::LATIN1, te::common::UNKNOWN_CHAR_ENCODING, and te::common::UTF8.
Referenced by te::common::Module::initialize().
|
private |
Assignment operator not allowed!
|
private |
The iconv state machine used to convert string from one character to another one.
Definition at line 158 of file CharEncodingConv.h.
Referenced by CharEncodingConv().
|
private |
The origin charset.
Definition at line 156 of file CharEncodingConv.h.
Referenced by CharEncodingConv().
|
private |
The target charset.
Definition at line 157 of file CharEncodingConv.h.
Referenced by CharEncodingConv().
|
staticprivate |
Static map with the encoding names.
Definition at line 160 of file CharEncodingConv.h.