DCL 4.0
Loading...
Searching...
No Matches
CharsetEncoder.cpp File Reference
#include <dcl/Config.h>
#include <string.h>
#include <wchar.h>
#include <dcl/Charset.h>
#include <dcl/Exception.h>

Go to the source code of this file.

Macros

#define ILLEGAL_UCS4   -1
#define BUFFER_SMALL   -2

Functions

__DCL_BEGIN_NAMESPACE IMPLEMENT_CLASSINFO (CharsetConvertException, Exception) CharsetConvertException
 IMPLEMENT_CLASSINFO (CharsetEncoder, Object) CharsetEncoder
 IMPLEMENT_CLASSINFO (UTF8Encoder, CharsetEncoder) UTF8Encoder
 IMPLEMENT_CLASSINFO (UTF16Encoder, CharsetEncoder) UTF16Encoder
 IMPLEMENT_CLASSINFO (UTF32Encoder, CharsetEncoder) UTF32Encoder
 IMPLEMENT_CLASSINFO (AsciiEncoder, CharsetEncoder) AsciiEncoder
 IMPLEMENT_CLASSINFO (Latin1Encoder, CharsetEncoder) Latin1Encoder
 IMPLEMENT_CLASSINFO (LocaleEncoder, CharsetEncoder) LocaleEncoder

Macro Definition Documentation

◆ BUFFER_SMALL

#define BUFFER_SMALL   -2

Definition at line 59 of file CharsetEncoder.cpp.

◆ ILLEGAL_UCS4

#define ILLEGAL_UCS4   -1

Definition at line 58 of file CharsetEncoder.cpp.

Function Documentation

◆ IMPLEMENT_CLASSINFO() [1/8]

IMPLEMENT_CLASSINFO ( AsciiEncoder ,
CharsetEncoder  )

Definition at line 454 of file CharsetEncoder.cpp.

457{
458}

◆ IMPLEMENT_CLASSINFO() [2/8]

__DCL_BEGIN_NAMESPACE IMPLEMENT_CLASSINFO ( CharsetConvertException ,
Exception  )

Definition at line 24 of file CharsetEncoder.cpp.

28{
29 __errorCode = _errorCode;
30}
#define NULL
Definition Config.h:340

◆ IMPLEMENT_CLASSINFO() [3/8]

IMPLEMENT_CLASSINFO ( CharsetEncoder ,
Object  )

Definition at line 61 of file CharsetEncoder.cpp.

64{
65#if __DCL_DEBUG
66 __DCL_ASSERT(sizeof(ucs4_t) == 4);
67#if __SIZEOF_WCHAR_T__ == 4
68 __DCL_ASSERT(sizeof(wchar_t) == 4);
69#endif
70#if __SIZEOF_WCHAR_T__ == 2
71 __DCL_ASSERT(sizeof(wchar_t) == 2);
72#endif
73 ucs4_t uc = 0x31323334;
74#if __BYTE_ORDER == __BIG_ENDIAN
75 __DCL_ASSERT(memcmp(&uc, "1234", sizeof(uc)) == 0);
76#else
77 __DCL_ASSERT(memcmp(&uc, "4321", sizeof(uc)) == 0);
78#endif
79#endif
80
81}
__DCL_BEGIN_NAMESPACE typedef uint32_t ucs4_t
Definition Charset.h:29
#define __DCL_ASSERT(expr)
Definition Object.h:371

◆ IMPLEMENT_CLASSINFO() [4/8]

IMPLEMENT_CLASSINFO ( Latin1Encoder ,
CharsetEncoder  )

Definition at line 469 of file CharsetEncoder.cpp.

472{
473}

◆ IMPLEMENT_CLASSINFO() [5/8]

IMPLEMENT_CLASSINFO ( LocaleEncoder ,
CharsetEncoder  )

Definition at line 484 of file CharsetEncoder.cpp.

487{
488 reset();
489}

◆ IMPLEMENT_CLASSINFO() [6/8]

IMPLEMENT_CLASSINFO ( UTF16Encoder ,
CharsetEncoder  )

Definition at line 275 of file CharsetEncoder.cpp.

281{
282 __DCL_ASSERT(_byteOrder == CS_BIG_ENDIAN || _byteOrder == CS_LITTLE_ENDIAN);
283 __addBOM = _addBOM;
284 __bigEndian = _byteOrder == CS_BIG_ENDIAN;
285 reset();
286}
@ CS_BIG_ENDIAN
Definition Charset.h:57
@ CS_LITTLE_ENDIAN
Definition Charset.h:56

◆ IMPLEMENT_CLASSINFO() [7/8]

IMPLEMENT_CLASSINFO ( UTF32Encoder ,
CharsetEncoder  )

Definition at line 371 of file CharsetEncoder.cpp.

377{
378 __DCL_ASSERT(_byteOrder == CS_BIG_ENDIAN || _byteOrder == CS_LITTLE_ENDIAN);
379 __addBOM = _addBOM;
380 __bigEndian = _byteOrder == CS_BIG_ENDIAN;
381 reset();
382}

◆ IMPLEMENT_CLASSINFO() [8/8]

IMPLEMENT_CLASSINFO ( UTF8Encoder ,
CharsetEncoder  )

Definition at line 195 of file CharsetEncoder.cpp.

200{
201 __addBOM = _addBOM;
202 reset();
203}