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:
smparkes@smparkes.net 2013-04-07 21:59:18 +00:00
parent cf2e1c9403
commit ae6e2e0bd3
45 changed files with 270 additions and 241 deletions

View file

@ -22,11 +22,11 @@
*/ */
namespace zxing { namespace zxing {
class BarcodeFormat;
}
class zxing::BarcodeFormat { class BarcodeFormat {
public: public:
// if you update the enum, update BarcodeFormat.cpp
enum Value { enum Value {
NONE, NONE,
AZTEC, AZTEC,
@ -52,12 +52,9 @@ public:
const Value value; const Value value;
operator Value () const {return value;} operator Value () const {return value;}
/* if you update the enum, please update the name in BarcodeFormat.cpp */
static char const* barcodeFormatNames[]; static char const* barcodeFormatNames[];
}; };
namespace zxing {
class BarcodeFormat;
} }
#endif // __BARCODE_FORMAT_H__ #endif // __BARCODE_FORMAT_H__

View file

@ -24,12 +24,12 @@
#include <zxing/ResultPointCallback.h> #include <zxing/ResultPointCallback.h>
namespace zxing { 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: private:
DecodeHintType hints; DecodeHintType hints;
Ref<ResultPointCallback> callback; Ref<ResultPointCallback> callback;
@ -78,4 +78,6 @@ class zxing::DecodeHints {
friend DecodeHints operator | (DecodeHints const&, DecodeHints const&); friend DecodeHints operator | (DecodeHints const&, DecodeHints const&);
}; };
}
#endif #endif

View file

@ -25,10 +25,8 @@
#include <exception> #include <exception>
namespace zxing { namespace zxing {
class Exception;
}
class zxing::Exception : public std::exception { class Exception : public std::exception {
private: private:
char const* const message; char const* const message;
@ -48,4 +46,6 @@ private:
void deleteMessage(); void deleteMessage();
}; };
}
#endif // __EXCEPTION_H__ #endif // __EXCEPTION_H__

View file

@ -22,14 +22,14 @@
#include <zxing/ReaderException.h> #include <zxing/ReaderException.h>
namespace zxing { namespace zxing {
class NotFoundException;
}
class zxing::NotFoundException : public ReaderException { class NotFoundException : public ReaderException {
public: public:
NotFoundException() throw() {} NotFoundException() throw() {}
NotFoundException(const char *msg) throw() : ReaderException(msg) {} NotFoundException(const char *msg) throw() : ReaderException(msg) {}
~NotFoundException() throw() {} ~NotFoundException() throw() {}
}; };
}
#endif // __NOT_FOUND_EXCEPTION_H__ #endif // __NOT_FOUND_EXCEPTION_H__

View file

@ -1,3 +1,4 @@
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
#ifndef __READER_EXCEPTION_H__ #ifndef __READER_EXCEPTION_H__
#define __READER_EXCEPTION_H__ #define __READER_EXCEPTION_H__
@ -23,14 +24,14 @@
#include <zxing/Exception.h> #include <zxing/Exception.h>
namespace zxing { namespace zxing {
class ReaderException;
}
class zxing::ReaderException : public Exception { class ReaderException : public Exception {
public: public:
ReaderException() throw() {} ReaderException() throw() {}
ReaderException(char const* msg) throw() : Exception(msg) {} ReaderException(char const* msg) throw() : Exception(msg) {}
~ReaderException() throw() {} ~ReaderException() throw() {}
}; };
}
#endif // __READER_EXCEPTION_H__ #endif // __READER_EXCEPTION_H__

View file

@ -18,6 +18,13 @@
#define __ZXING_H_ #define __ZXING_H_
#define ZXING_ARRAY_LEN(v) ((int)(sizeof(v)/sizeof(v[0]))) #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 #ifndef ZXING_DEBUG
#define ZXING_DEBUG 0 #define ZXING_DEBUG 0

View file

@ -25,22 +25,24 @@
#define ZXingWidget_AtztecDetecorResult_h #define ZXingWidget_AtztecDetecorResult_h
namespace zxing { namespace zxing {
namespace aztec { namespace aztec {
class AztecDetectorResult : public DetectorResult {
private: class AztecDetectorResult : public DetectorResult {
bool compact_; private:
int nbDatablocks_, nbLayers_; bool compact_;
public: int nbDatablocks_, nbLayers_;
AztecDetectorResult(Ref<BitMatrix> bits, public:
ArrayRef< Ref<ResultPoint> > points, AztecDetectorResult(Ref<BitMatrix> bits,
bool compact, ArrayRef< Ref<ResultPoint> > points,
int nbDatablocks, bool compact,
int nbLayers); int nbDatablocks,
bool isCompact(); int nbLayers);
int getNBDatablocks(); bool isCompact();
int getNBLayers(); int getNBDatablocks();
}; int getNBLayers();
} };
}
} }
#endif #endif

View file

@ -21,6 +21,7 @@
#include <zxing/aztec/AztecReader.h> #include <zxing/aztec/AztecReader.h>
#include <zxing/aztec/detector/Detector.h> #include <zxing/aztec/detector/Detector.h>
#include <zxing/common/DecoderResult.h>
#include <iostream> #include <iostream>
using zxing::Ref; using zxing::Ref;

View file

@ -27,23 +27,23 @@
#define ZXingWidget_AztecReader_h #define ZXingWidget_AztecReader_h
namespace zxing { namespace zxing {
namespace aztec { namespace aztec {
class AztecReader : public Reader { class AztecReader : public Reader {
private: private:
Decoder decoder_; Decoder decoder_;
protected: protected:
Decoder &getDecoder(); Decoder &getDecoder();
public: public:
AztecReader(); AztecReader();
virtual Ref<Result> decode(Ref<BinaryBitmap> image); virtual Ref<Result> decode(Ref<BinaryBitmap> image);
virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints); virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints);
virtual ~AztecReader(); virtual ~AztecReader();
}; };
} }
} }
#endif #endif

View file

@ -29,6 +29,7 @@
#include <zxing/common/reedsolomon/ReedSolomonException.h> #include <zxing/common/reedsolomon/ReedSolomonException.h>
#include <zxing/common/reedsolomon/GenericGF.h> #include <zxing/common/reedsolomon/GenericGF.h>
#include <zxing/common/IllegalArgumentException.h> #include <zxing/common/IllegalArgumentException.h>
#include <zxing/common/DecoderResult.h>
using zxing::aztec::Decoder; using zxing::aztec::Decoder;
using zxing::DecoderResult; using zxing::DecoderResult;

View file

@ -19,45 +19,51 @@
* limitations under the License. * 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/BitMatrix.h>
#include <zxing/common/Str.h> #include <zxing/common/Str.h>
#include <zxing/aztec/AztecDetectorResult.h> #include <zxing/aztec/AztecDetectorResult.h>
namespace zxing { namespace zxing {
namespace aztec {
class DecoderResult;
class Decoder : public Counted { namespace aztec {
private:
enum Table { class Decoder : public Counted {
UPPER, private:
LOWER, enum Table {
MIXED, UPPER,
DIGIT, LOWER,
PUNCT, MIXED,
BINARY DIGIT,
}; PUNCT,
BINARY
};
static Table getTable(char t); static Table getTable(char t);
static const char* getCharacter(Table table, int code); static const char* getCharacter(Table table, int code);
int numCodewords_; int numCodewords_;
int codewordSize_; int codewordSize_;
Ref<AztecDetectorResult> ddata_; Ref<AztecDetectorResult> ddata_;
int invertedBitCount_; int invertedBitCount_;
Ref<String> getEncodedData(Ref<BitArray> correctedBits); Ref<String> getEncodedData(Ref<BitArray> correctedBits);
Ref<BitArray> correctBits(Ref<BitArray> rawbits); Ref<BitArray> correctBits(Ref<BitArray> rawbits);
Ref<BitArray> extractBits(Ref<BitMatrix> matrix); Ref<BitArray> extractBits(Ref<BitMatrix> matrix);
static Ref<BitMatrix> removeDashedLines(Ref<BitMatrix> matrix); static Ref<BitMatrix> removeDashedLines(Ref<BitMatrix> matrix);
static int readCode(Ref<BitArray> rawbits, int startIndex, int length); static int readCode(Ref<BitArray> rawbits, int startIndex, int length);
public: public:
Decoder(); Decoder();
Ref<DecoderResult> decode(Ref<AztecDetectorResult> detectorResult); Ref<DecoderResult> decode(Ref<AztecDetectorResult> detectorResult);
}; };
} }
} }
#endif

View file

@ -19,6 +19,8 @@
* limitations under the License. * limitations under the License.
*/ */
#ifndef __ZXING_AZTEC_DETECTOR_DETECTOR_H__
#define __ZXING_AZTEC_DETECTOR_DETECTOR_H__
#include <vector> #include <vector>
@ -29,13 +31,9 @@
#include <zxing/aztec/AztecDetectorResult.h> #include <zxing/aztec/AztecDetectorResult.h>
namespace zxing { namespace zxing {
namespace aztec { namespace aztec {
class Point;
class Detector;
}
}
class zxing::aztec::Point : public Counted { class Point : public Counted {
public: public:
int x; int x;
int y; int y;
@ -48,7 +46,7 @@ public:
}; };
class zxing::aztec::Detector : public Counted { class Detector : public Counted {
private: private:
Ref<BitMatrix> image_; Ref<BitMatrix> image_;
@ -84,3 +82,8 @@ public:
Detector(Ref<BitMatrix> image); Detector(Ref<BitMatrix> image);
Ref<AztecDetectorResult> detect(); Ref<AztecDetectorResult> detect();
}; };
}
}
#endif

View file

