summaryrefslogtreecommitdiff
path: root/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2015-01-09 17:27:21 -0800
committerBo Xu <bo_xu@foxitsoftware.com>2015-01-09 17:27:21 -0800
commita902979f7c6a39fbdd8e9fc1b2ce00553b655eeb (patch)
tree854a51dbf1577ee8493db769ba7c8ab07cc72140 /xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h
parent5f21e9ddd181fc344f8d6070351858f98a25547e (diff)
downloadpdfium-a902979f7c6a39fbdd8e9fc1b2ce00553b655eeb.tar.xz
Organize barcode codes into modules.
Previously all the files in barcode are lumped together. The naming of some files are inconsistent, leading to difficult understanding of the structure. Now files are grouped based on different barcode type like in zxing. This also matches what it looks like in other xfa folders. The file names in each folder could be further modified to be consistent. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/842043002
Diffstat (limited to 'xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h')
-rw-r--r--xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h
new file mode 100644
index 0000000000..41d2f23db6
--- /dev/null
+++ b/xfa/src/fxbarcode/datamatrix/BC_DataMatrixVersion.h
@@ -0,0 +1,101 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _BC_DATAMATRIXVERSION_H_
+#define _BC_DATAMATRIXVERSION_H_
+class ECB;
+class ECBlocks;
+class CBC_DataMatrixVersion;
+class ECB : public CFX_Object
+{
+public:
+ ECB(FX_INT32 count, FX_INT32 dataCodewords)
+ {
+ m_count = count;
+ m_dataCodewords = dataCodewords;
+ }
+
+ FX_INT32 GetCount()
+ {
+ return m_count;
+ }
+
+ FX_INT32 GetDataCodewords()
+ {
+ return m_dataCodewords;
+ }
+private:
+ FX_INT32 m_count;
+ FX_INT32 m_dataCodewords;
+};
+class ECBlocks : public CFX_Object
+{
+public:
+ ECBlocks(FX_INT32 ecCodewords, ECB *ecBlocks)
+ {
+ m_ecCodewords = ecCodewords;
+ m_ecBlocks.Add(ecBlocks);
+ }
+
+ ECBlocks(FX_INT32 ecCodewords, ECB *ecBlocks1, ECB *ecBlocks2)
+ {
+ m_ecCodewords = ecCodewords;
+ m_ecBlocks.Add(ecBlocks1);
+ m_ecBlocks.Add(ecBlocks2);
+ }
+ ~ECBlocks()
+ {
+ for(FX_INT32 i = 0; i < m_ecBlocks.GetSize(); i++) {
+ delete (ECB*)m_ecBlocks[i];
+ }
+ m_ecBlocks.RemoveAll();
+ }
+
+ FX_INT32 GetECCodewords()
+ {
+ return m_ecCodewords;
+ }
+
+ const CFX_PtrArray &GetECBlocks()
+ {
+ return m_ecBlocks;
+ }
+private:
+ FX_INT32 m_ecCodewords;
+ CFX_PtrArray m_ecBlocks;
+};
+class CBC_DataMatrixVersion : public CFX_Object
+{
+public:
+ CBC_DataMatrixVersion(FX_INT32 versionNumber,
+ FX_INT32 symbolSizeRows,
+ FX_INT32 symbolSizeColumns,
+ FX_INT32 dataRegionSizeRows,
+ FX_INT32 dataRegionSizeColumns,
+ ECBlocks *ecBlocks);
+ virtual ~CBC_DataMatrixVersion();
+ static void Initialize();
+ static void Finalize();
+ FX_INT32 GetVersionNumber();
+ FX_INT32 GetSymbolSizeRows();
+ FX_INT32 GetSymbolSizeColumns();
+ FX_INT32 GetDataRegionSizeRows();
+ FX_INT32 GetDataRegionSizeColumns();
+ FX_INT32 GetTotalCodewords();
+ ECBlocks *GetECBlocks();
+ static CBC_DataMatrixVersion *GetVersionForDimensions(FX_INT32 numRows, FX_INT32 numColumns, FX_INT32 &e);
+ static void ReleaseAll();
+private:
+ FX_INT32 m_versionNumber;
+ FX_INT32 m_symbolSizeRows;
+ FX_INT32 m_symbolSizeColumns;
+ FX_INT32 m_dataRegionSizeRows;
+ FX_INT32 m_dataRegionSizeColumns;
+ ECBlocks *m_ecBlocks;
+ FX_INT32 m_totalCodewords;
+ static CFX_PtrArray* VERSIONS;
+};
+#endif