From 7b6a80e4ac7411a11ca170ce7852faf2ea9b43ac Mon Sep 17 00:00:00 2001 From: Henry Schimke Date: Tue, 21 Mar 2023 11:26:30 -0500 Subject: [PATCH] move some todo!() to unimplemented!() --- .../base_extentions/bitmatrix.rs | 39 ++++++++++++++++++- src/oned/one_d_code_writer.rs | 2 +- src/oned/upc_ean_reader.rs | 10 ++--- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/src/common/cpp_essentials/base_extentions/bitmatrix.rs b/src/common/cpp_essentials/base_extentions/bitmatrix.rs index 95ebd37..174eef2 100644 --- a/src/common/cpp_essentials/base_extentions/bitmatrix.rs +++ b/src/common/cpp_essentials/base_extentions/bitmatrix.rs @@ -27,12 +27,27 @@ impl BitMatrix { Ok(result) } - pub fn getTopLeftOnBitWithPosition(&self, left: u32, top: u32) -> (bool, u32, u32) { + pub fn getTopLeftOnBitWithPosition(&self, left: &mut u32, top: &mut u32) -> bool { todo!() + // int bitsOffset = (int)std::distance(_bits.begin(), std::find_if(_bits.begin(), _bits.end(), isSet)); + // if (bitsOffset == Size(_bits)) { + // return false; + // } + // top = bitsOffset / _width; + // left = (bitsOffset % _width); + // return true; } - pub fn getBottomRightOnBitWithPosition(&self, right: u32, bottom: u32) -> (bool, u32, u32) { + pub fn getBottomRightOnBitWithPosition(&self, right: &mut u32, bottom: &mut u32) -> bool { todo!() + // int bitsOffset = Size(_bits) - 1 - (int)std::distance(_bits.rbegin(), std::find_if(_bits.rbegin(), _bits.rend(), isSet)); + // if (bitsOffset < 0) { + // return false; + // } + + // bottom = bitsOffset / _width; + // right = (bitsOffset % _width); + // return true; } pub fn findBoundingBox( @@ -44,5 +59,25 @@ impl BitMatrix { minSize: u32, ) -> (bool, u32, u32, u32, u32) { todo!() + // int right, bottom; + // if (!getTopLeftOnBit(left, top) || !getBottomRightOnBit(right, bottom) || bottom - top + 1 < minSize) + // return false; + + // for (int y = top; y <= bottom; y++ ) { + // for (int x = 0; x < left; ++x) + // if (get(x, y)) { + // left = x; + // break; + // } + // for (int x = _width-1; x > right; x--) + // if (get(x, y)) { + // right = x; + // break; + // } + // } + + // width = right - left + 1; + // height = bottom - top + 1; + // return width >= minSize && height >= minSize; } } diff --git a/src/oned/one_d_code_writer.rs b/src/oned/one_d_code_writer.rs index a73b59e..b57c589 100644 --- a/src/oned/one_d_code_writer.rs +++ b/src/oned/one_d_code_writer.rs @@ -195,6 +195,6 @@ impl Writer for L { impl OneDimensionalCodeWriter for L { fn encode_oned(&self, _contents: &str) -> Result> { - todo!() + unimplemented!() } } diff --git a/src/oned/upc_ean_reader.rs b/src/oned/upc_ean_reader.rs index caa984a..11b1273 100644 --- a/src/oned/upc_ean_reader.rs +++ b/src/oned/upc_ean_reader.rs @@ -490,7 +490,7 @@ pub trait UPCEANReader: OneDReader { pub(crate) struct StandInStruct; impl UPCEANReader for StandInStruct { fn getBarcodeFormat(&self) -> BarcodeFormat { - todo!() + unimplemented!() } fn decodeMiddle( @@ -499,7 +499,7 @@ impl UPCEANReader for StandInStruct { _startRange: &[usize; 2], _resultString: &mut String, ) -> Result { - todo!() + unimplemented!() } } impl OneDReader for StandInStruct { @@ -509,13 +509,13 @@ impl OneDReader for StandInStruct { _row: &BitArray, _hints: &crate::DecodingHintDictionary, ) -> Result { - todo!() + unimplemented!() } } impl Reader for StandInStruct { fn decode(&mut self, _image: &mut crate::BinaryBitmap) -> Result { - todo!() + unimplemented!() } fn decode_with_hints( @@ -523,7 +523,7 @@ impl Reader for StandInStruct { _image: &mut crate::BinaryBitmap, _hints: &crate::DecodingHintDictionary, ) -> Result { - todo!() + unimplemented!() } }