@ -18,6 +18,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include <zxing/ZXing.h>
#include <zxing/common/Counted.h> #include <zxing/common/Counted.h>
#include <zxing/common/IllegalArgumentException.h> #include <zxing/common/IllegalArgumentException.h>
#include <zxing/common/Array.h> #include <zxing/common/Array.h>
@ -26,19 +27,8 @@
#include <iostream> #include <iostream>
namespace zxing { namespace zxing {
class BitArray;
std::ostream& operator << (std::ostream&, BitArray const&);
}
#define ZX_LOG_DIGITS(digits) \ class BitArray : public Counted {
((digits == 8) ? 3 : \
((digits == 16) ? 4 : \
((digits == 32) ? 5 : \
((digits == 64) ? 6 : \
((digits == 128) ? 7 : \
(-1))))))
class zxing::BitArray : public Counted {
public: public:
static const int bitsPerWord = std::numeric_limits<unsigned int>::digits; static const int bitsPerWord = std::numeric_limits<unsigned int>::digits;
@ -71,18 +61,21 @@ public:
std::vector<int>& getBitArray(); std::vector<int>& getBitArray();
void reverse(); void reverse();
class Reverse;
class Reverse {
private:
Ref<BitArray> array;
public:
Reverse(Ref<BitArray> array);
~Reverse();
};
private: private:
static int makeArraySize(int size); static int makeArraySize(int size);
}; };
class zxing::BitArray::Reverse { std::ostream& operator << (std::ostream&, BitArray const&);
private:
Ref<BitArray> array; }
public:
Reverse(Ref<BitArray> array);
~Reverse();
};
#endif // __BIT_ARRAY_H__ #endif // __BIT_ARRAY_H__

View file

@ -27,10 +27,8 @@
#include <limits> #include <limits>
namespace zxing { namespace zxing {
class BitMatrix;
}
class zxing::BitMatrix : public Counted { class BitMatrix : public Counted {
public: public:
static const int bitsPerWord = std::numeric_limits<unsigned int>::digits; static const int bitsPerWord = std::numeric_limits<unsigned int>::digits;
@ -87,4 +85,6 @@ private:
BitMatrix& operator =(const BitMatrix&); BitMatrix& operator =(const BitMatrix&);
}; };
}
#endif // __BIT_MATRIX_H__ #endif // __BIT_MATRIX_H__

View file

@ -23,12 +23,9 @@
#include <zxing/DecodeHints.h> #include <zxing/DecodeHints.h>
namespace zxing { namespace zxing {
namespace common { namespace common {
class CharacterSetECI;
}
}
class zxing::common::CharacterSetECI { class CharacterSetECI {
private: private:
static std::map<int, CharacterSetECI*> VALUE_TO_ECI; static std::map<int, CharacterSetECI*> VALUE_TO_ECI;
static std::map<std::string, CharacterSetECI*> NAME_TO_ECI; static std::map<std::string, CharacterSetECI*> NAME_TO_ECI;
@ -50,4 +47,7 @@ public:
static CharacterSetECI* getCharacterSetECIByName(std::string const& name); static CharacterSetECI* getCharacterSetECIByName(std::string const& name);
}; };
}
}
#endif #endif

View file

@ -26,10 +26,8 @@
#include <zxing/ResultPoint.h> #include <zxing/ResultPoint.h>
namespace zxing { namespace zxing {
class DetectorResult;
}
class zxing::DetectorResult : public Counted { class DetectorResult : public Counted {
private: private:
Ref<BitMatrix> bits_; Ref<BitMatrix> bits_;
ArrayRef< Ref<ResultPoint> > points_; ArrayRef< Ref<ResultPoint> > points_;
@ -40,4 +38,6 @@ public:
ArrayRef< Ref<ResultPoint> > getPoints(); ArrayRef< Ref<ResultPoint> > getPoints();
}; };
}
#endif // __DETECTOR_RESULT_H__ #endif // __DETECTOR_RESULT_H__

View file

@ -26,10 +26,8 @@
#include <zxing/common/Array.h> #include <zxing/common/Array.h>
namespace zxing { namespace zxing {
class GlobalHistogramBinarizer;
}
class zxing::GlobalHistogramBinarizer : public Binarizer { class GlobalHistogramBinarizer : public Binarizer {
private: private:
ArrayRef<char> luminances; ArrayRef<char> luminances;
ArrayRef<int> buckets; ArrayRef<int> buckets;
@ -44,5 +42,7 @@ public:
private: private:
void initArrays(int luminanceSize); void initArrays(int luminanceSize);
}; };
}
#endif /* GLOBALHISTOGRAMBINARIZER_H_ */ #endif /* GLOBALHISTOGRAMBINARIZER_H_ */

View file

@ -23,14 +23,14 @@
#include <zxing/Exception.h> #include <zxing/Exception.h>
namespace zxing { namespace zxing {
class IllegalArgumentException;
}
class zxing::IllegalArgumentException : public zxing::Exception { class IllegalArgumentException : public Exception {
public: public:
IllegalArgumentException(); IllegalArgumentException();
IllegalArgumentException(const char *msg); IllegalArgumentException(const char *msg);
~IllegalArgumentException() throw(); ~IllegalArgumentException() throw();
}; };
}
#endif // __ILLEGAL_ARGUMENT_EXCEPTION_H__ #endif // __ILLEGAL_ARGUMENT_EXCEPTION_H__

