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

#include <Charset.h>

Inheritance diagram for AsciiDecoder:
CharsetDecoder Object

Static Public Member Functions

static String decode (const char *_mbs, size_t _mbslen=(size_t) -1)

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 328 of file Charset.h.

Member Function Documentation

◆ decode()

String AsciiDecoder::decode ( const char * _mbs,
size_t _mbslen = (size_t)-1 )
static

Definition at line 401 of file CharsetDecoder.cpp.

402{
403 if (_mbslen == (size_t)-1)
404 _mbslen = ByteString::length(_mbs);
405
406 CharBuffer* buf = CharBuffer::create(_mbslen);
407 wchar_t* p = buf->data();
408 for(size_t i = 0; i < _mbslen; i++)
409 p[i] = (wchar_t)(byte_t)_mbs[i];
410
411 p[_mbslen] = L'\0';
412 buf->__dataLength = _mbslen;
413 __DCL_ASSERT(buf->data()[buf->__dataLength] == L'\0');
414
415 String r = buf;
416 buf->release();
417 return r;
418}
unsigned char byte_t
Definition Config.h:274
#define __DCL_ASSERT(expr)
Definition Object.h:371
ByteString r
ByteBuffer * buf

◆ toWideChar()

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

Implements CharsetDecoder.

Definition at line 391 of file CharsetDecoder.cpp.

392{
393 byte_t c = *_mbs;
394 if (c < 0x80) {
395 *_uc = c;
396 return 1;
397 }
398 return ILLEGAL_SEQUENCE;
399}
#define ILLEGAL_SEQUENCE

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