--- parser3/src/include/pa_charset.h 2009/04/10 11:31:34 1.41 +++ parser3/src/include/pa_charset.h 2009/11/06 05:01:24 1.44 @@ -8,7 +8,7 @@ #ifndef PA_CHARSET_H #define PA_CHARSET_H -static const char * const IDENT_CHARSET_H="$Date: 2009/04/10 11:31:34 $"; +static const char * const IDENT_CHARSET_H="$Date: 2009/11/06 05:01:24 $"; #include "pa_exception.h" @@ -41,7 +41,7 @@ static const char * const IDENT_CHARSET_ // helpers -typedef Hash HashStringString; +typedef HashString HashStringString; /** charset holds name & transcode tables registers libxml transcoders @@ -170,10 +170,29 @@ private: extern Charset::UTF8CaseTable UTF8CaseToUpper; extern Charset::UTF8CaseTable UTF8CaseToLower; void change_case_UTF8(const XMLByte* srcData, size_t srcLen, - XMLByte* toFill, size_t toFillLen, - const Charset::UTF8CaseTable& table); + XMLByte* toFill, size_t toFillLen, + const Charset::UTF8CaseTable& table); size_t getUTF8BytePos(const XMLByte* srcBegin, const XMLByte* srcEnd, size_t charPos/*position in characters*/); size_t getUTF8CharPos(const XMLByte* srcBegin, const XMLByte* srcEnd, size_t bytePos/*position in bytes*/); size_t lengthUTF8(const XMLByte* srcBegin, const XMLByte* srcEnd); +unsigned int lengthUTF8Char(const XMLByte c); + + +class UTF8_string_iterator { + public: + UTF8_string_iterator(const String& astring): fsrcPtr((XMLByte*)astring.cstr()), fsrcEnd(fsrcPtr + astring.length()) {} + UTF8_string_iterator(XMLByte* asrcPtr, size_t length): fsrcPtr(asrcPtr), fsrcEnd(fsrcPtr + length) {} + + bool has_next(); + XMLCh next() { return fUTF8Char; } + XMLByte getFirstByte(){ return ffirstByte; } + size_t getCharSize(){ return fcharSize; } + private: + const XMLByte* fsrcPtr; + const XMLByte* fsrcEnd; + size_t fcharSize; + XMLByte ffirstByte; + XMLCh fUTF8Char; +}; #endif