8 * Created by Christian Brunschen on 14/05/2008.
9 * Copyright 2008 ZXing authors All rights reserved.
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
15 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include "../../common/Counted.h"
25 #include "ErrorCorrectionLevel.h"
26 #include "../../ReaderException.h"
27 #include "../../common/BitMatrix.h"
34 using namespace common;
36 class Version : public Counted {
43 ECB(int count, int dataCodewords) :
44 count_(count), dataCodewords_(dataCodewords) { }
45 int getCount() { return count_; }
46 int getDataCodewords() { return dataCodewords_; }
52 vector<ECB*> ecBlocks_;
54 ECBlocks(int ecCodewords, ECB *ecBlocks) : ecCodewords_(ecCodewords) {
55 ecBlocks_.push_back(ecBlocks);
57 ECBlocks(int ecCodewords, ECB *ecBlocks1, ECB *ecBlocks2) :
58 ecCodewords_(ecCodewords) {
59 ecBlocks_.push_back(ecBlocks1);
60 ecBlocks_.push_back(ecBlocks2);
62 int getECCodewords() { return ecCodewords_; }
63 vector<ECB*>& getECBlocks() { return ecBlocks_; }
69 valarray<int> &alignmentPatternCenters_;
70 vector<ECBlocks*> ecBlocks_;
72 Version(int versionNumber,
73 valarray<int> *alignmentPatternCenters,
80 static unsigned int VERSION_DECODE_INFO[];
81 static int N_VERSION_DECODE_INFOS;
82 static vector<Version*> VERSIONS;
84 int getVersionNumber();
85 valarray<int> &getAlignmentPatternCenters();
86 int getTotalCodewords();
87 int getDimensionForVersion();
88 ECBlocks &getECBlocksForLevel(ErrorCorrectionLevel &ecLevel);
89 static Version *getProvisionalVersionForDimension(int dimension);
90 static Version *getVersionForNumber(int versionNumber);
91 static Version *decodeVersionInformation(unsigned int versionBits);
92 Ref<BitMatrix> buildFunctionPattern();
93 static int buildVersions();
98 #endif // __VERSION_H__