Issue 1737: Add hint to not strip Codabar start/end

git-svn-id: https://zxing.googlecode.com/svn/trunk@2847 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen@gmail.com 2013-07-24 08:08:37 +00:00
parent ef96893525
commit 20193fda16
2 changed files with 352 additions and 343 deletions

View file

@ -75,6 +75,13 @@ public enum DecodeHintType {
*/ */
ASSUME_GS1(Void.class), ASSUME_GS1(Void.class),
/**
* If true, return the start and end digits in a Codabar barcode instead of stripping them. They
* are alpha, whereas the rest are numeric. By default, they are stripped, but this causes them
* to not be. Doesn't matter what it maps to; use {@link Boolean#TRUE}.
*/
RETURN_CODABAR_START_END(Void.class),
/** /**
* The caller needs to be notified via callback when a possible {@link ResultPoint} * The caller needs to be notified via callback when a possible {@link ResultPoint}
* is found. Maps to a {@link ResultPointCallback}. * is found. Maps to a {@link ResultPointCallback}.

View file

@ -138,8 +138,10 @@ public final class CodaBarReader extends OneDReader {
throw NotFoundException.getNotFoundInstance(); throw NotFoundException.getNotFoundInstance();
} }
decodeRowResult.deleteCharAt(decodeRowResult.length() - 1); if (hints == null || !hints.containsKey(DecodeHintType.RETURN_CODABAR_START_END)) {
decodeRowResult.deleteCharAt(0); decodeRowResult.deleteCharAt(decodeRowResult.length() - 1);
decodeRowResult.deleteCharAt(0);
}
int runningCount = 0; int runningCount = 0;
for (int i = 0; i < startOffset; i++) { for (int i = 0; i < startOffset; i++) {