24 #ifndef __TextCharBuffer__ 25 #define __TextCharBuffer__ 28 #include "WideString.h" 31 inline bool IsHighSurrogate(UTF16TextChar c)
32 {
return (c >= kTextChar_HighSurrogateStart && c <= kTextChar_HighSurrogateEnd); }
34 inline bool IsLowSurrogate(UTF16TextChar c)
35 {
return (c >= kTextChar_LowSurrogateStart && c <= kTextChar_LowSurrogateEnd); }
37 inline UTF32TextChar BuildUTF32Char(UTF16TextChar hi, UTF16TextChar low)
38 {
return ((hi - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000); }
53 { fCharCount = e - b; }
58 TextCharBuffer(
const UTF16TextChar *begin,
const UTF16TextChar *end, int32 charCount)
59 :fBegin(begin), fEnd(end), fCharCount(charCount)
66 {
return !IsHighSurrogate(*fBegin) ? *fBegin : BuildUTF32Char(fBegin[0], fBegin[1]); }
85 {
return fCharCount; }
91 if (!IsHighSurrogate(*fBegin))
101 if (IsLowSurrogate(*fEnd))
108 const UTF16TextChar *fBegin;
109 const UTF16TextChar *fEnd;