mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
move to using Eci enum
Decouples the Eci and CharacterSet concepts within the library. Character sets can now exist independently from Eci encodation schemes.
This commit is contained in:
@@ -21,7 +21,7 @@ use unicode_segmentation::UnicodeSegmentation;
|
||||
use crate::common::Result;
|
||||
use crate::Exceptions;
|
||||
|
||||
use super::{CharacterSet, ECIEncoderSet, ECIInput};
|
||||
use super::{CharacterSet, ECIEncoderSet, ECIInput, Eci};
|
||||
|
||||
//* approximated (latch + 2 codewords)
|
||||
pub const COST_PER_ECI: usize = 3;
|
||||
@@ -154,7 +154,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<i32> {
|
||||
fn getECIValue(&self, index: usize) -> Result<Eci> {
|
||||
if index >= self.length() {
|
||||
return Err(Exceptions::INDEX_OUT_OF_BOUNDS);
|
||||
}
|
||||
@@ -163,7 +163,7 @@ impl ECIInput for MinimalECIInput {
|
||||
"value at {index} is not an ECI but a character"
|
||||
)));
|
||||
}
|
||||
Ok((self.bytes[index] as u32 - 256) as i32)
|
||||
Ok(Eci::from(self.bytes[index] as u32 - 256))
|
||||
}
|
||||
|
||||
fn haveNCharacters(&self, index: usize, n: usize) -> Result<bool> {
|
||||
@@ -383,7 +383,7 @@ impl MinimalECIInput {
|
||||
// 0..0,
|
||||
// [256 as u16 + encoderSet.getECIValue(c.encoderIndex) as u16],
|
||||
// );
|
||||
intsAL.insert(0, 256_u16 + encoderSet.getECIValue(c.encoderIndex) as u16);
|
||||
intsAL.insert(0, 256_u16 + encoderSet.get_eci(c.encoderIndex) as u16);
|
||||
}
|
||||
current = c.previous.clone();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user