mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
add missing to_string methods in pdf417
This commit is contained in:
@@ -648,7 +648,45 @@ impl DetectionRXingResult {
|
||||
|
||||
impl Display for DetectionRXingResult {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
todo!()
|
||||
let mut rowIndicatorColumn = &self.detectionRXingResultColumns[0];
|
||||
if rowIndicatorColumn.is_none() {
|
||||
rowIndicatorColumn = &self.detectionRXingResultColumns[self.barcodeColumnCount + 1];
|
||||
}
|
||||
// try (Formatter formatter = new Formatter()) {
|
||||
for codewordsRow in 0..rowIndicatorColumn.as_ref().unwrap().getCodewords().len() {
|
||||
// for (int codewordsRow = 0; codewordsRow < rowIndicatorColumn.getCodewords().length; codewordsRow++) {
|
||||
write!(f, "CW {0:3}", codewordsRow)?;
|
||||
// formatter.format("CW %3d:", codewordsRow);
|
||||
for barcodeColumn in 0..self.barcodeColumnCount + 2 {
|
||||
// for (int barcodeColumn = 0; barcodeColumn < barcodeColumnCount + 2; barcodeColumn++) {
|
||||
if self.detectionRXingResultColumns[barcodeColumn].is_none() {
|
||||
write!(f, "{}", " | ")?;
|
||||
// formatter.format(" | ");
|
||||
continue;
|
||||
}
|
||||
let codeword = self.detectionRXingResultColumns[barcodeColumn]
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.getCodewords()[codewordsRow];
|
||||
if codeword.is_none() {
|
||||
write!(f, "{}", " | ")?;
|
||||
// formatter.format(" | ");
|
||||
continue;
|
||||
}
|
||||
write!(
|
||||
f,
|
||||
" {}|{}",
|
||||
codeword.as_ref().unwrap().getRowNumber(),
|
||||
codeword.as_ref().unwrap().getValue()
|
||||
)?;
|
||||
// formatter.format(" %3d|%3d", codeword.getRowNumber(), codeword.getValue());
|
||||
}
|
||||
// formatter.format("%n");
|
||||
write!(f, "{}", "\n")?;
|
||||
}
|
||||
// return formatter.toString();
|
||||
write!(f, "")
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,9 +127,26 @@ impl DetectionRXingResultColumnTrait for DetectionRXingResultColumn {
|
||||
impl Display for DetectionRXingResultColumn {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
if self.isLeft.is_some() {
|
||||
write!(f, "IsLeft: {} \n", self.isLeft.as_ref().unwrap());
|
||||
write!(f, "IsLeft: {} \n", self.isLeft.as_ref().unwrap())?;
|
||||
}
|
||||
todo!()
|
||||
let mut row = 0;
|
||||
for codeword in &self.codewords {
|
||||
// for (Codeword codeword : codewords) {
|
||||
if codeword.is_none() {
|
||||
write!(f, "{:3}: | \n", row)?;
|
||||
row += 1;
|
||||
continue;
|
||||
}
|
||||
write!(
|
||||
f,
|
||||
"{:3}: {:3}|{:3}\n",
|
||||
row,
|
||||
codeword.as_ref().unwrap().getRowNumber(),
|
||||
codeword.as_ref().unwrap().getValue()
|
||||
)?;
|
||||
row += 1;
|
||||
}
|
||||
write!(f, "")
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
||||
Reference in New Issue
Block a user