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_QRCODE_BC_QRCODERENCODER_H_ | 7 #ifndef XFA_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_ |
8 #define XFA_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_ | 8 #define XFA_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_ |
9 | 9 |
| 10 #include <utility> |
| 11 #include <vector> |
| 12 |
10 #include "core/fxcrt/fx_basic.h" | 13 #include "core/fxcrt/fx_basic.h" |
11 #include "core/fxcrt/fx_string.h" | 14 #include "core/fxcrt/fx_string.h" |
12 | 15 |
13 class CBC_QRCoder; | 16 class CBC_QRCoder; |
14 class CBC_QRCoderErrorCorrectionLevel; | 17 class CBC_QRCoderErrorCorrectionLevel; |
15 class CBC_QRCoderMode; | 18 class CBC_QRCoderMode; |
16 class CBC_QRCoderBitVector; | 19 class CBC_QRCoderBitVector; |
17 class CBC_CommonByteArray; | 20 class CBC_CommonByteArray; |
18 class CBC_CommonByteMatrix; | 21 class CBC_CommonByteMatrix; |
19 class Make_Pair; | |
20 | 22 |
21 class CBC_QRCoderEncoder { | 23 class CBC_QRCoderEncoder { |
22 private: | |
23 static const int32_t m_alphaNumbericTable[96]; | |
24 | |
25 public: | 24 public: |
26 CBC_QRCoderEncoder(); | 25 CBC_QRCoderEncoder(); |
27 virtual ~CBC_QRCoderEncoder(); | 26 virtual ~CBC_QRCoderEncoder(); |
28 | 27 |
29 static void Encode(const CFX_ByteString& content, | 28 static void Encode(const CFX_ByteString& content, |
30 CBC_QRCoderErrorCorrectionLevel* ecLevel, | 29 CBC_QRCoderErrorCorrectionLevel* ecLevel, |
31 CBC_QRCoder* qrCode, | 30 CBC_QRCoder* qrCode, |
32 int32_t& e, | 31 int32_t& e, |
33 int32_t versionSpecify = 0); | 32 int32_t versionSpecify = 0); |
34 static void Encode(const CFX_WideString& content, | 33 static void Encode(const CFX_WideString& content, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 CBC_CommonByteMatrix* matrix, | 113 CBC_CommonByteMatrix* matrix, |
115 int32_t& e); | 114 int32_t& e); |
116 static int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix); | 115 static int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix); |
117 static void TerminateBits(int32_t numDataBytes, | 116 static void TerminateBits(int32_t numDataBytes, |
118 CBC_QRCoderBitVector* bits, | 117 CBC_QRCoderBitVector* bits, |
119 int32_t& e); | 118 int32_t& e); |
120 static int32_t GetSpanByVersion(CBC_QRCoderMode* modeFirst, | 119 static int32_t GetSpanByVersion(CBC_QRCoderMode* modeFirst, |
121 CBC_QRCoderMode* modeSecond, | 120 CBC_QRCoderMode* modeSecond, |
122 int32_t versionNum, | 121 int32_t versionNum, |
123 int32_t& e); | 122 int32_t& e); |
124 static void MergeString(CFX_ArrayTemplate<Make_Pair*>* result, | 123 static void MergeString( |
125 int32_t versionNum, | 124 std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>* result, |
126 int32_t& e); | 125 int32_t versionNum, |
127 static void SplitString(const CFX_ByteString& content, | 126 int32_t& e); |
128 CFX_ArrayTemplate<Make_Pair*>* result); | 127 static void SplitString( |
| 128 const CFX_ByteString& content, |
| 129 std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>* result); |
129 static void AppendDataModeLenghInfo( | 130 static void AppendDataModeLenghInfo( |
130 const CFX_ArrayTemplate<Make_Pair*>& splitResult, | 131 const std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>& |
| 132 splitResult, |
131 CBC_QRCoderBitVector& headerAndDataBits, | 133 CBC_QRCoderBitVector& headerAndDataBits, |
132 CBC_QRCoderMode* tempMode, | 134 CBC_QRCoderMode* tempMode, |
133 CBC_QRCoder* qrCode, | 135 CBC_QRCoder* qrCode, |
134 CFX_ByteString& encoding, | 136 CFX_ByteString& encoding, |
135 int32_t& e); | 137 int32_t& e); |
136 }; | 138 }; |
137 | 139 |
138 #endif // XFA_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_ | 140 #endif // XFA_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_ |
OLD | NEW |