|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |
#include "ot/base/SystemCodeConverter.h"
When configured to use char characters, OpenTop encodes Unicode characters into UTF-8. The size of a wchar_t is not uniformly defined on different platforms, so OpenTop offers a choice of two encoding schemes when configured to use wchar_t characters: UCS-4 for 32-bit implementations and UTF-16 for 16-bit implementations.
character type | size (bits) | encoding(s) |
---|---|---|
char | 8 | UTF-8 |
wchar_t | 16 | UTF-16 |
wchar_t | 32 | UCS-4 |
Method Summary | |
static Result |
FromInternalEncoding(UCS4Char& ch, const CharType* from, const CharType* from_end, const CharType*& from_next) Converts a sequence of 1 or more CharType characters, which are encoded according to the internal Unicode encoding scheme, into the code-point for a Unicode character. |
static size_t |
GetCharSequenceLength(UCharType ch) Returns the number of CharType characters that make up a multi-character sequence. |
static String |
GetInternalEncodingName() Returns the name of the encoding scheme used by OpenTop to encode Unicode characters. |
static size_t |
GetMaximumCharSequenceLength() Returns the maximum number of CharType characters that may be used to encode a single Unicode character. |
static bool |
IsSequenceStartChar(UCharType ch) Tests the passed character ch to see if it marks the start of a multi-character sequence, a standalone character or a trailing character. |
static bool |
IsValidCharSequence(const CharType* from, size_t len) Tests the passed CharType sequence from, for a length of len to see if it represents a properly encoded Unicode character. |
static Result |
TestEncodedSequence(const CharType* from, const CharType* from_end, const CharType*& from_next) Tests a sequence of CharType characters to check that it is encoded according to the chosen OpenTop internal encoding scheme. |
static String |
ToInternalEncoding(UCS4Char ch) Returns the Unicode character ch as a String containing a sequence of one or more CharType characters encoded using the OpenTop internal encoding scheme. |
static Result |
ToInternalEncoding(UCS4Char ch, CharType* to, const CharType* to_limit, CharType*& to_next) Converts a Unicode character value into a sequence of one or more CharType characters encoded according to the internal Unicode encoding scheme. |
Methods inherited from class ot::CodeConverterBase |
IsLegalUTF16, IsLegalUTF8, UTF8Decode, UTF8Encode |
Method Detail |
static Result FromInternalEncoding(UCS4Char& ch, const CharType* from, const CharType* from_end, const CharType*& from_next)
ch
- from
- from_end
- from_next
- NullPointerException
- static size_t GetCharSequenceLength(UCharType ch)
Each multi-character encoding supported (UTF-16 and UTF-8) allows the length of the sequence to be determined from the first character of the sequence.
In the case of UTF-16 this is 1 unless ch is a surrogate pair start character (0xD800-0xDBFF) in which case the length is 2.
In the case of UTF-8 the sequence length can be established by looking at the number of high-order bits set to '1' in the passed char ch. If no high-order bits are set, then the passed character is equivalent to an ASCII character and the sequence has a length of 1. In common with the rest of OpenTop, this method does not recognize UTF-8 sequences greater than 4 bytes. Lead bytes that indicate sequences longer than 4 are treated as indicating a sequence of length 1.
ch
- static String GetInternalEncodingName()
static size_t GetMaximumCharSequenceLength()
static bool IsSequenceStartChar(UCharType ch)
ch
- static bool IsValidCharSequence(const CharType* from, size_t len)
from
- len
- static Result TestEncodedSequence(const CharType* from, const CharType* from_end, const CharType*& from_next)
from
- from_end
- from_next
- NullPointerException
- static String ToInternalEncoding(UCS4Char ch)
ch
- IllegalCharacterException
- static Result ToInternalEncoding(UCS4Char ch, CharType* to, const CharType* to_limit, CharType*& to_next)
ch
- to
- to_limit
- to_next
- NullPointerException
-
|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |