InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IEncodingUtils Class Referenceabstract

#include <IEncodingUtils.h>

Inheritance diagram for IEncodingUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IENCODINGUTILS }
 
enum  encodingType {
  kCharInput = 0, kShiftJIS, kJIS, kKuten,
  kBig5, kGB, kKorean, kUnicode
}
 

Public Member Functions

virtual void Unicode2ShiftJIS (textchar &ch)=0
 
virtual void ShiftJIS2Unicode (textchar &ch)=0
 
virtual void ShiftJIS2JIS (textchar &ch)=0
 
virtual void JIS2ShiftJIS (textchar &ch)=0
 
virtual void JIS2Kuten (textchar &ch)=0
 
virtual void Kuten2JIS (textchar &ch)=0
 
virtual textchar ShiftJIS2Unicode (PlatformChar ch)=0
 
virtual textchar ShiftJIS2JIS (PlatformChar ch)=0
 
virtual encodingType PopupIndexToEncodingType (int32 popupIndex)=0
 
virtual UTF32TextChar StringToCharacterCode (PMString &str, encodingType encoding)=0
 
virtual PMString CharacterCodeToString (UTF32TextChar code, encodingType encoding)=0
 
virtual uint32 GetHexCode (PMString &s)=0
 
virtual textchar GetKutenCode (PMString &s)=0
 
virtual bool16 IsHex (uchar c)=0
 
virtual bool16 IsDecimal (uchar c)=0
 
virtual int32 IntValue (uchar c)=0
 
virtual UTF32TextChar DoubleByteEncoding2unicode (uchar16 ch, uint8 script=-1)=0
 
virtual bool16 DoubleByteIsValidUnicode (const textchar &inChar, uint8 script=-1)=0
 
virtual uchar16 unicode2DoubleByteEncoding (const UTF32TextChar &ch, uint8 script=-1)=0
 
virtual textchar FontBasedPlatformEncoding2Unicode (PlatformChar platformChar, IPMFont *transFont)=0
 
virtual PlatformChar FontBasedUnicode2PlatformEncoding (UTF32TextChar unicodeChar, IPMFont *transFont, uint8 script=-1)=0
 
virtual bool16 IsPossibleLeadByte (uchar charByte, int8 script)=0
 
virtual bool16 IsPossibleSecondByte (uchar charByte, int8 script)=0
 
virtual bool16 IsDoubleByteScript (int8 script)=0
 
virtual bool16 ValidLineBreakAfterIndex (const PMString &, CharCounter index)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

Utilities for converting encodings. i.e. Utils<IEncodingUtils>()->Unicode2ShiftJIS( ch );

Member Enumeration Documentation

Encoding Type

See Also
StringToCharacterCode
Enumerator
kCharInput 

Value is already character

kShiftJIS 

Value is string representation of shift JIS code for character

kJIS 

Value is string representation of JIS code for character

kKuten 

Value is string representation of Kuten code for character

kBig5 

Value is string representation of Chinese Big5 code for character

kGB 

Value is string representation of Chinese GB code for character

kKorean 

Value is string representation of Korean code for character

kUnicode 

Value is string representation of Unicode value for character

Member Function Documentation

virtual PMString IEncodingUtils::CharacterCodeToString (UTF32TextChar code,
encodingType encoding 
)
pure virtual

Converts a Unicode value to a string representation of a character code.

Parameters
codeUnicode to convert
encodingencoding
Returns
PMString string representation of character code
virtual UTF32TextChar IEncodingUtils::DoubleByteEncoding2unicode (uchar16 ch,
uint8 script = -1 
)
pure virtual

Convert character to unicode.

Parameters
chcharacter to convert.
scriptscript of character. If -1 default script of PMString is used.
Returns
UTF32TextChar new value.
virtual bool16 IEncodingUtils::DoubleByteIsValidUnicode (const textchar & inChar,
uint8 script = -1 
)
pure virtual

Character has Unicode value.

Parameters
chcharacter to check.
scriptscript of character. If -1 default script of PMString is used.
Returns
bool16 kTrue if character has value in Unicode.
virtual textchar IEncodingUtils::FontBasedPlatformEncoding2Unicode (PlatformChar platformChar,
IPMFonttransFont 
)
pure virtual

Convert character to unicode using font to convert.

Parameters
platformCharplatform character to convert
transFontfont to use to convert
Returns
textchar unicode value
virtual PlatformChar IEncodingUtils::FontBasedUnicode2PlatformEncoding (UTF32TextChar unicodeChar,
IPMFonttransFont,
uint8 script = -1 
)
pure virtual

DESCRIPTION

Parameters
unicodeCharunicode character to convert
transFontfont to use to convert. If nil script is used to convert.
scriptscript for conversion if transFont is nil. If -1 default script of PMString is used.
Returns
PlatformChar converted character
virtual uint32 IEncodingUtils::GetHexCode (PMStrings)
pure virtual

