From 9ff68e69743ea7aad30c6734c01957da939b599e Mon Sep 17 00:00:00 2001 From: Henry Schimke Date: Sat, 31 Dec 2022 13:15:30 -0600 Subject: [PATCH] rename multi barcode methods to snake case --- src/multi/generic_multiple_barcode_reader.rs | 6 +++--- src/multi/multi_test_case.rs | 4 ++-- src/multi/multiple_barcode_reader.rs | 4 ++-- src/multi/qrcode/qr_code_multi_reader.rs | 8 ++++---- src/multi_format_reader.rs | 18 +++++++++--------- src/pdf417/pdf_417_reader.rs | 6 +++--- tests/common/pdf_417_multiimage_span.rs | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/multi/generic_multiple_barcode_reader.rs b/src/multi/generic_multiple_barcode_reader.rs index e6c2178..acde7fa 100644 --- a/src/multi/generic_multiple_barcode_reader.rs +++ b/src/multi/generic_multiple_barcode_reader.rs @@ -40,14 +40,14 @@ use super::MultipleBarcodeReader; pub struct GenericMultipleBarcodeReader(T); impl MultipleBarcodeReader for GenericMultipleBarcodeReader { - fn decodeMultiple( + fn decode_multiple( &mut self, image: &crate::BinaryBitmap, ) -> Result, crate::Exceptions> { - self.decodeMultipleWithHints(image, &HashMap::new()) + self.decode_multiple_with_hints(image, &HashMap::new()) } - fn decodeMultipleWithHints( + fn decode_multiple_with_hints( &mut self, image: &crate::BinaryBitmap, hints: &crate::DecodingHintDictionary, diff --git a/src/multi/multi_test_case.rs b/src/multi/multi_test_case.rs index 645c2d6..7db76df 100644 --- a/src/multi/multi_test_case.rs +++ b/src/multi/multi_test_case.rs @@ -41,7 +41,7 @@ fn testMulti() { let bitmap = BinaryBitmap::new(Rc::new(HybridBinarizer::new(Box::new(source)))); let mut reader = GenericMultipleBarcodeReader::new(MultiFormatReader::default()); - let results = reader.decodeMultiple(&bitmap).expect("must decode multi"); + let results = reader.decode_multiple(&bitmap).expect("must decode multi"); // assertNotNull(results); assert_eq!(2, results.len()); @@ -66,7 +66,7 @@ fn testMultiQR() { let bitmap = BinaryBitmap::new(Rc::new(HybridBinarizer::new(Box::new(source)))); let mut reader = GenericMultipleBarcodeReader::new(MultiFormatReader::default()); - let results = reader.decodeMultiple(&bitmap).expect("must decode multi"); + let results = reader.decode_multiple(&bitmap).expect("must decode multi"); assert_eq!(4, results.len()); let mut barcodeContents = HashSet::new(); diff --git a/src/multi/multiple_barcode_reader.rs b/src/multi/multiple_barcode_reader.rs index 7ca546f..fa567fd 100644 --- a/src/multi/multiple_barcode_reader.rs +++ b/src/multi/multiple_barcode_reader.rs @@ -23,9 +23,9 @@ use crate::{BinaryBitmap, DecodingHintDictionary, Exceptions, RXingResult}; * @author Sean Owen */ pub trait MultipleBarcodeReader { - fn decodeMultiple(&mut self, image: &BinaryBitmap) -> Result, Exceptions>; + fn decode_multiple(&mut self, image: &BinaryBitmap) -> Result, Exceptions>; - fn decodeMultipleWithHints( + fn decode_multiple_with_hints( &mut self, image: &BinaryBitmap, hints: &DecodingHintDictionary, diff --git a/src/multi/qrcode/qr_code_multi_reader.rs b/src/multi/qrcode/qr_code_multi_reader.rs index e050dd3..87ab788 100644 --- a/src/multi/qrcode/qr_code_multi_reader.rs +++ b/src/multi/qrcode/qr_code_multi_reader.rs @@ -36,14 +36,14 @@ use super::detector::MultiDetector; */ pub struct QRCodeMultiReader(QRCodeReader); impl MultipleBarcodeReader for QRCodeMultiReader { - fn decodeMultiple( + fn decode_multiple( &mut self, image: &crate::BinaryBitmap, ) -> Result, crate::Exceptions> { - self.decodeMultipleWithHints(image, &HashMap::new()) + self.decode_multiple_with_hints(image, &HashMap::new()) } - fn decodeMultipleWithHints( + fn decode_multiple_with_hints( &mut self, image: &crate::BinaryBitmap, hints: &crate::DecodingHintDictionary, @@ -253,7 +253,7 @@ mod multi_qr_code_test_case { let bitmap = BinaryBitmap::new(Rc::new(HybridBinarizer::new(Box::new(source)))); let mut reader = QRCodeMultiReader::new(); - let results = reader.decodeMultiple(&bitmap).expect("must decode"); + let results = reader.decode_multiple(&bitmap).expect("must decode"); // assertNotNull(results); assert_eq!(4, results.len()); diff --git a/src/multi_format_reader.rs b/src/multi_format_reader.rs index da1963e..a851392 100644 --- a/src/multi_format_reader.rs +++ b/src/multi_format_reader.rs @@ -50,8 +50,8 @@ impl Reader for MultiFormatReader { &mut self, image: &crate::BinaryBitmap, ) -> Result { - self.setHints(&HashMap::new()); - self.decodeInternal(image) + self.set_ints(&HashMap::new()); + self.decode_internal(image) } /** @@ -67,8 +67,8 @@ impl Reader for MultiFormatReader { image: &crate::BinaryBitmap, hints: &crate::DecodingHintDictionary, ) -> Result { - self.setHints(hints); - self.decodeInternal(image) + self.set_ints(hints); + self.decode_internal(image) } fn reset(&mut self) { @@ -89,12 +89,12 @@ impl MultiFormatReader { * @return The contents of the image * @throws NotFoundException Any errors which occurred */ - pub fn decodeWithState(&mut self, image: &BinaryBitmap) -> Result { + pub fn decode_with_state(&mut self, image: &BinaryBitmap) -> Result { // Make sure to set up the default state so we don't crash if self.readers.is_empty() { - self.setHints(&HashMap::new()); + self.set_ints(&HashMap::new()); } - self.decodeInternal(image) + self.decode_internal(image) } /** @@ -104,7 +104,7 @@ impl MultiFormatReader { * * @param hints The set of hints to use for subsequent calls to decode(image) */ - pub fn setHints(&mut self, hints: &DecodingHintDictionary) { + pub fn set_ints(&mut self, hints: &DecodingHintDictionary) { self.hints = hints.clone(); // {hint} else {HashMap::new()}; let tryHarder = self.hints.contains_key(&DecodeHintType::TRY_HARDER); @@ -166,7 +166,7 @@ impl MultiFormatReader { self.readers = readers; //Vec::new(); //readers.toArray(EMPTY_READER_ARRAY); } - pub fn decodeInternal(&mut self, image: &BinaryBitmap) -> Result { + pub fn decode_internal(&mut self, image: &BinaryBitmap) -> Result { if !self.readers.is_empty() { for reader in self.readers.iter_mut() { // I'm not sure how to model this in rust diff --git a/src/pdf417/pdf_417_reader.rs b/src/pdf417/pdf_417_reader.rs index a660342..08c7904 100644 --- a/src/pdf417/pdf_417_reader.rs +++ b/src/pdf417/pdf_417_reader.rs @@ -63,14 +63,14 @@ impl Reader for PDF417Reader { } } impl MultipleBarcodeReader for PDF417Reader { - fn decodeMultiple( + fn decode_multiple( &mut self, image: &crate::BinaryBitmap, ) -> Result, crate::Exceptions> { - self.decodeMultipleWithHints(image, &HashMap::new()) + self.decode_multiple_with_hints(image, &HashMap::new()) } - fn decodeMultipleWithHints( + fn decode_multiple_with_hints( &mut self, image: &crate::BinaryBitmap, hints: &crate::DecodingHintDictionary, diff --git a/tests/common/pdf_417_multiimage_span.rs b/tests/common/pdf_417_multiimage_span.rs index 4f812ee..9050efa 100644 --- a/tests/common/pdf_417_multiimage_span.rs +++ b/tests/common/pdf_417_multiimage_span.rs @@ -748,7 +748,7 @@ impl PDF417MultiImageSpanAbstractBlackBoxTest hints.insert(DecodeHintType::TRY_HARDER, DecodeHintValue::TryHarder(true)); } - barcode_reader.decodeMultipleWithHints(source, &hints) + barcode_reader.decode_multiple_with_hints(source, &hints) } fn get_image_file_lists(&self) -> Result>, std::io::Error> {