xref: /aosp_15_r20/external/pdfium/fxbarcode/qrcode/BC_QRCoderVersion.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
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_QRCODE_BC_QRCODERVERSION_H_
8 #define FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
9 
10 #include <memory>
11 
12 #include "fxbarcode/qrcode/BC_QRCoderECBlocks.h"
13 
14 class CBC_QRCoderErrorCorrectionLevel;
15 
16 class CBC_QRCoderVersion {
17  public:
18   static constexpr int32_t kMaxVersion = 40;
19 
20   CBC_QRCoderVersion(int32_t versionNumber,
21                      const CBC_QRCoderECBlockData data[4]);
22   ~CBC_QRCoderVersion();
23 
24   static void Initialize();
25   static void Finalize();
26 
27   static const CBC_QRCoderVersion* GetVersionForNumber(int32_t versionNumber);
28 
29   int32_t GetVersionNumber() const;
30   int32_t GetTotalCodeWords() const;
31   int32_t GetDimensionForVersion() const;
32   const CBC_QRCoderECBlocks* GetECBlocksForLevel(
33       const CBC_QRCoderErrorCorrectionLevel& ecLevel) const;
34 
35  private:
36   const int32_t m_versionNumber;
37   int32_t m_totalCodeWords;
38   std::unique_ptr<CBC_QRCoderECBlocks> m_ecBlocksArray[4];
39 };
40 
41 #endif  // FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
42