OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef XFA_SRC_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ | |
8 #define XFA_SRC_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ | |
9 | |
10 #include "xfa/src/fxbarcode/datamatrix/BC_SymbolShapeHint.h" | |
11 | |
12 #define ASCII_ENCODATION 0 | |
13 #define C40_ENCODATION 1 | |
14 #define TEXT_ENCODATION 2 | |
15 #define X12_ENCODATION 3 | |
16 #define EDIFACT_ENCODATION 4 | |
17 #define BASE256_ENCODATION 5 | |
18 | |
19 class CBC_HighLevelEncoder : public CBC_SymbolShapeHint { | |
20 public: | |
21 CBC_HighLevelEncoder(); | |
22 virtual ~CBC_HighLevelEncoder(); | |
23 CFX_ByteArray& getBytesForMessage(CFX_WideString msg); | |
24 static CFX_WideString encodeHighLevel(CFX_WideString msg, | |
25 CFX_WideString ecLevel, | |
26 int32_t& e); | |
27 static CFX_WideString encodeHighLevel(CFX_WideString msg, | |
28 CFX_WideString ecLevel, | |
29 SymbolShapeHint shape, | |
30 CBC_Dimension* minSize, | |
31 CBC_Dimension* maxSize, | |
32 int32_t& e); | |
33 static int32_t lookAheadTest(CFX_WideString msg, | |
34 int32_t startpos, | |
35 int32_t currentMode); | |
36 static FX_BOOL isDigit(FX_WCHAR ch); | |
37 static FX_BOOL isExtendedASCII(FX_WCHAR ch); | |
38 static int32_t determineConsecutiveDigitCount(CFX_WideString msg, | |
39 int32_t startpos); | |
40 static void illegalCharacter(FX_WCHAR c, int32_t& e); | |
41 | |
42 public: | |
43 static FX_WCHAR LATCH_TO_C40; | |
44 static FX_WCHAR LATCH_TO_BASE256; | |
45 static FX_WCHAR UPPER_SHIFT; | |
46 static FX_WCHAR LATCH_TO_ANSIX12; | |
47 static FX_WCHAR LATCH_TO_TEXT; | |
48 static FX_WCHAR LATCH_TO_EDIFACT; | |
49 static FX_WCHAR C40_UNLATCH; | |
50 static FX_WCHAR X12_UNLATCH; | |
51 | |
52 private: | |
53 static FX_WCHAR PAD; | |
54 static FX_WCHAR MACRO_05; | |
55 static FX_WCHAR MACRO_06; | |
56 static const wchar_t* MACRO_05_HEADER; | |
57 static const wchar_t* MACRO_06_HEADER; | |
58 static const wchar_t MACRO_TRAILER; | |
59 CFX_ByteArray m_bytearray; | |
60 | |
61 private: | |
62 static FX_WCHAR randomize253State(FX_WCHAR ch, int32_t codewordPosition); | |
63 static int32_t findMinimums(CFX_FloatArray& charCounts, | |
64 CFX_Int32Array& intCharCounts, | |
65 int32_t min, | |
66 CFX_ByteArray& mins); | |
67 static int32_t getMinimumCount(CFX_ByteArray& mins); | |
68 static FX_BOOL isNativeC40(FX_WCHAR ch); | |
69 static FX_BOOL isNativeText(FX_WCHAR ch); | |
70 static FX_BOOL isNativeX12(FX_WCHAR ch); | |
71 static FX_BOOL isX12TermSep(FX_WCHAR ch); | |
72 static FX_BOOL isNativeEDIFACT(FX_WCHAR ch); | |
73 static FX_BOOL isSpecialB256(FX_WCHAR ch); | |
74 }; | |
75 | |
76 #endif // XFA_SRC_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ | |
OLD | NEW |