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(size_t dataCapacity, 16 size_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 const CBC_SymbolInfo* Lookup(size_t iDataCodewords, 26 bool bAllowRectangular); 27 28 int32_t getSymbolDataWidth() const; 29 int32_t getSymbolDataHeight() const; 30 int32_t getSymbolWidth() const; 31 int32_t getSymbolHeight() const; 32 size_t getCodewordCount() const; 33 virtual size_t getInterleavedBlockCount() const; 34 size_t getDataLengthForInterleavedBlock() const; 35 size_t getErrorLengthForInterleavedBlock() const; 36 dataCapacity()37 size_t dataCapacity() const { return m_dataCapacity; } errorCodewords()38 size_t errorCodewords() const { return m_errorCodewords; } matrixWidth()39 int32_t matrixWidth() const { return m_matrixWidth; } matrixHeight()40 int32_t matrixHeight() const { return m_matrixHeight; } 41 42 protected: 43 CBC_SymbolInfo(size_t dataCapacity, 44 size_t errorCodewords, 45 int32_t matrixWidth, 46 int32_t matrixHeight, 47 int32_t dataRegions, 48 size_t rsBlockData, 49 size_t rsBlockError); 50 51 private: 52 int32_t getHorizontalDataRegions() const; 53 int32_t getVerticalDataRegions() const; 54 55 const bool m_rectangular; 56 const size_t m_dataCapacity; 57 const size_t m_errorCodewords; 58 const int32_t m_matrixWidth; 59 const int32_t m_matrixHeight; 60 const int32_t m_dataRegions; 61 const size_t m_rsBlockData; 62 const size_t m_rsBlockError; 63 }; 64 65 #endif // FXBARCODE_DATAMATRIX_BC_SYMBOLINFO_H_ 66