View file

@ -26,11 +26,11 @@
#include <zxing/common/Counted.h> #include <zxing/common/Counted.h>
namespace zxing { 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: private:
std::string text_; std::string text_;
public: public:
@ -43,4 +43,6 @@ public:
friend std::ostream& zxing::operator << (std::ostream& out, String const& s); friend std::ostream& zxing::operator << (std::ostream& out, String const& s);
}; };
}
#endif // __COMMON__STRING_H__ #endif // __COMMON__STRING_H__

View file

@ -24,12 +24,9 @@
#include <zxing/DecodeHints.h> #include <zxing/DecodeHints.h>
namespace zxing { namespace zxing {
namespace common { namespace common {
class StringUtils;
}
}
class zxing::common::StringUtils { class StringUtils {
private: private:
static char const* const PLATFORM_DEFAULT_ENCODING; static char const* const PLATFORM_DEFAULT_ENCODING;
@ -49,4 +46,7 @@ public:
static std::string guessEncoding(char* bytes, int length, Hashtable const& hints); static std::string guessEncoding(char* bytes, int length, Hashtable const& hints);
}; };
}
}
#endif #endif

View file

@ -27,11 +27,10 @@
#include <zxing/common/Counted.h> #include <zxing/common/Counted.h>
namespace zxing { namespace zxing {
class GenericGF;
class GenericGFPoly; class GenericGF;
}
class zxing::GenericGFPoly : public Counted { class GenericGFPoly : public Counted {
private: private:
Ref<GenericGF> field_; Ref<GenericGF> field_;
ArrayRef<int> coefficients_; ArrayRef<int> coefficients_;
@ -49,7 +48,9 @@ public:
Ref<GenericGFPoly> multiplyByMonomial(int degree, int coefficient); Ref<GenericGFPoly> multiplyByMonomial(int degree, int coefficient);
std::vector<Ref<GenericGFPoly> > divide(Ref<GenericGFPoly> other); std::vector<Ref<GenericGFPoly> > divide(Ref<GenericGFPoly> other);
//#warning todo: add print method
}; };
}
#endif //GENERICGFPOLY_H #endif //GENERICGFPOLY_H

View file

@ -24,6 +24,7 @@
namespace zxing { namespace zxing {
namespace multi { namespace multi {
class ByQuadrantReader : public Reader { class ByQuadrantReader : public Reader {
private: private:
Reader& delegate_; Reader& delegate_;
@ -34,7 +35,8 @@ class ByQuadrantReader : public Reader {
virtual Ref<Result> decode(Ref<BinaryBitmap> image); virtual Ref<Result> decode(Ref<BinaryBitmap> image);
virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints); virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints);
}; };
} // End zxing::multi namespace
} // End zxing namespace }
}
#endif // __BY_QUADRANT_READER_H__ #endif // __BY_QUADRANT_READER_H__

View file

