A class for handling character enconding/decoding. More...
#include <CharEncoding.h>
Static Public Member Functions | |
| static std::string | convert (const std::string &src, EncodingType from, EncodingType to) |
| Convert a string from one character encoding to another one. More... | |
| static std::string | fromUTF8 (const std::string &src) |
| Convert a string in UTF-8 to the current locale encoding. More... | |
| static std::string | fromUTF8 (const std::string &src, EncodingType to) |
| Convert a string in UTF-8 to another character encoding. More... | |
| static std::vector< std::string > | getEncodingList () |
| Retrive a vector of string with all available encoding types name. More... | |
| static std::string | getEncodingName (EncodingType et) |
| Retrive a string from a given character encoding type enum. More... | |
| static te::core::EncodingType | getEncodingType (const std::string &name) |
| Retrive an EncodingType from a given character encoding name. More... | |
| static std::string | toASCII (const std::string &src) |
| Decomposes a UTF-8 encoded string and extracts its ASCII characters. More... | |
| static std::string | toUTF8 (const std::string &src) |
| Convert a string from a current locale encoding to UTF-8. More... | |
| static std::string | toUTF8 (const std::string &src, EncodingType from) |
| Convert a string from a given character encoding to UTF-8. More... | |
Private Member Functions | |
| CharEncoding () | |
| CharEncoding (CharEncoding const &) | |
| CharEncoding & | operator= (CharEncoding const &) |
| ~CharEncoding () | |
A class for handling character enconding/decoding.
Definition at line 67 of file CharEncoding.h.
|
private |
|
private |
|
private |
|
static |
Convert a string from one character encoding to another one.
| src | String encoded according to "from" encoding type. |
| from | Current string encoding. |
| to | New encoding for the string. |
Definition at line 106 of file CharEncoding.cpp.
References EncodingString.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Convert a string in UTF-8 to the current locale encoding.
| src | UTF-8 string. |
| te::Exception | if the system locale cannot be retrieved. |
Definition at line 77 of file CharEncoding.cpp.
References TE_LOG_ERROR, and TE_TR.
Referenced by BOOST_AUTO_TEST_CASE(), terralib4::Convert2Latin1(), te::core::FileSystem::copyFile(), te::core::FileSystem::createDirectories(), te::core::FileSystem::createDirectory(), te::mem::ExpansibleBandBlocksManager::createNewDiskFile(), te::rp::Matrix< TemplateElementType >::createNewDiskFile(), te::ws::core::CurlWrapper::downloadFile(), te::qt::plugins::terramobile::GeopackagePublisher::downloadGeopackageFile(), te::core::FileSystem::exists(), te::sa::SpatialWeightsExchanger::exportToGAL(), te::sa::SpatialWeightsExchanger::exportToGWT(), te::core::FileSystem::fileSize(), te::qt::widgets::HidroItem::getCtlParameters(), te::qt::widgets::Eta5kmItem::getCtlParameters(), te::qt::widgets::ImageItem::getCtlParameters(), te::core::FileSystem::isDirectory(), te::core::FileSystem::isEmpty(), te::core::FileSystem::isRegularFile(), te::core::FileSystem::listDirectory(), te::qt::widgets::HidroItem::loadCurrentImage(), te::qt::widgets::Eta5kmItem::loadCurrentImage(), TsGEOSWriterReader::loadGeometry(), TsGeometry::loadGeometry(), TsWKBReader::loadWKT(), TsGEOSWriterReader::loadWKT(), main(), te::qt::widgets::TimeSliderWidget::onAnimationDragEnterEvent(), te::da::CharEncodingConverter::operator()(), te::xerces::Reader::read(), te::v8::common::ReadFile(), te::core::FileSystem::remove(), te::core::FileSystem::rename(), te::core::FileSystem::systemCompletePath(), and te::xerces::Writer::writeToFile().
|
static |
Convert a string in UTF-8 to another character encoding.
| src | UTF-8 string. |
| to | The target character encoding. |
Definition at line 100 of file CharEncoding.cpp.
References EncodingString.
|
static |
Retrive a vector of string with all available encoding types name.
Definition at line 159 of file CharEncoding.cpp.
References EncodingString.
Referenced by BOOST_FIXTURE_TEST_SUITE(), te::qt::widgets::CharEncodingMenuWidget::CharEncodingMenuWidget(), te::qt::widgets::DataSetOptionsWizardPage::fillCharEncodingTypes(), and te::qt::widgets::CharEncodingMenuWidget::onEncodingClicked().
|
static |
Retrive a string from a given character encoding type enum.
| et | Encoding Type to be retrieved as string. |
Definition at line 141 of file CharEncoding.cpp.
References EncodingString.
Referenced by te::pgis::DataSource::create(), DataSetLayerReader(), te::qt::widgets::DataSetOptionsWizardPage::datasetPressed(), te::qt::plugins::pgis::PostGISCreatorDialog::getConnectionInfo(), te::ogr::Transactor::getDataSet(), GetPostGISConnection(), te::pgis::ConnectionPool::initialize(), te::wms::serialize::LayerReader(), LoadPGISDataSource(), te::qt::plugins::pgis::PostGISCreatorDialog::onApplyPushButtonPressed(), te::ogr::Transactor::query(), QueryLayerReader(), te::qt::widgets::CharEncodingMenuWidget::setLayer(), and te::map::serialize::WriteAbstractLayer().
|
static |
Retrive an EncodingType from a given character encoding name.
| name | Encoding name to be retrieved as enum. |
Definition at line 146 of file CharEncoding.cpp.
References EncodingString, and TE_TR.
Referenced by te::qt::widgets::DataSetOptionsWizardPage::applyChanges(), BOOST_FIXTURE_TEST_SUITE(), DataSetLayerReader(), te::ws::ogc::wms::serialize::LayerReader(), te::qt::widgets::CharEncodingMenuWidget::onEncodingClicked(), and QueryLayerReader().
|
private |
|
static |
Decomposes a UTF-8 encoded string and extracts its ASCII characters.
| src | UTF-8 encoded string. |
| te::Exception | if the given string cannot be decomposed. |
Definition at line 113 of file CharEncoding.cpp.
References TE_LOG_ERROR, and TE_TR.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
Convert a string from a current locale encoding to UTF-8.
| src | String to be encoded in UTF-8. |
| te::Exception | if the system locale cannot be retrieved. |
Definition at line 57 of file CharEncoding.cpp.
References TE_LOG_ERROR, and TE_TR.
Referenced by te::core::FileSystem::absolutePath(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_SUITE(), te::qt::widgets::Convert2Qt(), terralib4::Convert2Utf8(), te::core::FileSystem::currentPath(), te::core::FileSystem::executableDirectory(), te::core::FileSystem::listDirectory(), main(), te::core::FileSystem::systemCompletePath(), te::core::FileSystem::tempDirectoryPath(), and te::core::FileSystem::uniquePath().
|
static |
Convert a string from a given character encoding to UTF-8.
| src | String to be encoded in UTF-8. |
Definition at line 51 of file CharEncoding.cpp.
References EncodingString.