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