code 39 writer + tests

This commit is contained in:
Henry Schimke
2022-12-10 17:43:47 -06:00
parent f13d8bd479
commit 20f8d15065
4 changed files with 260 additions and 239 deletions

View File

@@ -42,7 +42,7 @@ impl OneDReader for Code39Reader {
_hints: &DecodingHintDictionary,
) -> Result<crate::RXingResult, Exceptions> {
// let theCounters = self.counters;
let mut counters = [0_u32;9];
let mut counters = [0_u32; 9];
// self.counters.fill(0);
// let result = self.decodeRowRXingResult;
// result.setLength(0);
@@ -145,14 +145,14 @@ impl OneDReader for Code39Reader {
}
}
impl Code39Reader {
const ALPHABET_STRING: &str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%";
pub const ALPHABET_STRING: &str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%";
/**
* These represent the encodings of characters, as patterns of wide and narrow bars.
* The 9 least-significant bits of each int correspond to the pattern of wide and narrow,
* with 1s representing "wide" and 0s representing narrow.
*/
const CHARACTER_ENCODINGS: [u32; 43] = [
pub const CHARACTER_ENCODINGS: [u32; 43] = [
0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, // 0-9
0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, // A-J
0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, // K-T
@@ -160,7 +160,7 @@ impl Code39Reader {
0x0A2, 0x08A, 0x02A, // /-%
];
const ASTERISK_ENCODING: u32 = 0x094;
pub const ASTERISK_ENCODING: u32 = 0x094;
/**
* Creates a reader that assumes all encoded data is data, and does not treat the final