#include "fxbarcode/qrcode/BC_QRCoderEncoder.h"
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "core/fxcrt/check.h"
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/data_vector.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/stl_util.h"
#include "fxbarcode/common/BC_CommonByteMatrix.h"
#include "fxbarcode/common/reedsolomon/BC_ReedSolomon.h"
#include "fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
#include "fxbarcode/qrcode/BC_QRCoder.h"
#include "fxbarcode/qrcode/BC_QRCoderBitVector.h"
#include "fxbarcode/qrcode/BC_QRCoderECBlockData.h"
#include "fxbarcode/qrcode/BC_QRCoderMaskUtil.h"
#include "fxbarcode/qrcode/BC_QRCoderMatrixUtil.h"
#include "fxbarcode/qrcode/BC_QRCoderMode.h"
#include "fxbarcode/qrcode/BC_QRCoderVersion.h"
ModeStringPair;
namespace {
CBC_ReedSolomonGF256* g_QRCodeField = …;
struct QRCoderBlockPair { … };
const auto kAlphaNumericTable = …;
int32_t GetAlphaNumericCode(int32_t code) { … }
bool AppendNumericBytes(const ByteString& content, CBC_QRCoderBitVector* bits) { … }
bool AppendAlphaNumericBytes(const ByteString& content,
CBC_QRCoderBitVector* bits) { … }
bool Append8BitBytes(const ByteString& content, CBC_QRCoderBitVector* bits) { … }
void AppendModeInfo(CBC_QRCoderMode* mode, CBC_QRCoderBitVector* bits) { … }
bool AppendLengthInfo(int32_t numLetters,
int32_t version,
CBC_QRCoderMode* mode,
CBC_QRCoderBitVector* bits) { … }
bool AppendBytes(const ByteString& content,
CBC_QRCoderMode* mode,
CBC_QRCoderBitVector* bits) { … }
bool InitQRCode(int32_t numInputBytes,
const CBC_QRCoderErrorCorrectionLevel* ecLevel,
CBC_QRCoder* qrCode) { … }
DataVector<uint8_t> GenerateECBytes(pdfium::span<const uint8_t> dataBytes,
size_t numEcBytesInBlock) { … }
int32_t CalculateMaskPenalty(CBC_CommonByteMatrix* matrix) { … }
std::optional<int32_t> ChooseMaskPattern(
CBC_QRCoderBitVector* bits,
const CBC_QRCoderErrorCorrectionLevel* ecLevel,
int32_t version,
CBC_CommonByteMatrix* matrix) { … }
void GetNumDataBytesAndNumECBytesForBlockID(int32_t numTotalBytes,
int32_t numDataBytes,
int32_t numRSBlocks,
int32_t blockID,
int32_t* numDataBytesInBlock,
int32_t* numECBytesInBlock) { … }
bool TerminateBits(int32_t numDataBytes, CBC_QRCoderBitVector* bits) { … }
CBC_QRCoderMode* ChooseMode(const ByteString& content) { … }
bool InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
int32_t numTotalBytes,
int32_t numDataBytes,
int32_t numRSBlocks,
CBC_QRCoderBitVector* result) { … }
}
void CBC_QRCoderEncoder::Initialize() { … }
void CBC_QRCoderEncoder::Finalize() { … }
bool CBC_QRCoderEncoder::Encode(WideStringView content,
const CBC_QRCoderErrorCorrectionLevel* ecLevel,
CBC_QRCoder* qrCode) { … }