DCL 4.0
Loading...
Searching...
No Matches
UTF32Decoder Class Reference

#include <Charset.h>

Inheritance diagram for UTF32Decoder:
CharsetDecoder Object

Protected Member Functions

virtual int toWideChar (const byte_t *_mbs, size_t _mbslen, ucs4_t *_uc)
Protected Member Functions inherited from CharsetDecoder
 CharsetDecoder ()
Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Additional Inherited Members

Public Member Functions inherited from CharsetDecoder
virtual int decode (const byte_t *_in, size_t &_inCount, wchar_t *_out, size_t &_outCount)
size_t getDecodedLength (const char *_mbs, size_t _mbslen) __DCL_THROWS1(CharsetConvertException *)
String decode (const char *_mbs, size_t _mbslen=(size_t) -1) __DCL_THROWS1(CharsetConvertException *)
String decode (const ByteString &_str) __DCL_THROWS1(CharsetConvertException *)
Public Member Functions inherited from Object
virtual String toString () const
virtual void destroy ()
String className () const
bool isInstanceOf (const std::type_info &typeinfo) const
virtual const std::type_info & typeInfo () const

Detailed Description

Definition at line 284 of file Charset.h.

Member Function Documentation

◆ toWideChar()

int UTF32Decoder::toWideChar ( const byte_t * _mbs,
size_t _mbslen,
ucs4_t * _uc )
protectedvirtual

Implements CharsetDecoder.

Definition at line 356 of file CharsetDecoder.cpp.

357{
358 int count = 0;
359 while(_mbslen >= 4) {
360 ucs4_t uc = __bigEndian ? (_mbs[0] << 24) + (_mbs[1] << 16) + (_mbs[2] << 8) + _mbs[3]
361 : _mbs[0] + (_mbs[1] << 8) + (_mbs[2] << 16) + (_mbs[3] << 24);
362
363 count += 4;
364
365 if (uc == 0x0000FEFF) {
366 __hasBOM = true;
367 }
368 else if (uc == 0xFFFE0000U) {
369 __hasBOM = true;
370 __bigEndian = !__bigEndian;
371 }
372 else {
373 if (uc < 0x110000 && !(uc >= 0xD800 && uc < 0xE000)) {
374 *_uc = uc;
375 return count;
376 }
377 else
378 return ILLEGAL_SEQUENCE;
379 }
380 _mbs += 4; _mbslen -= 4;
381 }
382 return SOURCE_FEW_N(count);
383}
__DCL_BEGIN_NAMESPACE typedef uint32_t ucs4_t
Definition Charset.h:29
#define ILLEGAL_SEQUENCE
#define SOURCE_FEW_N(_mbslen)

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