mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
Add default for most readers
This commit is contained in:
@@ -30,6 +30,7 @@ use super::{decoder, detector::Detector};
|
||||
*
|
||||
* @author David Olivier
|
||||
*/
|
||||
#[derive(Default)]
|
||||
pub struct AztecReader;
|
||||
|
||||
impl Reader for AztecReader {
|
||||
|
||||
@@ -35,6 +35,7 @@ lazy_static! {
|
||||
*
|
||||
* @author bbrown@google.com (Brian Brown)
|
||||
*/
|
||||
#[derive(Default)]
|
||||
pub struct DataMatrixReader;
|
||||
|
||||
// private static final RXingResultPoint[] NO_POINTS = new RXingResultPoint[0];
|
||||
|
||||
@@ -25,6 +25,7 @@ use super::decoder::decoder;
|
||||
/**
|
||||
* This implementation can detect and decode a MaxiCode in an image.
|
||||
*/
|
||||
#[derive(Default)]
|
||||
pub struct MaxiCodeReader {
|
||||
// private final Decoder decoder = new Decoder();
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ use super::MultipleBarcodeReader;
|
||||
*
|
||||
* @author Sean Owen
|
||||
*/
|
||||
#[derive(Default)]
|
||||
pub struct GenericMultipleBarcodeReader<T: Reader>(T);
|
||||
|
||||
impl<T: Reader> MultipleBarcodeReader for GenericMultipleBarcodeReader<T> {
|
||||
|
||||
@@ -34,6 +34,7 @@ use super::detector::MultiDetector;
|
||||
* @author Sean Owen
|
||||
* @author Hannes Erven
|
||||
*/
|
||||
#[derive(Default)]
|
||||
pub struct QRCodeMultiReader(QRCodeReader);
|
||||
impl MultipleBarcodeReader for QRCodeMultiReader {
|
||||
fn decode_multiple(
|
||||
|
||||
@@ -131,19 +131,19 @@ impl MultiFormatReader {
|
||||
readers.push(Box::new(MultiFormatOneDReader::new(hints)));
|
||||
}
|
||||
if formats.contains(&BarcodeFormat::QR_CODE) {
|
||||
readers.push(Box::new(QRCodeReader {}));
|
||||
readers.push(Box::<QRCodeReader>::default());
|
||||
}
|
||||
if formats.contains(&BarcodeFormat::DATA_MATRIX) {
|
||||
readers.push(Box::new(DataMatrixReader {}));
|
||||
readers.push(Box::<DataMatrixReader>::default());
|
||||
}
|
||||
if formats.contains(&BarcodeFormat::AZTEC) {
|
||||
readers.push(Box::new(AztecReader {}));
|
||||
readers.push(Box::<AztecReader>::default());
|
||||
}
|
||||
if formats.contains(&BarcodeFormat::PDF_417) {
|
||||
readers.push(Box::new(PDF417Reader {}));
|
||||
readers.push(Box::<PDF417Reader>::default());
|
||||
}
|
||||
if formats.contains(&BarcodeFormat::MAXICODE) {
|
||||
readers.push(Box::new(MaxiCodeReader {}));
|
||||
readers.push(Box::<MaxiCodeReader>::default());
|
||||
}
|
||||
// At end in "try harder" mode
|
||||
if addOneDReader && tryHarder {
|
||||
@@ -155,11 +155,11 @@ impl MultiFormatReader {
|
||||
readers.push(Box::new(MultiFormatOneDReader::new(hints)));
|
||||
}
|
||||
|
||||
readers.push(Box::new(QRCodeReader {}));
|
||||
readers.push(Box::new(DataMatrixReader {}));
|
||||
readers.push(Box::new(AztecReader {}));
|
||||
readers.push(Box::new(PDF417Reader {}));
|
||||
readers.push(Box::new(MaxiCodeReader {}));
|
||||
readers.push(Box::<QRCodeReader>::default());
|
||||
readers.push(Box::<DataMatrixReader>::default());
|
||||
readers.push(Box::<AztecReader>::default());
|
||||
readers.push(Box::<PDF417Reader>::default());
|
||||
readers.push(Box::<MaxiCodeReader>::default());
|
||||
// unimplemented!("");
|
||||
|
||||
if tryHarder {
|
||||
|
||||
@@ -27,7 +27,7 @@ use super::{one_d_reader, OneDReader};
|
||||
* @author Sean Owen
|
||||
* @see Code93Reader
|
||||
*/
|
||||
#[derive(OneDReader)]
|
||||
#[derive(OneDReader,Default)]
|
||||
pub struct Code39Reader {
|
||||
usingCheckDigit: bool,
|
||||
extendedMode: bool,
|
||||
|
||||
@@ -26,7 +26,7 @@ use super::{one_d_reader, OneDReader};
|
||||
* @author Sean Owen
|
||||
* @see Code39Reader
|
||||
*/
|
||||
#[derive(OneDReader)]
|
||||
#[derive(OneDReader,Default)]
|
||||
pub struct Code93Reader {
|
||||
decodeRowRXingResult: String,
|
||||
counters: [u32; 6],
|
||||
|
||||
@@ -31,6 +31,7 @@ use crate::Exceptions;
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
* @author Sean Owen
|
||||
*/
|
||||
#[derive(Default)]
|
||||
pub struct MultiFormatOneDReader(Vec<Box<dyn OneDReader>>);
|
||||
impl OneDReader for MultiFormatOneDReader {
|
||||
fn decodeRow(
|
||||
@@ -77,33 +78,33 @@ impl MultiFormatOneDReader {
|
||||
)));
|
||||
}
|
||||
if possibleFormats.contains(&BarcodeFormat::CODE_93) {
|
||||
readers.push(Box::new(Code93Reader::new()));
|
||||
readers.push(Box::<Code93Reader>::default());
|
||||
}
|
||||
if possibleFormats.contains(&BarcodeFormat::CODE_128) {
|
||||
readers.push(Box::new(Code128Reader {}));
|
||||
readers.push(Box::<Code128Reader>::default());
|
||||
}
|
||||
if possibleFormats.contains(&BarcodeFormat::ITF) {
|
||||
readers.push(Box::new(ITFReader::default()));
|
||||
readers.push(Box::<ITFReader>::default());
|
||||
}
|
||||
if possibleFormats.contains(&BarcodeFormat::CODABAR) {
|
||||
readers.push(Box::new(CodaBarReader::new()));
|
||||
readers.push(Box::<CodaBarReader>::default());
|
||||
}
|
||||
if possibleFormats.contains(&BarcodeFormat::RSS_14) {
|
||||
readers.push(Box::new(RSS14Reader::new()));
|
||||
readers.push(Box::<RSS14Reader>::default());
|
||||
}
|
||||
if possibleFormats.contains(&BarcodeFormat::RSS_EXPANDED) {
|
||||
readers.push(Box::new(RSSExpandedReader::new()));
|
||||
readers.push(Box::<RSSExpandedReader>::default());
|
||||
}
|
||||
}
|
||||
if readers.is_empty() {
|
||||
readers.push(Box::new(MultiFormatUPCEANReader::new(hints)));
|
||||
readers.push(Box::new(Code39Reader::new()));
|
||||
readers.push(Box::new(CodaBarReader::new()));
|
||||
readers.push(Box::new(Code93Reader::new()));
|
||||
readers.push(Box::new(Code128Reader {}));
|
||||
readers.push(Box::new(ITFReader::default()));
|
||||
readers.push(Box::new(RSS14Reader::new()));
|
||||
readers.push(Box::new(RSSExpandedReader::new()));
|
||||
readers.push(Box::<Code39Reader>::default());
|
||||
readers.push(Box::<CodaBarReader>::default());
|
||||
readers.push(Box::<Code93Reader>::default());
|
||||
readers.push(Box::<Code128Reader>::default());
|
||||
readers.push(Box::<ITFReader>::default());
|
||||
readers.push(Box::<RSS14Reader>::default());
|
||||
readers.push(Box::<RSSExpandedReader>::default());
|
||||
}
|
||||
|
||||
Self(readers)
|
||||
|
||||
@@ -30,6 +30,7 @@ use super::{
|
||||
/**
|
||||
* Decodes RSS-14, including truncated and stacked variants. See ISO/IEC 24724:2006.
|
||||
*/
|
||||
#[derive(Default)]
|
||||
pub struct RSS14Reader {
|
||||
possibleLeftPairs: Vec<Pair>,
|
||||
possibleRightPairs: Vec<Pair>,
|
||||
|
||||
@@ -32,6 +32,7 @@ use super::{
|
||||
*
|
||||
* @author Sean Owen
|
||||
*/
|
||||
#[derive(Default)]
|
||||
pub struct QRCodeReader;
|
||||
// pub struct QRCodeReader; {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user