Added a project written on Qt framework for Symbian and added tutorials for both...
[zxing.git] / symbian / QQrDecoder / zxing / oned / Code128Reader.h
1 /*
2  *  Code128Reader.h
3  *  ZXing
4  *
5  *  Created by Lukasz Warchol on 10-01-15.
6  *  Copyright 2010 ZXing authors All rights reserved.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #include <zxing/oned/OneDReader.h>
22 #include <zxing/common/BitArray.h>
23 #include <zxing/Result.h>
24
25 namespace zxing {
26         namespace oned {
27                 class Code128Reader : public OneDReader {
28                         
29                 private:
30                         static const int MAX_AVG_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.25f);
31                         static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f);
32                         
33                         static const int CODE_SHIFT = 98;
34                         
35                         static const int CODE_CODE_C = 99;
36                         static const int CODE_CODE_B = 100;
37                         static const int CODE_CODE_A = 101;
38                         
39                         static const int CODE_FNC_1 = 102;
40                         static const int CODE_FNC_2 = 97;
41                         static const int CODE_FNC_3 = 96;
42                         static const int CODE_FNC_4_A = 101;
43                         static const int CODE_FNC_4_B = 100;
44                         
45                         static const int CODE_START_A = 103;
46                         static const int CODE_START_B = 104;
47                         static const int CODE_START_C = 105;
48                         static const int CODE_STOP = 106;
49                         
50                         static int* findStartPattern(Ref<BitArray> row);
51                         static int decodeCode(Ref<BitArray> row, int counters[], int countersCount, int rowOffset);
52                         
53                         void append(char* s, char c);
54                 public:
55                         Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
56                         Code128Reader();
57                         ~Code128Reader();
58                 };
59         }
60 }
61