Home | History | Annotate | Download | only in qrcode
      1 // Copyright 2014 PDFium Authors. All rights reserved.
      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 #include <vector>
     12 
     13 #include "fxbarcode/qrcode/BC_QRCoderECBlocks.h"
     14 
     15 class CBC_QRCoderErrorCorrectionLevel;
     16 
     17 class CBC_QRCoderVersion {
     18  public:
     19   static constexpr int32_t kMaxVersion = 40;
     20 
     21   CBC_QRCoderVersion(int32_t versionNumber,
     22                      const CBC_QRCoderECBlockData data[4]);
     23   ~CBC_QRCoderVersion();
     24 
     25   static void Initialize();
     26   static void Finalize();
     27 
     28   static const CBC_QRCoderVersion* GetVersionForNumber(int32_t versionNumber);
     29   static void Destroy();
     30 
     31   int32_t GetVersionNumber() const;
     32   int32_t GetTotalCodeWords() const;
     33   int32_t GetDimensionForVersion() const;
     34   const CBC_QRCoderECBlocks* GetECBlocksForLevel(
     35       const CBC_QRCoderErrorCorrectionLevel& ecLevel) const;
     36 
     37  private:
     38   const int32_t m_versionNumber;
     39   int32_t m_totalCodeWords;
     40   std::unique_ptr<CBC_QRCoderECBlocks> m_ecBlocksArray[4];
     41 };
     42 
     43 #endif  // FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
     44