mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-28 05:12:34 +00:00
rename character set and rename methods
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
use java_rand;
|
||||
|
||||
use crate::common::CharacterSetECI;
|
||||
use crate::common::CharacterSet;
|
||||
use crate::pdf417::decoder::decoded_bit_stream_parser;
|
||||
use crate::pdf417::encoder::{pdf_417_high_level_encoder_test_adapter, Compaction};
|
||||
use crate::pdf417::PDF417RXingResultMetadata;
|
||||
@@ -307,7 +307,7 @@ fn testBinaryData() {
|
||||
random.next_bytes(&mut bytes);
|
||||
|
||||
total += encodeDecode(
|
||||
&CharacterSetECI::ISO8859_1
|
||||
&CharacterSet::ISO8859_1
|
||||
.decode(&bytes)
|
||||
.expect("decode bytes"),
|
||||
);
|
||||
@@ -437,7 +437,7 @@ fn encodeDecode(input: &str) -> u32 {
|
||||
|
||||
fn encodeDecodeWithAll(
|
||||
input: &str,
|
||||
charset: Option<CharacterSetECI>,
|
||||
charset: Option<CharacterSet>,
|
||||
autoECI: bool,
|
||||
decode: bool,
|
||||
) -> u32 {
|
||||
@@ -523,7 +523,7 @@ fn performECITest(
|
||||
// for (int i = 0; i < 1000; i++) {
|
||||
let s = generateText(&mut random, 100, chars, weights);
|
||||
minLength += encodeDecodeWithAll(&s, None, true, true);
|
||||
utfLength += encodeDecodeWithAll(&s, Some(CharacterSetECI::UTF8), false, true);
|
||||
utfLength += encodeDecodeWithAll(&s, Some(CharacterSet::UTF8), false, true);
|
||||
}
|
||||
assert_eq!(expectedMinLength, minLength);
|
||||
assert_eq!(expectedUTFLength, utfLength);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* This file has been modified from its original form in Barcode4J.
|
||||
*/
|
||||
|
||||
use crate::common::{CharacterSetECI, Result};
|
||||
use crate::common::{CharacterSet, Result};
|
||||
use crate::Exceptions;
|
||||
|
||||
use super::{
|
||||
@@ -32,7 +32,7 @@ pub struct PDF417 {
|
||||
barcodeMatrix: Option<BarcodeMatrix>,
|
||||
compact: bool,
|
||||
compaction: Compaction,
|
||||
encoding: Option<CharacterSetECI>,
|
||||
encoding: Option<CharacterSet>,
|
||||
minCols: u32,
|
||||
maxCols: u32,
|
||||
maxRows: u32,
|
||||
@@ -345,7 +345,7 @@ impl PDF417 {
|
||||
/**
|
||||
* @param encoding sets character encoding to use
|
||||
*/
|
||||
pub fn setEncoding(&mut self, encoding: Option<CharacterSetECI>) {
|
||||
pub fn setEncoding(&mut self, encoding: Option<CharacterSet>) {
|
||||
self.encoding = encoding;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use std::{any::TypeId, fmt::Display, str::FromStr};
|
||||
|
||||
use crate::{
|
||||
common::{CharacterSetECI, ECIInput, MinimalECIInput, Result},
|
||||
common::{CharacterSet, ECIInput, MinimalECIInput, Result},
|
||||
Exceptions,
|
||||
};
|
||||
|
||||
@@ -123,7 +123,7 @@ const TEXT_PUNCTUATION_RAW: [u8; 30] = [
|
||||
40, 41, 63, 123, 125, 39, 0,
|
||||
];
|
||||
|
||||
const DEFAULT_ENCODING: CharacterSetECI = CharacterSetECI::ISO8859_1; //StandardCharsets.ISO_8859_1;
|
||||
const DEFAULT_ENCODING: CharacterSet = CharacterSet::ISO8859_1; //StandardCharsets.ISO_8859_1;
|
||||
|
||||
const MIXED: [i8; 128] = {
|
||||
let mut mixed = [-1_i8; 128];
|
||||
@@ -172,7 +172,7 @@ const PUNCTUATION: [i8; 128] = {
|
||||
pub fn encodeHighLevel(
|
||||
msg: &str,
|
||||
compaction: Compaction,
|
||||
encoding: Option<CharacterSetECI>,
|
||||
encoding: Option<CharacterSet>,
|
||||
autoECI: bool,
|
||||
) -> Result<String> {
|
||||
let mut encoding = encoding;
|
||||
@@ -205,7 +205,7 @@ pub fn encodeHighLevel(
|
||||
// }
|
||||
|
||||
encodingECI(
|
||||
CharacterSetECI::getValue(&encoding.ok_or(Exceptions::ILLEGAL_STATE)?) as i32,
|
||||
CharacterSet::get_eci_value(&encoding.ok_or(Exceptions::ILLEGAL_STATE)?) as i32,
|
||||
&mut sb,
|
||||
)?;
|
||||
}
|
||||
@@ -758,7 +758,7 @@ fn determineConsecutiveTextCount<T: ECIInput + ?Sized>(input: &T, startpos: u32)
|
||||
fn determineConsecutiveBinaryCount<T: ECIInput + ?Sized + 'static>(
|
||||
input: &T,
|
||||
startpos: u32,
|
||||
encoding: Option<CharacterSetECI>,
|
||||
encoding: Option<CharacterSet>,
|
||||
) -> Result<u32> {
|
||||
let len = input.length();
|
||||
let mut idx = startpos as usize;
|
||||
@@ -863,13 +863,13 @@ impl Display for NoECIInput {
|
||||
#[cfg(test)]
|
||||
mod PDF417EncoderTestCase {
|
||||
use crate::{
|
||||
common::CharacterSetECI,
|
||||
common::CharacterSet,
|
||||
pdf417::encoder::{pdf_417_high_level_encoder::encodeHighLevel, Compaction},
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn testEncodeAuto() {
|
||||
let encoded = encodeHighLevel("ABCD", Compaction::AUTO, Some(CharacterSetECI::UTF8), false)
|
||||
let encoded = encodeHighLevel("ABCD", Compaction::AUTO, Some(CharacterSet::UTF8), false)
|
||||
.expect("encode");
|
||||
assert_eq!("\u{039f}\u{001A}\u{0385}ABCD", encoded);
|
||||
}
|
||||
@@ -880,7 +880,7 @@ mod PDF417EncoderTestCase {
|
||||
encodeHighLevel(
|
||||
"1%§s ?aG$",
|
||||
Compaction::AUTO,
|
||||
Some(CharacterSetECI::UTF8),
|
||||
Some(CharacterSet::UTF8),
|
||||
false,
|
||||
)
|
||||
.expect("encode");
|
||||
@@ -892,7 +892,7 @@ mod PDF417EncoderTestCase {
|
||||
encodeHighLevel(
|
||||
"asdfg§asd",
|
||||
Compaction::AUTO,
|
||||
Some(CharacterSetECI::ISO8859_1),
|
||||
Some(CharacterSet::ISO8859_1),
|
||||
false,
|
||||
)
|
||||
.expect("encode");
|
||||
@@ -900,7 +900,7 @@ mod PDF417EncoderTestCase {
|
||||
|
||||
#[test]
|
||||
fn testEncodeText() {
|
||||
let encoded = encodeHighLevel("ABCD", Compaction::TEXT, Some(CharacterSetECI::UTF8), false)
|
||||
let encoded = encodeHighLevel("ABCD", Compaction::TEXT, Some(CharacterSet::UTF8), false)
|
||||
.expect("encode");
|
||||
assert_eq!("Ο\u{001A}\u{0001}?", encoded);
|
||||
}
|
||||
@@ -910,7 +910,7 @@ mod PDF417EncoderTestCase {
|
||||
let encoded = encodeHighLevel(
|
||||
"1234",
|
||||
Compaction::NUMERIC,
|
||||
Some(CharacterSetECI::UTF8),
|
||||
Some(CharacterSet::UTF8),
|
||||
false,
|
||||
)
|
||||
.expect("encode");
|
||||
@@ -920,7 +920,7 @@ mod PDF417EncoderTestCase {
|
||||
|
||||
#[test]
|
||||
fn testEncodeByte() {
|
||||
let encoded = encodeHighLevel("abcd", Compaction::BYTE, Some(CharacterSetECI::UTF8), false)
|
||||
let encoded = encodeHighLevel("abcd", Compaction::BYTE, Some(CharacterSet::UTF8), false)
|
||||
.expect("encode");
|
||||
assert_eq!("\u{039f}\u{001A}\u{0385}abcd", encoded);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use crate::common::{CharacterSetECI, Result};
|
||||
use crate::common::{CharacterSet, Result};
|
||||
|
||||
use super::{pdf_417_high_level_encoder, Compaction};
|
||||
|
||||
@@ -25,7 +25,7 @@ use super::{pdf_417_high_level_encoder, Compaction};
|
||||
pub fn encodeHighLevel(
|
||||
msg: &str,
|
||||
compaction: Compaction,
|
||||
encoding: Option<CharacterSetECI>,
|
||||
encoding: Option<CharacterSet>,
|
||||
autoECI: bool,
|
||||
) -> Result<String> {
|
||||
pdf_417_high_level_encoder::encodeHighLevel(msg, compaction, encoding, autoECI)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
common::{BitMatrix, CharacterSetECI, Result},
|
||||
common::{BitMatrix, CharacterSet, Result},
|
||||
BarcodeFormat, EncodeHintType, EncodeHintValue, Exceptions, Writer,
|
||||
};
|
||||
|
||||
@@ -108,7 +108,7 @@ impl Writer for PDF417Writer {
|
||||
if let Some(EncodeHintValue::CharacterSet(cs)) =
|
||||
hints.get(&EncodeHintType::CHARACTER_SET)
|
||||
{
|
||||
encoder.setEncoding(CharacterSetECI::getCharacterSetECIByName(cs));
|
||||
encoder.setEncoding(CharacterSet::get_character_set_by_name(cs));
|
||||
}
|
||||
if let Some(EncodeHintValue::Pdf417AutoEci(auto_eci_str)) =
|
||||
hints.get(&EncodeHintType::PDF417_AUTO_ECI)
|
||||
|
||||
Reference in New Issue
Block a user