Public Types | Public Member Functions | Private Attributes | Static Private Attributes
Poco::UTF16Encoding Class Reference

#include <UTF16Encoding.h>

Inheritance diagram for Poco::UTF16Encoding:
Inheritance graph
[legend]

List of all members.

Public Types

enum  ByteOrderType { BIG_ENDIAN_BYTE_ORDER, LITTLE_ENDIAN_BYTE_ORDER, NATIVE_BYTE_ORDER }

Public Member Functions

const char * canonicalName () const
const CharacterMapcharacterMap () const
int convert (const unsigned char *bytes) const
int convert (int ch, unsigned char *bytes, int length) const
ByteOrderType getByteOrder () const
bool isA (const std::string &encodingName) const
void setByteOrder (ByteOrderType byteOrder)
 Returns the byte-order currently in use.
void setByteOrder (int byteOrderMark)
 Sets the byte order.
 UTF16Encoding (ByteOrderType byteOrder=NATIVE_BYTE_ORDER)
 UTF16Encoding (int byteOrderMark)
 Creates and initializes the encoding for the given byte order.
 ~UTF16Encoding ()

Private Attributes

bool _flipBytes

Static Private Attributes

static const CharacterMap _charMap
static const char * _names []

Detailed Description

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.


Member Enumeration Documentation

Enumerator:
BIG_ENDIAN_BYTE_ORDER 
LITTLE_ENDIAN_BYTE_ORDER 
NATIVE_BYTE_ORDER 

Definition at line 61 of file UTF16Encoding.h.


Constructor & Destructor Documentation

Definition at line 74 of file UTF16Encoding.cpp.

Poco::UTF16Encoding::UTF16Encoding ( int  byteOrderMark)

Creates and initializes the encoding for the given byte order.

Definition at line 80 of file UTF16Encoding.cpp.

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 86 of file UTF16Encoding.cpp.


Member Function Documentation

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 117 of file UTF16Encoding.cpp.

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 134 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 140 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 150 of file UTF16Encoding.cpp.

Definition at line 91 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 123 of file UTF16Encoding.cpp.

Returns the byte-order currently in use.

Definition at line 101 of file UTF16Encoding.cpp.

void Poco::UTF16Encoding::setByteOrder ( int  byteOrderMark)

Sets the byte order.

Definition at line 111 of file UTF16Encoding.cpp.


Member Data Documentation

Initial value:
 
{
                -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.

Definition at line 96 of file UTF16Encoding.h.

const char * Poco::UTF16Encoding::_names [static, private]
Initial value:
{
        "UTF-16",
        "UTF16",
        NULL
}

Definition at line 97 of file UTF16Encoding.h.


The documentation for this class was generated from the following files:


pluginlib
Author(s): Tully Foote and Eitan Marder-Eppstein
autogenerated on Sat Dec 28 2013 17:20:20