InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IEncodingUtils.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: hhorton, (Bernd Paradies: generalized from EncodingUtils.h).
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef _H_IEncodingUtils
25 #define _H_IEncodingUtils
26 
27 #include "CJKID.h" // For IID_IENCODINGUTILS
28 #include "IPMUnknown.h"
29 #include "Utils.h"
30 class PMString;
31 class IPMFont;
32 
36 class IEncodingUtils : public IPMUnknown
37 {
38 public:
39  enum { kDefaultIID = IID_IENCODINGUTILS };
40 
44  virtual void Unicode2ShiftJIS(textchar &ch) = 0;
45 
49  virtual void ShiftJIS2Unicode(textchar &ch) = 0;
50 
54  virtual void ShiftJIS2JIS(textchar &ch) = 0;
55 
59  virtual void JIS2ShiftJIS(textchar &ch) = 0;
60 
64  virtual void JIS2Kuten(textchar &ch) = 0;
65 
69  virtual void Kuten2JIS(textchar &ch) = 0;
70 
71 
76  virtual textchar ShiftJIS2Unicode(PlatformChar ch) = 0;
77 
82  virtual textchar ShiftJIS2JIS(PlatformChar ch) = 0;
83 
89  typedef enum {
106  } encodingType;
112  virtual encodingType PopupIndexToEncodingType(int32 popupIndex) = 0;
113 
120  virtual UTF32TextChar StringToCharacterCode(PMString& str, encodingType encoding) = 0;
121 
127  virtual PMString CharacterCodeToString(UTF32TextChar code, encodingType encoding) = 0;
128 
134  virtual uint32 GetHexCode(PMString& s) = 0;
135 
140  virtual textchar GetKutenCode(PMString& s) = 0;
141 
146  virtual bool16 IsHex(uchar c) = 0;
147 
152  virtual bool16 IsDecimal(uchar c) = 0;
153 
159  virtual int32 IntValue(uchar c) = 0;
160 
161  // if script is -1 functions use script of PMString constructor for conversion
167  virtual UTF32TextChar DoubleByteEncoding2unicode( uchar16 ch, uint8 script = -1 ) = 0;
168 
174  virtual bool16 DoubleByteIsValidUnicode(const textchar &inChar, uint8 script = -1 ) = 0;
175 
181  virtual uchar16 unicode2DoubleByteEncoding( const UTF32TextChar &ch, uint8 script = -1 ) = 0;
182 
183 
189  virtual textchar FontBasedPlatformEncoding2Unicode( PlatformChar platformChar, IPMFont *transFont ) = 0;
190 
197  virtual PlatformChar FontBasedUnicode2PlatformEncoding( UTF32TextChar unicodeChar, IPMFont *transFont, uint8 script = -1 ) = 0;
198 
199  // routines for parsing 2-byte text.
205  virtual bool16 IsPossibleLeadByte(uchar charByte, int8 script) = 0;
206 
212  virtual bool16 IsPossibleSecondByte(uchar charByte, int8 script) = 0;
213 
218  virtual bool16 IsDoubleByteScript(int8 script) = 0;
219 
220 
226  virtual bool16 ValidLineBreakAfterIndex(const PMString &, CharCounter index) = 0;
227 };
228 
229 
232 namespace EncodingUtils
233 {
234  // routines for parsing 2-byte text.
235  bool16 IsPossibleLeadByte(uchar charByte, int8 script);
236  bool16 IsPossibleSecondByte(uchar charByte, int8 script);
237 }
238 
239 
240 
241 #endif /* _H_EncodingUtils */
242