diff --git a/cpp/core/src/zxing/BarcodeFormat.h b/cpp/core/src/zxing/BarcodeFormat.h index d58152a30..f9d123dd9 100644 --- a/cpp/core/src/zxing/BarcodeFormat.h +++ b/cpp/core/src/zxing/BarcodeFormat.h @@ -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__ diff --git a/cpp/core/src/zxing/DecodeHints.h b/cpp/core/src/zxing/DecodeHints.h index da7393602..76d34fb97 100644 --- a/cpp/core/src/zxing/DecodeHints.h +++ b/cpp/core/src/zxing/DecodeHints.h @@ -24,12 +24,12 @@ #include 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 callback; @@ -78,4 +78,6 @@ class zxing::DecodeHints { friend DecodeHints operator | (DecodeHints const&, DecodeHints const&); }; +} + #endif diff --git a/cpp/core/src/zxing/Exception.h b/cpp/core/src/zxing/Exception.h index c7aa1b3de..f0df1e5b4 100644 --- a/cpp/core/src/zxing/Exception.h +++ b/cpp/core/src/zxing/Exception.h @@ -25,10 +25,8 @@ #include 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__ diff --git a/cpp/core/src/zxing/NotFoundException.h b/cpp/core/src/zxing/NotFoundException.h index 4fd97677e..d44336259 100644 --- a/cpp/core/src/zxing/NotFoundException.h +++ b/cpp/core/src/zxing/NotFoundException.h @@ -22,14 +22,14 @@ #include 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__ diff --git a/cpp/core/src/zxing/ReaderException.h b/cpp/core/src/zxing/ReaderException.h index cf726f895..b09aea3bd 100644 --- a/cpp/core/src/zxing/ReaderException.h +++ b/cpp/core/src/zxing/ReaderException.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 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__ diff --git a/cpp/core/src/zxing/ZXing.h b/cpp/core/src/zxing/ZXing.h index c30762604..85799af71 100644 --- a/cpp/core/src/zxing/ZXing.h +++ b/cpp/core/src/zxing/ZXing.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 diff --git a/cpp/core/src/zxing/aztec/AztecDetectorResult.h b/cpp/core/src/zxing/aztec/AztecDetectorResult.h index 0e0ca9dc6..3e0557980 100644 --- a/cpp/core/src/zxing/aztec/AztecDetectorResult.h +++ b/cpp/core/src/zxing/aztec/AztecDetectorResult.h @@ -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 bits, - ArrayRef< Ref > 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 bits, + ArrayRef< Ref > points, + bool compact, + int nbDatablocks, + int nbLayers); + bool isCompact(); + int getNBDatablocks(); + int getNBLayers(); +}; + +} } #endif diff --git a/cpp/core/src/zxing/aztec/AztecReader.cpp b/cpp/core/src/zxing/aztec/AztecReader.cpp index 8620e5ce1..91b28c0ed 100644 --- a/cpp/core/src/zxing/aztec/AztecReader.cpp +++ b/cpp/core/src/zxing/aztec/AztecReader.cpp @@ -21,6 +21,7 @@ #include #include +#include #include using zxing::Ref; diff --git a/cpp/core/src/zxing/aztec/AztecReader.h b/cpp/core/src/zxing/aztec/AztecReader.h index 0ab0ce030..97850029c 100644 --- a/cpp/core/src/zxing/aztec/AztecReader.h +++ b/cpp/core/src/zxing/aztec/AztecReader.h @@ -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 decode(Ref image); - virtual Ref decode(Ref image, DecodeHints hints); - virtual ~AztecReader(); - }; + public: + AztecReader(); + virtual Ref decode(Ref image); + virtual Ref decode(Ref image, DecodeHints hints); + virtual ~AztecReader(); +}; - } +} } #endif diff --git a/cpp/core/src/zxing/aztec/decoder/Decoder.cpp b/cpp/core/src/zxing/aztec/decoder/Decoder.cpp index b1d2e280f..0856364e7 100644 --- a/cpp/core/src/zxing/aztec/decoder/Decoder.cpp +++ b/cpp/core/src/zxing/aztec/decoder/Decoder.cpp @@ -29,6 +29,7 @@ #include #include #include +#include using zxing::aztec::Decoder; using zxing::DecoderResult; diff --git a/cpp/core/src/zxing/aztec/decoder/Decoder.h b/cpp/core/src/zxing/aztec/decoder/Decoder.h index e29801c69..d9f5cceef 100644 --- a/cpp/core/src/zxing/aztec/decoder/Decoder.h +++ b/cpp/core/src/zxing/aztec/decoder/Decoder.h @@ -19,45 +19,51 @@ * limitations under the License. */ -#include +#ifndef __ZXING_AZTEC_DECODER_DECODER_H__ +#define __ZXING_AZTEC_DECODER_DECODER_H__ + #include #include #include 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 ddata_; - int invertedBitCount_; + int numCodewords_; + int codewordSize_; + Ref ddata_; + int invertedBitCount_; - Ref getEncodedData(Ref correctedBits); - Ref correctBits(Ref rawbits); - Ref extractBits(Ref matrix); - static Ref removeDashedLines(Ref matrix); - static int readCode(Ref rawbits, int startIndex, int length); + Ref getEncodedData(Ref correctedBits); + Ref correctBits(Ref rawbits); + Ref extractBits(Ref matrix); + static Ref removeDashedLines(Ref matrix); + static int readCode(Ref rawbits, int startIndex, int length); - public: - Decoder(); - Ref decode(Ref detectorResult); - }; + public: + Decoder(); + Ref decode(Ref detectorResult); +}; - } +} } +#endif diff --git a/cpp/core/src/zxing/aztec/detector/Detector.h b/cpp/core/src/zxing/aztec/detector/Detector.h index 34728d0ca..f1b229163 100644 --- a/cpp/core/src/zxing/aztec/detector/Detector.h +++ b/cpp/core/src/zxing/aztec/detector/Detector.h @@ -19,6 +19,8 @@ * limitations under the License. */ +#ifndef __ZXING_AZTEC_DETECTOR_DETECTOR_H__ +#define __ZXING_AZTEC_DETECTOR_DETECTOR_H__ #include @@ -29,13 +31,9 @@ #include 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 image_; @@ -84,3 +82,8 @@ public: Detector(Ref image); Ref detect(); }; + +} +} + +#endif diff --git a/cpp/core/src/zxing/common/BitArray.h b/cpp/core/src/zxing/common/BitArray.h index a728d5496..e4a95a7c2 100644 --- a/cpp/core/src/zxing/common/BitArray.h +++ b/cpp/core/src/zxing/common/BitArray.h @@ -18,6 +18,7 @@ * limitations under the License. */ +#include #include #include #include @@ -26,19 +27,8 @@ #include 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::digits; @@ -71,18 +61,21 @@ public: std::vector& getBitArray(); void reverse(); - class Reverse; + + class Reverse { + private: + Ref array; + public: + Reverse(Ref array); + ~Reverse(); + }; private: static int makeArraySize(int size); }; -class zxing::BitArray::Reverse { -private: - Ref array; -public: - Reverse(Ref array); - ~Reverse(); -}; +std::ostream& operator << (std::ostream&, BitArray const&); + +} #endif // __BIT_ARRAY_H__ diff --git a/cpp/core/src/zxing/common/BitMatrix.h b/cpp/core/src/zxing/common/BitMatrix.h index dfbb2e06f..587f0a5d9 100644 --- a/cpp/core/src/zxing/common/BitMatrix.h +++ b/cpp/core/src/zxing/common/BitMatrix.h @@ -27,10 +27,8 @@ #include namespace zxing { - class BitMatrix; -} -class zxing::BitMatrix : public Counted { +class BitMatrix : public Counted { public: static const int bitsPerWord = std::numeric_limits::digits; @@ -87,4 +85,6 @@ private: BitMatrix& operator =(const BitMatrix&); }; +} + #endif // __BIT_MATRIX_H__ diff --git a/cpp/core/src/zxing/common/CharacterSetECI.h b/cpp/core/src/zxing/common/CharacterSetECI.h index 517d0ad5b..95ea86fc6 100644 --- a/cpp/core/src/zxing/common/CharacterSetECI.h +++ b/cpp/core/src/zxing/common/CharacterSetECI.h @@ -23,12 +23,9 @@ #include namespace zxing { - namespace common { - class CharacterSetECI; - } -} +namespace common { -class zxing::common::CharacterSetECI { +class CharacterSetECI { private: static std::map VALUE_TO_ECI; static std::map NAME_TO_ECI; @@ -50,4 +47,7 @@ public: static CharacterSetECI* getCharacterSetECIByName(std::string const& name); }; +} +} + #endif diff --git a/cpp/core/src/zxing/common/DetectorResult.h b/cpp/core/src/zxing/common/DetectorResult.h index 2b0a7ee95..26b633a00 100644 --- a/cpp/core/src/zxing/common/DetectorResult.h +++ b/cpp/core/src/zxing/common/DetectorResult.h @@ -26,10 +26,8 @@ #include namespace zxing { - class DetectorResult; -} -class zxing::DetectorResult : public Counted { +class DetectorResult : public Counted { private: Ref bits_; ArrayRef< Ref > points_; @@ -40,4 +38,6 @@ public: ArrayRef< Ref > getPoints(); }; +} + #endif // __DETECTOR_RESULT_H__ diff --git a/cpp/core/src/zxing/common/GlobalHistogramBinarizer.h b/cpp/core/src/zxing/common/GlobalHistogramBinarizer.h index 57813a785..b0d1bd401 100644 --- a/cpp/core/src/zxing/common/GlobalHistogramBinarizer.h +++ b/cpp/core/src/zxing/common/GlobalHistogramBinarizer.h @@ -26,10 +26,8 @@ #include namespace zxing { - class GlobalHistogramBinarizer; -} -class zxing::GlobalHistogramBinarizer : public Binarizer { +class GlobalHistogramBinarizer : public Binarizer { private: ArrayRef luminances; ArrayRef buckets; @@ -44,5 +42,7 @@ public: private: void initArrays(int luminanceSize); }; + +} #endif /* GLOBALHISTOGRAMBINARIZER_H_ */ diff --git a/cpp/core/src/zxing/common/IllegalArgumentException.h b/cpp/core/src/zxing/common/IllegalArgumentException.h index a12d66e67..735ab06e8 100644 --- a/cpp/core/src/zxing/common/IllegalArgumentException.h +++ b/cpp/core/src/zxing/common/IllegalArgumentException.h @@ -23,14 +23,14 @@ #include 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__ diff --git a/cpp/core/src/zxing/common/Str.h b/cpp/core/src/zxing/common/Str.h index b2b1f0e22..7b561360c 100644 --- a/cpp/core/src/zxing/common/Str.h +++ b/cpp/core/src/zxing/common/Str.h @@ -26,11 +26,11 @@ #include 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__ diff --git a/cpp/core/src/zxing/common/StringUtils.h b/cpp/core/src/zxing/common/StringUtils.h index 32354fb22..dd7d670ef 100644 --- a/cpp/core/src/zxing/common/StringUtils.h +++ b/cpp/core/src/zxing/common/StringUtils.h @@ -24,12 +24,9 @@ #include 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 diff --git a/cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h b/cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h index f39ac8143..e8ae843c1 100644 --- a/cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h +++ b/cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h @@ -27,11 +27,10 @@ #include namespace zxing { - class GenericGF; - class GenericGFPoly; -} + +class GenericGF; -class zxing::GenericGFPoly : public Counted { +class GenericGFPoly : public Counted { private: Ref field_; ArrayRef coefficients_; @@ -49,7 +48,9 @@ public: Ref multiplyByMonomial(int degree, int coefficient); std::vector > divide(Ref other); - //#warning todo: add print method + }; +} + #endif //GENERICGFPOLY_H diff --git a/cpp/core/src/zxing/multi/ByQuadrantReader.h b/cpp/core/src/zxing/multi/ByQuadrantReader.h index 18dcc33ab..3f7fac656 100644 --- a/cpp/core/src/zxing/multi/ByQuadrantReader.h +++ b/cpp/core/src/zxing/multi/ByQuadrantReader.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 decode(Ref image); virtual Ref decode(Ref image, DecodeHints hints); }; -} // End zxing::multi namespace -} // End zxing namespace + +} +} #endif // __BY_QUADRANT_READER_H__ diff --git a/cpp/core/src/zxing/multi/MultipleBarcodeReader.h b/cpp/core/src/zxing/multi/MultipleBarcodeReader.h index 61242971d..9f02adbb4 100644 --- a/cpp/core/src/zxing/multi/MultipleBarcodeReader.h +++ b/cpp/core/src/zxing/multi/MultipleBarcodeReader.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 > decodeMultiple(Ref image, DecodeHints hints) = 0; virtual ~MultipleBarcodeReader(); }; -} // End zxing::multi namespace -} // End zxing namespace + +} +} #endif // __MULTIPLE_BARCODE_READER_H__ diff --git a/cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.h b/cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.h index e32be8ce1..be17041a0 100644 --- a/cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.h +++ b/cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.h @@ -22,13 +22,15 @@ namespace zxing { namespace multi { + class QRCodeMultiReader: public zxing::qrcode::QRCodeReader, public MultipleBarcodeReader { public: QRCodeMultiReader(); virtual ~QRCodeMultiReader(); virtual std::vector > decodeMultiple(Ref image, DecodeHints hints); }; -} // End zxing::multi namespace -} // End zxing namespace + +} +} #endif // __QRCODE_MULTI_READER_H__ diff --git a/cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.h b/cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.h index 338d5d9c0..7c9a1891c 100644 --- a/cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.h +++ b/cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.h @@ -23,13 +23,15 @@ namespace zxing { namespace multi { + class MultiDetector : public zxing::qrcode::Detector { public: MultiDetector(Ref image); virtual ~MultiDetector(); virtual std::vector > detectMulti(DecodeHints hints); }; -} // End zxing::multi namespace -} // End zxing namespace + +} +} #endif // __MULTI_DETECTOR_H__ diff --git a/cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h b/cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h index c700273ee..4612d7294 100644 --- a/cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h +++ b/cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h @@ -23,6 +23,7 @@ namespace zxing { namespace multi { + class MultiFinderPatternFinder : zxing::qrcode::FinderPatternFinder { private: std::vector > > selectBestPatterns(); @@ -39,6 +40,7 @@ class MultiFinderPatternFinder : zxing::qrcode::FinderPatternFinder { }; + } } diff --git a/cpp/core/src/zxing/oned/CodaBarReader.h b/cpp/core/src/zxing/oned/CodaBarReader.h index 826aebe63..a9f21b2b0 100644 --- a/cpp/core/src/zxing/oned/CodaBarReader.h +++ b/cpp/core/src/zxing/oned/CodaBarReader.h @@ -22,12 +22,9 @@ #include 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 diff --git a/cpp/core/src/zxing/oned/Code128Reader.h b/cpp/core/src/zxing/oned/Code128Reader.h index 43232ec29..7731ac742 100644 --- a/cpp/core/src/zxing/oned/Code128Reader.h +++ b/cpp/core/src/zxing/oned/Code128Reader.h @@ -22,12 +22,9 @@ #include 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 diff --git a/cpp/core/src/zxing/oned/Code39Reader.h b/cpp/core/src/zxing/oned/Code39Reader.h index 03ce7291e..28b628596 100644 --- a/cpp/core/src/zxing/oned/Code39Reader.h +++ b/cpp/core/src/zxing/oned/Code39Reader.h @@ -25,17 +25,14 @@ #include namespace zxing { - namespace oned { - class Code39Reader; - } -} +namespace oned { /** *

Decodes Code 39 barcodes. This does not support "Full ASCII Code 39" yet.

* 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 decodeRow(int rowNumber, Ref row); }; +} +} + #endif diff --git a/cpp/core/src/zxing/oned/Code93Reader.h b/cpp/core/src/zxing/oned/Code93Reader.h index a78c2c78d..7237aad48 100644 --- a/cpp/core/src/zxing/oned/Code93Reader.h +++ b/cpp/core/src/zxing/oned/Code93Reader.h @@ -25,17 +25,14 @@ #include namespace zxing { - namespace oned { - class Code93Reader; - } -} +namespace oned { /** *

Decodes Code 93 barcodes. This does not support "Full ASCII Code 93" yet.

* Ported form Java (author Sean Owen) * @author Lukasz Warchol */ -class zxing::oned::Code93Reader : public OneDReader { +class Code93Reader : public OneDReader { public: Code93Reader(); Ref decodeRow(int rowNumber, Ref row); @@ -55,4 +52,7 @@ private: int weightMax); }; +} +} + #endif diff --git a/cpp/core/src/zxing/oned/EAN13Reader.h b/cpp/core/src/zxing/oned/EAN13Reader.h index 0e11c7236..a4282255b 100644 --- a/cpp/core/src/zxing/oned/EAN13Reader.h +++ b/cpp/core/src/zxing/oned/EAN13Reader.h @@ -25,12 +25,9 @@ #include namespace zxing { - namespace oned { - class EAN13Reader; - } -} +namespace oned { -class zxing::oned::EAN13Reader : public UPCEANReader { +class EAN13Reader : public UPCEANReader { private: std::vector decodeMiddleCounters; static void determineFirstDigit(std::string& resultString, @@ -46,4 +43,7 @@ public: BarcodeFormat getBarcodeFormat(); }; +} +} + #endif diff --git a/cpp/core/src/zxing/oned/EAN8Reader.h b/cpp/core/src/zxing/oned/EAN8Reader.h index 99ae97785..7dfaf3a03 100644 --- a/cpp/core/src/zxing/oned/EAN8Reader.h +++ b/cpp/core/src/zxing/oned/EAN8Reader.h @@ -25,15 +25,13 @@ #include namespace zxing { - namespace oned { - class EAN8Reader; - } -} +namespace oned { -class zxing::oned::EAN8Reader : public UPCEANReader { +class EAN8Reader : public UPCEANReader { + private: std::vector decodeMiddleCounters; -public: + public: EAN8Reader(); int decodeMiddle(Ref row, @@ -43,4 +41,7 @@ public: BarcodeFormat getBarcodeFormat(); }; +} +} + #endif diff --git a/cpp/core/src/zxing/oned/ITFReader.h b/cpp/core/src/zxing/oned/ITFReader.h index 847b00069..59d0aae2f 100644 --- a/cpp/core/src/zxing/oned/ITFReader.h +++ b/cpp/core/src/zxing/oned/ITFReader.h @@ -23,13 +23,9 @@ #include 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 diff --git a/cpp/core/src/zxing/oned/MultiFormatUPCEANReader.h b/cpp/core/src/zxing/oned/MultiFormatUPCEANReader.h index 016216cb5..d0e2b2074 100644 --- a/cpp/core/src/zxing/oned/MultiFormatUPCEANReader.h +++ b/cpp/core/src/zxing/oned/MultiFormatUPCEANReader.h @@ -23,13 +23,11 @@ #include 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 > readers; public: @@ -37,4 +35,7 @@ public: Ref decodeRow(int rowNumber, Ref row); }; +} +} + #endif diff --git a/cpp/core/src/zxing/oned/OneDReader.h b/cpp/core/src/zxing/oned/OneDReader.h index 6552a1afc..6043e0a2c 100644 --- a/cpp/core/src/zxing/oned/OneDReader.h +++ b/cpp/core/src/zxing/oned/OneDReader.h @@ -24,12 +24,9 @@ #include namespace zxing { - namespace oned { - class OneDReader; - } -} +namespace oned { -class zxing::oned::OneDReader : public Reader { +class OneDReader : public Reader { private: Ref doDecode(Ref image, DecodeHints hints); @@ -78,4 +75,7 @@ public: virtual ~OneDReader(); }; +} +} + #endif diff --git a/cpp/core/src/zxing/oned/UPCAReader.h b/cpp/core/src/zxing/oned/UPCAReader.h index d5b00171a..00c02bf33 100644 --- a/cpp/core/src/zxing/oned/UPCAReader.h +++ b/cpp/core/src/zxing/oned/UPCAReader.h @@ -24,12 +24,9 @@ #include 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 diff --git a/cpp/core/src/zxing/oned/UPCEANReader.h b/cpp/core/src/zxing/oned/UPCEANReader.h index 951903176..6603739e9 100644 --- a/cpp/core/src/zxing/oned/UPCEANReader.h +++ b/cpp/core/src/zxing/oned/UPCEANReader.h @@ -23,15 +23,10 @@ #include 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 diff --git a/cpp/core/src/zxing/oned/UPCEReader.h b/cpp/core/src/zxing/oned/UPCEReader.h index cb836d478..9578f0e94 100644 --- a/cpp/core/src/zxing/oned/UPCEReader.h +++ b/cpp/core/src/zxing/oned/UPCEReader.h @@ -22,12 +22,9 @@ #include namespace zxing { - namespace oned { - class UPCEReader; - } -} +namespace oned { -class zxing::oned::UPCEReader : public UPCEANReader { +class UPCEReader : public UPCEANReader { private: std::vector decodeMiddleCounters; static bool determineNumSysAndCheckDigit(std::string& resultString, int lgPatternFound); @@ -44,4 +41,7 @@ public: BarcodeFormat getBarcodeFormat(); }; +} +} + #endif diff --git a/iphone/Barcodes/Classes/ScanViewController.m b/iphone/Barcodes/Classes/ScanViewController.m index ef29183df..2184eafeb 100644 --- a/iphone/Barcodes/Classes/ScanViewController.m +++ b/iphone/Barcodes/Classes/ScanViewController.m @@ -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)); diff --git a/iphone/Barcodes/Classes/ZXMainViewController.mm b/iphone/Barcodes/Classes/ZXMainViewController.mm index c040a1346..93db5a920 100644 --- a/iphone/Barcodes/Classes/ZXMainViewController.mm +++ b/iphone/Barcodes/Classes/ZXMainViewController.mm @@ -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]; diff --git a/iphone/ZXingWidget/Classes/Decoder.mm b/iphone/ZXingWidget/Classes/Decoder.mm index db410c3ed..80b3ede73 100644 --- a/iphone/ZXingWidget/Classes/Decoder.mm +++ b/iphone/ZXingWidget/Classes/Decoder.mm @@ -81,13 +81,13 @@ ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {} - (ArrayRef) 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 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 callback(callback_pointer); Ref 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]; diff --git a/iphone/ZXingWidget/Classes/ZXingWidgetController.m b/iphone/ZXingWidget/Classes/ZXingWidgetController.m index ef4eaab07..82f9f2588 100644 --- a/iphone/ZXingWidget/Classes/ZXingWidgetController.m +++ b/iphone/ZXingWidget/Classes/ZXingWidgetController.m @@ -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 } diff --git a/iphone/ZXingWidget/Classes/parsedResults/URIParsedResult.m b/iphone/ZXingWidget/Classes/parsedResults/URIParsedResult.m index cf2f4f9dd..b18385e4c 100644 --- a/iphone/ZXingWidget/Classes/parsedResults/URIParsedResult.m +++ b/iphone/ZXingWidget/Classes/parsedResults/URIParsedResult.m @@ -71,7 +71,7 @@ } - (void)populateActions { -#ifdef ZXING_DEBUG +#if ZXING_DEBUG NSLog(@"creating action to open URL '%@'", self.urlString); #endif diff --git a/iphone/ZXingWidget/Classes/resultParsers/ResultParser.m b/iphone/ZXingWidget/Classes/resultParsers/ResultParser.m index 8e5ce3bc4..78fe30367 100644 --- a/iphone/ZXingWidget/Classes/resultParsers/ResultParser.m +++ b/iphone/ZXingWidget/Classes/resultParsers/ResultParser.m @@ -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]; diff --git a/iphone/ZXingWidget/Classes/resultParsers/UniversalResultParser.m b/iphone/ZXingWidget/Classes/resultParsers/UniversalResultParser.m index 7be204cb3..3aa549167 100644 --- a/iphone/ZXingWidget/Classes/resultParsers/UniversalResultParser.m +++ b/iphone/ZXingWidget/Classes/resultParsers/UniversalResultParser.m @@ -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;