Merge to XFA: Use stdint.h types throughout PDFium.
[pdfium.git] / xfa / src / fxbarcode / qrcode / BC_QRCoderEncoder.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc.\r
6 \r
9 class Make_Pair;\r
10 class CBC_QRCoder;\r
11 class CBC_QRCoderErrorCorrectionLevel;\r
12 class CBC_QRCoderMode;\r
13 class CBC_QRCoderBitVector;\r
14 class CBC_CommonByteArray;\r
15 class CBC_CommonByteMatrix;\r
16 class CBC_QRCoderEncoder;\r
17 class CBC_QRCoderEncoder\r
18 {\r
19 private:\r
20     const static int32_t m_alphaNumbericTable[96];\r
21 public:\r
22     CBC_QRCoderEncoder();\r
23     virtual ~CBC_QRCoderEncoder();\r
24 \r
25     static void Encode(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e, int32_t versionSpecify = 0);\r
26     static void Encode(const CFX_WideString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e);\r
27     static void EncodeWithSpecifyVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel,\r
28                                          CBC_QRCoder *qrCode, int32_t versionSpecify, int32_t &e);\r
29     static void EncodeWithAutoVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, int32_t &e);\r
30     static CBC_QRCoderMode* ChooseMode(const CFX_ByteString & content, CFX_ByteString encoding);\r
31     static int32_t GetAlphaNumericCode(int32_t code);\r
32     static void AppendECI(CBC_QRCoderBitVector* bits);\r
33     static void AppendBytes(const CFX_ByteString &content, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t &e);\r
34     static void AppendNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e);\r
35     static void AppendAlphaNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e);\r
36     static void Append8BitBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, int32_t &e);\r
37     static void Append8BitBytes(CFX_ByteArray &bytes, CBC_QRCoderBitVector *bits, int32_t &e);\r
38     static void AppendKanjiBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e);\r
39     static void AppendGBKBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, int32_t &e);\r
40     static void InitQRCode(int32_t numInputBytes, int32_t versionNumber,\r
41                            CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, int32_t &e);\r
42     static void InitQRCode(int32_t numInputBytes, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, int32_t &e);\r
43     static void AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, int32_t &e);\r
44     static void AppendLengthInfo(int32_t numLetters, int32_t version, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, int32_t &e);\r
45 \r
46     static void InterleaveWithECBytes(CBC_QRCoderBitVector* bits, int32_t numTotalBytes, int32_t numDataBytes, int32_t numRSBlocks, CBC_QRCoderBitVector* result, int32_t &e);\r
47     static void GetNumDataBytesAndNumECBytesForBlockID(int32_t numTotalBytes, int32_t numDataBytes,\r
48             int32_t numRSBlocks, int32_t blockID,\r
49             int32_t &numDataBytesInBlock, int32_t& numECBytesInBlocks);\r
50     static CBC_CommonByteArray* GenerateECBytes(CBC_CommonByteArray* dataBytes, int32_t numEcBytesInBlock, int32_t &e);\r
51     static int32_t ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_QRCoderErrorCorrectionLevel* ecLevel,\r
52                                       int32_t version, CBC_CommonByteMatrix* matrix, int32_t &e);\r
53     static int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix);\r
54     static void TerminateBits(int32_t numDataBytes, CBC_QRCoderBitVector* bits, int32_t &e);\r
55     static int32_t GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QRCoderMode *modeSecond, int32_t versionNum, int32_t &e);\r
56     static void MergeString(CFX_PtrArray &result, int32_t versionNum, int32_t &e);\r
57     static void SplitString(const CFX_ByteString &content, CFX_PtrArray &result);\r
58     static void AppendDataModeLenghInfo(CFX_PtrArray &splitResult, CBC_QRCoderBitVector &headerAndDataBits,     CBC_QRCoderMode *tempMode, CBC_QRCoder *qrCode, CFX_ByteString &encoding, int32_t &e);\r
59 };\r
60 #endif\r