Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
BC_PDF417HighLevelEncoder.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
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 FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
8#define FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
9
10#include "core/fxcrt/widestring.h"
11#include "fxbarcode/pdf417/BC_PDF417.h"
12#include "third_party/abseil-cpp/absl/types/optional.h"
13#include "third_party/base/containers/span.h"
14
16 public:
19
20 static absl::optional<WideString> EncodeHighLevel(WideStringView msg);
21
22 private:
23 enum class EncodingMode { kUnknown = 0, kText, kByte, kNumeric };
24
25 enum class SubMode { kAlpha = 0, kLower, kMixed, kPunctuation };
26
27 static SubMode EncodeText(const WideString& msg,
28 size_t startpos,
29 size_t count,
30 SubMode initialSubmode,
31 WideString* sb);
32 static void EncodeBinary(pdfium::span<const uint8_t> bytes,
33 size_t startpos,
34 size_t count,
35 EncodingMode startmode,
36 WideString* sb);
37 static void EncodeNumeric(const WideString& msg,
38 size_t startpos,
39 size_t count,
40 WideString* sb);
41 static size_t DetermineConsecutiveDigitCount(WideString msg, size_t startpos);
42 static size_t DetermineConsecutiveTextCount(WideString msg, size_t startpos);
43 static absl::optional<size_t> DetermineConsecutiveBinaryCount(
44 WideString msg,
45 pdfium::span<const uint8_t> bytes,
46 size_t startpos);
47
48 friend class PDF417HighLevelEncoderTest_ConsecutiveBinaryCount_Test;
49 friend class PDF417HighLevelEncoderTest_ConsecutiveDigitCount_Test;
50 friend class PDF417HighLevelEncoderTest_ConsecutiveTextCount_Test;
51 friend class PDF417HighLevelEncoderTest_EncodeBinary_Test;
52 friend class PDF417HighLevelEncoderTest_EncodeHighLevel_Test;
53 friend class PDF417HighLevelEncoderTest_EncodeNumeric_Test;
54 friend class PDF417HighLevelEncoderTest_EncodeText_Test;
55};
56
57#endif // FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
CBC_BarcodeRow * getRow(size_t row) const
DataVector< uint8_t > toBitArray()
CBC_BarcodeMatrix(size_t width, size_t height)
void AddBar(bool black, size_t width)
CBC_BarcodeRow(size_t width)
pdfium::span< const uint8_t > GetRow() const
static absl::optional< WideString > GenerateErrorCorrection(const WideString &dataCodewords, int32_t errorCorrectionLevel)
static int32_t GetErrorCorrectionCodewordCount(int32_t errorCorrectionLevel)
static absl::optional< WideString > EncodeHighLevel(WideStringView msg)
void setDimensions(int32_t maxCols, int32_t minCols, int32_t maxRows, int32_t minRows)
bool GenerateBarcodeLogic(WideStringView msg, int32_t errorCorrectionLevel)
CBC_BarcodeMatrix * getBarcodeMatrix()
WideString & operator+=(wchar_t ch)
CharType operator[](const size_t index) const
Definition widestring.h:146
WideString(const WideString &other)