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 _BC_HIGHLEVALENCODER_H_ | 7 #ifndef _BC_HIGHLEVALENCODER_H_ |
8 #define _BC_HIGHLEVALENCODER_H_ | 8 #define _BC_HIGHLEVALENCODER_H_ |
9 class CBC_SymbolShapeHint; | 9 class CBC_SymbolShapeHint; |
10 class CBC_HighLevelEncoder; | 10 class CBC_HighLevelEncoder; |
11 #define ASCII_ENCODATION 0 | 11 #define ASCII_ENCODATION 0 |
12 #define C40_ENCODATION 1 | 12 #define C40_ENCODATION 1 |
13 #define TEXT_ENCODATION 2 | 13 #define TEXT_ENCODATION 2 |
14 #define X12_ENCODATION 3 | 14 #define X12_ENCODATION 3 |
15 #define EDIFACT_ENCODATION 4 | 15 #define EDIFACT_ENCODATION 4 |
16 #define BASE256_ENCODATION 5 | 16 #define BASE256_ENCODATION 5 |
17 class CBC_HighLevelEncoder : public CBC_SymbolShapeHint | 17 class CBC_HighLevelEncoder : public CBC_SymbolShapeHint |
18 { | 18 { |
19 public: | 19 public: |
20 CBC_HighLevelEncoder(); | 20 CBC_HighLevelEncoder(); |
21 virtual ~CBC_HighLevelEncoder(); | 21 virtual ~CBC_HighLevelEncoder(); |
22 CFX_ByteArray& getBytesForMessage(CFX_WideString msg); | 22 CFX_ByteArray& getBytesForMessage(CFX_WideString msg); |
23 static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecL
evel, FX_INT32 &e); | 23 static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecL
evel, int32_t &e); |
24 static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecL
evel, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, FX_
INT32 &e); | 24 static CFX_WideString encodeHighLevel(CFX_WideString msg, CFX_WideString ecL
evel, SymbolShapeHint shape, CBC_Dimension* minSize, CBC_Dimension* maxSize, int
32_t &e); |
25 static FX_INT32 lookAheadTest(CFX_WideString msg, FX_INT32 startpos, FX_INT3
2 currentMode); | 25 static int32_t lookAheadTest(CFX_WideString msg, int32_t startpos, int32_t c
urrentMode); |
26 static FX_BOOL isDigit(FX_WCHAR ch); | 26 static FX_BOOL isDigit(FX_WCHAR ch); |
27 static FX_BOOL isExtendedASCII(FX_WCHAR ch); | 27 static FX_BOOL isExtendedASCII(FX_WCHAR ch); |
28 static FX_INT32 determineConsecutiveDigitCount(CFX_WideString msg, FX_INT32
startpos); | 28 static int32_t determineConsecutiveDigitCount(CFX_WideString msg, int32_t st
artpos); |
29 static void illegalCharacter(FX_WCHAR c, FX_INT32 &e); | 29 static void illegalCharacter(FX_WCHAR c, int32_t &e); |
30 | 30 |
31 public: | 31 public: |
32 static FX_WCHAR LATCH_TO_C40; | 32 static FX_WCHAR LATCH_TO_C40; |
33 static FX_WCHAR LATCH_TO_BASE256; | 33 static FX_WCHAR LATCH_TO_BASE256; |
34 static FX_WCHAR UPPER_SHIFT; | 34 static FX_WCHAR UPPER_SHIFT; |
35 static FX_WCHAR LATCH_TO_ANSIX12; | 35 static FX_WCHAR LATCH_TO_ANSIX12; |
36 static FX_WCHAR LATCH_TO_TEXT; | 36 static FX_WCHAR LATCH_TO_TEXT; |
37 static FX_WCHAR LATCH_TO_EDIFACT; | 37 static FX_WCHAR LATCH_TO_EDIFACT; |
38 static FX_WCHAR C40_UNLATCH; | 38 static FX_WCHAR C40_UNLATCH; |
39 static FX_WCHAR X12_UNLATCH; | 39 static FX_WCHAR X12_UNLATCH; |
40 private: | 40 private: |
41 static FX_WCHAR PAD; | 41 static FX_WCHAR PAD; |
42 static FX_WCHAR MACRO_05; | 42 static FX_WCHAR MACRO_05; |
43 static FX_WCHAR MACRO_06; | 43 static FX_WCHAR MACRO_06; |
44 static const wchar_t* MACRO_05_HEADER; | 44 static const wchar_t* MACRO_05_HEADER; |
45 static const wchar_t* MACRO_06_HEADER; | 45 static const wchar_t* MACRO_06_HEADER; |
46 static const wchar_t MACRO_TRAILER; | 46 static const wchar_t MACRO_TRAILER; |
47 CFX_ByteArray m_bytearray; | 47 CFX_ByteArray m_bytearray; |
48 private: | 48 private: |
49 static FX_WCHAR randomize253State(FX_WCHAR ch, FX_INT32 codewordPosition); | 49 static FX_WCHAR randomize253State(FX_WCHAR ch, int32_t codewordPosition); |
50 static FX_INT32 findMinimums(CFX_FloatArray &charCounts, CFX_Int32Array &int
CharCounts, FX_INT32 min, CFX_ByteArray &mins); | 50 static int32_t findMinimums(CFX_FloatArray &charCounts, CFX_Int32Array &intC
harCounts, int32_t min, CFX_ByteArray &mins); |
51 static FX_INT32 getMinimumCount(CFX_ByteArray &mins); | 51 static int32_t getMinimumCount(CFX_ByteArray &mins); |
52 static FX_BOOL isNativeC40(FX_WCHAR ch); | 52 static FX_BOOL isNativeC40(FX_WCHAR ch); |
53 static FX_BOOL isNativeText(FX_WCHAR ch); | 53 static FX_BOOL isNativeText(FX_WCHAR ch); |
54 static FX_BOOL isNativeX12(FX_WCHAR ch); | 54 static FX_BOOL isNativeX12(FX_WCHAR ch); |
55 static FX_BOOL isX12TermSep(FX_WCHAR ch); | 55 static FX_BOOL isX12TermSep(FX_WCHAR ch); |
56 static FX_BOOL isNativeEDIFACT(FX_WCHAR ch); | 56 static FX_BOOL isNativeEDIFACT(FX_WCHAR ch); |
57 static FX_BOOL isSpecialB256(FX_WCHAR ch); | 57 static FX_BOOL isSpecialB256(FX_WCHAR ch); |
58 | 58 |
59 }; | 59 }; |
60 #endif | 60 #endif |
OLD | NEW |