Small style stuff
[zxing.git] / cpp / core / src / zxing / qrcode / Version.h
1 #ifndef __VERSION_H__
2 #define __VERSION_H__
3
4 /*
5  *  Version.h
6  *  zxing
7  *
8  *  Copyright 2010 ZXing authors All rights reserved.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  *      http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22
23 #include <zxing/common/Counted.h>
24 #include <zxing/qrcode/ErrorCorrectionLevel.h>
25 #include <zxing/ReaderException.h>
26 #include <zxing/common/BitMatrix.h>
27 #include <zxing/common/Counted.h>
28 #include <vector>
29
30 namespace zxing {
31 namespace qrcode {
32
33 class ECB {
34 private:
35   int count_;
36   int dataCodewords_;
37 public:
38   ECB(int count, int dataCodewords);
39   int getCount();
40   int getDataCodewords();
41 };
42
43 class ECBlocks {
44 private:
45   int ecCodewords_;
46   std::vector<ECB*> ecBlocks_;
47 public:
48   ECBlocks(int ecCodewords, ECB *ecBlocks);
49   ECBlocks(int ecCodewords, ECB *ecBlocks1, ECB *ecBlocks2);
50   int getECCodewords();
51   std::vector<ECB*>& getECBlocks();
52   ~ECBlocks();
53 };
54
55 class Version : public Counted {
56
57 private:
58   int versionNumber_;
59   std::vector<int> &alignmentPatternCenters_;
60   std::vector<ECBlocks*> ecBlocks_;
61   int totalCodewords_;
62   Version(int versionNumber, std::vector<int> *alignmentPatternCenters, ECBlocks *ecBlocks1, ECBlocks *ecBlocks2,
63           ECBlocks *ecBlocks3, ECBlocks *ecBlocks4);
64
65 public:
66   static unsigned int VERSION_DECODE_INFO[];
67   static int N_VERSION_DECODE_INFOS;
68   static std::vector<Ref<Version> > VERSIONS;
69
70   ~Version();
71   int getVersionNumber();
72   std::vector<int> &getAlignmentPatternCenters();
73   int getTotalCodewords();
74   int getDimensionForVersion();
75   ECBlocks &getECBlocksForLevel(ErrorCorrectionLevel &ecLevel);
76   static Version *getProvisionalVersionForDimension(int dimension);
77   static Version *getVersionForNumber(int versionNumber);
78   static Version *decodeVersionInformation(unsigned int versionBits);
79   Ref<BitMatrix> buildFunctionPattern();
80   static int buildVersions();
81 };
82 }
83 }
84
85 #endif // __VERSION_H__