Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
BC_QRCoder.cpp
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
// Original code is licensed as follows:
7
/*
8
* Copyright 2008 ZXing authors
9
*
10
* Licensed under the Apache License, Version 2.0 (the "License");
11
* you may not use this file except in compliance with the License.
12
* You may obtain a copy of the License at
13
*
14
* http://www.apache.org/licenses/LICENSE-2.0
15
*
16
* Unless required by applicable law or agreed to in writing, software
17
* distributed under the License is distributed on an "AS IS" BASIS,
18
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
* See the License for the specific language governing permissions and
20
* limitations under the License.
21
*/
22
23
#
include
<
utility
>
24
25
#
include
"core/fxcrt/numerics/safe_conversions.h"
26
#
include
"fxbarcode/common/BC_CommonByteMatrix.h"
27
#
include
"fxbarcode/qrcode/BC_QRCoder.h"
28
#
include
"fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
29
#
include
"fxbarcode/qrcode/BC_QRCoderMode.h"
30
31
CBC_QRCoder::
CBC_QRCoder
() =
default
;
32
33
CBC_QRCoder::~
CBC_QRCoder
() =
default
;
34
35
const
CBC_QRCoderErrorCorrectionLevel
* CBC_QRCoder::
GetECLevel
()
const
{
36
return
m_ecLevel;
37
}
38
39
int32_t CBC_QRCoder::
GetVersion
()
const
{
40
return
m_version;
41
}
42
43
int32_t CBC_QRCoder::
GetMatrixWidth
()
const
{
44
return
m_matrixWidth;
45
}
46
47
int32_t CBC_QRCoder::
GetMaskPattern
()
const
{
48
return
m_maskPattern;
49
}
50
51
int32_t CBC_QRCoder::
GetNumTotalBytes
()
const
{
52
return
m_numTotalBytes;
53
}
54
55
int32_t CBC_QRCoder::
GetNumDataBytes
()
const
{
56
return
m_numDataBytes;
57
}
58
59
int32_t CBC_QRCoder::
GetNumRSBlocks
()
const
{
60
return
m_numRSBlocks;
61
}
62
63
std
::
unique_ptr
<
CBC_CommonByteMatrix
> CBC_QRCoder::
TakeMatrix
() {
64
return
std
::move(m_matrix);
65
}
66
67
bool
CBC_QRCoder::
IsValid
()
const
{
68
return
m_ecLevel && m_version != -1 && m_matrixWidth != -1 &&
69
m_maskPattern != -1 && m_numTotalBytes != -1 && m_numDataBytes != -1 &&
70
m_numECBytes != -1 && m_numRSBlocks != -1 &&
71
IsValidMaskPattern(m_maskPattern) &&
72
m_numTotalBytes == m_numDataBytes + m_numECBytes && m_matrix &&
73
m_matrixWidth == pdfium::checked_cast<int32_t>(m_matrix->GetWidth()) &&
74
m_matrix->GetWidth() == m_matrix->GetHeight();
75
}
76
77
void
CBC_QRCoder::
SetECLevel
(
const
CBC_QRCoderErrorCorrectionLevel
* ecLevel) {
78
m_ecLevel = ecLevel;
79
}
80
81
void
CBC_QRCoder::
SetVersion
(int32_t version) {
82
m_version = version;
83
}
84
85
void
CBC_QRCoder::
SetMatrixWidth
(int32_t width) {
86
m_matrixWidth = width;
87
}
88
89
void
CBC_QRCoder::
SetMaskPattern
(int32_t pattern) {
90
m_maskPattern = pattern;
91
}
92
93
void
CBC_QRCoder::
SetNumDataBytes
(int32_t bytes) {
94
m_numDataBytes = bytes;
95
}
96
97
void
CBC_QRCoder::
SetNumTotalBytes
(int32_t value) {
98
m_numTotalBytes = value;
99
}
100
101
void
CBC_QRCoder::
SetNumRSBlocks
(int32_t block) {
102
m_numRSBlocks = block;
103
}
104
105
void
CBC_QRCoder::
SetNumECBytes
(int32_t value) {
106
m_numECBytes = value;
107
}
108
109
bool
CBC_QRCoder::
IsValidMaskPattern
(int32_t maskPattern) {
110
return
maskPattern >= 0 && maskPattern <
kNumMaskPatterns
;
111
}
112
113
void
CBC_QRCoder::
SetMatrix
(std::unique_ptr<CBC_CommonByteMatrix> pMatrix) {
114
m_matrix = std::move(pMatrix);
115
}
CBC_QRCoderErrorCorrectionLevel
Definition
BC_QRCoderErrorCorrectionLevel.h:12
CBC_QRCoder::SetMatrixWidth
void SetMatrixWidth(int32_t width)
Definition
BC_QRCoder.cpp:85
CBC_QRCoder::GetNumRSBlocks
int32_t GetNumRSBlocks() const
Definition
BC_QRCoder.cpp:59
CBC_QRCoder::SetMatrix
void SetMatrix(std::unique_ptr< CBC_CommonByteMatrix > pMatrix)
Definition
BC_QRCoder.cpp:113
CBC_QRCoder::GetNumTotalBytes
int32_t GetNumTotalBytes() const
Definition
BC_QRCoder.cpp:51
CBC_QRCoder::SetNumECBytes
void SetNumECBytes(int32_t value)
Definition
BC_QRCoder.cpp:105
CBC_QRCoder::SetECLevel
void SetECLevel(const CBC_QRCoderErrorCorrectionLevel *ecLevel)
Definition
BC_QRCoder.cpp:77
CBC_QRCoder::SetNumRSBlocks
void SetNumRSBlocks(int32_t block)
Definition
BC_QRCoder.cpp:101
CBC_QRCoder::GetECLevel
const CBC_QRCoderErrorCorrectionLevel * GetECLevel() const
Definition
BC_QRCoder.cpp:35
CBC_QRCoder::GetMatrixWidth
int32_t GetMatrixWidth() const
Definition
BC_QRCoder.cpp:43
CBC_QRCoder::GetNumDataBytes
int32_t GetNumDataBytes() const
Definition
BC_QRCoder.cpp:55
CBC_QRCoder::kNumMaskPatterns
static constexpr int32_t kNumMaskPatterns
Definition
BC_QRCoder.h:19
CBC_QRCoder::SetMaskPattern
void SetMaskPattern(int32_t pattern)
Definition
BC_QRCoder.cpp:89
CBC_QRCoder::GetMaskPattern
int32_t GetMaskPattern() const
Definition
BC_QRCoder.cpp:47
CBC_QRCoder::SetNumDataBytes
void SetNumDataBytes(int32_t bytes)
Definition
BC_QRCoder.cpp:93
CBC_QRCoder::IsValid
bool IsValid() const
Definition
BC_QRCoder.cpp:67
CBC_QRCoder::SetNumTotalBytes
void SetNumTotalBytes(int32_t value)
Definition
BC_QRCoder.cpp:97
CBC_QRCoder::~CBC_QRCoder
~CBC_QRCoder()
CBC_QRCoder::IsValidMaskPattern
static bool IsValidMaskPattern(int32_t maskPattern)
Definition
BC_QRCoder.cpp:109
CBC_QRCoder::TakeMatrix
std::unique_ptr< CBC_CommonByteMatrix > TakeMatrix()
Definition
BC_QRCoder.cpp:63
CBC_QRCoder::CBC_QRCoder
CBC_QRCoder()
CBC_QRCoder::GetVersion
int32_t GetVersion() const
Definition
BC_QRCoder.cpp:39
CBC_QRCoder::SetVersion
void SetVersion(int32_t version)
Definition
BC_QRCoder.cpp:81
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtwebengine
src
3rdparty
chromium
third_party
pdfium
fxbarcode
qrcode
BC_QRCoder.cpp
Generated on
for Qt by
1.18.0