cd1fe25854b20ca79c748c80cce2645c9ca1539d
[zxing.git] / cpp / core / src / zxing / DecodeHints.h
1 /*
2  *  DecodeHintType.h
3  *  zxing
4  *
5  *  Copyright 2010 ZXing authors All rights reserved.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 #ifndef DECODEHINTS_H_
20 #define DECODEHINTS_H_
21
22 #include <zxing/BarcodeFormat.h>
23
24 namespace zxing {
25
26 typedef unsigned int DecodeHintType;
27
28 class DecodeHints {
29
30  private:
31
32   static const DecodeHintType BARCODEFORMAT_QR_CODE_HINT = 1 << BarcodeFormat_QR_CODE;
33   static const DecodeHintType BARCODEFORMAT_DATA_MATRIX_HINT = 1 << BarcodeFormat_DATA_MATRIX;
34   static const DecodeHintType BARCODEFORMAT_UPC_E_HINT = 1 << BarcodeFormat_UPC_E;
35   static const DecodeHintType BARCODEFORMAT_UPC_A_HINT = 1 << BarcodeFormat_UPC_A;
36   static const DecodeHintType BARCODEFORMAT_EAN_8_HINT = 1 << BarcodeFormat_EAN_8;
37   static const DecodeHintType BARCODEFORMAT_EAN_13_HINT = 1 << BarcodeFormat_EAN_13;
38   static const DecodeHintType BARCODEFORMAT_CODE_128_HINT = 1 << BarcodeFormat_CODE_128;
39   static const DecodeHintType BARCODEFORMAT_CODE_39_HINT = 1 << BarcodeFormat_CODE_39;
40   static const DecodeHintType BARCODEFORMAT_ITF_HINT = 1 << BarcodeFormat_ITF;
41   static const DecodeHintType TRYHARDER_HINT = 1 << 31;
42
43   DecodeHintType hints;
44
45  public:
46
47   static const DecodeHintType BARCODEFORMAT_PRODUCT_HINT =
48       BARCODEFORMAT_UPC_E_HINT |
49       BARCODEFORMAT_UPC_A_HINT |
50       BARCODEFORMAT_EAN_8_HINT |
51       BARCODEFORMAT_EAN_13_HINT;
52
53   static const DecodeHintType BARCODEFORMAT_ONED_HINT =
54       BARCODEFORMAT_PRODUCT_HINT |
55       BARCODEFORMAT_CODE_128_HINT |
56       BARCODEFORMAT_CODE_39_HINT |
57       BARCODEFORMAT_ITF_HINT;
58
59   static const DecodeHintType BARCODEFORMAT_ANY_HINT =
60       BARCODEFORMAT_ONED_HINT |
61 // TODO: uncomment once this passes QA
62 //      BARCODEFORMAT_DATA_MATRIX_HINT |
63       BARCODEFORMAT_QR_CODE_HINT;
64
65   static const DecodeHintType DEFAULT_HINTS = BARCODEFORMAT_ANY_HINT;
66
67   DecodeHints();
68   DecodeHints(DecodeHintType init);
69   ~DecodeHints();
70   void addFormat(BarcodeFormat toadd);
71   bool containsFormat(BarcodeFormat tocheck) const;
72   void setTryHarder(bool toset);
73   bool getTryHarder() const;
74
75 };
76
77 }
78
79 #endif