mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
step towards making VS happy
git-svn-id: https://zxing.googlecode.com/svn/trunk@2637 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
cf2e1c9403
commit
ae6e2e0bd3
|
@ -22,11 +22,11 @@
|
|||
*/
|
||||
|
||||
namespace zxing {
|
||||
class BarcodeFormat;
|
||||
}
|
||||
|
||||
class zxing::BarcodeFormat {
|
||||
class BarcodeFormat {
|
||||
public:
|
||||
// if you update the enum, update BarcodeFormat.cpp
|
||||
|
||||
enum Value {
|
||||
NONE,
|
||||
AZTEC,
|
||||
|
@ -52,12 +52,9 @@ public:
|
|||
const Value value;
|
||||
operator Value () const {return value;}
|
||||
|
||||
/* if you update the enum, please update the name in BarcodeFormat.cpp */
|
||||
static char const* barcodeFormatNames[];
|
||||
};
|
||||
|
||||
namespace zxing {
|
||||
class BarcodeFormat;
|
||||
}
|
||||
|
||||
#endif // __BARCODE_FORMAT_H__
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
#include <zxing/ResultPointCallback.h>
|
||||
|
||||
namespace zxing {
|
||||
typedef unsigned int DecodeHintType;
|
||||
class DecodeHints;
|
||||
DecodeHints operator | (DecodeHints const&, DecodeHints const&);
|
||||
}
|
||||
|
||||
class zxing::DecodeHints {
|
||||
typedef unsigned int DecodeHintType;
|
||||
class DecodeHints;
|
||||
DecodeHints operator | (DecodeHints const&, DecodeHints const&);
|
||||
|
||||
class DecodeHints {
|
||||
private:
|
||||
DecodeHintType hints;
|
||||
Ref<ResultPointCallback> callback;
|
||||
|
@ -78,4 +78,6 @@ class zxing::DecodeHints {
|
|||
friend DecodeHints operator | (DecodeHints const&, DecodeHints const&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,10 +25,8 @@
|
|||
#include <exception>
|
||||
|
||||
namespace zxing {
|
||||
class Exception;
|
||||
}
|
||||
|
||||
class zxing::Exception : public std::exception {
|
||||
class Exception : public std::exception {
|
||||
private:
|
||||
char const* const message;
|
||||
|
||||
|
@ -48,4 +46,6 @@ private:
|
|||
void deleteMessage();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __EXCEPTION_H__
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
#include <zxing/ReaderException.h>
|
||||
|
||||
namespace zxing {
|
||||
class NotFoundException;
|
||||
}
|
||||
|
||||
class zxing::NotFoundException : public ReaderException {
|
||||
class NotFoundException : public ReaderException {
|
||||
public:
|
||||
NotFoundException() throw() {}
|
||||
NotFoundException(const char *msg) throw() : ReaderException(msg) {}
|
||||
~NotFoundException() throw() {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __NOT_FOUND_EXCEPTION_H__
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
#ifndef __READER_EXCEPTION_H__
|
||||
#define __READER_EXCEPTION_H__
|
||||
|
||||
|
@ -23,14 +24,14 @@
|
|||
#include <zxing/Exception.h>
|
||||
|
||||
namespace zxing {
|
||||
class ReaderException;
|
||||
}
|
||||
|
||||
class zxing::ReaderException : public Exception {
|
||||
public:
|
||||
class ReaderException : public Exception {
|
||||
public:
|
||||
ReaderException() throw() {}
|
||||
ReaderException(char const* msg) throw() : Exception(msg) {}
|
||||
~ReaderException() throw() {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __READER_EXCEPTION_H__
|
||||
|
|
|
@ -18,6 +18,13 @@
|
|||
#define __ZXING_H_
|
||||
|
||||
#define ZXING_ARRAY_LEN(v) ((int)(sizeof(v)/sizeof(v[0])))
|
||||
#define ZX_LOG_DIGITS(digits) \
|
||||
((digits == 8) ? 3 : \
|
||||
((digits == 16) ? 4 : \
|
||||
((digits == 32) ? 5 : \
|
||||
((digits == 64) ? 6 : \
|
||||
((digits == 128) ? 7 : \
|
||||
(-1))))))
|
||||
|
||||
#ifndef ZXING_DEBUG
|
||||
#define ZXING_DEBUG 0
|
||||
|
|
|
@ -25,22 +25,24 @@
|
|||
#define ZXingWidget_AtztecDetecorResult_h
|
||||
|
||||
namespace zxing {
|
||||
namespace aztec {
|
||||
class AztecDetectorResult : public DetectorResult {
|
||||
private:
|
||||
bool compact_;
|
||||
int nbDatablocks_, nbLayers_;
|
||||
public:
|
||||
AztecDetectorResult(Ref<BitMatrix> bits,
|
||||
ArrayRef< Ref<ResultPoint> > points,
|
||||
bool compact,
|
||||
int nbDatablocks,
|
||||
int nbLayers);
|
||||
bool isCompact();
|
||||
int getNBDatablocks();
|
||||
int getNBLayers();
|
||||
};
|
||||
}
|
||||
namespace aztec {
|
||||
|
||||
class AztecDetectorResult : public DetectorResult {
|
||||
private:
|
||||
bool compact_;
|
||||
int nbDatablocks_, nbLayers_;
|
||||
public:
|
||||
AztecDetectorResult(Ref<BitMatrix> bits,
|
||||
ArrayRef< Ref<ResultPoint> > points,
|
||||
bool compact,
|
||||
int nbDatablocks,
|
||||
int nbLayers);
|
||||
bool isCompact();
|
||||
int getNBDatablocks();
|
||||
int getNBLayers();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <zxing/aztec/AztecReader.h>
|
||||
#include <zxing/aztec/detector/Detector.h>
|
||||
#include <zxing/common/DecoderResult.h>
|
||||
#include <iostream>
|
||||
|
||||
using zxing::Ref;
|
||||
|
|
|
@ -27,23 +27,23 @@
|
|||
#define ZXingWidget_AztecReader_h
|
||||
|
||||
namespace zxing {
|
||||
namespace aztec {
|
||||
namespace aztec {
|
||||
|
||||
class AztecReader : public Reader {
|
||||
private:
|
||||
Decoder decoder_;
|
||||
class AztecReader : public Reader {
|
||||
private:
|
||||
Decoder decoder_;
|
||||
|
||||
protected:
|
||||
Decoder &getDecoder();
|
||||
protected:
|
||||
Decoder &getDecoder();
|
||||
|
||||
public:
|
||||
AztecReader();
|
||||
virtual Ref<Result> decode(Ref<BinaryBitmap> image);
|
||||
virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints);
|
||||
virtual ~AztecReader();
|
||||
};
|
||||
public:
|
||||
AztecReader();
|
||||
virtual Ref<Result> decode(Ref<BinaryBitmap> image);
|
||||
virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints);
|
||||
virtual ~AztecReader();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <zxing/common/reedsolomon/ReedSolomonException.h>
|
||||
#include <zxing/common/reedsolomon/GenericGF.h>
|
||||
#include <zxing/common/IllegalArgumentException.h>
|
||||
#include <zxing/common/DecoderResult.h>
|
||||
|
||||
using zxing::aztec::Decoder;
|
||||
using zxing::DecoderResult;
|
||||
|
|
|
@ -19,45 +19,51 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <zxing/common/DecoderResult.h>
|
||||
#ifndef __ZXING_AZTEC_DECODER_DECODER_H__
|
||||
#define __ZXING_AZTEC_DECODER_DECODER_H__
|
||||
|
||||
#include <zxing/common/BitMatrix.h>
|
||||
#include <zxing/common/Str.h>
|
||||
#include <zxing/aztec/AztecDetectorResult.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace aztec {
|
||||
|
||||
class DecoderResult;
|
||||
|
||||
class Decoder : public Counted {
|
||||
private:
|
||||
enum Table {
|
||||
UPPER,
|
||||
LOWER,
|
||||
MIXED,
|
||||
DIGIT,
|
||||
PUNCT,
|
||||
BINARY
|
||||
};
|
||||
namespace aztec {
|
||||
|
||||
class Decoder : public Counted {
|
||||
private:
|
||||
enum Table {
|
||||
UPPER,
|
||||
LOWER,
|
||||
MIXED,
|
||||
DIGIT,
|
||||
PUNCT,
|
||||
BINARY
|
||||
};
|
||||
|
||||
static Table getTable(char t);
|
||||
static const char* getCharacter(Table table, int code);
|
||||
static Table getTable(char t);
|
||||
static const char* getCharacter(Table table, int code);
|
||||
|
||||
int numCodewords_;
|
||||
int codewordSize_;
|
||||
Ref<AztecDetectorResult> ddata_;
|
||||
int invertedBitCount_;
|
||||
int numCodewords_;
|
||||
int codewordSize_;
|
||||
Ref<AztecDetectorResult> ddata_;
|
||||
int invertedBitCount_;
|
||||
|
||||
Ref<String> getEncodedData(Ref<BitArray> correctedBits);
|
||||
Ref<BitArray> correctBits(Ref<BitArray> rawbits);
|
||||
Ref<BitArray> extractBits(Ref<BitMatrix> matrix);
|
||||
static Ref<BitMatrix> removeDashedLines(Ref<BitMatrix> matrix);
|
||||
static int readCode(Ref<BitArray> rawbits, int startIndex, int length);
|
||||
Ref<String> getEncodedData(Ref<BitArray> correctedBits);
|
||||
Ref<BitArray> correctBits(Ref<BitArray> rawbits);
|
||||
Ref<BitArray> extractBits(Ref<BitMatrix> matrix);
|
||||
static Ref<BitMatrix> removeDashedLines(Ref<BitMatrix> matrix);
|
||||
static int readCode(Ref<BitArray> rawbits, int startIndex, int length);
|
||||
|
||||
|
||||
public:
|
||||
Decoder();
|
||||
Ref<DecoderResult> decode(Ref<AztecDetectorResult> detectorResult);
|
||||
};
|
||||
public:
|
||||
Decoder();
|
||||
Ref<DecoderResult> decode(Ref<AztecDetectorResult> detectorResult);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __ZXING_AZTEC_DETECTOR_DETECTOR_H__
|
||||
#define __ZXING_AZTEC_DETECTOR_DETECTOR_H__
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -29,13 +31,9 @@
|
|||
#include <zxing/aztec/AztecDetectorResult.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace aztec {
|
||||
class Point;
|
||||
class Detector;
|
||||
}
|
||||
}
|
||||
namespace aztec {
|
||||
|
||||
class zxing::aztec::Point : public Counted {
|
||||
class Point : public Counted {
|
||||
public:
|
||||
int x;
|
||||
int y;
|
||||
|
@ -48,7 +46,7 @@ public:
|
|||
|
||||
};
|
||||
|
||||
class zxing::aztec::Detector : public Counted {
|
||||
class Detector : public Counted {
|
||||
|
||||
private:
|
||||
Ref<BitMatrix> image_;
|
||||
|
@ -84,3 +82,8 @@ public:
|
|||
Detector(Ref<BitMatrix> image);
|
||||
Ref<AztecDetectorResult> detect();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <zxing/ZXing.h>
|
||||
#include <zxing/common/Counted.h>
|
||||
#include <zxing/common/IllegalArgumentException.h>
|
||||
#include <zxing/common/Array.h>
|
||||
|
@ -26,19 +27,8 @@
|
|||
#include <iostream>
|
||||
|
||||
namespace zxing {
|
||||
class BitArray;
|
||||
std::ostream& operator << (std::ostream&, BitArray const&);
|
||||
}
|
||||
|
||||
#define ZX_LOG_DIGITS(digits) \
|
||||
((digits == 8) ? 3 : \
|
||||
((digits == 16) ? 4 : \
|
||||
((digits == 32) ? 5 : \
|
||||
((digits == 64) ? 6 : \
|
||||
((digits == 128) ? 7 : \
|
||||
(-1))))))
|
||||
|
||||
class zxing::BitArray : public Counted {
|
||||
class BitArray : public Counted {
|
||||
public:
|
||||
static const int bitsPerWord = std::numeric_limits<unsigned int>::digits;
|
||||
|
||||
|
@ -71,18 +61,21 @@ public:
|
|||
std::vector<int>& getBitArray();
|
||||
|
||||
void reverse();
|
||||
class Reverse;
|
||||
|
||||
class Reverse {
|
||||
private:
|
||||
Ref<BitArray> array;
|
||||
public:
|
||||
Reverse(Ref<BitArray> array);
|
||||
~Reverse();
|
||||
};
|
||||
|
||||
private:
|
||||
static int makeArraySize(int size);
|
||||
};
|
||||
|
||||
class zxing::BitArray::Reverse {
|
||||
private:
|
||||
Ref<BitArray> array;
|
||||
public:
|
||||
Reverse(Ref<BitArray> array);
|
||||
~Reverse();
|
||||
};
|
||||
std::ostream& operator << (std::ostream&, BitArray const&);
|
||||
|
||||
}
|
||||
|
||||
#endif // __BIT_ARRAY_H__
|
||||
|
|
|
@ -27,10 +27,8 @@
|
|||
#include <limits>
|
||||
|
||||
namespace zxing {
|
||||
class BitMatrix;
|
||||
}
|
||||
|
||||
class zxing::BitMatrix : public Counted {
|
||||
class BitMatrix : public Counted {
|
||||
public:
|
||||
static const int bitsPerWord = std::numeric_limits<unsigned int>::digits;
|
||||
|
||||
|
@ -87,4 +85,6 @@ private:
|
|||
BitMatrix& operator =(const BitMatrix&);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __BIT_MATRIX_H__
|
||||
|
|
|
@ -23,12 +23,9 @@
|
|||
#include <zxing/DecodeHints.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace common {
|
||||
class CharacterSetECI;
|
||||
}
|
||||
}
|
||||
namespace common {
|
||||
|
||||
class zxing::common::CharacterSetECI {
|
||||
class CharacterSetECI {
|
||||
private:
|
||||
static std::map<int, CharacterSetECI*> VALUE_TO_ECI;
|
||||
static std::map<std::string, CharacterSetECI*> NAME_TO_ECI;
|
||||
|
@ -50,4 +47,7 @@ public:
|
|||
static CharacterSetECI* getCharacterSetECIByName(std::string const& name);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,10 +26,8 @@
|
|||
#include <zxing/ResultPoint.h>
|
||||
|
||||
namespace zxing {
|
||||
class DetectorResult;
|
||||
}
|
||||
|
||||
class zxing::DetectorResult : public Counted {
|
||||
class DetectorResult : public Counted {
|
||||
private:
|
||||
Ref<BitMatrix> bits_;
|
||||
ArrayRef< Ref<ResultPoint> > points_;
|
||||
|
@ -40,4 +38,6 @@ public:
|
|||
ArrayRef< Ref<ResultPoint> > getPoints();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __DETECTOR_RESULT_H__
|
||||
|
|
|
@ -26,10 +26,8 @@
|
|||
#include <zxing/common/Array.h>
|
||||
|
||||
namespace zxing {
|
||||
class GlobalHistogramBinarizer;
|
||||
}
|
||||
|
||||
class zxing::GlobalHistogramBinarizer : public Binarizer {
|
||||
class GlobalHistogramBinarizer : public Binarizer {
|
||||
private:
|
||||
ArrayRef<char> luminances;
|
||||
ArrayRef<int> buckets;
|
||||
|
@ -44,5 +42,7 @@ public:
|
|||
private:
|
||||
void initArrays(int luminanceSize);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* GLOBALHISTOGRAMBINARIZER_H_ */
|
||||
|
|
|
@ -23,14 +23,14 @@
|
|||
#include <zxing/Exception.h>
|
||||
|
||||
namespace zxing {
|
||||
class IllegalArgumentException;
|
||||
}
|
||||
|
||||
class zxing::IllegalArgumentException : public zxing::Exception {
|
||||
class IllegalArgumentException : public Exception {
|
||||
public:
|
||||
IllegalArgumentException();
|
||||
IllegalArgumentException(const char *msg);
|
||||
~IllegalArgumentException() throw();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __ILLEGAL_ARGUMENT_EXCEPTION_H__
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
#include <zxing/common/Counted.h>
|
||||
|
||||
namespace zxing {
|
||||
class String;
|
||||
std::ostream& operator << (std::ostream& out, String const& s);
|
||||
}
|
||||
|
||||
class zxing::String : public Counted {
|
||||
class String;
|
||||
std::ostream& operator << (std::ostream& out, String const& s);
|
||||
|
||||
class String : public Counted {
|
||||
private:
|
||||
std::string text_;
|
||||
public:
|
||||
|
@ -43,4 +43,6 @@ public:
|
|||
friend std::ostream& zxing::operator << (std::ostream& out, String const& s);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __COMMON__STRING_H__
|
||||
|
|
|
@ -24,12 +24,9 @@
|
|||
#include <zxing/DecodeHints.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace common {
|
||||
class StringUtils;
|
||||
}
|
||||
}
|
||||
namespace common {
|
||||
|
||||
class zxing::common::StringUtils {
|
||||
class StringUtils {
|
||||
private:
|
||||
static char const* const PLATFORM_DEFAULT_ENCODING;
|
||||
|
||||
|
@ -49,4 +46,7 @@ public:
|
|||
static std::string guessEncoding(char* bytes, int length, Hashtable const& hints);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,11 +27,10 @@
|
|||
#include <zxing/common/Counted.h>
|
||||
|
||||
namespace zxing {
|
||||
class GenericGF;
|
||||
class GenericGFPoly;
|
||||
}
|
||||
|
||||
class GenericGF;
|
||||
|
||||
class zxing::GenericGFPoly : public Counted {
|
||||
class GenericGFPoly : public Counted {
|
||||
private:
|
||||
Ref<GenericGF> field_;
|
||||
ArrayRef<int> coefficients_;
|
||||
|
@ -49,7 +48,9 @@ public:
|
|||
Ref<GenericGFPoly> multiplyByMonomial(int degree, int coefficient);
|
||||
std::vector<Ref<GenericGFPoly> > divide(Ref<GenericGFPoly> other);
|
||||
|
||||
//#warning todo: add print method
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //GENERICGFPOLY_H
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
namespace zxing {
|
||||
namespace multi {
|
||||
|
||||
class ByQuadrantReader : public Reader {
|
||||
private:
|
||||
Reader& delegate_;
|
||||
|
@ -34,7 +35,8 @@ class ByQuadrantReader : public Reader {
|
|||
virtual Ref<Result> decode(Ref<BinaryBitmap> image);
|
||||
virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints);
|
||||
};
|
||||
} // End zxing::multi namespace
|
||||
} // End zxing namespace
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __BY_QUADRANT_READER_H__
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
namespace zxing {
|
||||
namespace multi {
|
||||
|
||||
class MultipleBarcodeReader : public Counted {
|
||||
protected:
|
||||
MultipleBarcodeReader() {}
|
||||
|
@ -33,7 +34,8 @@ class MultipleBarcodeReader : public Counted {
|
|||
virtual std::vector<Ref<Result> > decodeMultiple(Ref<BinaryBitmap> image, DecodeHints hints) = 0;
|
||||
virtual ~MultipleBarcodeReader();
|
||||
};
|
||||
} // End zxing::multi namespace
|
||||
} // End zxing namespace
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __MULTIPLE_BARCODE_READER_H__
|
||||
|
|
|
@ -22,13 +22,15 @@
|
|||
|
||||
namespace zxing {
|
||||
namespace multi {
|
||||
|
||||
class QRCodeMultiReader: public zxing::qrcode::QRCodeReader, public MultipleBarcodeReader {
|
||||
public:
|
||||
QRCodeMultiReader();
|
||||
virtual ~QRCodeMultiReader();
|
||||
virtual std::vector<Ref<Result> > decodeMultiple(Ref<BinaryBitmap> image, DecodeHints hints);
|
||||
};
|
||||
} // End zxing::multi namespace
|
||||
} // End zxing namespace
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __QRCODE_MULTI_READER_H__
|
||||
|
|
|
@ -23,13 +23,15 @@
|
|||
|
||||
namespace zxing {
|
||||
namespace multi {
|
||||
|
||||
class MultiDetector : public zxing::qrcode::Detector {
|
||||
public:
|
||||
MultiDetector(Ref<BitMatrix> image);
|
||||
virtual ~MultiDetector();
|
||||
virtual std::vector<Ref<DetectorResult> > detectMulti(DecodeHints hints);
|
||||
};
|
||||
} // End zxing::multi namespace
|
||||
} // End zxing namespace
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __MULTI_DETECTOR_H__
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
namespace zxing {
|
||||
namespace multi {
|
||||
|
||||
class MultiFinderPatternFinder : zxing::qrcode::FinderPatternFinder {
|
||||
private:
|
||||
std::vector<std::vector<Ref<zxing::qrcode::FinderPattern> > > selectBestPatterns();
|
||||
|
@ -39,6 +40,7 @@ class MultiFinderPatternFinder : zxing::qrcode::FinderPatternFinder {
|
|||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,12 +22,9 @@
|
|||
#include <zxing/Result.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class CodaBarReader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
class zxing::oned::CodaBarReader : public OneDReader {
|
||||
class CodaBarReader : public OneDReader {
|
||||
private:
|
||||
static const int MAX_ACCEPTABLE;
|
||||
static const int PADDING;
|
||||
|
@ -54,4 +51,7 @@ private:
|
|||
int toNarrowWidePattern(int position);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,12 +22,9 @@
|
|||
#include <zxing/Result.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class Code128Reader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
class zxing::oned::Code128Reader : public OneDReader {
|
||||
class Code128Reader : public OneDReader {
|
||||
private:
|
||||
static const int MAX_AVG_VARIANCE;
|
||||
static const int MAX_INDIVIDUAL_VARIANCE;
|
||||
|
@ -45,4 +42,7 @@ public:
|
|||
BarcodeFormat getBarcodeFormat();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,17 +25,14 @@
|
|||
#include <zxing/Result.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class Code39Reader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
/**
|
||||
* <p>Decodes Code 39 barcodes. This does not support "Full ASCII Code 39" yet.</p>
|
||||
* Ported form Java (author Sean Owen)
|
||||
* @author Lukasz Warchol
|
||||
*/
|
||||
class zxing::oned::Code39Reader : public OneDReader {
|
||||
class Code39Reader : public OneDReader {
|
||||
private:
|
||||
bool usingCheckDigit;
|
||||
bool extendedMode;
|
||||
|
@ -60,4 +57,7 @@ public:
|
|||
Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,17 +25,14 @@
|
|||
#include <zxing/Result.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class Code93Reader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
/**
|
||||
* <p>Decodes Code 93 barcodes. This does not support "Full ASCII Code 93" yet.</p>
|
||||
* Ported form Java (author Sean Owen)
|
||||
* @author Lukasz Warchol
|
||||
*/
|
||||
class zxing::oned::Code93Reader : public OneDReader {
|
||||
class Code93Reader : public OneDReader {
|
||||
public:
|
||||
Code93Reader();
|
||||
Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
|
||||
|
@ -55,4 +52,7 @@ private:
|
|||
int weightMax);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,12 +25,9 @@
|
|||
#include <zxing/Result.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class EAN13Reader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
class zxing::oned::EAN13Reader : public UPCEANReader {
|
||||
class EAN13Reader : public UPCEANReader {
|
||||
private:
|
||||
std::vector<int> decodeMiddleCounters;
|
||||
static void determineFirstDigit(std::string& resultString,
|
||||
|
@ -46,4 +43,7 @@ public:
|
|||
BarcodeFormat getBarcodeFormat();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,15 +25,13 @@
|
|||
#include <zxing/Result.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class EAN8Reader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
class zxing::oned::EAN8Reader : public UPCEANReader {
|
||||
class EAN8Reader : public UPCEANReader {
|
||||
private:
|
||||
std::vector<int> decodeMiddleCounters;
|
||||
|
||||
public:
|
||||
public:
|
||||
EAN8Reader();
|
||||
|
||||
int decodeMiddle(Ref<BitArray> row,
|
||||
|
@ -43,4 +41,7 @@ public:
|
|||
BarcodeFormat getBarcodeFormat();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,13 +23,9 @@
|
|||
#include <zxing/Result.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class ITFReader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
class zxing::oned::ITFReader : public OneDReader {
|
||||
|
||||
class ITFReader : public OneDReader {
|
||||
private:
|
||||
enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 420/1000)};
|
||||
enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 800/1000)};
|
||||
|
@ -52,4 +48,7 @@ public:
|
|||
~ITFReader();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,13 +23,11 @@
|
|||
#include <zxing/oned/OneDReader.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class UPCEANReader;
|
||||
class MultiFormatUPCEANReader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
class zxing::oned::MultiFormatUPCEANReader : public OneDReader {
|
||||
class UPCEANReader;
|
||||
|
||||
class MultiFormatUPCEANReader : public OneDReader {
|
||||
private:
|
||||
std::vector< Ref<UPCEANReader> > readers;
|
||||
public:
|
||||
|
@ -37,4 +35,7 @@ public:
|
|||
Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,12 +24,9 @@
|
|||
#include <zxing/Reader.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class OneDReader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
class zxing::oned::OneDReader : public Reader {
|
||||
class OneDReader : public Reader {
|
||||
private:
|
||||
Ref<Result> doDecode(Ref<BinaryBitmap> image, DecodeHints hints);
|
||||
|
||||
|
@ -78,4 +75,7 @@ public:
|
|||
virtual ~OneDReader();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,12 +24,9 @@
|
|||
#include <zxing/DecodeHints.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class UPCAReader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
class zxing::oned::UPCAReader : public UPCEANReader {
|
||||
class UPCAReader : public UPCEANReader {
|
||||
|
||||
private:
|
||||
EAN13Reader ean13Reader;
|
||||
|
@ -47,4 +44,7 @@ public:
|
|||
BarcodeFormat getBarcodeFormat();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,15 +23,10 @@
|
|||
#include <zxing/Result.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class MultiFormatUPCEANReader;
|
||||
class UPCEANReader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
class zxing::oned::UPCEANReader : public OneDReader {
|
||||
friend class MultiFormatUPCEANReader;
|
||||
private:
|
||||
class UPCEANReader : public OneDReader {
|
||||
private:
|
||||
std::string decodeRowStringBuffer;
|
||||
// UPCEANExtensionSupport extensionReader;
|
||||
// EANManufacturerOrgSupport eanManSupport;
|
||||
|
@ -83,6 +78,11 @@ public:
|
|||
|
||||
virtual BarcodeFormat getBarcodeFormat() = 0;
|
||||
virtual ~UPCEANReader();
|
||||
|
||||
friend class MultiFormatUPCEANReader;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,12 +22,9 @@
|
|||
#include <zxing/Result.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace oned {
|
||||
class UPCEReader;
|
||||
}
|
||||
}
|
||||
namespace oned {
|
||||
|
||||
class zxing::oned::UPCEReader : public UPCEANReader {
|
||||
class UPCEReader : public UPCEANReader {
|
||||
private:
|
||||
std::vector<int> decodeMiddleCounters;
|
||||
static bool determineNumSysAndCheckDigit(std::string& resultString, int lgPatternFound);
|
||||
|
@ -44,4 +41,7 @@ public:
|
|||
BarcodeFormat getBarcodeFormat();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
return TITLE_HEIGHT;
|
||||
} else if (indexPath.row == 1) {
|
||||
CGSize size = [[result stringForDisplay] sizeWithFont:bodyFont constrainedToSize:CGSizeMake(280.0, TEXT_VIEW_HEIGHT) lineBreakMode:UILineBreakModeWordWrap];
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"text size = %f", size.height);
|
||||
#endif
|
||||
return fminf(TEXT_VIEW_HEIGHT, fmaxf(44, size.height + 24));
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
#pragma mark ZXingDelegateMethods
|
||||
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)resultString {
|
||||
[self dismissModalViewControllerAnimated:YES];
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"result has %d actions", actions ? 0 : actions.count);
|
||||
#endif
|
||||
Scan * scan = [[Database sharedDatabase] addScanWithText:resultString];
|
||||
|
@ -190,13 +190,15 @@
|
|||
}
|
||||
|
||||
if (self.actions == nil || self.actions.count == 0) {
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"result has no actions to perform!");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.actions.count == 1) {
|
||||
ResultAction *action = [self.actions lastObject];
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"Result has the single action, (%@) '%@', performing it",
|
||||
NSStringFromClass([action class]), [action title]);
|
||||
#endif
|
||||
|
@ -204,7 +206,7 @@
|
|||
withObject:action
|
||||
afterDelay:0.0];
|
||||
} else {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"Result has multiple actions, popping up an action sheet");
|
||||
#endif
|
||||
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithFrame:self.view.bounds];
|
||||
|
|
|
@ -81,13 +81,13 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
|
|||
|
||||
- (ArrayRef<char>) prepareSubset {
|
||||
CGSize size = [image size];
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"decoding: image is (%.1f x %.1f), cropRect is (%.1f,%.1f)x(%.1f,%.1f)", size.width, size.height,
|
||||
cropRect.origin.x, cropRect.origin.y, cropRect.size.width, cropRect.size.height);
|
||||
#endif
|
||||
float scale = fminf(1.0f, fmaxf(SUBSET_SIZE / cropRect.size.width, SUBSET_SIZE / cropRect.size.height));
|
||||
CGPoint offset = CGPointMake(-cropRect.origin.x, -cropRect.origin.y);
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@" offset = (%.1f, %.1f), scale = %.3f", offset.x, offset.y, scale);
|
||||
#endif
|
||||
|
||||
|
@ -95,12 +95,12 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
|
|||
subsetHeight = cropRect.size.height * scale;
|
||||
|
||||
subsetBytesPerRow = ((subsetWidth + 0xf) >> 4) << 4;
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"decoding: image to decode is (%lu x %lu) (%lu bytes/row)", subsetWidth, subsetHeight, subsetBytesPerRow);
|
||||
#endif
|
||||
|
||||
ArrayRef<char> subsetData (subsetBytesPerRow * subsetHeight);
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"allocated %lu bytes of memory", subsetBytesPerRow * subsetHeight);
|
||||
#endif
|
||||
|
||||
|
@ -117,28 +117,28 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
|
|||
CGContextTranslateCTM(ctx, 0.0, subsetHeight);
|
||||
CGContextScaleCTM(ctx, 1.0, -1.0);
|
||||
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"created %lux%lu bitmap context", subsetWidth, subsetHeight);
|
||||
#endif
|
||||
|
||||
UIGraphicsPushContext(ctx);
|
||||
CGRect rect = CGRectMake(offset.x * scale, offset.y * scale, scale * size.width, scale * size.height);
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"rect for image = (%.1f,%.1f)x(%.1f,%.1f)", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
|
||||
#endif
|
||||
[image drawInRect:rect];
|
||||
UIGraphicsPopContext();
|
||||
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"drew image into %lu(%lu)x%lu bitmap context", subsetWidth, subsetBytesPerRow, subsetHeight);
|
||||
#endif
|
||||
CGContextFlush(ctx);
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"flushed context");
|
||||
#endif
|
||||
|
||||
CGImageRef subsetImageRef = CGBitmapContextCreateImage(ctx);
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"created CGImage from context");
|
||||
#endif
|
||||
|
||||
|
@ -146,7 +146,7 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
|
|||
CGImageRelease(subsetImageRef);
|
||||
|
||||
CGContextRelease(ctx);
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"released context");
|
||||
#endif
|
||||
return subsetData;
|
||||
|
@ -176,13 +176,13 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
|
|||
NSMutableArray *points = nil;
|
||||
NSString *resultString = nil;
|
||||
try {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"decoding gray image");
|
||||
#endif
|
||||
ResultPointCallback* callback_pointer(new ZXingWidgetControllerCallback(self));
|
||||
Ref<ResultPointCallback> callback(callback_pointer);
|
||||
Ref<Result> result([reader decode:grayImage andCallback:callback]);
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"gray image decoded");
|
||||
#endif
|
||||
|
||||
|
@ -201,12 +201,12 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
|
|||
if (decoderResult) [decoderResult release];
|
||||
decoderResult = [[TwoDDecoderResult alloc] initWithText:resultString points:points];
|
||||
} catch (ReaderException &rex) {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"failed to decode, caught ReaderException '%s'",
|
||||
rex.what());
|
||||
#endif
|
||||
} catch (IllegalArgumentException &iex) {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"failed to decode, caught IllegalArgumentException '%s'",
|
||||
iex.what());
|
||||
#endif
|
||||
|
@ -220,11 +220,11 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
|
|||
|
||||
#ifdef TRY_ROTATIONS
|
||||
if (!decoderResult) {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"rotating gray image");
|
||||
#endif
|
||||
grayImage = grayImage->rotateCounterClockwise();
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"gray image rotated");
|
||||
#endif
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
|
|||
}
|
||||
|
||||
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"finished decoding.");
|
||||
#endif
|
||||
[mainpool release];
|
||||
|
|
|
@ -237,7 +237,7 @@
|
|||
// DecoderDelegate methods
|
||||
|
||||
- (void)decoder:(Decoder *)decoder willDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset{
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"DecoderViewController MessageWhileDecodingWithDimensions: Decoding image (%.0fx%.0f) ...", image.size.width, image.size.height);
|
||||
#endif
|
||||
}
|
||||
|
@ -252,7 +252,7 @@
|
|||
if (beepSound != (SystemSoundID)-1) {
|
||||
AudioServicesPlaySystemSound(beepSound);
|
||||
}
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"result string = %@", resultString);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
}
|
||||
|
||||
- (void)populateActions {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"creating action to open URL '%@'", self.urlString);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -53,23 +53,23 @@ static NSMutableSet *sResultParsers = nil;
|
|||
|
||||
+ (ParsedResult *)parsedResultForString:(NSString *)s
|
||||
format:(BarcodeFormat)barcodeFormat {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"parsing result:\n<<<\n%@\n>>>\n", s);
|
||||
#endif
|
||||
for (Class c in [self resultParsers]) {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"trying %@", NSStringFromClass(c));
|
||||
#endif
|
||||
ParsedResult *result = [c parsedResultForString:s format:barcodeFormat];
|
||||
if (result != nil) {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"parsed as %@ %@", NSStringFromClass([result class]), result);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"No result parsers matched. Falling back to text.");
|
||||
#endif
|
||||
return [TextResultParser parsedResultForString:s format:barcodeFormat];
|
||||
|
|
|
@ -69,16 +69,16 @@ static NSMutableArray *sTheResultParsers = nil;
|
|||
|
||||
+ (ParsedResult *)parsedResultForString:(NSString *)s
|
||||
format:(BarcodeFormat)format {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"parsing result:\n<<<\n%@\n>>>\n", s);
|
||||
#endif
|
||||
for (Class c in sTheResultParsers) {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"trying %@", NSStringFromClass(c));
|
||||
#endif
|
||||
ParsedResult *result = [c parsedResultForString:s format:format];
|
||||
if (result != nil) {
|
||||
#ifdef ZXING_DEBUG
|
||||
#if ZXING_DEBUG
|
||||
NSLog(@"parsed as %@ %@", NSStringFromClass([result class]), result);
|
||||
#endif
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue