#include <Pt/Utf8Codec.h>
Convert between unicode and UTF-8.
Inherits TextCodec< Char, char >.
Public Types | |
| typedef char | extern_type |
| External character type. | |
| typedef Char | intern_type |
| Internal character type. | |
| typedef MBState | state_type |
| Conversion state type. | |
Public Member Functions | |
| Utf8Codec (std::size_t ref=0) | |
| Constructor. | |
| virtual | ~Utf8Codec () |
| Destructor. | |
| bool | always_noconv () const |
| Returns true if no conversion is required. | |
| int | encoding () const |
| Returns the encoding rate. | |
| result | in (MBState &s, const char *fbeg, const char *fend, const char *&fnext, Char *tbeg, Char *tend, Char *&tnext) const |
| Decodes a character sequence. | |
| int | length (MBState &state, const char *from, const char *end, std::size_t max) const |
| Returns the number of the decoded characters. | |
| int | max_length () const |
| Maximum length of an external sequence if one character is encoded. | |
| result | out (MBState &state, const Char *fbeg, const Char *fend, const Char *&fnext, char *tbeg, char *tend, char *&tnext) const |
| Encodes a character sequence. | |
| result | unshift (MBState &state, char *to, char *to_end, char *&to_next) const |
| Unshifts a character sequence. | |
Static Public Member Functions | |
| static String | decode (const char *data, std::size_t size) |
| Decode to a unicode string. | |
| static String | decode (const std::string &data) |
| Decode to a unicode string. | |
| static std::string | encode (const Char *data, std::size_t size) |
| Encode to a UTF-8 string. | |
| static std::string | encode (const String &data) |
| Encode to a UTF-8 string. | |