@ -25,6 +25,7 @@
namespace zxing { namespace zxing {
namespace multi { namespace multi {
class MultipleBarcodeReader : public Counted { class MultipleBarcodeReader : public Counted {
protected: protected:
MultipleBarcodeReader() {} MultipleBarcodeReader() {}
@ -33,7 +34,8 @@ class MultipleBarcodeReader : public Counted {
virtual std::vector<Ref<Result> > decodeMultiple(Ref<BinaryBitmap> image, DecodeHints hints) = 0; virtual std::vector<Ref<Result> > decodeMultiple(Ref<BinaryBitmap> image, DecodeHints hints) = 0;
virtual ~MultipleBarcodeReader(); virtual ~MultipleBarcodeReader();
}; };
} // End zxing::multi namespace
} // End zxing namespace }
}
#endif // __MULTIPLE_BARCODE_READER_H__ #endif // __MULTIPLE_BARCODE_READER_H__

View file

@ -22,13 +22,15 @@
namespace zxing { namespace zxing {
namespace multi { namespace multi {
class QRCodeMultiReader: public zxing::qrcode::QRCodeReader, public MultipleBarcodeReader { class QRCodeMultiReader: public zxing::qrcode::QRCodeReader, public MultipleBarcodeReader {
public: public:
QRCodeMultiReader(); QRCodeMultiReader();
virtual ~QRCodeMultiReader(); virtual ~QRCodeMultiReader();
virtual std::vector<Ref<Result> > decodeMultiple(Ref<BinaryBitmap> image, DecodeHints hints); virtual std::vector<Ref<Result> > decodeMultiple(Ref<BinaryBitmap> image, DecodeHints hints);
}; };
} // End zxing::multi namespace
} // End zxing namespace }
}
#endif // __QRCODE_MULTI_READER_H__ #endif // __QRCODE_MULTI_READER_H__

View file

@ -23,13 +23,15 @@
namespace zxing { namespace zxing {
namespace multi { namespace multi {
class MultiDetector : public zxing::qrcode::Detector { class MultiDetector : public zxing::qrcode::Detector {
public: public:
MultiDetector(Ref<BitMatrix> image); MultiDetector(Ref<BitMatrix> image);
virtual ~MultiDetector(); virtual ~MultiDetector();
virtual std::vector<Ref<DetectorResult> > detectMulti(DecodeHints hints); virtual std::vector<Ref<DetectorResult> > detectMulti(DecodeHints hints);
}; };
} // End zxing::multi namespace
} // End zxing namespace }
}
#endif // __MULTI_DETECTOR_H__ #endif // __MULTI_DETECTOR_H__

View file

@ -23,6 +23,7 @@
namespace zxing { namespace zxing {
namespace multi { namespace multi {
class MultiFinderPatternFinder : zxing::qrcode::FinderPatternFinder { class MultiFinderPatternFinder : zxing::qrcode::FinderPatternFinder {
private: private:
std::vector<std::vector<Ref<zxing::qrcode::FinderPattern> > > selectBestPatterns(); std::vector<std::vector<Ref<zxing::qrcode::FinderPattern> > > selectBestPatterns();
@ -39,6 +40,7 @@ class MultiFinderPatternFinder : zxing::qrcode::FinderPatternFinder {
}; };
} }
} }

View file

@ -22,12 +22,9 @@
#include <zxing/Result.h> #include <zxing/Result.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class CodaBarReader;
}
}
class zxing::oned::CodaBarReader : public OneDReader { class CodaBarReader : public OneDReader {
private: private:
static const int MAX_ACCEPTABLE; static const int MAX_ACCEPTABLE;
static const int PADDING; static const int PADDING;
@ -54,4 +51,7 @@ private:
int toNarrowWidePattern(int position); int toNarrowWidePattern(int position);
}; };
}
}
#endif #endif

View file

@ -22,12 +22,9 @@
#include <zxing/Result.h> #include <zxing/Result.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class Code128Reader;
}
}
class zxing::oned::Code128Reader : public OneDReader { class Code128Reader : public OneDReader {
private: private:
static const int MAX_AVG_VARIANCE; static const int MAX_AVG_VARIANCE;
static const int MAX_INDIVIDUAL_VARIANCE; static const int MAX_INDIVIDUAL_VARIANCE;
@ -45,4 +42,7 @@ public:
BarcodeFormat getBarcodeFormat(); BarcodeFormat getBarcodeFormat();
}; };
}
}
#endif #endif

View file

@ -25,17 +25,14 @@
#include <zxing/Result.h> #include <zxing/Result.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class Code39Reader;
}
}
/** /**
* <p>Decodes Code 39 barcodes. This does not support "Full ASCII Code 39" yet.</p> * <p>Decodes Code 39 barcodes. This does not support "Full ASCII Code 39" yet.</p>
* Ported form Java (author Sean Owen) * Ported form Java (author Sean Owen)
* @author Lukasz Warchol * @author Lukasz Warchol
*/ */
class zxing::oned::Code39Reader : public OneDReader { class Code39Reader : public OneDReader {
private: private:
bool usingCheckDigit; bool usingCheckDigit;
bool extendedMode; bool extendedMode;
@ -60,4 +57,7 @@ public:
Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row); Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
}; };
}
}
#endif #endif

View file

@ -25,17 +25,14 @@
#include <zxing/Result.h> #include <zxing/Result.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class Code93Reader;
}
}
/** /**
* <p>Decodes Code 93 barcodes. This does not support "Full ASCII Code 93" yet.</p> * <p>Decodes Code 93 barcodes. This does not support "Full ASCII Code 93" yet.</p>
* Ported form Java (author Sean Owen) * Ported form Java (author Sean Owen)
* @author Lukasz Warchol * @author Lukasz Warchol
*/ */
class zxing::oned::Code93Reader : public OneDReader { class Code93Reader : public OneDReader {
public: public:
Code93Reader(); Code93Reader();
Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row); Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
@ -55,4 +52,7 @@ private:
int weightMax); int weightMax);
}; };
}
}
#endif #endif

View file

@ -25,12 +25,9 @@
#include <zxing/Result.h> #include <zxing/Result.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class EAN13Reader;
}
}
class zxing::oned::EAN13Reader : public UPCEANReader { class EAN13Reader : public UPCEANReader {
private: private:
std::vector<int> decodeMiddleCounters; std::vector<int> decodeMiddleCounters;
static void determineFirstDigit(std::string& resultString, static void determineFirstDigit(std::string& resultString,
@ -46,4 +43,7 @@ public:
BarcodeFormat getBarcodeFormat(); BarcodeFormat getBarcodeFormat();
}; };
}
}
#endif #endif

View file

@ -25,15 +25,13 @@
#include <zxing/Result.h> #include <zxing/Result.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class EAN8Reader;
}
}
class zxing::oned::EAN8Reader : public UPCEANReader { class EAN8Reader : public UPCEANReader {
private:
std::vector<int> decodeMiddleCounters; std::vector<int> decodeMiddleCounters;
public: public:
EAN8Reader(); EAN8Reader();
int decodeMiddle(Ref<BitArray> row, int decodeMiddle(Ref<BitArray> row,
@ -43,4 +41,7 @@ public:
BarcodeFormat getBarcodeFormat(); BarcodeFormat getBarcodeFormat();
}; };
}
}
#endif #endif

