Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_QRCODE_BC_QRCODERENCODER_H_
8 #define XFA_SRC_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
9
10 #include "core/include/fxcrt/fx_basic.h"
11 #include "core/include/fxcrt/fx_string.h"
12
13 class CBC_QRCoder;
14 class CBC_QRCoderErrorCorrectionLevel;
15 class CBC_QRCoderMode;
16 class CBC_QRCoderBitVector;
17 class CBC_CommonByteArray;
18 class CBC_CommonByteMatrix;
19
20 class CBC_QRCoderEncoder {
21 private:
22 static const int32_t m_alphaNumbericTable[96];
23
24 public:
25 CBC_QRCoderEncoder();
26 virtual ~CBC_QRCoderEncoder();
27
28 static void Encode(const CFX_ByteString& content,
29 CBC_QRCoderErrorCorrectionLevel* ecLevel,
30 CBC_QRCoder* qrCode,
31 int32_t& e,
32 int32_t versionSpecify = 0);
33 static void Encode(const CFX_WideString& content,
34 CBC_QRCoderErrorCorrectionLevel* ecLevel,
35 CBC_QRCoder* qrCode,
36 int32_t& e);
37 static void EncodeWithSpecifyVersion(const CFX_ByteString& content,
38 CBC_QRCoderErrorCorrectionLevel* ecLevel,
39 CBC_QRCoder* qrCode,
40 int32_t versionSpecify,
41 int32_t& e);
42 static void EncodeWithAutoVersion(const CFX_ByteString& content,
43 CBC_QRCoderErrorCorrectionLevel* ecLevel,
44 CBC_QRCoder* qrCode,
45 int32_t& e);
46 static CBC_QRCoderMode* ChooseMode(const CFX_ByteString& content,
47 CFX_ByteString encoding);
48 static int32_t GetAlphaNumericCode(int32_t code);
49 static void AppendECI(CBC_QRCoderBitVector* bits);
50 static void AppendBytes(const CFX_ByteString& content,
51 CBC_QRCoderMode* mode,
52 CBC_QRCoderBitVector* bits,
53 CFX_ByteString encoding,
54 int32_t& e);
55 static void AppendNumericBytes(const CFX_ByteString& content,
56 CBC_QRCoderBitVector* bits,
57 int32_t& e);
58 static void AppendAlphaNumericBytes(const CFX_ByteString& content,
59 CBC_QRCoderBitVector* bits,
60 int32_t& e);
61 static void Append8BitBytes(const CFX_ByteString& content,
62 CBC_QRCoderBitVector* bits,
63 CFX_ByteString encoding,
64 int32_t& e);
65 static void Append8BitBytes(CFX_ByteArray& bytes,
66 CBC_QRCoderBitVector* bits,
67 int32_t& e);
68 static void AppendKanjiBytes(const CFX_ByteString& content,
69 CBC_QRCoderBitVector* bits,
70 int32_t& e);
71 static void AppendGBKBytes(const CFX_ByteString& content,
72 CBC_QRCoderBitVector* bits,
73 int32_t& e);
74 static void InitQRCode(int32_t numInputBytes,
75 int32_t versionNumber,
76 CBC_QRCoderErrorCorrectionLevel* ecLevel,
77 CBC_QRCoderMode* mode,
78 CBC_QRCoder* qrCode,
79 int32_t& e);
80 static void InitQRCode(int32_t numInputBytes,
81 CBC_QRCoderErrorCorrectionLevel* ecLevel,
82 CBC_QRCoderMode* mode,
83 CBC_QRCoder* qrCode,
84 int32_t& e);
85 static void AppendModeInfo(CBC_QRCoderMode* mode,
86 CBC_QRCoderBitVector* bits,
87 int32_t& e);
88 static void AppendLengthInfo(int32_t numLetters,
89 int32_t version,
90 CBC_QRCoderMode* mode,
91 CBC_QRCoderBitVector* bits,
92 int32_t& e);
93
94 static void InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
95 int32_t numTotalBytes,
96 int32_t numDataBytes,
97 int32_t numRSBlocks,
98 CBC_QRCoderBitVector* result,
99 int32_t& e);
100 static void GetNumDataBytesAndNumECBytesForBlockID(
101 int32_t numTotalBytes,
102 int32_t numDataBytes,
103 int32_t numRSBlocks,
104 int32_t blockID,
105 int32_t& numDataBytesInBlock,
106 int32_t& numECBytesInBlocks);
107 static CBC_CommonByteArray* GenerateECBytes(CBC_CommonByteArray* dataBytes,
108 int32_t numEcBytesInBlock,
109 int32_t& e);
110 static int32_t ChooseMaskPattern(CBC_QRCoderBitVector* bits,
111 CBC_QRCoderErrorCorrectionLevel* ecLevel,
112 int32_t version,
113 CBC_CommonByteMatrix* matrix,
114 int32_t& e);
115 static int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix);
116 static void TerminateBits(int32_t numDataBytes,
117 CBC_QRCoderBitVector* bits,
118 int32_t& e);
119 static int32_t GetSpanByVersion(CBC_QRCoderMode* modeFirst,
120 CBC_QRCoderMode* modeSecond,
121 int32_t versionNum,
122 int32_t& e);
123 static void MergeString(CFX_PtrArray& result, int32_t versionNum, int32_t& e);
124 static void SplitString(const CFX_ByteString& content, CFX_PtrArray& result);
125 static void AppendDataModeLenghInfo(CFX_PtrArray& splitResult,
126 CBC_QRCoderBitVector& headerAndDataBits,
127 CBC_QRCoderMode* tempMode,
128 CBC_QRCoder* qrCode,
129 CFX_ByteString& encoding,
130 int32_t& e);
131 };
132
133 #endif // XFA_SRC_FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
OLDNEW
« no previous file with comments | « xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp ('k') | xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698