| 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 XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ | 7 #ifndef XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ |
| 8 #define XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ | 8 #define XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h" | 12 #include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h" |
| 13 | 13 |
| 14 #define ASCII_ENCODATION 0 | 14 #define ASCII_ENCODATION 0 |
| 15 #define C40_ENCODATION 1 | 15 #define C40_ENCODATION 1 |
| 16 #define TEXT_ENCODATION 2 | 16 #define TEXT_ENCODATION 2 |
| 17 #define X12_ENCODATION 3 | 17 #define X12_ENCODATION 3 |
| 18 #define EDIFACT_ENCODATION 4 | 18 #define EDIFACT_ENCODATION 4 |
| 19 #define BASE256_ENCODATION 5 | 19 #define BASE256_ENCODATION 5 |
| 20 | 20 |
| 21 class CBC_HighLevelEncoder : public CBC_SymbolShapeHint { | 21 class CBC_HighLevelEncoder : public CBC_SymbolShapeHint { |
| 22 public: | 22 public: |
| 23 CBC_HighLevelEncoder(); | 23 CBC_HighLevelEncoder(); |
| 24 ~CBC_HighLevelEncoder() override; | 24 ~CBC_HighLevelEncoder() override; |
| 25 | 25 |
| 26 CFX_ByteArray& getBytesForMessage(CFX_WideString msg); | 26 CFX_ArrayTemplate<uint8_t>& getBytesForMessage(CFX_WideString msg); |
| 27 static CFX_WideString encodeHighLevel(CFX_WideString msg, | 27 static CFX_WideString encodeHighLevel(CFX_WideString msg, |
| 28 CFX_WideString ecLevel, | 28 CFX_WideString ecLevel, |
| 29 int32_t& e); | 29 int32_t& e); |
| 30 static CFX_WideString encodeHighLevel(CFX_WideString msg, | 30 static CFX_WideString encodeHighLevel(CFX_WideString msg, |
| 31 CFX_WideString ecLevel, | 31 CFX_WideString ecLevel, |
| 32 SymbolShapeHint shape, | 32 SymbolShapeHint shape, |
| 33 CBC_Dimension* minSize, | 33 CBC_Dimension* minSize, |
| 34 CBC_Dimension* maxSize, | 34 CBC_Dimension* maxSize, |
| 35 int32_t& e); | 35 int32_t& e); |
| 36 static int32_t lookAheadTest(CFX_WideString msg, | 36 static int32_t lookAheadTest(CFX_WideString msg, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 52 static FX_WCHAR C40_UNLATCH; | 52 static FX_WCHAR C40_UNLATCH; |
| 53 static FX_WCHAR X12_UNLATCH; | 53 static FX_WCHAR X12_UNLATCH; |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 static FX_WCHAR PAD; | 56 static FX_WCHAR PAD; |
| 57 static FX_WCHAR MACRO_05; | 57 static FX_WCHAR MACRO_05; |
| 58 static FX_WCHAR MACRO_06; | 58 static FX_WCHAR MACRO_06; |
| 59 static const wchar_t* MACRO_05_HEADER; | 59 static const wchar_t* MACRO_05_HEADER; |
| 60 static const wchar_t* MACRO_06_HEADER; | 60 static const wchar_t* MACRO_06_HEADER; |
| 61 static const wchar_t MACRO_TRAILER; | 61 static const wchar_t MACRO_TRAILER; |
| 62 CFX_ByteArray m_bytearray; | 62 CFX_ArrayTemplate<uint8_t> m_bytearray; |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 static FX_WCHAR randomize253State(FX_WCHAR ch, int32_t codewordPosition); | 65 static FX_WCHAR randomize253State(FX_WCHAR ch, int32_t codewordPosition); |
| 66 static int32_t findMinimums(std::vector<FX_FLOAT>& charCounts, | 66 static int32_t findMinimums(std::vector<FX_FLOAT>& charCounts, |
| 67 CFX_Int32Array& intCharCounts, | 67 CFX_ArrayTemplate<int32_t>& intCharCounts, |
| 68 int32_t min, | 68 int32_t min, |
| 69 CFX_ByteArray& mins); | 69 CFX_ArrayTemplate<uint8_t>& mins); |
| 70 static int32_t getMinimumCount(CFX_ByteArray& mins); | 70 static int32_t getMinimumCount(CFX_ArrayTemplate<uint8_t>& mins); |
| 71 static bool isNativeC40(FX_WCHAR ch); | 71 static bool isNativeC40(FX_WCHAR ch); |
| 72 static bool isNativeText(FX_WCHAR ch); | 72 static bool isNativeText(FX_WCHAR ch); |
| 73 static bool isNativeX12(FX_WCHAR ch); | 73 static bool isNativeX12(FX_WCHAR ch); |
| 74 static bool isX12TermSep(FX_WCHAR ch); | 74 static bool isX12TermSep(FX_WCHAR ch); |
| 75 static bool isNativeEDIFACT(FX_WCHAR ch); | 75 static bool isNativeEDIFACT(FX_WCHAR ch); |
| 76 static bool isSpecialB256(FX_WCHAR ch); | 76 static bool isSpecialB256(FX_WCHAR ch); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 #endif // XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ | 79 #endif // XFA_FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_ |
| OLD | NEW |