View file

@ -23,13 +23,9 @@
#include <zxing/Result.h> #include <zxing/Result.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class ITFReader;
}
}
class zxing::oned::ITFReader : public OneDReader { class ITFReader : public OneDReader {
private: private:
enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 420/1000)}; 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)}; enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 800/1000)};
@ -52,4 +48,7 @@ public:
~ITFReader(); ~ITFReader();
}; };
}
}
#endif #endif

View file

@ -23,13 +23,11 @@
#include <zxing/oned/OneDReader.h> #include <zxing/oned/OneDReader.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class UPCEANReader;
class MultiFormatUPCEANReader;
}
}
class zxing::oned::MultiFormatUPCEANReader : public OneDReader { class UPCEANReader;
class MultiFormatUPCEANReader : public OneDReader {
private: private:
std::vector< Ref<UPCEANReader> > readers; std::vector< Ref<UPCEANReader> > readers;
public: public:
@ -37,4 +35,7 @@ public:
Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row); Ref<Result> decodeRow(int rowNumber, Ref<BitArray> row);
}; };
}
}
#endif #endif

View file

@ -24,12 +24,9 @@
#include <zxing/Reader.h> #include <zxing/Reader.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class OneDReader;
}
}
class zxing::oned::OneDReader : public Reader { class OneDReader : public Reader {
private: private:
Ref<Result> doDecode(Ref<BinaryBitmap> image, DecodeHints hints); Ref<Result> doDecode(Ref<BinaryBitmap> image, DecodeHints hints);
@ -78,4 +75,7 @@ public:
virtual ~OneDReader(); virtual ~OneDReader();
}; };
}
}
#endif #endif

View file

@ -24,12 +24,9 @@
#include <zxing/DecodeHints.h> #include <zxing/DecodeHints.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class UPCAReader;
}
}
class zxing::oned::UPCAReader : public UPCEANReader { class UPCAReader : public UPCEANReader {
private: private:
EAN13Reader ean13Reader; EAN13Reader ean13Reader;
@ -47,4 +44,7 @@ public:
BarcodeFormat getBarcodeFormat(); BarcodeFormat getBarcodeFormat();
}; };
}
}
#endif #endif

View file

@ -23,15 +23,10 @@
#include <zxing/Result.h> #include <zxing/Result.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class MultiFormatUPCEANReader;
class UPCEANReader;
}
}
class zxing::oned::UPCEANReader : public OneDReader { class UPCEANReader : public OneDReader {
friend class MultiFormatUPCEANReader; private:
private:
std::string decodeRowStringBuffer; std::string decodeRowStringBuffer;
// UPCEANExtensionSupport extensionReader; // UPCEANExtensionSupport extensionReader;
// EANManufacturerOrgSupport eanManSupport; // EANManufacturerOrgSupport eanManSupport;
@ -83,6 +78,11 @@ public:
virtual BarcodeFormat getBarcodeFormat() = 0; virtual BarcodeFormat getBarcodeFormat() = 0;
virtual ~UPCEANReader(); virtual ~UPCEANReader();
friend class MultiFormatUPCEANReader;
}; };
}
}
#endif #endif

View file

@ -22,12 +22,9 @@
#include <zxing/Result.h> #include <zxing/Result.h>
namespace zxing { namespace zxing {
namespace oned { namespace oned {
class UPCEReader;
}
}
class zxing::oned::UPCEReader : public UPCEANReader { class UPCEReader : public UPCEANReader {
private: private:
std::vector<int> decodeMiddleCounters; std::vector<int> decodeMiddleCounters;
static bool determineNumSysAndCheckDigit(std::string& resultString, int lgPatternFound); static bool determineNumSysAndCheckDigit(std::string& resultString, int lgPatternFound);
@ -44,4 +41,7 @@ public:
BarcodeFormat getBarcodeFormat(); BarcodeFormat getBarcodeFormat();
}; };
}
}
#endif #endif

View file

@ -141,7 +141,7 @@
return TITLE_HEIGHT; return TITLE_HEIGHT;
} else if (indexPath.row == 1) { } else if (indexPath.row == 1) {
CGSize size = [[result stringForDisplay] sizeWithFont:bodyFont constrainedToSize:CGSizeMake(280.0, TEXT_VIEW_HEIGHT) lineBreakMode:UILineBreakModeWordWrap]; 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); NSLog(@"text size = %f", size.height);
#endif #endif
return fminf(TEXT_VIEW_HEIGHT, fmaxf(44, size.height + 24)); return fminf(TEXT_VIEW_HEIGHT, fmaxf(44, size.height + 24));

View file

