@@ -33,9 +33,18 @@ namespace ZXing {
3333
3434MultiFormatReader::MultiFormatReader (const DecodeHints& hints)
3535{
36+ setFormat (hints);
37+ }
38+
39+ MultiFormatReader::~MultiFormatReader ()
40+ {
41+ }
42+
43+ void MultiFormatReader::setFormat (const DecodeHints &hints)
44+ {
45+ _readers.clear ();
3646 bool tryHarder = hints.shouldTryHarder ();
37- if (hints.hasNoFormat ()) {
38- bool addOneDReader =
47+ bool addOneDReader =
3948 hints.hasFormat (BarcodeFormat::UPC_A ) ||
4049 hints.hasFormat (BarcodeFormat::UPC_E ) ||
4150 hints.hasFormat (BarcodeFormat::EAN_13 ) ||
@@ -48,29 +57,28 @@ MultiFormatReader::MultiFormatReader(const DecodeHints& hints)
4857 hints.hasFormat (BarcodeFormat::RSS_14 ) ||
4958 hints.hasFormat (BarcodeFormat::RSS_EXPANDED );
5059
51- // Put 1D readers upfront in "normal" mode
52- if (addOneDReader && !tryHarder) {
53- _readers.emplace_back (new OneD::Reader (hints));
54- }
55- if (hints.hasFormat (BarcodeFormat::QR_CODE )) {
56- _readers.emplace_back (new QRCode::Reader (hints));
57- }
58- if (hints.hasFormat (BarcodeFormat::DATA_MATRIX )) {
59- _readers.emplace_back (new DataMatrix::Reader (hints));
60- }
61- if (hints.hasFormat (BarcodeFormat::AZTEC )) {
62- _readers.emplace_back (new Aztec::Reader ());
63- }
64- if (hints.hasFormat (BarcodeFormat::PDF_417 )) {
65- _readers.emplace_back (new Pdf417::Reader ());
66- }
67- if (hints.hasFormat (BarcodeFormat::MAXICODE )) {
68- _readers.emplace_back (new MaxiCode::Reader ());
69- }
70- // At end in "try harder" mode
71- if (addOneDReader && tryHarder) {
72- _readers.emplace_back (new OneD::Reader (hints));
73- }
60+ // Put 1D readers upfront in "normal" mode
61+ if (addOneDReader && !tryHarder) {
62+ _readers.emplace_back (new OneD::Reader (hints));
63+ }
64+ if (hints.hasFormat (BarcodeFormat::QR_CODE )) {
65+ _readers.emplace_back (new QRCode::Reader (hints));
66+ }
67+ if (hints.hasFormat (BarcodeFormat::DATA_MATRIX )) {
68+ _readers.emplace_back (new DataMatrix::Reader (hints));
69+ }
70+ if (hints.hasFormat (BarcodeFormat::AZTEC )) {
71+ _readers.emplace_back (new Aztec::Reader ());
72+ }
73+ if (hints.hasFormat (BarcodeFormat::PDF_417 )) {
74+ _readers.emplace_back (new Pdf417::Reader ());
75+ }
76+ if (hints.hasFormat (BarcodeFormat::MAXICODE )) {
77+ _readers.emplace_back (new MaxiCode::Reader ());
78+ }
79+ // At end in "try harder" mode
80+ if (addOneDReader && tryHarder) {
81+ _readers.emplace_back (new OneD::Reader (hints));
7482 }
7583
7684 if (_readers.empty ()) {
@@ -88,16 +96,6 @@ MultiFormatReader::MultiFormatReader(const DecodeHints& hints)
8896 }
8997}
9098
91- MultiFormatReader::~MultiFormatReader ()
92- {
93- }
94-
95- void MultiFormatReader::setFormat (const DecodeHints &hints)
96- {
97- _readers.clear ();
98- _readers.emplace_back (new OneD::Reader (hints));
99- }
100-
10199Result
102100MultiFormatReader::read (const BinaryBitmap& image) const
103101{
0 commit comments