CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
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 bool 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)
 
static OdString convertAlphaNumJapanese (const OdString &strText)
 
static OdAnsiString convertAlphaNumJapanese (const OdAnsiString &strText)
 
static bool containsSpecialSequence (OdString &str, OdFont *font, OdIntArray &ulRanges)
 
static OdString embedTextRawData (const OdString &msg, const OdIntArray &ulFlags, int *length=NULL, bool *raw=NULL)
 

Detailed Description

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

Definition at line 49 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.
Returns
The ANSI code page corresponding to the specified code page.

◆ addBigFonts()

static OdResult OdCharMapper::addBigFonts ( OdStreamBuf io)
static

Receives the bigFont list to map from the specified stream.

Parameters
io[in] Stream with next format.
Returns
eOk if the bigFont list is received successfully, or an appropriate error code otherwise.
Remarks
Anything after the '#' 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

◆ addBigFontWithCodepage()

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

Adds a bigFont to a map with the specified code page ID.

Parameters
bigFont[in] Big font file name.
codePageId[in] Code page ID.
Returns
eOk if the bigFont is added to the map successfully, or an appropriate error code otherwise.
Remarks
codePageId must be one of the following:

@untitled table CP_ANSI_932 CP_ANSI_950 CP_ANSI_949 CP_ANSI_936

◆ addBigFontWithIndex()

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

Adds a bigFont to a map with the specified code page index.

Parameters
bigFont[in] Big font file name.
cpIndex[in] Code page index.
Returns
eOk if the bigFont is added to the map successfully, or an appropriate error code otherwise.
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

◆ 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.
Returns
The code page corresponding to the specified ANSI code page.

◆ codepageDescToId()

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

Gets the code page with the specified description.

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

◆ codepageIdToDesc()

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

Gets the description for the specified code page.

Parameters
codepageId[in] Object ID of the code page.
description[out] Receives the description.
Returns
eOk if the description is received successfully, or an appropriate error code otherwise.

◆ 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
eOk if the Unicode character is received successfully, or an appropriate error code otherwise.

◆ containsSpecialSequence()

static bool OdCharMapper::containsSpecialSequence ( OdString str,
OdFont font,
OdIntArray ulRanges 
)
static

Checking special sequences and replacing them with character codes. Look for following sequences: "%%", "\\U+", "\\u+", "\\M+", "\\m+".

Parameters
str[in/out] Source string.
font[in] Font.
ulRanges[out] Ranges underlined, overlined and striked.
Returns
true if special sequence was found and replaced, or false otherwise.

◆ convertAlphaNumJapanese() [1/2]

static OdAnsiString OdCharMapper::convertAlphaNumJapanese ( const OdAnsiString &  strText)
static

Gets a converted ANSI string from a specified string in the Latin alphanumeric Japanese code page.

Parameters
str[in] Source string for conversion.
Returns
The ANSI string converted from the Latin alphanumeric Japanese code page.

◆ convertAlphaNumJapanese() [2/2]

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

Gets a converted Unicode string from the specified string in the Latin alphanumeric Japanese Unicode range.

Parameters
str[in] Source string for conversion.
Returns
The Unicode string converted from the Latin alphanumeric Japanese Unicode range.

◆ convertCIFcoding()

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

Gets a converted Unicode string from the specified CIF coding string.

Parameters
str[in] Source string for conversion.
Returns
The Unicode string converted from the CIF coding string.

◆ embedTextRawData()

static OdString OdCharMapper::embedTextRawData ( const OdString msg,
const OdIntArray ulFlags,
int *  length = NULL,
bool *  raw = NULL 
)
static

Conversion source string with flags underlined, overlined and striked to string with special sequence %u, %o and %k

Parameters
str[in] Source string.
ulRanges[in] Ranges underlined, overlined and striked.
length[out] Length returned string.
raw[out] Raw flag.
Returns
Result string with special sequences if it is needed

◆ getCheckSumAnsi()

static double OdCharMapper::getCheckSumAnsi ( OdAnsiString  str)
static

Gets the check sum for an ANSI string.

Parameters
str[in] String for calculating the check sum.
Returns
The check sum for an ANSI string.

◆ getCheckSumUnicode()

static double OdCharMapper::getCheckSumUnicode ( OdString  str)
static

Gets the check sum for a Unicode string.

Parameters
str[in] String for calculating the check sum.
Returns
The check sum for a Unicode string.

◆ getCodepageByCharset()

static OdCodePageId OdCharMapper::getCodepageByCharset ( OdUInt16  ansiCharacterSet)
static

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

Parameters
ansiCharacterSet[in] Character set.
Returns
The code page corresponding to the specified ANSI character set.

◆ getCpByBigFont()

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

Gets the code page from a big font file name.

Parameters
bigFont[in] Big font file name.
Returns
The code page.
Remarks
getCpByBigFont returns one of the following:

@untitled table CP_ANSI_932 CP_ANSI_950 CP_ANSI_949 CP_ANSI_936

◆ getCpIndexByBigFont()

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

Gets the code page index from a bigFont file name.

Parameters
bigFont[in] Big font file name.
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

◆ getReorderCharsetByChar()

static OdUInt16 OdCharMapper::getReorderCharsetByChar ( OdChar  ch)
static

Gets the charset corresponding to the specified character.

Parameters
ch[in] Character.
Returns
The charset corresponding to the specified character.
Remarks
If the character is in the Hebrew range, returns 0xB1. If the character is in the Arabic range, returns 0xB2. Otherwise returns 0.

◆ initialize()

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

Initializes this CharMapper object from the specified mapping file.

Parameters
filename[in] File name.
Returns
eOk if the CharMapper is initialized successfully, or an appropriate error code otherwise.

◆ isConversionSupported()

static bool OdCharMapper::isConversionSupported ( OdCodePageId  codepageId)
static

Checks whether the specified code page supports conversion.

Parameters
codepageId[in] Object ID of the code page.
Returns
true if the specified code page supports conversion, or false otherwise.

◆ isLeadByte()

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

Checks whether 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.
Returns
true if the specified byte is one of the leading bytes of the specified code page, or false otherwise.

◆ multiByteToWideChar()

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

Maps the specified code page characters to Unicode.

Parameters
codepage[in] Source character code page.
srcBuf[in] Source character buffer.
srcSize[in] Size source character buffer.
dstBuf[out] Receives the Unicode character array.

◆ numValidCodepages()

static OdUInt32 OdCharMapper::numValidCodepages ( )
static

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

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 the default ANSI code page and OEM code page if conversion with codepageId is not OK.
Returns
eOk if the code page character is received successfully, or an appropriate error code otherwise.

◆ unicodeToCodepage2()

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

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

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

◆ unicodeToUtf8()

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

Maps the Unicode characters to UTF-8.

Parameters
srcBuf[in] Source Unicode character buffer.
srcSize[in] Size of the source character buffer.
dstBuf[out] Receives the UTF-8 character array.

◆ utf8ToUnicode()

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

Maps the UTF-8 characters to Unicode.

Parameters
srcBuf[in] Source UTF-8 character buffer.
srcSize[in] Size of the source character buffer.
dstBuf[out] Receives the Unicode character array.
Returns
true if the value is mapped successfully, or false otherwise.

◆ wideCharToMultiByte()

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

Maps the Unicode characters to the specified code page.

Parameters
codepage[in] Destination character code page.
srcBuf[in] Source Unicode character buffer.
srcSize[in] Size of the source character buffer.
dstBuf[out] Receives the character array in the specified code page.

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