CFx SDK Documentation  2022 SP0
Static Public Member Functions | List of all members
OdCharMapper Class Reference

#include <OdCharMapper.h>

Static Public Member Functions

static OdResult initialize (const OdString &filename)
 
static OdResult unicodeToCodepage (OdChar sourceChar, OdCodePageId codepageId, OdChar &codepageChar, bool bTryToUseSystemCP=true)
 
static OdResult unicodeToCodepage2 (OdChar sourceChar, OdCodePageId codepageId, OdChar &codepageChar)
 
static OdResult codepageToUnicode (OdChar sourceChar, OdCodePageId codepageId, OdChar &unicodeChar)
 
static bool isLeadByte (OdUInt8 testByte, OdCodePageId codepageId)
 
static OdResult codepageDescToId (const OdString &description, OdCodePageId &codepageId)
 
static OdResult codepageIdToDesc (OdCodePageId codepageId, OdString &description)
 
static OdUInt32 numValidCodepages ()
 
static OdCodePageId ansiCpToAcadCp (OdUInt32 ansiCodePage)
 
static OdUInt32 acadCpToAnsiCp (OdCodePageId acadCodePageId)
 
static OdCodePageId getCodepageByCharset (OdUInt16 ansiCharacterSet)
 
static OdUInt16 getReorderCharsetByChar (OdChar ch)
 
static bool isConversionSupported (OdCodePageId codepageId)
 
static void wideCharToMultiByte (OdCodePageId codePage, const OdChar *srcBuf, int srcSize, OdAnsiCharArray &dstBuf)
 
static void multiByteToWideChar (OdCodePageId codePage, const char *srcBuf, int srcSize, OdCharArray &dstBuf)
 
static void utf8ToUnicode (const char *srcBuf, int srcSize, OdCharArray &dstBuf)
 
static void unicodeToUtf8 (const OdChar *srcBuf, int srcSize, OdAnsiCharArray &dstBuf)
 
static OdResult addBigFontWithIndex (const OdString &bigFont, OdInt32 cpIndex)
 
static OdResult addBigFontWithCodepage (const OdString &bigFont, OdCodePageId codePageId)
 
static OdResult addBigFonts (OdStreamBuf *io)
 
static OdCodePageId getCpByBigFont (const OdString &bigFont)
 
static OdInt32 getCpIndexByBigFont (const OdString &bigFont)
 
static double getCheckSumAnsi (OdAnsiString str)
 
static double getCheckSumUnicode (OdString str)
 
static OdString convertCIFcoding (const OdString &strText)
 

Detailed Description

This class implements character mapping. Corresponding C++ library: TD_Root <group Other_Classes>

Definition at line 47 of file OdCharMapper.h.

Member Function Documentation

◆ acadCpToAnsiCp()

static OdUInt32 OdCharMapper::acadCpToAnsiCp ( OdCodePageId  acadCodePageId)
static

Returns the ANSI code page corresponding to the specified code page.

Parameters
acadCodePageId[in] code page.

◆ addBigFonts()

static OdResult OdCharMapper::addBigFonts ( OdStreamBuf io)
static

Adds the bigfont list from io stream to map.

Parameters
io[in] stream with next format.

Anything after a '#' character is a comment (and ignored) The ';' character is used to separate the file name from the code page index

<BIGFONTFILENAME.SHX>;

There should be no leading or trailing spaces for the filename

JAPANESE_CODEPAGE_INDEX = 1, TRADITIONAL_CHINESE_CODEPAGE_INDEX = 2, KOREAN_CODEPAGE_INDEX = 3, KOREAN_JOHAB_CODEPAGE_INDEX = 4, SIMPLIFIED_CHINESE_CODEPAGE_INDEX = 5

Returns eOk if successful, or an appropriate error code if not.

◆ addBigFontWithCodepage()

static OdResult OdCharMapper::addBigFontWithCodepage ( const OdString bigFont,
OdCodePageId  codePageId 
)
static

Adds the bigFont to map.

Parameters
bigFont[in] big font file name.
codePageId[in] CodePage ID.
Remarks
codePageId must be one of the following:

@untitled table CP_ANSI_932 CP_ANSI_950 CP_ANSI_949 CP_ANSI_936

Returns eOk if successful, or an appropriate error code if not.

◆ addBigFontWithIndex()

static OdResult OdCharMapper::addBigFontWithIndex ( const OdString bigFont,
OdInt32  cpIndex 
)
static

Adds the bigFont to map.

Parameters
bigFont[in] big font file name.
cpIndex[in] code page index.
Remarks
cpIndex must be one of the following:

Description 1 CP_ANSI_932 2 CP_ANSI_950 3 CP_ANSI_949 5 CP_ANSI_936

Returns eOk if successful, or an appropriate error code if not.

◆ ansiCpToAcadCp()

static OdCodePageId OdCharMapper::ansiCpToAcadCp ( OdUInt32  ansiCodePage)
static

Returns the code page corresponding to the specified ANSI code page.

Parameters
ansiCodePage[in] ANSI code page.

◆ codepageDescToId()

static OdResult OdCharMapper::codepageDescToId ( const OdString description,
OdCodePageId codepageId 
)
static

Returns the code page with the specified description.

Parameters
description[in] Description.
codepageId[out] Receives the object ID of the code page.
Returns
Returns eOk if successful, or an appropriate error code if not.

