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_QRCoderMode.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 2007 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
"fxbarcode/qrcode/BC_QRCoderMode.h"
24
25
#
include
<
utility
>
26
27
#
include
"core/fxcrt/check.h"
28
#
include
"core/fxcrt/fx_system.h"
29
30
CBC_QRCoderMode* CBC_QRCoderMode::
sBYTE
=
nullptr
;
31
CBC_QRCoderMode* CBC_QRCoderMode::
sNUMERIC
=
nullptr
;
32
CBC_QRCoderMode* CBC_QRCoderMode::
sALPHANUMERIC
=
nullptr
;
33
34
CBC_QRCoderMode::CBC_QRCoderMode(std::vector<int32_t> charCountBits,
35
int32_t bits)
36
: m_characterCountBitsForVersions(std::move(charCountBits)), m_bits(bits) {}
37
38
CBC_QRCoderMode::~
CBC_QRCoderMode
() =
default
;
39
40
void
CBC_QRCoderMode::
Initialize
() {
41
sBYTE
=
new
CBC_QRCoderMode({8, 16, 16}, 0x4);
42
sALPHANUMERIC
=
new
CBC_QRCoderMode({9, 11, 13}, 0x2);
43
sNUMERIC
=
new
CBC_QRCoderMode({10, 12, 14}, 0x1);
44
}
45
46
void
CBC_QRCoderMode::
Finalize
() {
47
delete
sBYTE
;
48
sBYTE
=
nullptr
;
49
delete
sALPHANUMERIC
;
50
sALPHANUMERIC
=
nullptr
;
51
delete
sNUMERIC
;
52
sNUMERIC
=
nullptr
;
53
}
54
55
int32_t CBC_QRCoderMode::
GetBits
()
const
{
56
return
m_bits;
57
}
58
59
int32_t CBC_QRCoderMode::
GetCharacterCountBits
(int32_t number)
const
{
60
if
(m_characterCountBitsForVersions.empty())
61
return
0;
62
63
int32_t offset;
64
if
(number <= 9)
65
offset = 0;
66
else
if
(number <= 26)
67
offset = 1;
68
else
69
offset = 2;
70
71
int32_t result = m_characterCountBitsForVersions[offset];
72
DCHECK
(result != 0);
73
return
result;
74
}
DCHECK
#define DCHECK
Definition
check.h:33
CBC_QRCoderMode::sNUMERIC
static CBC_QRCoderMode * sNUMERIC
Definition
BC_QRCoderMode.h:25
CBC_QRCoderMode::GetCharacterCountBits
int32_t GetCharacterCountBits(int32_t number) const
Definition
BC_QRCoderMode.cpp:59
CBC_QRCoderMode::sBYTE
static CBC_QRCoderMode * sBYTE
Definition
BC_QRCoderMode.h:24
CBC_QRCoderMode::GetBits
int32_t GetBits() const
Definition
BC_QRCoderMode.cpp:55
CBC_QRCoderMode::Finalize
static void Finalize()
Definition
BC_QRCoderMode.cpp:46
CBC_QRCoderMode::~CBC_QRCoderMode
~CBC_QRCoderMode()
CBC_QRCoderMode::Initialize
static void Initialize()
Definition
BC_QRCoderMode.cpp:40
CBC_QRCoderMode::sALPHANUMERIC
static CBC_QRCoderMode * sALPHANUMERIC
Definition
BC_QRCoderMode.h:26
qtwebengine
src
3rdparty
chromium
third_party
pdfium
fxbarcode
qrcode
BC_QRCoderMode.cpp
Generated on
for Qt by
1.18.0