-
Notifications
You must be signed in to change notification settings - Fork 0
/
StdCharConverter.h
50 lines (33 loc) · 1.16 KB
/
StdCharConverter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef STDCHARCONVERTER_H
#define STDCHARCONVERTER_H
/** @file */
class QTextCodec;
/**
* A class enabling conversion of characters between 8859-15 and UTF-8.
* Client software that needs to convert characters between character sets can do so with the help of this class.
* The actual conversion is performed by the underlying platform, and is thus not available on all operating systems.
* For those that do not support conversion, a NULL character will be returned.
*/
class CStdCharConverter
{
private:
QTextCodec *m_textCodec8859; /**< Codec for working with 8859-15 text */
QTextCodec *m_textCodecUTF8; /**< Codec for working with UTF-8 text */
public:
static CStdCharConverter *New();
int construct();
static int charSize(const unsigned char *a_buffer);
static std::string makeString(uint32_t a_character);
static std::string makeString(uint32_t a_character, int a_size);
std::pair<uint32_t, int> to8859(uint32_t a_character);
std::pair<uint32_t, int> toUTF8(uint32_t a_character);
QTextCodec *get8859TextCodec()
{
return m_textCodec8859;
}
QTextCodec *getUTF8TextCodec()
{
return m_textCodecUTF8;
}
};
#endif /* ! STDCHARCONVERTER_H */