Converts a string representation of a Unicode value to a Unicode value. So "0041" becomes the unicode value for 'A'

Parameters
sstring representation of unicode value
Returns
uint32 new value. 0 or 1 if value could not be converted.
virtual textchar IEncodingUtils::GetKutenCode (PMStrings)
pure virtual

Converts a Kuten Code to a Unicode value.

Parameters
sKuten Code
Returns
textchar new value. 0 if value could not be converted.
virtual int32 IEncodingUtils::IntValue (uchar c)
pure virtual

Get integer value of character

Parameters
ccharacter to check. should be '0' - '9' or 'A'-'F' or 'a'-'F'.
Returns
int32 value of character as integer. Value will be 0-15. value is 0 if is not an integer
virtual bool16 IEncodingUtils::IsDecimal (uchar c)
pure virtual

Character is '0' - '9'

Parameters
ccharacter to check
Returns
bool16 kTrue if decimal
virtual bool16 IEncodingUtils::IsDoubleByteScript (int8 script)
pure virtual

Checks if script is double byte.

Parameters
scriptscript to check
Returns
bool16 kTrue if Japanese, TraditionalChinese, Korean or SimplifiedChinese
virtual bool16 IEncodingUtils::IsHex (uchar c)
pure virtual

Character is '0' - '9' or 'A'-'F' or 'a'-'F'

Parameters
ccharacter to check
Returns
bool16 kTrue if hex
virtual bool16 IEncodingUtils::IsPossibleLeadByte (uchar charByte,
int8 script 
)
pure virtual

Character is in lead byte range for script.

Parameters
charBytebyte to check
scriptscript to check with. using -1 will always return kFalse.
Returns
bool16 kTrue if byte is lead byte for script
virtual bool16 IEncodingUtils::IsPossibleSecondByte (uchar charByte,
int8 script 
)
pure virtual

Character is in possible second byte range for script.

Parameters
charBytebyte to check
scriptscript to check with. using -1 will always return kFalse.
Returns
bool16 kTrue if byte is possible second byte for script
virtual void IEncodingUtils::JIS2Kuten (textchar & ch)
pure virtual

Convert JIS value to kuten value.

Parameters
chIN/OUT on exit ch contains kuten value.
virtual void IEncodingUtils::JIS2ShiftJIS (textchar & ch)
pure virtual

Convert JIS value to shift JIS value.

Parameters
chIN/OUT on exit ch contains shift JIS value.
virtual void IEncodingUtils::Kuten2JIS (textchar & ch)
pure virtual

Convert kuten value to JIS value.

Parameters
chIN/OUT on exit ch contains JIS value.
virtual encodingType IEncodingUtils::PopupIndexToEncodingType (int32 popupIndex)
pure virtual

Use this if you have a popup with the following Entries - Character Input, Separator, Shift JIS, JIS, Kuten, Unicode

Parameters
popupIndexindex in popup
Returns
encodingType encodingType
virtual void IEncodingUtils::ShiftJIS2JIS (textchar & ch)
pure virtual

Convert shift JIS to JIS value.

Parameters
chIN/OUT on exit ch contains JIS value.
virtual textchar IEncodingUtils::ShiftJIS2JIS (PlatformChar ch)
pure virtual

Convert shift JIS to JIS

Parameters
chshift JIS value
Returns
textchar JIS value
virtual void IEncodingUtils::ShiftJIS2Unicode (textchar & ch)
pure virtual

Convert shift JIS value to Unicode value.

Parameters
chIN/OUT on exit ch contains unicode value.
virtual textchar IEncodingUtils::ShiftJIS2Unicode (PlatformChar ch)
pure virtual

Convert shift JIS to unicode

Parameters
chshift JIS value
Returns
textchar Unicode value
virtual UTF32TextChar IEncodingUtils::StringToCharacterCode (PMStringstr,
encodingType encoding 
)
pure virtual

Converts a string representation of a character code to a Unicode value. So "0041" with encoding kUnicode becomes the unicode value for 'A'

Parameters
strstring representation of character code
encodingencoding
Returns
UTF32TextChar new value. 0 or 1 if value could not be converted.
virtual uchar16 IEncodingUtils::unicode2DoubleByteEncoding (const UTF32TextCharch,
uint8 script = -1 
)
pure virtual

Convert Unicode value to platform encoding.

Parameters
chunicode value to convert
scriptscript of character. If -1 default script of PMString is used.
Returns
uchar16 platform encoding value
virtual void IEncodingUtils::Unicode2ShiftJIS (textchar & ch)
pure virtual

Convert Unicode value to shift JIS value.

Parameters
chIN/OUT on exit ch contains shift JIS value.
virtual bool16 IEncodingUtils::ValidLineBreakAfterIndex (const PMString,
CharCounter index 
)
pure virtual

Determine if we can break string after the character index

Parameters
sstring to check
indexindex to check
Returns
bool16 kTrue if break is possible