◆ codepageIdToDesc()

static OdResult OdCharMapper::codepageIdToDesc ( OdCodePageId  codepageId,
OdString description 
)
static

Returns the description for the specified code page.

Parameters
description[out] Receives the description.
codepageId[in] Object ID of the code page.
Returns
Returns eOk if successful, or an appropriate error code if not.

◆ codepageToUnicode()

static OdResult OdCharMapper::codepageToUnicode ( OdChar  sourceChar,
OdCodePageId  codepageId,
OdChar unicodeChar 
)
static

Maps the specified code page character to Unicode.

Parameters
sourceChar[in] Code page source character.
codepageId[in] Object ID of the code page.
unicodeChar[out] Receives the Unicode character.
Returns
Returns eOk if successful, or an appropriate error code if not.

◆ convertCIFcoding()

static OdString OdCharMapper::convertCIFcoding ( const OdString strText)
static

◆ getCheckSumAnsi()

static double OdCharMapper::getCheckSumAnsi ( OdAnsiString  str)
static

Returns the check sum for an ANSI string.

Parameters
str[in] String for calculating check sum.

◆ getCheckSumUnicode()

static double OdCharMapper::getCheckSumUnicode ( OdString  str)
static

Returns the check sum for a unicode string.

Parameters
str[in] String for calculating check sum.

◆ getCodepageByCharset()

static OdCodePageId OdCharMapper::getCodepageByCharset ( OdUInt16  ansiCharacterSet)
static

Returns the code page corresponding to the specified ANSI character set.

Parameters
ansiCharacterSet[in] Character Set.

◆ getCpByBigFont()

static OdCodePageId OdCharMapper::getCpByBigFont ( const OdString bigFont)
static

Returns the OdCodePageId.

Remarks
getCpByBigFont returns one of the following:

@untitled table CP_ANSI_932 CP_ANSI_950 CP_ANSI_949 CP_ANSI_936

Parameters
bigFont[in] big font file name.

◆ getCpIndexByBigFont()

static OdInt32 OdCharMapper::getCpIndexByBigFont ( const OdString bigFont)
static

Returns the code page index.

Remarks
getCpIndexByBigFont returns one of the following:

Description 1 CP_ANSI_932 2 CP_ANSI_950 3 CP_ANSI_949 5 CP_ANSI_936

Parameters
bigFont[in] big font file name.

◆ getReorderCharsetByChar()

static OdUInt16 OdCharMapper::getReorderCharsetByChar ( OdChar  ch)
static

◆ initialize()

static OdResult OdCharMapper::initialize ( const OdString filename)
static

Initializes this CharMapper object from the specified mapping file.

Parameters
filename[in] File name.
Returns
Returns eOk if successful, or an appropriate error code if not.

◆ isConversionSupported()

static bool OdCharMapper::isConversionSupported ( OdCodePageId  codepageId)
static

Returns true if and only if the specified code page supports conversion.

Parameters
codepageId[in] Object ID of the code page.

◆ isLeadByte()

static bool OdCharMapper::isLeadByte ( OdUInt8  testByte,
OdCodePageId  codepageId 
)
static

Returns true if and only if the specified byte is one of the leading bytes of the specified code page.

Parameters
testByte[in] Byte to test.
codepageId[in] Object ID of the code page.

◆ multiByteToWideChar()

static void OdCharMapper::multiByteToWideChar ( OdCodePageId  codePage,
const char *  srcBuf,
int  srcSize,
OdCharArray dstBuf 
)
static

◆ numValidCodepages()

static OdUInt32 OdCharMapper::numValidCodepages ( )
static

Returns the number of valid code pages for this CharMapper object.

◆ unicodeToCodepage()

static OdResult OdCharMapper::unicodeToCodepage ( OdChar  sourceChar,
OdCodePageId  codepageId,
OdChar codepageChar,
bool  bTryToUseSystemCP = true 
)
static

Maps the specified Unicode character to the specified code page.

Parameters
sourceChar[in] Unicode source character.
codepageId[in] Object ID of the code page.
codepageChar[out] Receives the code page character.
bTryToUseSystemCP[in] Try to use default ANSI code page and OEM code page in case conversion with codepageId is not OK
Returns
Returns eOk if successful, or an appropriate error code if not.

◆ unicodeToCodepage2()

static OdResult OdCharMapper::unicodeToCodepage2 ( OdChar  sourceChar,
OdCodePageId  codepageId,
OdChar codepageChar 
)
static

Maps the specified Unicode character to the specified code page using IMLangFontLink2 interface.

Parameters
sourceChar[in] Unicode source character.
codepageId[in] Object ID of the code page.
codepageChar[out] Receives the code page character.
Returns
Returns eOk if successful, or an appropriate error code if not.

◆ unicodeToUtf8()

static void OdCharMapper::unicodeToUtf8 ( const OdChar srcBuf,
int  srcSize,
OdAnsiCharArray dstBuf 
)
static

◆ utf8ToUnicode()

static void OdCharMapper::utf8ToUnicode ( const char *  srcBuf,
int  srcSize,
OdCharArray dstBuf 
)
static

◆ wideCharToMultiByte()

static void OdCharMapper::wideCharToMultiByte ( OdCodePageId  codePage,
const OdChar srcBuf,
int  srcSize,
OdAnsiCharArray dstBuf 
)
static

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