@ -109,7 +109,7 @@
#pragma mark ZXingDelegateMethods #pragma mark ZXingDelegateMethods
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)resultString { - (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)resultString {
[self dismissModalViewControllerAnimated:YES]; [self dismissModalViewControllerAnimated:YES];
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"result has %d actions", actions ? 0 : actions.count); NSLog(@"result has %d actions", actions ? 0 : actions.count);
#endif #endif
Scan * scan = [[Database sharedDatabase] addScanWithText:resultString]; Scan * scan = [[Database sharedDatabase] addScanWithText:resultString];
@ -190,13 +190,15 @@
} }
if (self.actions == nil || self.actions.count == 0) { if (self.actions == nil || self.actions.count == 0) {
#if ZXING_DEBUG
NSLog(@"result has no actions to perform!"); NSLog(@"result has no actions to perform!");
#endif
return; return;
} }
if (self.actions.count == 1) { if (self.actions.count == 1) {
ResultAction *action = [self.actions lastObject]; ResultAction *action = [self.actions lastObject];
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"Result has the single action, (%@) '%@', performing it", NSLog(@"Result has the single action, (%@) '%@', performing it",
NSStringFromClass([action class]), [action title]); NSStringFromClass([action class]), [action title]);
#endif #endif
@ -204,7 +206,7 @@
withObject:action withObject:action
afterDelay:0.0]; afterDelay:0.0];
} else { } else {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"Result has multiple actions, popping up an action sheet"); NSLog(@"Result has multiple actions, popping up an action sheet");
#endif #endif
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithFrame:self.view.bounds]; UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithFrame:self.view.bounds];

View file

@ -81,13 +81,13 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
- (ArrayRef<char>) prepareSubset { - (ArrayRef<char>) prepareSubset {
CGSize size = [image size]; 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, 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); cropRect.origin.x, cropRect.origin.y, cropRect.size.width, cropRect.size.height);
#endif #endif
float scale = fminf(1.0f, fmaxf(SUBSET_SIZE / cropRect.size.width, SUBSET_SIZE / cropRect.size.height)); 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); 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); NSLog(@" offset = (%.1f, %.1f), scale = %.3f", offset.x, offset.y, scale);
#endif #endif
@ -95,12 +95,12 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
subsetHeight = cropRect.size.height * scale; subsetHeight = cropRect.size.height * scale;
subsetBytesPerRow = ((subsetWidth + 0xf) >> 4) << 4; 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); NSLog(@"decoding: image to decode is (%lu x %lu) (%lu bytes/row)", subsetWidth, subsetHeight, subsetBytesPerRow);
#endif #endif
ArrayRef<char> subsetData (subsetBytesPerRow * subsetHeight); ArrayRef<char> subsetData (subsetBytesPerRow * subsetHeight);
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"allocated %lu bytes of memory", subsetBytesPerRow * subsetHeight); NSLog(@"allocated %lu bytes of memory", subsetBytesPerRow * subsetHeight);
#endif #endif
@ -117,28 +117,28 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
CGContextTranslateCTM(ctx, 0.0, subsetHeight); CGContextTranslateCTM(ctx, 0.0, subsetHeight);
CGContextScaleCTM(ctx, 1.0, -1.0); CGContextScaleCTM(ctx, 1.0, -1.0);
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"created %lux%lu bitmap context", subsetWidth, subsetHeight); NSLog(@"created %lux%lu bitmap context", subsetWidth, subsetHeight);
#endif #endif
UIGraphicsPushContext(ctx); UIGraphicsPushContext(ctx);
CGRect rect = CGRectMake(offset.x * scale, offset.y * scale, scale * size.width, scale * size.height); 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); NSLog(@"rect for image = (%.1f,%.1f)x(%.1f,%.1f)", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
#endif #endif
[image drawInRect:rect]; [image drawInRect:rect];
UIGraphicsPopContext(); UIGraphicsPopContext();
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"drew image into %lu(%lu)x%lu bitmap context", subsetWidth, subsetBytesPerRow, subsetHeight); NSLog(@"drew image into %lu(%lu)x%lu bitmap context", subsetWidth, subsetBytesPerRow, subsetHeight);
#endif #endif
CGContextFlush(ctx); CGContextFlush(ctx);
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"flushed context"); NSLog(@"flushed context");
#endif #endif
CGImageRef subsetImageRef = CGBitmapContextCreateImage(ctx); CGImageRef subsetImageRef = CGBitmapContextCreateImage(ctx);
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"created CGImage from context"); NSLog(@"created CGImage from context");
#endif #endif
@ -146,7 +146,7 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
CGImageRelease(subsetImageRef); CGImageRelease(subsetImageRef);
CGContextRelease(ctx); CGContextRelease(ctx);
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"released context"); NSLog(@"released context");
#endif #endif
return subsetData; return subsetData;
@ -176,13 +176,13 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
NSMutableArray *points = nil; NSMutableArray *points = nil;
NSString *resultString = nil; NSString *resultString = nil;
try { try {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"decoding gray image"); NSLog(@"decoding gray image");
#endif #endif
ResultPointCallback* callback_pointer(new ZXingWidgetControllerCallback(self)); ResultPointCallback* callback_pointer(new ZXingWidgetControllerCallback(self));
Ref<ResultPointCallback> callback(callback_pointer); Ref<ResultPointCallback> callback(callback_pointer);
Ref<Result> result([reader decode:grayImage andCallback:callback]); Ref<Result> result([reader decode:grayImage andCallback:callback]);
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"gray image decoded"); NSLog(@"gray image decoded");
#endif #endif
@ -201,12 +201,12 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
if (decoderResult) [decoderResult release]; if (decoderResult) [decoderResult release];
decoderResult = [[TwoDDecoderResult alloc] initWithText:resultString points:points]; decoderResult = [[TwoDDecoderResult alloc] initWithText:resultString points:points];
} catch (ReaderException &rex) { } catch (ReaderException &rex) {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"failed to decode, caught ReaderException '%s'", NSLog(@"failed to decode, caught ReaderException '%s'",
rex.what()); rex.what());
#endif #endif
} catch (IllegalArgumentException &iex) { } catch (IllegalArgumentException &iex) {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"failed to decode, caught IllegalArgumentException '%s'", NSLog(@"failed to decode, caught IllegalArgumentException '%s'",
iex.what()); iex.what());
#endif #endif
@ -220,11 +220,11 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
#ifdef TRY_ROTATIONS #ifdef TRY_ROTATIONS
if (!decoderResult) { if (!decoderResult) {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"rotating gray image"); NSLog(@"rotating gray image");
#endif #endif
grayImage = grayImage->rotateCounterClockwise(); grayImage = grayImage->rotateCounterClockwise();
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"gray image rotated"); NSLog(@"gray image rotated");
#endif #endif
} }
@ -245,7 +245,7 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
} }
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"finished decoding."); NSLog(@"finished decoding.");
#endif #endif
[mainpool release]; [mainpool release];

View file

@ -237,7 +237,7 @@
// DecoderDelegate methods // DecoderDelegate methods
- (void)decoder:(Decoder *)decoder willDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset{ - (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); NSLog(@"DecoderViewController MessageWhileDecodingWithDimensions: Decoding image (%.0fx%.0f) ...", image.size.width, image.size.height);
#endif #endif
} }
@ -252,7 +252,7 @@
if (beepSound != (SystemSoundID)-1) { if (beepSound != (SystemSoundID)-1) {
AudioServicesPlaySystemSound(beepSound); AudioServicesPlaySystemSound(beepSound);
} }
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"result string = %@", resultString); NSLog(@"result string = %@", resultString);
#endif #endif
} }

View file

@ -71,7 +71,7 @@
} }
- (void)populateActions { - (void)populateActions {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"creating action to open URL '%@'", self.urlString); NSLog(@"creating action to open URL '%@'", self.urlString);
#endif #endif

View file

@ -53,23 +53,23 @@ static NSMutableSet *sResultParsers = nil;
+ (ParsedResult *)parsedResultForString:(NSString *)s + (ParsedResult *)parsedResultForString:(NSString *)s
format:(BarcodeFormat)barcodeFormat { format:(BarcodeFormat)barcodeFormat {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"parsing result:\n<<<\n%@\n>>>\n", s); NSLog(@"parsing result:\n<<<\n%@\n>>>\n", s);
#endif #endif
for (Class c in [self resultParsers]) { for (Class c in [self resultParsers]) {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"trying %@", NSStringFromClass(c)); NSLog(@"trying %@", NSStringFromClass(c));
#endif #endif
ParsedResult *result = [c parsedResultForString:s format:barcodeFormat]; ParsedResult *result = [c parsedResultForString:s format:barcodeFormat];
if (result != nil) { if (result != nil) {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"parsed as %@ %@", NSStringFromClass([result class]), result); NSLog(@"parsed as %@ %@", NSStringFromClass([result class]), result);
#endif #endif
return result; return result;
} }
} }
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"No result parsers matched. Falling back to text."); NSLog(@"No result parsers matched. Falling back to text.");
#endif #endif
return [TextResultParser parsedResultForString:s format:barcodeFormat]; return [TextResultParser parsedResultForString:s format:barcodeFormat];

View file

@ -69,16 +69,16 @@ static NSMutableArray *sTheResultParsers = nil;
+ (ParsedResult *)parsedResultForString:(NSString *)s + (ParsedResult *)parsedResultForString:(NSString *)s
format:(BarcodeFormat)format { format:(BarcodeFormat)format {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"parsing result:\n<<<\n%@\n>>>\n", s); NSLog(@"parsing result:\n<<<\n%@\n>>>\n", s);
#endif #endif
for (Class c in sTheResultParsers) { for (Class c in sTheResultParsers) {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"trying %@", NSStringFromClass(c)); NSLog(@"trying %@", NSStringFromClass(c));
#endif #endif
ParsedResult *result = [c parsedResultForString:s format:format]; ParsedResult *result = [c parsedResultForString:s format:format];
if (result != nil) { if (result != nil) {
#ifdef ZXING_DEBUG #if ZXING_DEBUG
NSLog(@"parsed as %@ %@", NSStringFromClass([result class]), result); NSLog(@"parsed as %@ %@", NSStringFromClass([result class]), result);
#endif #endif
return result; return result;