zxing_cpp 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.gitmodules +3 -0
- data/CHANGELOG.rdoc +6 -0
- data/Gemfile +3 -0
- data/Manifest.txt +331 -0
- data/README.rdoc +138 -0
- data/Rakefile +28 -0
- data/bin/zxd +87 -0
- data/bin/zxe +53 -0
- data/ext/zxing/extconf.rb +27 -0
- data/ext/zxing/zxing-cpp/.gitignore +4 -0
- data/ext/zxing/zxing-cpp/AUTHORS +115 -0
- data/ext/zxing/zxing-cpp/CMakeLists.txt +84 -0
- data/ext/zxing/zxing-cpp/COPYING +201 -0
- data/ext/zxing/zxing-cpp/NOTICE +65 -0
- data/ext/zxing/zxing-cpp/README.md +50 -0
- data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.cpp +112 -0
- data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.h +40 -0
- data/ext/zxing/zxing-cpp/cli/src/jpgd.cpp +3174 -0
- data/ext/zxing/zxing-cpp/cli/src/jpgd.h +319 -0
- data/ext/zxing/zxing-cpp/cli/src/lodepng.cpp +6261 -0
- data/ext/zxing/zxing-cpp/cli/src/lodepng.h +1695 -0
- data/ext/zxing/zxing-cpp/cli/src/main.cpp +297 -0
- data/ext/zxing/zxing-cpp/cmake/FindCPPUNIT.cmake +54 -0
- data/ext/zxing/zxing-cpp/cmake/FindIconv.cmake +57 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/.gitignore +6 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.cc +405 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.hh +215 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.cc +70 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.hh +25 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerLibrary.hh +8 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.cc +50 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.hh +72 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.cc +697 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.hh +418 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.cc +125 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.hh +122 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/ChangeLog +146 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/Makefile +73 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/NumberlikeArray.hh +177 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/README +71 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/iconv.h +14 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/stdint.h +247 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/win_iconv.c +2035 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.cpp +40 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.h +60 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.cpp +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.cpp +70 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.cpp +28 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.h +34 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.cpp +142 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.h +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Exception.cpp +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Exception.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.cpp +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/IllegalStateException.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.cpp +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.cpp +86 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.cpp +124 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/NotFoundException.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Reader.cpp +31 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Reader.h +40 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ReaderException.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Result.cpp +61 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Result.h +55 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultIO.cpp +34 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.cpp +108 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.h +55 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.cpp +26 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.h +39 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ZXing.h +133 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.cpp +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.cpp +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.cpp +489 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.h +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.cpp +548 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.h +92 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Array.h +170 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.cpp +155 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.h +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArrayIO.cpp +31 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.cpp +143 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.h +91 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.cpp +76 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.h +74 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.cpp +104 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.h +53 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Counted.h +140 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.cpp +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.cpp +39 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.cpp +212 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.cpp +80 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.h +53 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.cpp +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.h +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.cpp +122 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.cpp +226 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.h +67 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.cpp +27 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.h +36 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.cpp +107 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Point.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.cpp +61 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.cpp +198 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.h +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/JavaMath.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MathUtils.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.cpp +174 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.h +62 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.cpp +330 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.cpp +150 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.h +73 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.cpp +218 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.cpp +174 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.cpp +30 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.h +33 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.cpp +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.cpp +199 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.h +87 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.cpp +361 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.cpp +113 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.cpp +416 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.h +104 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.cpp +93 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.cpp +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.cpp +446 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.h +94 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.cpp +23 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.h +23 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.cpp +75 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.h +42 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.cpp +137 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.cpp +29 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.h +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.cpp +58 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.h +36 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp +236 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.cpp +340 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.cpp +496 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.cpp +328 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.h +63 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.cpp +293 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.h +58 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.cpp +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.cpp +65 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.cpp +337 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.h +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.cpp +96 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.h +38 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.cpp +110 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.h +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.cpp +227 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.h +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.cpp +28 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.cpp +71 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.cpp +309 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.h +88 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.cpp +146 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.cpp +170 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.cpp +997 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.h +84 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.cpp +563 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.h +84 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.cpp +118 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.h +62 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.cpp +214 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.h +71 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.cpp +120 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.h +72 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.cpp +284 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.h +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.cpp +664 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.h +106 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.cpp +714 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.h +122 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.cpp +65 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.h +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.cpp +117 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.h +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.cpp +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.cpp +560 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.h +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.cpp +183 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.cpp +118 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.cpp +159 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp +425 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.h +72 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.cpp +107 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.h +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.cpp +90 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.cpp +208 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.h +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.cpp +314 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.h +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.cpp +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.cpp +559 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.h +76 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.cpp +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/TestRunner.cpp +30 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.cpp +216 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.h +61 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.cpp +106 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.h +55 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.cpp +49 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.h +42 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.cpp +58 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.h +46 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.cpp +69 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.cpp +129 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.h +62 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.h +45 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.cpp +88 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.cpp +88 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.h +49 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.cpp +132 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.h +91 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.cpp +52 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.h +47 -0
- data/ext/zxing/zxing.cc +224 -0
- data/lib/zxing.rb +50 -0
- data/lib/zxing/.gitignore +2 -0
- data/lib/zxing/aztec.rb +5 -0
- data/lib/zxing/aztec/aztec_reader.rb +14 -0
- data/lib/zxing/bad_image_exception.rb +4 -0
- data/lib/zxing/binarizer.rb +8 -0
- data/lib/zxing/binary_bitmap.rb +15 -0
- data/lib/zxing/checksum_exception.rb +4 -0
- data/lib/zxing/common.rb +7 -0
- data/lib/zxing/common/bit_matrix.rb +9 -0
- data/lib/zxing/common/hybrid_binarizer.rb +17 -0
- data/lib/zxing/common/illegal_argument_exception.rb +4 -0
- data/lib/zxing/datamatrix.rb +5 -0
- data/lib/zxing/datamatrix/data_matrix_reader.rb +14 -0
- data/lib/zxing/decodable.rb +11 -0
- data/lib/zxing/exception.rb +4 -0
- data/lib/zxing/ffi.rb +20 -0
- data/lib/zxing/ffi/aztec.rb +6 -0
- data/lib/zxing/ffi/aztec/aztec_reader.rb +9 -0
- data/lib/zxing/ffi/binarizer.rb +25 -0
- data/lib/zxing/ffi/binary_bitmap.rb +15 -0
- data/lib/zxing/ffi/common.rb +8 -0
- data/lib/zxing/ffi/common/bit_matrix.rb +12 -0
- data/lib/zxing/ffi/common/greyscale_luminance_source.rb +30 -0
- data/lib/zxing/ffi/common/hybrid_binarizer.rb +10 -0
- data/lib/zxing/ffi/datamatrix.rb +6 -0
- data/lib/zxing/ffi/datamatrix/data_matrix_reader.rb +9 -0
- data/lib/zxing/ffi/library.rb +102 -0
- data/lib/zxing/ffi/luminance_source.rb +18 -0
- data/lib/zxing/ffi/multi_format_reader.rb +9 -0
- data/lib/zxing/ffi/oned.rb +6 -0
- data/lib/zxing/ffi/oned/code_39_reader.rb +10 -0
- data/lib/zxing/ffi/qrcode.rb +8 -0
- data/lib/zxing/ffi/qrcode/decoder.rb +10 -0
- data/lib/zxing/ffi/qrcode/detector.rb +10 -0
- data/lib/zxing/ffi/reader.rb +58 -0
- data/lib/zxing/ffi/result.rb +23 -0
- data/lib/zxing/format_exception.rb +4 -0
- data/lib/zxing/illegal_argument_exception.rb +4 -0
- data/lib/zxing/image.rb +15 -0
- data/lib/zxing/luminance_source.rb +18 -0
- data/lib/zxing/multi_format_reader.rb +11 -0
- data/lib/zxing/not_found_exception.rb +4 -0
- data/lib/zxing/oned.rb +5 -0
- data/lib/zxing/oned/code_39_reader.rb +15 -0
- data/lib/zxing/qrcode.rb +8 -0
- data/lib/zxing/qrcode/decoder.rb +14 -0
- data/lib/zxing/qrcode/detector.rb +14 -0
- data/lib/zxing/qrcode/encoder.rb +8 -0
- data/lib/zxing/qrcode/encoder/byte_matrix.rb +18 -0
- data/lib/zxing/qrcode/encoder/encoder.rb +9 -0
- data/lib/zxing/qrcode/encoder/qrcode.rb +18 -0
- data/lib/zxing/reader.rb +8 -0
- data/lib/zxing/reader_exception.rb +4 -0
- data/lib/zxing/reed_solomon_exception.rb +2 -0
- data/lib/zxing/result.rb +18 -0
- data/lib/zxing/rmagick.rb +5 -0
- data/lib/zxing/rmagick/image.rb +104 -0
- data/lib/zxing/version.rb +33 -0
- data/test/qrcode.png +0 -0
- data/test/test_helper.rb +5 -0
- data/test/test_zxing.rb +58 -0
- data/test/vendor.rb +360 -0
- data/test/zxing/test_decodable.rb +38 -0
- data/zxing_cpp.gemspec +48 -0
- metadata +473 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
#ifndef __VERSION_TEST_H__
|
2
|
+
#define __VERSION_TEST_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* VersionTest.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
9
|
+
*
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
* you may not use this file except in compliance with the License.
|
12
|
+
* You may obtain a copy of the License at
|
13
|
+
*
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
* See the License for the specific language governing permissions and
|
20
|
+
* limitations under the License.
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include <cppunit/TestFixture.h>
|
24
|
+
#include <cppunit/extensions/HelperMacros.h>
|
25
|
+
#include <zxing/qrcode/ErrorCorrectionLevel.h>
|
26
|
+
|
27
|
+
namespace zxing {
|
28
|
+
namespace qrcode {
|
29
|
+
|
30
|
+
class VersionTest : public CPPUNIT_NS::TestFixture {
|
31
|
+
CPPUNIT_TEST_SUITE(VersionTest);
|
32
|
+
CPPUNIT_TEST(testVersionForNumber);
|
33
|
+
CPPUNIT_TEST(testGetProvisionalVersionForDimension);
|
34
|
+
CPPUNIT_TEST(testDecodeVersionInformation);
|
35
|
+
CPPUNIT_TEST_SUITE_END();
|
36
|
+
|
37
|
+
public:
|
38
|
+
|
39
|
+
protected:
|
40
|
+
void testVersionForNumber();
|
41
|
+
void testGetProvisionalVersionForDimension();
|
42
|
+
void testDecodeVersionInformation();
|
43
|
+
|
44
|
+
private:
|
45
|
+
};
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
#endif // __VERSION_TEST_H__
|
@@ -0,0 +1,132 @@
|
|
1
|
+
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
2
|
+
/*
|
3
|
+
* Created by Christian Brunschen on 19/05/2008.
|
4
|
+
* Copyright 2008 ZXing authors All rights reserved.
|
5
|
+
*
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
* you may not use this file except in compliance with the License.
|
8
|
+
* You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
* See the License for the specific language governing permissions and
|
16
|
+
* limitations under the License.
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include "DataMaskTest.h"
|
20
|
+
|
21
|
+
namespace zxing {
|
22
|
+
namespace qrcode {
|
23
|
+
|
24
|
+
CPPUNIT_TEST_SUITE_REGISTRATION(DataMaskTest);
|
25
|
+
|
26
|
+
class Mask0Condition : public MaskCondition {
|
27
|
+
public:
|
28
|
+
Mask0Condition() { }
|
29
|
+
bool isMasked(int i, int j) {
|
30
|
+
return (i + j) % 2 == 0;
|
31
|
+
}
|
32
|
+
};
|
33
|
+
|
34
|
+
class Mask1Condition : public MaskCondition {
|
35
|
+
public:
|
36
|
+
Mask1Condition() { }
|
37
|
+
bool isMasked(int i, int) {
|
38
|
+
return i % 2 == 0;
|
39
|
+
}
|
40
|
+
};
|
41
|
+
|
42
|
+
class Mask2Condition : public MaskCondition {
|
43
|
+
public:
|
44
|
+
Mask2Condition() { }
|
45
|
+
bool isMasked(int, int j) {
|
46
|
+
return j % 3 == 0;
|
47
|
+
}
|
48
|
+
};
|
49
|
+
|
50
|
+
class Mask3Condition : public MaskCondition {
|
51
|
+
public:
|
52
|
+
Mask3Condition() { }
|
53
|
+
bool isMasked(int i, int j) {
|
54
|
+
return (i + j) % 3 == 0;
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
58
|
+
class Mask4Condition : public MaskCondition {
|
59
|
+
public:
|
60
|
+
Mask4Condition() { }
|
61
|
+
bool isMasked(int i, int j) {
|
62
|
+
return (i / 2 + j / 3) % 2 == 0;
|
63
|
+
}
|
64
|
+
};
|
65
|
+
|
66
|
+
class Mask5Condition : public MaskCondition {
|
67
|
+
public:
|
68
|
+
Mask5Condition() { }
|
69
|
+
bool isMasked(int i, int j) {
|
70
|
+
return (i * j) % 2 + (i * j) % 3 == 0;
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
class Mask6Condition : public MaskCondition {
|
75
|
+
public:
|
76
|
+
Mask6Condition() { }
|
77
|
+
bool isMasked(int i, int j) {
|
78
|
+
return ((i * j) % 2 + (i * j) % 3) % 2 == 0;
|
79
|
+
}
|
80
|
+
};
|
81
|
+
|
82
|
+
class Mask7Condition : public MaskCondition {
|
83
|
+
public:
|
84
|
+
Mask7Condition() { }
|
85
|
+
bool isMasked(int i, int j) {
|
86
|
+
return ((i + j) % 2 + (i * j) % 3) % 2 == 0;
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
|
91
|
+
void DataMaskTest::testMask0() {
|
92
|
+
Mask0Condition condition;
|
93
|
+
testMaskAcrossDimensions(0, condition);
|
94
|
+
}
|
95
|
+
|
96
|
+
void DataMaskTest::testMask1() {
|
97
|
+
Mask1Condition condition;
|
98
|
+
testMaskAcrossDimensions(1, condition);
|
99
|
+
}
|
100
|
+
|
101
|
+
void DataMaskTest::testMask2() {
|
102
|
+
Mask2Condition condition;
|
103
|
+
testMaskAcrossDimensions(2, condition);
|
104
|
+
}
|
105
|
+
|
106
|
+
void DataMaskTest::testMask3() {
|
107
|
+
Mask3Condition condition;
|
108
|
+
testMaskAcrossDimensions(3, condition);
|
109
|
+
}
|
110
|
+
|
111
|
+
void DataMaskTest::testMask4() {
|
112
|
+
Mask4Condition condition;
|
113
|
+
testMaskAcrossDimensions(4, condition);
|
114
|
+
}
|
115
|
+
|
116
|
+
void DataMaskTest::testMask5() {
|
117
|
+
Mask5Condition condition;
|
118
|
+
testMaskAcrossDimensions(5, condition);
|
119
|
+
}
|
120
|
+
|
121
|
+
void DataMaskTest::testMask6() {
|
122
|
+
Mask6Condition condition;
|
123
|
+
testMaskAcrossDimensions(6, condition);
|
124
|
+
}
|
125
|
+
|
126
|
+
void DataMaskTest::testMask7() {
|
127
|
+
Mask7Condition condition;
|
128
|
+
testMaskAcrossDimensions(7, condition);
|
129
|
+
}
|
130
|
+
|
131
|
+
}
|
132
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
#ifndef __DATA_MASK_TEST_H__
|
2
|
+
#define __DATA_MASK_TEST_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* DataMaskTest.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
9
|
+
*
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
* you may not use this file except in compliance with the License.
|
12
|
+
* You may obtain a copy of the License at
|
13
|
+
*
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
* See the License for the specific language governing permissions and
|
20
|
+
* limitations under the License.
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include <cppunit/TestFixture.h>
|
24
|
+
#include <cppunit/extensions/HelperMacros.h>
|
25
|
+
#include <zxing/qrcode/decoder/DataMask.h>
|
26
|
+
#include <zxing/common/BitMatrix.h>
|
27
|
+
|
28
|
+
namespace zxing {
|
29
|
+
namespace qrcode {
|
30
|
+
|
31
|
+
class MaskCondition {
|
32
|
+
public:
|
33
|
+
MaskCondition() { }
|
34
|
+
virtual bool isMasked(int i, int j) = 0;
|
35
|
+
virtual ~MaskCondition() { }
|
36
|
+
};
|
37
|
+
|
38
|
+
|
39
|
+
class DataMaskTest : public CPPUNIT_NS::TestFixture {
|
40
|
+
CPPUNIT_TEST_SUITE(DataMaskTest);
|
41
|
+
CPPUNIT_TEST(testMask0);
|
42
|
+
CPPUNIT_TEST(testMask1);
|
43
|
+
CPPUNIT_TEST(testMask2);
|
44
|
+
CPPUNIT_TEST(testMask3);
|
45
|
+
CPPUNIT_TEST(testMask4);
|
46
|
+
CPPUNIT_TEST(testMask5);
|
47
|
+
CPPUNIT_TEST(testMask6);
|
48
|
+
CPPUNIT_TEST(testMask7);
|
49
|
+
CPPUNIT_TEST_SUITE_END();
|
50
|
+
|
51
|
+
public:
|
52
|
+
|
53
|
+
protected:
|
54
|
+
void testMask0();
|
55
|
+
void testMask1();
|
56
|
+
void testMask2();
|
57
|
+
void testMask3();
|
58
|
+
void testMask4();
|
59
|
+
void testMask5();
|
60
|
+
void testMask6();
|
61
|
+
void testMask7();
|
62
|
+
|
63
|
+
private:
|
64
|
+
void testMaskAcrossDimensions(int reference,
|
65
|
+
MaskCondition &condition) {
|
66
|
+
DataMask& mask = DataMask::forReference(reference);
|
67
|
+
for (int version = 1; version <= 40; version++) {
|
68
|
+
int dimension = 17 + 4 * version;
|
69
|
+
testMask(mask, dimension, condition);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
void testMask(DataMask& mask, int dimension, MaskCondition &condition) {
|
74
|
+
BitMatrix bits(dimension);
|
75
|
+
mask.unmaskBitMatrix(bits, dimension);
|
76
|
+
for (int i = 0; i < dimension; i++) {
|
77
|
+
for (int j = 0; j < dimension; j++) {
|
78
|
+
//TODO: check why the coordinates are swapped
|
79
|
+
CPPUNIT_ASSERT_EQUAL(
|
80
|
+
//"(" + i + ',' + j + ')',
|
81
|
+
condition.isMasked(i, j),
|
82
|
+
bits.get(j, i));
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
};
|
87
|
+
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
#endif // __DATA_MASK_TEST_H__
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/*
|
2
|
+
* ModeTest.cpp
|
3
|
+
* zxing
|
4
|
+
*
|
5
|
+
* Created by Christian Brunschen on 19/05/2008.
|
6
|
+
* Copyright 2008 ZXing authors All rights reserved.
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "ModeTest.h"
|
22
|
+
#include <zxing/qrcode/Version.h>
|
23
|
+
|
24
|
+
namespace zxing {
|
25
|
+
namespace qrcode {
|
26
|
+
|
27
|
+
CPPUNIT_TEST_SUITE_REGISTRATION(ModeTest);
|
28
|
+
|
29
|
+
void ModeTest::testForBits() {
|
30
|
+
CPPUNIT_ASSERT_EQUAL(&Mode::TERMINATOR, &(Mode::forBits(0x00)));
|
31
|
+
CPPUNIT_ASSERT_EQUAL(&Mode::NUMERIC, &(Mode::forBits(0x01)));
|
32
|
+
CPPUNIT_ASSERT_EQUAL(&Mode::ALPHANUMERIC, &(Mode::forBits(0x02)));
|
33
|
+
CPPUNIT_ASSERT_EQUAL(&Mode::BYTE, &(Mode::forBits(0x04)));
|
34
|
+
CPPUNIT_ASSERT_EQUAL(&Mode::KANJI, &(Mode::forBits(0x08)));
|
35
|
+
try {
|
36
|
+
Mode::forBits(0x10);
|
37
|
+
CPPUNIT_FAIL("should have thrown an exception");
|
38
|
+
} catch (zxing::ReaderException const& ex) {
|
39
|
+
// expected
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
void ModeTest::testCharacterCount() {
|
44
|
+
CPPUNIT_ASSERT_EQUAL(10, Mode::NUMERIC.getCharacterCountBits(Version::getVersionForNumber(5)));
|
45
|
+
CPPUNIT_ASSERT_EQUAL(12, Mode::NUMERIC.getCharacterCountBits(Version::getVersionForNumber(26)));
|
46
|
+
CPPUNIT_ASSERT_EQUAL(14, Mode::NUMERIC.getCharacterCountBits(Version::getVersionForNumber(40)));
|
47
|
+
CPPUNIT_ASSERT_EQUAL(9, Mode::ALPHANUMERIC.getCharacterCountBits(Version::getVersionForNumber(6)));
|
48
|
+
CPPUNIT_ASSERT_EQUAL(8, Mode::BYTE.getCharacterCountBits(Version::getVersionForNumber(7)));
|
49
|
+
CPPUNIT_ASSERT_EQUAL(8, Mode::KANJI.getCharacterCountBits(Version::getVersionForNumber(8)));
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#ifndef __MODE_TEST_H__
|
2
|
+
#define __MODE_TEST_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* ModeTest.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
9
|
+
*
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
* you may not use this file except in compliance with the License.
|
12
|
+
* You may obtain a copy of the License at
|
13
|
+
*
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
* See the License for the specific language governing permissions and
|
20
|
+
* limitations under the License.
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include <cppunit/TestFixture.h>
|
24
|
+
#include <cppunit/extensions/HelperMacros.h>
|
25
|
+
#include <zxing/qrcode/decoder/Mode.h>
|
26
|
+
|
27
|
+
namespace zxing {
|
28
|
+
namespace qrcode {
|
29
|
+
|
30
|
+
class ModeTest : public CPPUNIT_NS::TestFixture {
|
31
|
+
CPPUNIT_TEST_SUITE(ModeTest);
|
32
|
+
CPPUNIT_TEST(testForBits);
|
33
|
+
CPPUNIT_TEST(testCharacterCount);
|
34
|
+
CPPUNIT_TEST_SUITE_END();
|
35
|
+
|
36
|
+
public:
|
37
|
+
|
38
|
+
protected:
|
39
|
+
void testForBits();
|
40
|
+
void testCharacterCount();
|
41
|
+
|
42
|
+
private:
|
43
|
+
};
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
#endif // __MODE_TEST_H__
|
data/ext/zxing/zxing.cc
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
// -*- c-basic-offset:2 -*-
|
2
|
+
|
3
|
+
#include <zxing/Reader.h>
|
4
|
+
#include <zxing/MultiFormatReader.h>
|
5
|
+
#include <zxing/datamatrix/DataMatrixReader.h>
|
6
|
+
#include <zxing/aztec/AztecReader.h>
|
7
|
+
#include <zxing/oned/Code39Reader.h>
|
8
|
+
#include <zxing/common/GreyscaleLuminanceSource.h>
|
9
|
+
#include <zxing/common/HybridBinarizer.h>
|
10
|
+
#include <zxing/FormatException.h>
|
11
|
+
#include <zxing/ReaderException.h>
|
12
|
+
#include <zxing/ChecksumException.h>
|
13
|
+
#include <zxing/common/reedsolomon/ReedSolomonException.h>
|
14
|
+
#include <zxing/common/IllegalArgumentException.h>
|
15
|
+
#include <zxing/common/Str.h>
|
16
|
+
|
17
|
+
#include <stdlib.h>
|
18
|
+
#include <stdint.h>
|
19
|
+
|
20
|
+
using namespace std;
|
21
|
+
|
22
|
+
extern "C" {
|
23
|
+
void Reader_delete(void* reader_ptr) {
|
24
|
+
zxing::Ref<zxing::Reader>* ref = (zxing::Ref<zxing::Reader>*)reader_ptr;
|
25
|
+
delete ref;
|
26
|
+
}
|
27
|
+
|
28
|
+
void* new_exception_data(const char* className, std::exception const& e) {
|
29
|
+
void** exception = (void**)malloc(sizeof(void*)*2);
|
30
|
+
exception[0] = (void*)className;
|
31
|
+
size_t size = strlen(e.what())+1;
|
32
|
+
exception[1] = malloc(size);
|
33
|
+
memcpy(exception[1], e.what(), size);
|
34
|
+
return (void*)((uintptr_t)exception | 1);
|
35
|
+
}
|
36
|
+
|
37
|
+
void* Reader_decode(
|
38
|
+
void* reader_ref_ptr,
|
39
|
+
void* bitmap_ref_ptr,
|
40
|
+
void* hints_ptr) {
|
41
|
+
|
42
|
+
zxing::Ref<zxing::Reader>* reader =
|
43
|
+
(zxing::Ref<zxing::Reader>*)reader_ref_ptr;
|
44
|
+
zxing::Ref<zxing::BinaryBitmap>* bitmap =
|
45
|
+
(zxing::Ref<zxing::BinaryBitmap>*)bitmap_ref_ptr;
|
46
|
+
zxing::DecodeHints* hints = (zxing::DecodeHints*)hints_ptr;
|
47
|
+
void* result = 0;
|
48
|
+
try {
|
49
|
+
zxing::Ref<zxing::Result> decoded ((*reader)->decode(*bitmap, *hints));
|
50
|
+
result = new zxing::Ref<zxing::Result>(decoded);
|
51
|
+
} catch(zxing::IllegalArgumentException const& e) {
|
52
|
+
result = new_exception_data("zxing::IllegalArgumentException", e);
|
53
|
+
} catch(zxing::ReedSolomonException const& e) {
|
54
|
+
result = new_exception_data("zxing::ReedSolomonException", e);
|
55
|
+
} catch(zxing::FormatException const& e) {
|
56
|
+
result = new_exception_data("zxing::FormatException", e);
|
57
|
+
} catch(zxing::ChecksumException const& e) {
|
58
|
+
result = new_exception_data("zxing::ChecksumException", e);
|
59
|
+
} catch(zxing::ReaderException const& e) {
|
60
|
+
result = new_exception_data("zxing::ReaderException", e);
|
61
|
+
} catch(zxing::Exception const& e) {
|
62
|
+
result = new_exception_data("zxing::Exception", e);
|
63
|
+
} catch(...) {
|
64
|
+
result = new_exception_data("...", std::exception());
|
65
|
+
}
|
66
|
+
return result;
|
67
|
+
}
|
68
|
+
|
69
|
+
void* MultiFormatReader_new() {
|
70
|
+
zxing::MultiFormatReader* reader = new zxing::MultiFormatReader();
|
71
|
+
return new zxing::Ref<zxing::Reader>(reader);
|
72
|
+
}
|
73
|
+
|
74
|
+
void* DataMatrixReader_new() {
|
75
|
+
zxing::datamatrix::DataMatrixReader* reader = new zxing::datamatrix::DataMatrixReader();
|
76
|
+
return new zxing::Ref<zxing::Reader>(reader);
|
77
|
+
}
|
78
|
+
|
79
|
+
void* AztecReader_new() {
|
80
|
+
zxing::aztec::AztecReader* reader = new zxing::aztec::AztecReader();
|
81
|
+
return new zxing::Ref<zxing::Reader>(reader);
|
82
|
+
}
|
83
|
+
|
84
|
+
void* Code39Reader_new(bool usingCheckDigit, bool extendedMode) {
|
85
|
+
zxing::oned::Code39Reader* reader =
|
86
|
+
new zxing::oned::Code39Reader(usingCheckDigit, extendedMode);
|
87
|
+
return new zxing::Ref<zxing::Reader>(reader);
|
88
|
+
}
|
89
|
+
|
90
|
+
void LuminanceSource_delete(void* source_ptr) {
|
91
|
+
zxing::Ref<zxing::LuminanceSource>* ref = (zxing::Ref<zxing::LuminanceSource>*)source_ptr;
|
92
|
+
delete ref;
|
93
|
+
}
|
94
|
+
|
95
|
+
int LuminanceSource_width(void* source_ptr) {
|
96
|
+
zxing::Ref<zxing::LuminanceSource>* ref = (zxing::Ref<zxing::LuminanceSource>*)source_ptr;
|
97
|
+
return (*ref)->getWidth();
|
98
|
+
}
|
99
|
+
|
100
|
+
int LuminanceSource_height(void* source_ptr) {
|
101
|
+
zxing::Ref<zxing::LuminanceSource>* ref = (zxing::Ref<zxing::LuminanceSource>*)source_ptr;
|
102
|
+
return (*ref)->getHeight();
|
103
|
+
}
|
104
|
+
|
105
|
+
void* LuminanceSource_matrix(void* source_ptr) {
|
106
|
+
zxing::Ref<zxing::LuminanceSource>* ref = (zxing::Ref<zxing::LuminanceSource>*)source_ptr;
|
107
|
+
return &(*ref)->getMatrix()[0];
|
108
|
+
}
|
109
|
+
|
110
|
+
void* GreyscaleLuminanceSource_new(
|
111
|
+
char* greyData,
|
112
|
+
int dataWidth,
|
113
|
+
int dataHeight,
|
114
|
+
int left,
|
115
|
+
int top,
|
116
|
+
int width,
|
117
|
+
int height) {
|
118
|
+
zxing::GreyscaleLuminanceSource* source =
|
119
|
+
new zxing::GreyscaleLuminanceSource(
|
120
|
+
zxing::ArrayRef<char>(greyData, dataWidth*dataHeight),
|
121
|
+
dataWidth,
|
122
|
+
dataHeight,
|
123
|
+
left,
|
124
|
+
top,
|
125
|
+
width,
|
126
|
+
height);
|
127
|
+
return new zxing::Ref<zxing::LuminanceSource>(source);
|
128
|
+
}
|
129
|
+
|
130
|
+
void Binarizer_delete(void* binarizer_ptr) {
|
131
|
+
zxing::Ref<zxing::Binarizer>* ref = (zxing::Ref<zxing::Binarizer>*)binarizer_ptr;
|
132
|
+
delete ref;
|
133
|
+
}
|
134
|
+
|
135
|
+
void* Binarizer_black_matrix(void* binarizer_ptr) {
|
136
|
+
zxing::Ref<zxing::Binarizer>* ref = (zxing::Ref<zxing::Binarizer>*)binarizer_ptr;
|
137
|
+
return new zxing::Ref<zxing::BitMatrix>((*ref)->getBlackMatrix());
|
138
|
+
}
|
139
|
+
|
140
|
+
void* BinaryBitmap_black_matrix(void* ref_ptr) {
|
141
|
+
zxing::Ref<zxing::BinaryBitmap>* ref = (zxing::Ref<zxing::BinaryBitmap>*)ref_ptr;
|
142
|
+
return new zxing::Ref<zxing::BitMatrix>((*ref)->getBlackMatrix());
|
143
|
+
}
|
144
|
+
|
145
|
+
bool BitMatrix_get(void* ref_ptr, int x, int y) {
|
146
|
+
zxing::Ref<zxing::BitMatrix>* ref = (zxing::Ref<zxing::BitMatrix>*)ref_ptr;
|
147
|
+
return (*ref)->get(x, y);
|
148
|
+
}
|
149
|
+
|
150
|
+
void* HybridBinarizer_new(zxing::Ref<zxing::LuminanceSource>* luminance_source) {
|
151
|
+
zxing::HybridBinarizer* binarizer = new zxing::HybridBinarizer(*luminance_source);
|
152
|
+
return new zxing::Ref<zxing::Binarizer>(binarizer);
|
153
|
+
}
|
154
|
+
|
155
|
+
void* BinaryBitmap_new(zxing::Ref<zxing::Binarizer>* binarizer) {
|
156
|
+
zxing::BinaryBitmap* bitmap = new zxing::BinaryBitmap(*binarizer);
|
157
|
+
return new zxing::Ref<zxing::BinaryBitmap>(bitmap);
|
158
|
+
}
|
159
|
+
|
160
|
+
int BinaryBitmap_count(void* bitmap_ptr) {
|
161
|
+
zxing::Ref<zxing::BinaryBitmap>* ref = (zxing::Ref<zxing::BinaryBitmap>*)bitmap_ptr;
|
162
|
+
return (*ref)->count();
|
163
|
+
}
|
164
|
+
|
165
|
+
void BinaryBitmap_delete(void* bitmap_ptr) {
|
166
|
+
zxing::Ref<zxing::BinaryBitmap>* ref = (zxing::Ref<zxing::BinaryBitmap>*)bitmap_ptr;
|
167
|
+
delete ref;
|
168
|
+
}
|
169
|
+
|
170
|
+
void* DecodeHints_new(int value) {
|
171
|
+
return new zxing::DecodeHints(value);
|
172
|
+
}
|
173
|
+
|
174
|
+
void* DecodeHints_default() {
|
175
|
+
return new zxing::DecodeHints(zxing::DecodeHints::DEFAULT_HINT);
|
176
|
+
}
|
177
|
+
|
178
|
+
void DecodeHints_delete(void* hints_ptr) {
|
179
|
+
zxing::DecodeHints* hints = (zxing::DecodeHints*)hints_ptr;
|
180
|
+
delete hints;
|
181
|
+
}
|
182
|
+
|
183
|
+
void DecodeHints_setTryHarder(void* hints_ptr, bool value) {
|
184
|
+
zxing::DecodeHints* hints = (zxing::DecodeHints*)hints_ptr;
|
185
|
+
hints->setTryHarder(value);
|
186
|
+
}
|
187
|
+
|
188
|
+
void DecodeHints_setDataMatrix(void* hints_ptr, bool) {
|
189
|
+
zxing::DecodeHints* hints = (zxing::DecodeHints*)hints_ptr;
|
190
|
+
hints->addFormat(zxing::BarcodeFormat::DATA_MATRIX);
|
191
|
+
}
|
192
|
+
|
193
|
+
void Result_delete(void* result_ptr) {
|
194
|
+
zxing::Ref<zxing::Result>* ref = (zxing::Ref<zxing::Result>*)result_ptr;
|
195
|
+
delete ref;
|
196
|
+
}
|
197
|
+
|
198
|
+
int Result_getBarcodeFormat(void* ref_ptr) {
|
199
|
+
zxing::Ref<zxing::Result>* ref = (zxing::Ref<zxing::Result>*)ref_ptr;
|
200
|
+
return (*ref)->getBarcodeFormat();
|
201
|
+
}
|
202
|
+
|
203
|
+
void* Result_getText(void* ref_ptr) {
|
204
|
+
zxing::Ref<zxing::Result>* ref = (zxing::Ref<zxing::Result>*)ref_ptr;
|
205
|
+
zxing::Ref<zxing::String> string = (*ref)->getText();
|
206
|
+
return new zxing::Ref<zxing::String>(string);
|
207
|
+
}
|
208
|
+
|
209
|
+
char const* BarcodeFormat_enum_to_string(zxing::BarcodeFormat format) {
|
210
|
+
return zxing::BarcodeFormat::barcodeFormatNames[format];
|
211
|
+
}
|
212
|
+
|
213
|
+
void String_delete(void* string_ptr) {
|
214
|
+
zxing::Ref<zxing::String>* ref = (zxing::Ref<zxing::String>*)string_ptr;
|
215
|
+
delete ref;
|
216
|
+
}
|
217
|
+
|
218
|
+
char const* String_string(void* string_ptr) {
|
219
|
+
zxing::Ref<zxing::String>* ref = (zxing::Ref<zxing::String>*)string_ptr;
|
220
|
+
return (*ref)->getText().c_str();
|
221
|
+
}
|
222
|
+
|
223
|
+
}
|
224
|
+
|