c++ port of r2595

git-svn-id: https://zxing.googlecode.com/svn/trunk@2627 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
smparkes@smparkes.net 2013-04-06 20:31:58 +00:00
parent d2d6378205
commit 0c7e4d5fcc
2 changed files with 19 additions and 10 deletions

View file

@ -53,9 +53,13 @@ class zxing::DecodeHints {
static const DecodeHintType UPC_E_HINT = 1 << BarcodeFormat::UPC_E;
static const DecodeHintType UPC_EAN_EXTENSION_HINT = 1 << BarcodeFormat::UPC_EAN_EXTENSION;
static const DecodeHintType CHARACTER_SET = 1 << 30;
static const DecodeHintType TRYHARDER_HINT = 1 << 31;
static const DecodeHintType CHARACTER_SET = 1 << 30;
// static const DecodeHintType ALLOWED_LENGTHS = 1 << 29;
// static const DecodeHintType ASSUME_CODE_39_CHECK_DIGIT = 1 << 28;
static const DecodeHintType ASSUME_GS1 = 1 << 27;
// static const DecodeHintType NEED_RESULT_POINT_CALLBACK = 1 << 26;
static const DecodeHints PRODUCT_HINT;
static const DecodeHints ONED_HINT;
static const DecodeHints DEFAULT_HINT;

View file

@ -15,7 +15,8 @@
* limitations under the License.
*/
#include "Code128Reader.h"
#include <zxing/ZXing.h>
#include <zxing/oned/Code128Reader.h>
#include <zxing/oned/OneDResultPoint.h>
#include <zxing/common/Array.h>
#include <zxing/ReaderException.h>
@ -243,6 +244,8 @@ int Code128Reader::decodeCode(Ref<BitArray> row, vector<int>& counters, int rowO
}
Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
// boolean convertFNC1 = hints != null && hints.containsKey(DecodeHintType.ASSUME_GS1);
boolean convertFNC1 = false;
vector<int> startPatternInfo (findStartPattern(row));
int startCode = startPatternInfo[2];
int codeSet;
@ -328,13 +331,15 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
}
switch (code) {
case CODE_FNC_1:
if (result.length() == 0){
// GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
// is FNC1 then this is GS1-128. We add the symbology identifier.
result.append("]C1");
} else {
// GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)
result.append(1, (char) 29);
if (convertFNC1) {
if (result.length() == 0){
// GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code
// is FNC1 then this is GS1-128. We add the symbology identifier.
result.append("]C1");
} else {
// GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)
result.append(1, (char) 29);
}
}
break;
case CODE_FNC_2: