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