OLD | NEW |
| (Empty) |
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 XFA_SRC_FXBARCODE_DATAMATRIX_BC_DATAMATRIXVERSION_H_ | |
8 #define XFA_SRC_FXBARCODE_DATAMATRIX_BC_DATAMATRIXVERSION_H_ | |
9 | |
10 #include "core/include/fxcrt/fx_basic.h" | |
11 | |
12 class CBC_DataMatrixVersion; | |
13 | |
14 class ECB { | |
15 public: | |
16 ECB(int32_t count, int32_t dataCodewords) { | |
17 m_count = count; | |
18 m_dataCodewords = dataCodewords; | |
19 } | |
20 | |
21 int32_t GetCount() { return m_count; } | |
22 | |
23 int32_t GetDataCodewords() { return m_dataCodewords; } | |
24 | |
25 private: | |
26 int32_t m_count; | |
27 int32_t m_dataCodewords; | |
28 }; | |
29 | |
30 class ECBlocks { | |
31 public: | |
32 ECBlocks(int32_t ecCodewords, ECB* ecBlocks) { | |
33 m_ecCodewords = ecCodewords; | |
34 m_ecBlocks.Add(ecBlocks); | |
35 } | |
36 | |
37 ECBlocks(int32_t ecCodewords, ECB* ecBlocks1, ECB* ecBlocks2) { | |
38 m_ecCodewords = ecCodewords; | |
39 m_ecBlocks.Add(ecBlocks1); | |
40 m_ecBlocks.Add(ecBlocks2); | |
41 } | |
42 ~ECBlocks() { | |
43 for (int32_t i = 0; i < m_ecBlocks.GetSize(); i++) { | |
44 delete (ECB*)m_ecBlocks[i]; | |
45 } | |
46 m_ecBlocks.RemoveAll(); | |
47 } | |
48 | |
49 int32_t GetECCodewords() { return m_ecCodewords; } | |
50 | |
51 const CFX_PtrArray& GetECBlocks() { return m_ecBlocks; } | |
52 | |
53 private: | |
54 int32_t m_ecCodewords; | |
55 CFX_PtrArray m_ecBlocks; | |
56 }; | |
57 | |
58 class CBC_DataMatrixVersion { | |
59 public: | |
60 CBC_DataMatrixVersion(int32_t versionNumber, | |
61 int32_t symbolSizeRows, | |
62 int32_t symbolSizeColumns, | |
63 int32_t dataRegionSizeRows, | |
64 int32_t dataRegionSizeColumns, | |
65 ECBlocks* ecBlocks); | |
66 virtual ~CBC_DataMatrixVersion(); | |
67 static void Initialize(); | |
68 static void Finalize(); | |
69 int32_t GetVersionNumber(); | |
70 int32_t GetSymbolSizeRows(); | |
71 int32_t GetSymbolSizeColumns(); | |
72 int32_t GetDataRegionSizeRows(); | |
73 int32_t GetDataRegionSizeColumns(); | |
74 int32_t GetTotalCodewords(); | |
75 ECBlocks* GetECBlocks(); | |
76 static CBC_DataMatrixVersion* GetVersionForDimensions(int32_t numRows, | |
77 int32_t numColumns, | |
78 int32_t& e); | |
79 static void ReleaseAll(); | |
80 | |
81 private: | |
82 int32_t m_versionNumber; | |
83 int32_t m_symbolSizeRows; | |
84 int32_t m_symbolSizeColumns; | |
85 int32_t m_dataRegionSizeRows; | |
86 int32_t m_dataRegionSizeColumns; | |
87 ECBlocks* m_ecBlocks; | |
88 int32_t m_totalCodewords; | |
89 static CFX_PtrArray* VERSIONS; | |
90 }; | |
91 | |
92 #endif // XFA_SRC_FXBARCODE_DATAMATRIX_BC_DATAMATRIXVERSION_H_ | |
OLD | NEW |