| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXVERSION_H_ | 7 #ifndef XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXVERSION_H_ |
| 8 #define XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXVERSION_H_ | 8 #define XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXVERSION_H_ |
| 9 | 9 |
| 10 #include "core/fxcrt/include/fx_basic.h" | 10 #include "core/fxcrt/include/fx_basic.h" |
| 11 | 11 |
| 12 class CBC_DataMatrixVersion; | 12 class CBC_DataMatrixVersion; |
| 13 | 13 |
| 14 class ECB { | 14 class ECB { |
| 15 public: | 15 public: |
| 16 ECB(int32_t count, int32_t dataCodewords) | 16 ECB(int32_t count, int32_t dataCodewords); |
| 17 : m_count(count), m_dataCodewords(dataCodewords) {} | |
| 18 | 17 |
| 19 int32_t GetCount() const { return m_count; } | 18 int32_t GetCount() const { return m_count; } |
| 20 int32_t GetDataCodewords() const { return m_dataCodewords; } | 19 int32_t GetDataCodewords() const { return m_dataCodewords; } |
| 21 | 20 |
| 22 private: | 21 private: |
| 23 int32_t m_count; | 22 int32_t m_count; |
| 24 int32_t m_dataCodewords; | 23 int32_t m_dataCodewords; |
| 25 }; | 24 }; |
| 26 | 25 |
| 27 class ECBlocks { | 26 class ECBlocks { |
| 28 public: | 27 public: |
| 29 ECBlocks(int32_t ecCodewords, ECB* ecBlocks) : m_ecCodewords(ecCodewords) { | 28 ECBlocks(int32_t ecCodewords, ECB* ecBlocks); |
| 30 m_ecBlocksArray.Add(ecBlocks); | 29 ECBlocks(int32_t ecCodewords, ECB* ecBlocks1, ECB* ecBlocks2); |
| 31 } | 30 ~ECBlocks(); |
| 32 | |
| 33 ECBlocks(int32_t ecCodewords, ECB* ecBlocks1, ECB* ecBlocks2) | |
| 34 : m_ecCodewords(ecCodewords) { | |
| 35 m_ecBlocksArray.Add(ecBlocks1); | |
| 36 m_ecBlocksArray.Add(ecBlocks2); | |
| 37 } | |
| 38 | |
| 39 ~ECBlocks() { | |
| 40 for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); i++) | |
| 41 delete m_ecBlocksArray[i]; | |
| 42 } | |
| 43 | 31 |
| 44 int32_t GetECCodewords() { return m_ecCodewords; } | 32 int32_t GetECCodewords() { return m_ecCodewords; } |
| 45 const CFX_ArrayTemplate<ECB*>& GetECBlocks() { return m_ecBlocksArray; } | 33 const CFX_ArrayTemplate<ECB*>& GetECBlocks() { return m_ecBlocksArray; } |
| 46 | 34 |
| 47 private: | 35 private: |
| 48 int32_t m_ecCodewords; | 36 int32_t m_ecCodewords; |
| 49 CFX_ArrayTemplate<ECB*> m_ecBlocksArray; | 37 CFX_ArrayTemplate<ECB*> m_ecBlocksArray; |
| 50 }; | 38 }; |
| 51 | 39 |
| 52 class CBC_DataMatrixVersion { | 40 class CBC_DataMatrixVersion { |
| 53 public: | 41 public: |
| 54 CBC_DataMatrixVersion(int32_t versionNumber, | 42 CBC_DataMatrixVersion(int32_t versionNumber, |
| 55 int32_t symbolSizeRows, | 43 int32_t symbolSizeRows, |
| 56 int32_t symbolSizeColumns, | 44 int32_t symbolSizeColumns, |
| 57 int32_t dataRegionSizeRows, | 45 int32_t dataRegionSizeRows, |
| 58 int32_t dataRegionSizeColumns, | 46 int32_t dataRegionSizeColumns, |
| 59 ECBlocks* ecBlocks); | 47 ECBlocks* ecBlocks); |
| 60 virtual ~CBC_DataMatrixVersion(); | 48 virtual ~CBC_DataMatrixVersion(); |
| 49 |
| 61 static void Initialize(); | 50 static void Initialize(); |
| 62 static void Finalize(); | 51 static void Finalize(); |
| 63 int32_t GetVersionNumber(); | 52 int32_t GetVersionNumber(); |
| 64 int32_t GetSymbolSizeRows(); | 53 int32_t GetSymbolSizeRows(); |
| 65 int32_t GetSymbolSizeColumns(); | 54 int32_t GetSymbolSizeColumns(); |
| 66 int32_t GetDataRegionSizeRows(); | 55 int32_t GetDataRegionSizeRows(); |
| 67 int32_t GetDataRegionSizeColumns(); | 56 int32_t GetDataRegionSizeColumns(); |
| 68 int32_t GetTotalCodewords(); | 57 int32_t GetTotalCodewords(); |
| 69 ECBlocks* GetECBlocks(); | 58 ECBlocks* GetECBlocks(); |
| 70 static CBC_DataMatrixVersion* GetVersionForDimensions(int32_t numRows, | 59 static CBC_DataMatrixVersion* GetVersionForDimensions(int32_t numRows, |
| 71 int32_t numColumns, | 60 int32_t numColumns, |
| 72 int32_t& e); | 61 int32_t& e); |
| 73 static void ReleaseAll(); | 62 static void ReleaseAll(); |
| 74 | 63 |
| 75 private: | 64 private: |
| 76 int32_t m_versionNumber; | 65 int32_t m_versionNumber; |
| 77 int32_t m_symbolSizeRows; | 66 int32_t m_symbolSizeRows; |
| 78 int32_t m_symbolSizeColumns; | 67 int32_t m_symbolSizeColumns; |
| 79 int32_t m_dataRegionSizeRows; | 68 int32_t m_dataRegionSizeRows; |
| 80 int32_t m_dataRegionSizeColumns; | 69 int32_t m_dataRegionSizeColumns; |
| 81 ECBlocks* m_ecBlocks; | 70 ECBlocks* m_ecBlocks; |
| 82 int32_t m_totalCodewords; | 71 int32_t m_totalCodewords; |
| 83 static CFX_ArrayTemplate<CBC_DataMatrixVersion*>* VERSIONS; | 72 static CFX_ArrayTemplate<CBC_DataMatrixVersion*>* VERSIONS; |
| 84 }; | 73 }; |
| 85 | 74 |
| 86 #endif // XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXVERSION_H_ | 75 #endif // XFA_FXBARCODE_DATAMATRIX_BC_DATAMATRIXVERSION_H_ |
| OLD | NEW |