3#ifndef __STRINGUTIL_H__
4#define __STRINGUTIL_H__
17#define ALIGNED __attribute__ ((aligned(16)))
22#define UCS2Char unsigned short
23#define UCS2String unsigned short*
24#define UTF8ByteType unsigned char
25#define UTF8String char*
29#define UTF8_FOLLOW_BYTE_TAG 0x80
30#define UTF8_TWO_BYTE_TAG 0xC0
31#define UTF8_THREE_BYTE_TAG 0xE0
32#define UTF8_FOUR_BYTE_TAG 0xF0
34#define UTF8_FOLLOW_BYTE_MASK 0x3F
35#define UTF8_TWO_BYTE_MASK 0x1F
36#define UTF8_THREE_BYTE_MASK 0x0F
38#define UTF8_IS_THREE_BYTE(a) (((UTF8ByteType)a & UTF8_FOUR_BYTE_TAG)==UTF8_THREE_BYTE_TAG)
39#define UTF8_IS_TWO_BYTE(a) (((UTF8ByteType)a & UTF8_THREE_BYTE_TAG)==UTF8_TWO_BYTE_TAG)
40#define UTF8_IS_FOLLOW_BYTE(a) (((UTF8ByteType)a & UTF8_TWO_BYTE_TAG)==UTF8_FOLLOW_BYTE_TAG)
41#define UTF8_IS_SINGLE_BYTE(a) ((UTF8ByteType)a <= 0x7F)
43#define REPLACE_INVALID_CHAR '?'
49int _ReadUCS2CharFromUTF8String (
const UTF8String theUTF8String, UCS2Char* theUnicodeChar,
int theMaxLength);
50int _UCS2CharToUTF8String (UCS2Char theUCS2Char, UTF8String theUTF8String);
51int _UCS2ToUTF8ConversionLengthOnly (
const UCS2String theUCS2String);
52int _UTF8ToUCS2ConversionLengthOnly (
const UTF8String theUTF8String);
55int AsciiToUTF8String(
const char* theAsciiString, UTF8String theUTF8String );
56int UTF8ToAsciiString(
const UTF8String theUTF8String,
char* theAsciiString);
57int UCS2ToUTF8String (
const UCS2String theUCS2String, UTF8String theUTF8String );
58int UTF8ToUCS2String (
const UTF8String theUTF8String, UCS2String theUCS2String );
59int UCS2ToAsciiString(
const UCS2String theUCS2String,
char* theAsciiString);
60int AsciiToUCS2String(
const char* theAsciiString, UCS2String theUCS2String );
65int UTF8ToUCS2StringLen(
const UTF8String theUTF8String, UCS2String theUCS2String,
int theMaxLength);
68UTF8String UCS2ToUTF8StringAlloc(
const UCS2String theUCS2String);
69UCS2String UTF8ToUCS2StringAlloc(
const UTF8String theUTF8String);
72UTF8String* UCS2ToUTF8StringArrayAlloc(
const UCS2String* theUCS2StringArray,
int theNumStrings);
73UCS2String* UTF8ToUCS2StringArrayAlloc(
const UTF8String* theUTF8StringArray,
int theNumStrings);