Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / src / fxbarcode / src / include / 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 : public CFX_Object\r
18 {\r
19 private:\r
20     const static FX_INT32 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, FX_INT32 &e, FX_INT32 versionSpecify = 0);\r
26     static void Encode(const CFX_WideString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e);\r
27     static void EncodeWithSpecifyVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel,\r
28                                          CBC_QRCoder *qrCode, FX_INT32 versionSpecify, FX_INT32 &e);\r
29     static void EncodeWithAutoVersion(const CFX_ByteString &content, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoder *qrCode, FX_INT32 &e);\r
30     static CBC_QRCoderMode* ChooseMode(const CFX_ByteString & content, CFX_ByteString encoding);\r
31     static FX_INT32 GetAlphaNumericCode(FX_INT32 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, FX_INT32 &e);\r
34     static void AppendNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e);\r
35     static void AppendAlphaNumericBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e);\r
36     static void Append8BitBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, CFX_ByteString encoding, FX_INT32 &e);\r
37     static void Append8BitBytes(CFX_ByteArray &bytes, CBC_QRCoderBitVector *bits, FX_INT32 &e);\r
38     static void AppendKanjiBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e);\r
39     static void AppendGBKBytes(const CFX_ByteString &content, CBC_QRCoderBitVector* bits, FX_INT32 &e);\r
40     static void InitQRCode(FX_INT32 numInputBytes, FX_INT32 versionNumber,\r
41                            CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, FX_INT32 &e);\r
42     static void InitQRCode(FX_INT32 numInputBytes, CBC_QRCoderErrorCorrectionLevel* ecLevel, CBC_QRCoderMode* mode, CBC_QRCoder* qrCode, FX_INT32 &e);\r
43     static void AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, FX_INT32 &e);\r
44     static void AppendLengthInfo(FX_INT32 numLetters, FX_INT32 version, CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits, FX_INT32 &e);\r
45 \r
46     static void InterleaveWithECBytes(CBC_QRCoderBitVector* bits, FX_INT32 numTotalBytes, FX_INT32 numDataBytes, FX_INT32 numRSBlocks, CBC_QRCoderBitVector* result, FX_INT32 &e);\r
47     static void GetNumDataBytesAndNumECBytesForBlockID(FX_INT32 numTotalBytes, FX_INT32 numDataBytes,\r
48             FX_INT32 numRSBlocks, FX_INT32 blockID,\r
49             FX_INT32 &numDataBytesInBlock, FX_INT32& numECBytesInBlocks);\r
50     static CBC_CommonByteArray* GenerateECBytes(CBC_CommonByteArray* dataBytes, FX_INT32 numEcBytesInBlock, FX_INT32 &e);\r
51     static FX_INT32 ChooseMaskPattern(CBC_QRCoderBitVector* bits, CBC_QRCoderErrorCorrectionLevel* ecLevel,\r
52                                       FX_INT32 version, CBC_CommonByteMatrix* matrix, FX_INT32 &e);\r
53     static FX_INT32 CalculateMaskPenalty(CBC_CommonByteMatrix* matrix);\r
54     static void TerminateBits(FX_INT32 numDataBytes, CBC_QRCoderBitVector* bits, FX_INT32 &e);\r
55     static FX_INT32 GetSpanByVersion(CBC_QRCoderMode *modeFirst, CBC_QRCoderMode *modeSecond, FX_INT32 versionNum, FX_INT32 &e);\r
56     static void MergeString(CFX_PtrArray &result, FX_INT32 versionNum, FX_INT32 &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, FX_INT32 &e);\r
59 };\r
60 #endif\r