rename multi barcode methods to snake case

This commit is contained in:
Henry Schimke
2022-12-31 13:15:30 -06:00
parent ede88360ad
commit 9ff68e6974
7 changed files with 24 additions and 24 deletions

View File

@@ -40,14 +40,14 @@ use super::MultipleBarcodeReader;
pub struct GenericMultipleBarcodeReader<T: Reader>(T);
impl<T: Reader> MultipleBarcodeReader for GenericMultipleBarcodeReader<T> {
fn decodeMultiple(
fn decode_multiple(
&mut self,
image: &crate::BinaryBitmap,
) -> Result<Vec<crate::RXingResult>, 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,

View File

@@ -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();

View File

@@ -23,9 +23,9 @@ use crate::{BinaryBitmap, DecodingHintDictionary, Exceptions, RXingResult};
* @author Sean Owen
*/
pub trait MultipleBarcodeReader {
fn decodeMultiple(&mut self, image: &BinaryBitmap) -> Result<Vec<RXingResult>, Exceptions>;
fn decode_multiple(&mut self, image: &BinaryBitmap) -> Result<Vec<RXingResult>, Exceptions>;
fn decodeMultipleWithHints(
fn decode_multiple_with_hints(
&mut self,
image: &BinaryBitmap,
hints: &DecodingHintDictionary,

View File

@@ -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<Vec<crate::RXingResult>, 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());

View File

@@ -50,8 +50,8 @@ impl Reader for MultiFormatReader {
&mut self,
image: &crate::BinaryBitmap,
) -> Result<crate::RXingResult, crate::Exceptions> {
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<crate::RXingResult, crate::Exceptions> {
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<RXingResult, Exceptions> {
pub fn decode_with_state(&mut self, image: &BinaryBitmap) -> Result<RXingResult, Exceptions> {
// 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<RXingResult, Exceptions> {
pub fn decode_internal(&mut self, image: &BinaryBitmap) -> Result<RXingResult, Exceptions> {
if !self.readers.is_empty() {
for reader in self.readers.iter_mut() {
// I'm not sure how to model this in rust

View File

@@ -63,14 +63,14 @@ impl Reader for PDF417Reader {
}
}
impl MultipleBarcodeReader for PDF417Reader {
fn decodeMultiple(
fn decode_multiple(
&mut self,
image: &crate::BinaryBitmap,
) -> Result<Vec<crate::RXingResult>, 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,