#include <UTF16Encoding.h>

Public Types | |
| enum | ByteOrderType { BIG_ENDIAN_BYTE_ORDER, LITTLE_ENDIAN_BYTE_ORDER, NATIVE_BYTE_ORDER } |
Public Member Functions | |
| const char * | canonicalName () const |
| const CharacterMap & | characterMap () const |
| int | convert (int ch, unsigned char *bytes, int length) const |
| int | convert (const unsigned char *bytes) const |
| ByteOrderType | getByteOrder () const |
| bool | isA (const std::string &encodingName) const |
| void | setByteOrder (int byteOrderMark) |
| Sets the byte order. | |
| void | setByteOrder (ByteOrderType byteOrder) |
| Returns the byte-order currently in use. | |
| UTF16Encoding (int byteOrderMark) | |
| Creates and initializes the encoding for the given byte order. | |
| UTF16Encoding (ByteOrderType byteOrder=NATIVE_BYTE_ORDER) | |
| ~UTF16Encoding () | |
Private Attributes | |
| bool | _flipBytes |
Static Private Attributes | |
| static const CharacterMap | _charMap |
| static const char * | _names [] |
UTF-16 text encoding, as defined in RFC 2781.
When converting from UTF-16 to Unicode, surrogates are reported as they are - in other words, surrogate pairs are not combined into one Unicode character. When converting from Unicode to UTF-16, however, characters outside the 16-bit range are converted into a low and high surrogate.
Definition at line 50 of file UTF16Encoding.h.
Definition at line 61 of file UTF16Encoding.h.
| Poco::UTF16Encoding::UTF16Encoding | ( | ByteOrderType | byteOrder = NATIVE_BYTE_ORDER |
) |
Definition at line 71 of file UTF16Encoding.cpp.
| Poco::UTF16Encoding::UTF16Encoding | ( | int | byteOrderMark | ) |
Creates and initializes the encoding for the given byte order.
Definition at line 77 of file UTF16Encoding.cpp.
| Poco::UTF16Encoding::~UTF16Encoding | ( | ) |
Creates and initializes the encoding for the byte-order indicated by the given byte-order mark, which is the Unicode character 0xFEFF.
Definition at line 83 of file UTF16Encoding.cpp.
| const char * Poco::UTF16Encoding::canonicalName | ( | ) | const [virtual] |
Sets the byte order according to the given byte order mark, which is the Unicode character 0xFEFF.
Implements Poco::TextEncoding.
Definition at line 114 of file UTF16Encoding.cpp.
| const TextEncoding::CharacterMap & Poco::UTF16Encoding::characterMap | ( | ) | const [virtual] |
Returns true if the given name is one of the names of this encoding. For example, the "ISO-8859-1" encoding is also known as "Latin-1".
Encoding name comparision are be case insensitive.
Implements Poco::TextEncoding.
Definition at line 131 of file UTF16Encoding.cpp.
| int Poco::UTF16Encoding::convert | ( | int | ch, | |
| unsigned char * | bytes, | |||
| int | length | |||
| ) | const [virtual] |
The convert function is used to convert multibyte sequences; bytes will point to a byte sequence of n bytes where getCharacterMap()[*bytes] == -n.
The convert function must return the Unicode scalar value represented by this byte sequence or -1 if the byte sequence is malformed. The default implementation returns (int) bytes[0].
Reimplemented from Poco::TextEncoding.
Definition at line 147 of file UTF16Encoding.cpp.
| int Poco::UTF16Encoding::convert | ( | const unsigned char * | bytes | ) | const [virtual] |
Returns the CharacterMap for the encoding. The CharacterMap should be kept in a static member. As characterMap() can be called frequently, it should be implemented in such a way that it just returns a static map. If the map is built at runtime, this should be done in the constructor.
Reimplemented from Poco::TextEncoding.
Definition at line 137 of file UTF16Encoding.cpp.
| UTF16Encoding::ByteOrderType Poco::UTF16Encoding::getByteOrder | ( | ) | const |
Definition at line 88 of file UTF16Encoding.cpp.
| bool Poco::UTF16Encoding::isA | ( | const std::string & | encodingName | ) | const [virtual] |
Returns the canonical name of this encoding, e.g. "ISO-8859-1". Encoding name comparisons are case insensitive.
Implements Poco::TextEncoding.
Definition at line 120 of file UTF16Encoding.cpp.
| void Poco::UTF16Encoding::setByteOrder | ( | int | byteOrderMark | ) |
Sets the byte order.
Definition at line 108 of file UTF16Encoding.cpp.
| void Poco::UTF16Encoding::setByteOrder | ( | ByteOrderType | byteOrder | ) |
Returns the byte-order currently in use.
Definition at line 98 of file UTF16Encoding.cpp.
const TextEncoding::CharacterMap Poco::UTF16Encoding::_charMap [static, private] |
{
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
}
Definition at line 98 of file UTF16Encoding.h.
bool Poco::UTF16Encoding::_flipBytes [private] |
Definition at line 96 of file UTF16Encoding.h.
const char * Poco::UTF16Encoding::_names [static, private] |
{
"UTF-16",
"UTF16",
NULL
}
Definition at line 97 of file UTF16Encoding.h.