summaryrefslogtreecommitdiff
path: root/fxbarcode/qrcode/BC_QRCoderEncoder.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-29 15:18:41 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-29 21:01:07 +0000
commite778668fe92b8c60e0537ee48f79d5af6c1a2f1e (patch)
treece7ce115b6f7306a6363f4a3d26d0de2c5646aea /fxbarcode/qrcode/BC_QRCoderEncoder.h
parentb929ab0886a2b0ceb701989ef126e5b0cabf6997 (diff)
downloadpdfium-e778668fe92b8c60e0537ee48f79d5af6c1a2f1e.tar.xz
Move xfa/fxbarcode fxbarcode/
Nothing in fxbarcode/ depends on XFA code. This CL moves xfa/fxbarcode to be fxbarcode/ and creates a static_library for fxbarcode which is depend on by the xfa library. Change-Id: I0b708737b07efb94b769a5238d92af92bc62880d Reviewed-on: https://pdfium-review.googlesource.com/3291 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxbarcode/qrcode/BC_QRCoderEncoder.h')
-rw-r--r--fxbarcode/qrcode/BC_QRCoderEncoder.h140
1 files changed, 140 insertions, 0 deletions
diff --git a/fxbarcode/qrcode/BC_QRCoderEncoder.h b/fxbarcode/qrcode/BC_QRCoderEncoder.h
new file mode 100644
index 0000000000..f46a64e9a9
--- /dev/null
+++ b/fxbarcode/qrcode/BC_QRCoderEncoder.h
@@ -0,0 +1,140 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
+#define FXBARCODE_QRCODE_BC_QRCODERENCODER_H_
+
+#include <utility>
+#include <vector>
+
+#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/fx_string.h"
+
+class CBC_QRCoder;
+class CBC_QRCoderErrorCorrectionLevel;
+class CBC_QRCoderMode;
+class CBC_QRCoderBitVector;
+class CBC_CommonByteArray;
+class CBC_CommonByteMatrix;
+
+class CBC_QRCoderEncoder {
+ public:
+ CBC_QRCoderEncoder();
+ virtual ~CBC_QRCoderEncoder();
+
+ static void Encode(const CFX_ByteString& content,
+ CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ CBC_QRCoder* qrCode,
+ int32_t& e,
+ int32_t versionSpecify = 0);
+ static void Encode(const CFX_WideString& content,
+ CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ CBC_QRCoder* qrCode,
+ int32_t& e);
+ static void EncodeWithSpecifyVersion(const CFX_ByteString& content,
+ CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ CBC_QRCoder* qrCode,
+ int32_t versionSpecify,
+ int32_t& e);
+ static void EncodeWithAutoVersion(const CFX_ByteString& content,
+ CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ CBC_QRCoder* qrCode,
+ int32_t& e);
+ static CBC_QRCoderMode* ChooseMode(const CFX_ByteString& content,
+ CFX_ByteString encoding);
+ static int32_t GetAlphaNumericCode(int32_t code);
+ static void AppendECI(CBC_QRCoderBitVector* bits);
+ static void AppendBytes(const CFX_ByteString& content,
+ CBC_QRCoderMode* mode,
+ CBC_QRCoderBitVector* bits,
+ CFX_ByteString encoding,
+ int32_t& e);
+ static void AppendNumericBytes(const CFX_ByteString& content,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e);
+ static void AppendAlphaNumericBytes(const CFX_ByteString& content,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e);
+ static void Append8BitBytes(const CFX_ByteString& content,
+ CBC_QRCoderBitVector* bits,
+ CFX_ByteString encoding,
+ int32_t& e);
+ static void Append8BitBytes(std::vector<uint8_t>& bytes,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e);
+ static void AppendKanjiBytes(const CFX_ByteString& content,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e);
+ static void AppendGBKBytes(const CFX_ByteString& content,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e);
+ static void InitQRCode(int32_t numInputBytes,
+ int32_t versionNumber,
+ CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ CBC_QRCoderMode* mode,
+ CBC_QRCoder* qrCode,
+ int32_t& e);
+ static void InitQRCode(int32_t numInputBytes,
+ CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ CBC_QRCoderMode* mode,
+ CBC_QRCoder* qrCode,
+ int32_t& e);
+ static void AppendModeInfo(CBC_QRCoderMode* mode,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e);
+ static void AppendLengthInfo(int32_t numLetters,
+ int32_t version,
+ CBC_QRCoderMode* mode,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e);
+
+ static void InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
+ int32_t numTotalBytes,
+ int32_t numDataBytes,
+ int32_t numRSBlocks,
+ CBC_QRCoderBitVector* result,
+ int32_t& e);
+ static void GetNumDataBytesAndNumECBytesForBlockID(
+ int32_t numTotalBytes,
+ int32_t numDataBytes,
+ int32_t numRSBlocks,
+ int32_t blockID,
+ int32_t& numDataBytesInBlock,
+ int32_t& numECBytesInBlocks);
+ static CBC_CommonByteArray* GenerateECBytes(CBC_CommonByteArray* dataBytes,
+ int32_t numEcBytesInBlock,
+ int32_t& e);
+ static int32_t ChooseMaskPattern(CBC_QRCoderBitVector* bits,
+ CBC_QRCoderErrorCorrectionLevel* ecLevel,
+ int32_t version,
+ CBC_CommonByteMatrix* matrix,
+ int32_t& e);
+ static int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix);
+ static void TerminateBits(int32_t numDataBytes,
+ CBC_QRCoderBitVector* bits,
+ int32_t& e);
+ static int32_t GetSpanByVersion(CBC_QRCoderMode* modeFirst,
+ CBC_QRCoderMode* modeSecond,
+ int32_t versionNum,
+ int32_t& e);
+ static void MergeString(
+ std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>* result,
+ int32_t versionNum,
+ int32_t& e);
+ static void SplitString(
+ const CFX_ByteString& content,
+ std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>* result);
+ static void AppendDataModeLenghInfo(
+ const std::vector<std::pair<CBC_QRCoderMode*, CFX_ByteString>>&
+ splitResult,
+ CBC_QRCoderBitVector& headerAndDataBits,
+ CBC_QRCoderMode* tempMode,
+ CBC_QRCoder* qrCode,
+ CFX_ByteString& encoding,
+ int32_t& e);
+};
+
+#endif // FXBARCODE_QRCODE_BC_QRCODERENCODER_H_