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_DATAMATRIX_BC_SYMBOLINFO_H_ 8 #define FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_ 9 10 #include "core/fxcrt/fx_string.h" 11 #include "core/fxcrt/fx_system.h" 12 13 class CBC_SymbolInfo { 14 public: 15 CBC_SymbolInfo(int32_t dataCapacity, 16 int32_t errorCodewords, 17 int32_t matrixWidth, 18 int32_t matrixHeight, 19 int32_t dataRegions); 20 virtual ~CBC_SymbolInfo(); 21 22 static void Initialize(); 23 static void Finalize(); 24 static void overrideSymbolSet(CBC_SymbolInfo* override); 25 static CBC_SymbolInfo* lookup(int32_t dataCodewords, 26 bool allowRectangular, 27 int32_t& e); 28 29 int32_t getSymbolDataWidth() const; 30 int32_t getSymbolDataHeight() const; 31 int32_t getSymbolWidth() const; 32 int32_t getSymbolHeight() const; 33 int32_t getCodewordCount() const; 34 virtual int32_t getInterleavedBlockCount() const; 35 int32_t getDataLengthForInterleavedBlock(int32_t index) const; 36 int32_t getErrorLengthForInterleavedBlock(int32_t index) const; 37 dataCapacity()38 int32_t dataCapacity() const { return m_dataCapacity; } errorCodewords()39 int32_t errorCodewords() const { return m_errorCodewords; } matrixWidth()40 int32_t matrixWidth() const { return m_matrixWidth; } matrixHeight()41 int32_t matrixHeight() const { return m_matrixHeight; } 42 43 protected: 44 CBC_SymbolInfo(int32_t dataCapacity, 45 int32_t errorCodewords, 46 int32_t matrixWidth, 47 int32_t matrixHeight, 48 int32_t dataRegions, 49 int32_t rsBlockData, 50 int32_t rsBlockError); 51 52 private: 53 int32_t getHorizontalDataRegions() const; 54 int32_t getVerticalDataRegions() const; 55 56 const bool m_rectangular; 57 const int32_t m_dataCapacity; 58 const int32_t m_errorCodewords; 59 const int32_t m_matrixWidth; 60 const int32_t m_matrixHeight; 61 const int32_t m_dataRegions; 62 const int32_t m_rsBlockData; 63 const int32_t m_rsBlockError; 64 }; 65 66 #endif // FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_ 67