high level encoder builds

This commit is contained in:
Henry Schimke
2022-12-17 18:47:38 -06:00
parent f99a862f9d
commit d9b0d46f71
13 changed files with 1093 additions and 1004 deletions

View File

@@ -16,6 +16,8 @@
//package com.google.zxing.common;
use std::fmt::Display;
use crate::Exceptions;
/**
@@ -23,7 +25,7 @@ use crate::Exceptions;
*
* @author Alex Geller
*/
pub trait ECIInput {
pub trait ECIInput:Display {
/**
* Returns the length of this input. The length is the number
* of {@code byte}s in or ECIs in the sequence.
@@ -103,6 +105,6 @@ pub trait ECIInput {
* @throws IllegalArgumentException
* if the value at the {@code index} argument is not an ECI (@see #isECI)
*/
fn getECIValue(&self, index: usize) -> Result<u32, Exceptions>;
fn getECIValue(&self, index: usize) -> Result<i32, Exceptions>;
fn haveNCharacters(&self, index: usize, n: usize) -> bool;
}

View File

@@ -162,7 +162,7 @@ impl ECIInput for MinimalECIInput {
* @throws IllegalArgumentException
* if the value at the {@code index} argument is not an ECI (@see #isECI)
*/
fn getECIValue(&self, index: usize) -> Result<u32, Exceptions> {
fn getECIValue(&self, index: usize) -> Result<i32, Exceptions> {
if index >= self.length() {
return Err(Exceptions::IndexOutOfBoundsException(index.to_string()));
}
@@ -172,7 +172,7 @@ impl ECIInput for MinimalECIInput {
index
)));
}
Ok((self.bytes[index] as u32 - 256) as u32)
Ok((self.bytes[index] as u32 - 256) as i32)
}
fn haveNCharacters(&self, index: usize, n: usize) -> bool {