rename helper methods

This commit is contained in:
Vukašin Stepanović
2023-02-15 12:52:59 +00:00
parent bfcdb397ad
commit 935519ced5
133 changed files with 858 additions and 1044 deletions

View File

@@ -221,18 +221,14 @@ pub fn encodeHighLevelWithDimensionForceC40WithSymbolInfoLookup(
if forceC40 {
c40Encoder.encodeMaximalC40(&mut context)?;
encodingMode = context
.getNewEncoding()
.ok_or(Exceptions::illegalStateEmpty())?;
encodingMode = context.getNewEncoding().ok_or(Exceptions::illegalState)?;
context.resetEncoderSignal();
}
while context.hasMoreCharacters() {
encoders[encodingMode].encode(&mut context)?;
if context.getNewEncoding().is_some() {
encodingMode = context
.getNewEncoding()
.ok_or(Exceptions::illegalStateEmpty())?;
encodingMode = context.getNewEncoding().ok_or(Exceptions::illegalState)?;
context.resetEncoderSignal();
}
}
@@ -240,7 +236,7 @@ pub fn encodeHighLevelWithDimensionForceC40WithSymbolInfoLookup(
context.updateSymbolInfo();
let capacity = context
.getSymbolInfo()
.ok_or(Exceptions::illegalStateEmpty())?
.ok_or(Exceptions::illegalState)?
.getDataCapacity();
if len < capacity as usize
&& encodingMode != ASCII_ENCODATION
@@ -611,7 +607,7 @@ pub fn determineConsecutiveDigitCount(msg: &str, startpos: u32) -> u32 {
pub fn illegalCharacter(c: char) -> Result<(), Exceptions> {
// let hex = Integer.toHexString(c);
// hex = "0000".substring(0, 4 - hex.length()) + hex;
Err(Exceptions::illegalArgument(format!(
Err(Exceptions::illegalArgumentWith(format!(
"Illegal character: {c} (0x{c})"
)))
}