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,8 +53,12 @@ class zxing::DecodeHints {
static const DecodeHintType UPC_E_HINT = 1 << BarcodeFormat::UPC_E; 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 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 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 PRODUCT_HINT;
static const DecodeHints ONED_HINT; static const DecodeHints ONED_HINT;

View file

@ -15,7 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include "Code128Reader.h" #include <zxing/ZXing.h>
#include <zxing/oned/Code128Reader.h>
#include <zxing/oned/OneDResultPoint.h> #include <zxing/oned/OneDResultPoint.h>
#include <zxing/common/Array.h> #include <zxing/common/Array.h>
#include <zxing/ReaderException.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) { 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)); vector<int> startPatternInfo (findStartPattern(row));
int startCode = startPatternInfo[2]; int startCode = startPatternInfo[2];
int codeSet; int codeSet;
@ -328,6 +331,7 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
} }
switch (code) { switch (code) {
case CODE_FNC_1: case CODE_FNC_1:
if (convertFNC1) {
if (result.length() == 0){ if (result.length() == 0){
// GS1 specification 5.4.3.7. and 5.4.6.4. If the first char after the start code // 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. // is FNC1 then this is GS1-128. We add the symbology identifier.
@ -336,6 +340,7 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
// GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS) // GS1 specification 5.4.7.5. Every subsequent FNC1 is returned as ASCII 29 (GS)
result.append(1, (char) 29); result.append(1, (char) 29);
} }
}
break; break;
case CODE_FNC_2: case CODE_FNC_2:
case CODE_FNC_3: case CODE_FNC_3: