OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _FX_CODEPAGE | 7 #ifndef _FX_CODEPAGE |
8 #define _FX_CODEPAGE | 8 #define _FX_CODEPAGE |
9 class IFX_CodePage; | 9 class IFX_CodePage; |
10 #define FX_CODEPAGE_DefANSI 0 | 10 #define FX_CODEPAGE_DefANSI 0 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 #define FX_CHARSET_MSWin_Arabic 178 | 123 #define FX_CHARSET_MSWin_Arabic 178 |
124 #define FX_CHARSET_ArabicTraditional 179 | 124 #define FX_CHARSET_ArabicTraditional 179 |
125 #define FX_CHARSET_ArabicUser 180 | 125 #define FX_CHARSET_ArabicUser 180 |
126 #define FX_CHARSET_HebrewUser 181 | 126 #define FX_CHARSET_HebrewUser 181 |
127 #define FX_CHARSET_MSWin_Baltic 186 | 127 #define FX_CHARSET_MSWin_Baltic 186 |
128 #define FX_CHARSET_MSWin_Cyrillic 204 | 128 #define FX_CHARSET_MSWin_Cyrillic 204 |
129 #define FX_CHARSET_Thai 222 | 129 #define FX_CHARSET_Thai 222 |
130 #define FX_CHARSET_MSWin_EasterEuropean 238 | 130 #define FX_CHARSET_MSWin_EasterEuropean 238 |
131 #define FX_CHARSET_US 254 | 131 #define FX_CHARSET_US 254 |
132 #define FX_CHARSET_OEM 255 | 132 #define FX_CHARSET_OEM 255 |
133 FX_WORD»FX_GetCodePageFromCharset(FX_BYTE charset); | 133 FX_WORD»FX_GetCodePageFromCharset(uint8_t charset); |
134 FX_WORD FX_GetCharsetFromCodePage(FX_WORD codepage); | 134 FX_WORD FX_GetCharsetFromCodePage(FX_WORD codepage); |
135 FX_WORD»FX_GetCodePageFromStringA(FX_LPCSTR pStr, FX_INT32 iLength); | 135 FX_WORD»FX_GetCodePageFromStringA(FX_LPCSTR pStr, int32_t iLength); |
136 FX_WORD FX_GetCodePageFormStringW(FX_LPCWSTR pStr, FX_INT32 iLength); | 136 FX_WORD FX_GetCodePageFormStringW(FX_LPCWSTR pStr, int32_t iLength); |
137 FX_WORD FX_GetDefCodePageByLanguage(FX_WORD wLanguage); | 137 FX_WORD FX_GetDefCodePageByLanguage(FX_WORD wLanguage); |
138 void» FX_SwapByteOrder(FX_LPWSTR pStr, FX_INT32 iLength); | 138 void» FX_SwapByteOrder(FX_LPWSTR pStr, int32_t iLength); |
139 void» FX_SwapByteOrderCopy(FX_LPCWSTR pSrc, FX_LPWSTR pDst, FX_INT32 iLength); | 139 void» FX_SwapByteOrderCopy(FX_LPCWSTR pSrc, FX_LPWSTR pDst, int32_t iLength); |
140 void» FX_UTF16ToWChar(FX_LPVOID pBuffer, FX_INT32 iLength); | 140 void» FX_UTF16ToWChar(FX_LPVOID pBuffer, int32_t iLength); |
141 void» FX_UTF16ToWCharCopy(const FX_WORD *pUTF16, FX_LPWSTR pWChar, FX_INT32 iL
ength); | 141 void» FX_UTF16ToWCharCopy(const FX_WORD *pUTF16, FX_LPWSTR pWChar, int32_t iLe
ngth); |
142 void» FX_WCharToUTF16(FX_LPVOID pBuffer, FX_INT32 iLength); | 142 void» FX_WCharToUTF16(FX_LPVOID pBuffer, int32_t iLength); |
143 void» FX_WCharToUTF16Copy(FX_LPCWSTR pWChar, FX_WORD *pUTF16, FX_INT32 iLength
); | 143 void» FX_WCharToUTF16Copy(FX_LPCWSTR pWChar, FX_WORD *pUTF16, int32_t iLength)
; |
144 FX_INT32» FX_DecodeString(FX_WORD wCodePage, FX_LPCSTR pSrc, FX_INT32 *pSr
cLen, FX_LPWSTR pDst, FX_INT32 *pDstLen, FX_BOOL bErrBreak = FALSE); | 144 int32_t»FX_DecodeString(FX_WORD wCodePage, FX_LPCSTR pSrc, int32_t *pSrcLen, FX_
LPWSTR pDst, int32_t *pDstLen, FX_BOOL bErrBreak = FALSE); |
145 FX_INT32» FX_UTF8Decode(FX_LPCSTR pSrc, FX_INT32 *pSrcLen, FX_LPWSTR pDst,
FX_INT32 *pDstLen); | 145 int32_t»FX_UTF8Decode(FX_LPCSTR pSrc, int32_t *pSrcLen, FX_LPWSTR pDst, int32_t
*pDstLen); |
146 enum FX_CODESYSTEM { | 146 enum FX_CODESYSTEM { |
147 FX_MBCS = 0, | 147 FX_MBCS = 0, |
148 FX_SBCS , | 148 FX_SBCS , |
149 FX_DBCS , | 149 FX_DBCS , |
150 }; | 150 }; |
151 typedef struct _FX_CODEPAGE_HEADER { | 151 typedef struct _FX_CODEPAGE_HEADER { |
152 FX_UINT16» » uCPID; | 152 uint16_t» » uCPID; |
153 FX_UINT8» » uMinCharBytes; | 153 uint8_t» » uMinCharBytes; |
154 FX_UINT8» » uMaxCharBytes; | 154 uint8_t» » uMaxCharBytes; |
155 FX_CODESYSTEM eCPType; | 155 FX_CODESYSTEM eCPType; |
156 FX_BOOL bHasLeadByte; | 156 FX_BOOL bHasLeadByte; |
157 FX_WCHAR wMinChar; | 157 FX_WCHAR wMinChar; |
158 FX_WCHAR wMaxChar; | 158 FX_WCHAR wMaxChar; |
159 FX_WCHAR wDefChar; | 159 FX_WCHAR wDefChar; |
160 FX_WCHAR wMinUnicode; | 160 FX_WCHAR wMinUnicode; |
161 FX_WCHAR wMaxUnicode; | 161 FX_WCHAR wMaxUnicode; |
162 FX_WCHAR wDefUnicode; | 162 FX_WCHAR wDefUnicode; |
163 } FX_CODEPAGE_HEADER; | 163 } FX_CODEPAGE_HEADER; |
164 #define FX_CPMAPTYPE_Consecution 1 | 164 #define FX_CPMAPTYPE_Consecution 1 |
165 #define FX_CPMAPTYPE_Strict 2 | 165 #define FX_CPMAPTYPE_Strict 2 |
166 #define FX_CPMAPTYPE_NoMapping 3 | 166 #define FX_CPMAPTYPE_NoMapping 3 |
167 #define FX_CPMAPTYPE_Delta 4 | 167 #define FX_CPMAPTYPE_Delta 4 |
168 typedef struct _FX_CPCU_MAPTABLE1 { | 168 typedef struct _FX_CPCU_MAPTABLE1 { |
169 FX_UINT16 uMapType; | 169 uint16_t uMapType; |
170 FX_UINT16 uUniocde; | 170 uint16_t uUniocde; |
171 } FX_CPCU_MAPTABLE1; | 171 } FX_CPCU_MAPTABLE1; |
172 typedef struct _FX_CPCU_MAPTABLE2 { | 172 typedef struct _FX_CPCU_MAPTABLE2 { |
173 FX_UINT8» uTrailByte; | 173 uint8_t» uTrailByte; |
174 FX_UINT8» uMapType; | 174 uint8_t» uMapType; |
175 FX_UINT16» uOffset; | 175 uint16_t» uOffset; |
176 } FX_CPCU_MAPTABLE2; | 176 } FX_CPCU_MAPTABLE2; |
177 typedef struct _FX_CPCU_MAPINFO { | 177 typedef struct _FX_CPCU_MAPINFO { |
178 FX_CPCU_MAPTABLE1 *pMapTable1; | 178 FX_CPCU_MAPTABLE1 *pMapTable1; |
179 FX_CPCU_MAPTABLE2 *pMapTable2; | 179 FX_CPCU_MAPTABLE2 *pMapTable2; |
180 FX_LPCBYTE pMapData; | 180 FX_LPCBYTE pMapData; |
181 } FX_CPCU_MAPINFO; | 181 } FX_CPCU_MAPINFO; |
182 typedef struct _FX_CPUC_MAPTABLE { | 182 typedef struct _FX_CPUC_MAPTABLE { |
183 FX_UINT16» uStartUnicode; | 183 uint16_t» uStartUnicode; |
184 FX_UINT16» uEndUnicode; | 184 uint16_t» uEndUnicode; |
185 FX_UINT16» uMapType; | 185 uint16_t» uMapType; |
186 FX_UINT16» uOffset; | 186 uint16_t» uOffset; |
187 } FX_CPUC_MAPTABLE; | 187 } FX_CPUC_MAPTABLE; |
188 typedef struct _FX_CPUC_MAPINFO { | 188 typedef struct _FX_CPUC_MAPINFO { |
189 FX_UINT32» » » uMapCount; | 189 uint32_t» » » uMapCount; |
190 FX_CPUC_MAPTABLE *pMapTable; | 190 FX_CPUC_MAPTABLE *pMapTable; |
191 FX_LPCBYTE pMapData; | 191 FX_LPCBYTE pMapData; |
192 } FX_CPUC_MAPINFO; | 192 } FX_CPUC_MAPINFO; |
193 typedef struct _FX_CODEPAGE { | 193 typedef struct _FX_CODEPAGE { |
194 FX_CODEPAGE_HEADER const *pCPHeader; | 194 FX_CODEPAGE_HEADER const *pCPHeader; |
195 FX_CPCU_MAPINFO const *pCPCUMapInfo; | 195 FX_CPCU_MAPINFO const *pCPCUMapInfo; |
196 FX_CPUC_MAPINFO const *pCPUCMapInfo; | 196 FX_CPUC_MAPINFO const *pCPUCMapInfo; |
197 } FX_CODEPAGE, * FX_LPCODEPAGE; | 197 } FX_CODEPAGE, * FX_LPCODEPAGE; |
198 typedef FX_CODEPAGE const * FX_LPCCODEPAGE; | 198 typedef FX_CODEPAGE const * FX_LPCCODEPAGE; |
199 typedef struct _FX_STR2CPHASH { | 199 typedef struct _FX_STR2CPHASH { |
200 FX_UINT32 uHash; | 200 uint32_t uHash; |
201 FX_UINT32 uCodePage; | 201 uint32_t uCodePage; |
202 } FX_STR2CPHASH; | 202 } FX_STR2CPHASH; |
203 typedef struct _FX_CHARSET_MAP { | 203 typedef struct _FX_CHARSET_MAP { |
204 FX_UINT16 charset; | 204 uint16_t charset; |
205 FX_UINT16 codepage; | 205 uint16_t codepage; |
206 } FX_CHARSET_MAP; | 206 } FX_CHARSET_MAP; |
207 typedef struct _FX_LANG2CPMAP { | 207 typedef struct _FX_LANG2CPMAP { |
208 FX_WORD wLanguage; | 208 FX_WORD wLanguage; |
209 FX_WORD wCodepage; | 209 FX_WORD wCodepage; |
210 } FX_LANG2CPMAP; | 210 } FX_LANG2CPMAP; |
211 class IFX_CodePage | 211 class IFX_CodePage |
212 { | 212 { |
213 public: | 213 public: |
214 static IFX_CodePage* Create(FX_WORD wCodePage); | 214 static IFX_CodePage* Create(FX_WORD wCodePage); |
215 virtual void Release() = 0; | 215 virtual void Release() = 0; |
216 virtual FX_WORD GetCodePageNumber() const = 0; | 216 virtual FX_WORD GetCodePageNumber() const = 0; |
217 virtual FX_CODESYSTEM GetCodeSystemType() const = 0; | 217 virtual FX_CODESYSTEM GetCodeSystemType() const = 0; |
218 virtual FX_BOOL HasLeadByte() const = 0; | 218 virtual FX_BOOL HasLeadByte() const = 0; |
219 virtual FX_BOOL» » » IsLeadByte(FX_BYTE byte) const = 0; | 219 virtual FX_BOOL» » » IsLeadByte(uint8_t byte) const = 0; |
220 virtual FX_INT32» » GetMinBytesPerChar() const = 0; | 220 virtual int32_t» » GetMinBytesPerChar() const = 0; |
221 virtual FX_INT32» » GetMaxBytesPerChar() const = 0; | 221 virtual int32_t» » GetMaxBytesPerChar() const = 0; |
222 virtual FX_WCHAR GetMinCharcode() const = 0; | 222 virtual FX_WCHAR GetMinCharcode() const = 0; |
223 virtual FX_WCHAR GetMaxCharcode() const = 0; | 223 virtual FX_WCHAR GetMaxCharcode() const = 0; |
224 virtual FX_WCHAR GetDefCharcode() const = 0; | 224 virtual FX_WCHAR GetDefCharcode() const = 0; |
225 virtual FX_WCHAR GetMinUnicode() const = 0; | 225 virtual FX_WCHAR GetMinUnicode() const = 0; |
226 virtual FX_WCHAR GetMaxUnicode() const = 0; | 226 virtual FX_WCHAR GetMaxUnicode() const = 0; |
227 virtual FX_WCHAR GetDefUnicode() const = 0; | 227 virtual FX_WCHAR GetDefUnicode() const = 0; |
228 virtual FX_BOOL IsValidCharcode(FX_WORD wCharcode) const
= 0; | 228 virtual FX_BOOL IsValidCharcode(FX_WORD wCharcode) const
= 0; |
229 virtual FX_WCHAR GetUnicode(FX_WORD wCharcode) const = 0; | 229 virtual FX_WCHAR GetUnicode(FX_WORD wCharcode) const = 0; |
230 virtual FX_BOOL IsValidUnicode(FX_WCHAR wUnicode) const
= 0; | 230 virtual FX_BOOL IsValidUnicode(FX_WCHAR wUnicode) const
= 0; |
231 virtual FX_WORD GetCharcode(FX_WCHAR wUnicode) const = 0
; | 231 virtual FX_WORD GetCharcode(FX_WCHAR wUnicode) const = 0
; |
232 }; | 232 }; |
233 #endif | 233 #endif |
OLD | NEW |