Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
wiki:documentation:devguide:core:char_encoding [2016/10/03 10:48] carolina.santos |
wiki:documentation:devguide:core:char_encoding [2016/10/04 14:00] (current) carolina.santos [References] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== TerraLib.Core: CharEncoding ====== | ====== TerraLib.Core: CharEncoding ====== | ||
- | Na TerraLib optamos por utilizar strings em UTF-8, assim como para realizar a entrada e saída das operações (strings provenientes dos drivers e strings que chegam na API da TerraLib). | + | In TerraLib was decided to use strings in UTF-8 as well as to perform input and output operations (strings from the drivers and strings that come in the TerraLib API). |
- | Como suporte foi criada a classe **te::core::CharEncoding** que fornece suporte a conversão de caracteres utilizando a [[http://www.boost.org/doc/libs/1_62_0/libs/locale/doc/html/index.html | Boost.Locale]]. | + | As support was created the class **te::core::Char Encoding** that allows the conversion of characters using the [[http://www.boost.org/doc/libs/1_62_0/libs/locale/doc/html/index.html | Boost.Locale]]. |
- | + | ||
- | Esta classe é utilizada somente através de funções membros estáticas, não sendo possível criar instancias ou cópias da classe. | + | |
+ | This class is used only through static member functions and it is not possible to create instances or copies of the class. | ||
===== API ===== | ===== API ===== | ||
==== C++ ==== | ==== C++ ==== | ||
- | A API para coversão de caracteres na TerraLib é definida pela classe ''CharEncoding'', mostrada abaixo: | + | The API for converting characters in TerraLib is defined by the **CharEncoding** class, shown below: |
<code cpp> | <code cpp> | ||
Line 40: | Line 39: | ||
\brief A class for handling character enconding/decoding. | \brief A class for handling character enconding/decoding. | ||
*/ | */ | ||
- | class TECOREEXPORT CharEncoding | + | class CharEncoding |
{ | { | ||
public: | public: | ||
Line 132: | Line 131: | ||
*/ | */ | ||
static std::vector<std::string> getEncodingList(); | static std::vector<std::string> getEncodingList(); | ||
- | |||
- | private: | ||
- | // Not instatiable | ||
- | CharEncoding(); | ||
- | ~CharEncoding(); | ||
- | // No copy allowed | ||
- | CharEncoding(CharEncoding const&); | ||
- | CharEncoding& operator=(CharEncoding const&); | ||
}; | }; | ||
} // end namespace core | } // end namespace core | ||
Line 145: | Line 136: | ||
</code> | </code> | ||
- | ===== Exemplo ===== | + | ===== Example ===== |
- | A seguir um exemplo de uso simples das funções fornecidas pela classe ''CharEncoding'': | + | Here is a simple example using the functions provided by **CharEncoding** class: |
<code cpp> | <code cpp> | ||
Line 178: | Line 169: | ||
==== Interfaces Qt ==== | ==== Interfaces Qt ==== | ||
- | A seguir um exemplo de utilização de uma QString nos componentes Qt: | + | Here is an example of using a QString in Qt components: |
<code cpp> | <code cpp> | ||
Line 185: | Line 176: | ||
</code> | </code> | ||
- | **Nota:** caso não seja possível converter um caracter o mesmo será ignorado. | + | **Note:** in case it is not possible to convert a character it will be ignored. |
- | ===== Referências ===== | + | ===== Additional References ===== |
- | * [[http://www.boost.org/doc/libs/1_62_0/libs/locale/doc/html/index.html | Boost.Locale]] | ||
* [[http://stackoverflow.com/questions/1259084/what-encoding-code-page-is-cmd-exe-using | What encoding/code page is cmd.exe using]] | * [[http://stackoverflow.com/questions/1259084/what-encoding-code-page-is-cmd-exe-using | What encoding/code page is cmd.exe using]] | ||