├── .gitignore ├── JQQRCode.pro ├── README.md ├── builder ├── JQQRCodeReaderBuilder │ └── JQQRCodeReaderBuilder.pro ├── JQQRCodeWriterBuilder │ └── JQQRCodeWriterBuilder.pro └── builder.pro ├── demos ├── QRCodeReader │ ├── QRCodeReader.pro │ ├── cpp │ │ └── main.cpp │ └── resources │ │ └── images │ │ ├── images.qrc │ │ └── test.png ├── QRCodeReaderForQml │ ├── QRCodeReaderForQml.pro │ ├── cpp │ │ └── main.cpp │ ├── ios │ │ └── Info.plist │ └── qml │ │ ├── main.qml │ │ └── qml.qrc ├── QRCodeWriter │ ├── QRCodeWriter.pro │ └── cpp │ │ └── main.cpp └── demos.pro └── sharedlibrary └── JQLibrary ├── JQLibrary.pri ├── JQQRCodeReader.pri ├── JQQRCodeWriter.pri ├── include ├── JQQRCodeReader │ ├── JQQRCodeReader.h │ └── JQQRCodeReaderForQml.h └── JQQRCodeWriter │ └── JQQRCodeWriter.h ├── qml ├── JQQRCodeReader │ ├── FlashOff.png │ ├── FlashOn.png │ ├── Frame.png │ ├── JQQRCodeReader.qml │ ├── LightNeedle.png │ └── qmldir └── JQQRCodeReaderQml.qrc └── src ├── JQQRCodeReader ├── JQQRCodeReader.cpp ├── JQQRCodeReaderForQml.cpp └── zxing │ ├── bigint │ ├── .gitignore │ ├── BigInteger.cc │ ├── BigInteger.hh │ ├── BigIntegerAlgorithms.cc │ ├── BigIntegerAlgorithms.hh │ ├── BigIntegerLibrary.hh │ ├── BigIntegerUtils.cc │ ├── BigIntegerUtils.hh │ ├── BigUnsigned.cc │ ├── BigUnsigned.hh │ ├── BigUnsignedInABase.cc │ ├── BigUnsignedInABase.hh │ ├── ChangeLog │ ├── NumberlikeArray.hh │ └── README │ ├── win32 │ └── zxing │ │ ├── iconv.h │ │ ├── stdint.h │ │ └── win_iconv.c │ └── zxing │ ├── BarcodeFormat.cpp │ ├── BarcodeFormat.h │ ├── Binarizer.cpp │ ├── Binarizer.h │ ├── BinaryBitmap.cpp │ ├── BinaryBitmap.h │ ├── ChecksumException.cpp │ ├── ChecksumException.h │ ├── DecodeHints.cpp │ ├── DecodeHints.h │ ├── Exception.cpp │ ├── Exception.h │ ├── FormatException.cpp │ ├── FormatException.h │ ├── IllegalStateException.h │ ├── InvertedLuminanceSource.cpp │ ├── InvertedLuminanceSource.h │ ├── LuminanceSource.cpp │ ├── LuminanceSource.h │ ├── MultiFormatReader.cpp │ ├── MultiFormatReader.h │ ├── NotFoundException.h │ ├── Reader.cpp │ ├── Reader.h │ ├── ReaderException.h │ ├── Result.cpp │ ├── Result.h │ ├── ResultIO.cpp │ ├── ResultPoint.cpp │ ├── ResultPoint.h │ ├── ResultPointCallback.cpp │ ├── ResultPointCallback.h │ ├── ZXing.h │ ├── aztec │ ├── AztecDetectorResult.cpp │ ├── AztecDetectorResult.h │ ├── AztecReader.cpp │ ├── AztecReader.h │ ├── decoder │ │ ├── Decoder.h │ │ └── Decoder1.cpp │ └── detector │ │ ├── Detector.h │ │ └── Detector1.cpp │ ├── common │ ├── Array.h │ ├── BitArray.cpp │ ├── BitArray.h │ ├── BitArrayIO.cpp │ ├── BitMatrix.cpp │ ├── BitMatrix.h │ ├── BitSource.cpp │ ├── BitSource.h │ ├── CharacterSetECI.cpp │ ├── CharacterSetECI.h │ ├── Counted.h │ ├── DecoderResult.cpp │ ├── DecoderResult.h │ ├── DetectorResult.cpp │ ├── DetectorResult.h │ ├── GlobalHistogramBinarizer.cpp │ ├── GlobalHistogramBinarizer.h │ ├── GreyscaleLuminanceSource.cpp │ ├── GreyscaleLuminanceSource.h │ ├── GreyscaleRotatedLuminanceSource.cpp │ ├── GreyscaleRotatedLuminanceSource.h │ ├── GridSampler.cpp │ ├── GridSampler.h │ ├── HybridBinarizer.cpp │ ├── HybridBinarizer.h │ ├── IllegalArgumentException.cpp │ ├── IllegalArgumentException.h │ ├── PerspectiveTransform.cpp │ ├── PerspectiveTransform.h │ ├── Point.h │ ├── Str.cpp │ ├── Str.h │ ├── StringUtils.cpp │ ├── StringUtils.h │ ├── detector │ │ ├── JavaMath.h │ │ ├── MathUtils.h │ │ ├── MonochromeRectangleDetector.cpp │ │ ├── MonochromeRectangleDetector.h │ │ ├── WhiteRectangleDetector.cpp │ │ └── WhiteRectangleDetector.h │ └── reedsolomon │ │ ├── GenericGF.cpp │ │ ├── GenericGF.h │ │ ├── GenericGFPoly.cpp │ │ ├── GenericGFPoly.h │ │ ├── ReedSolomonDecoder.cpp │ │ ├── ReedSolomonDecoder.h │ │ ├── ReedSolomonException.cpp │ │ └── ReedSolomonException.h │ ├── datamatrix │ ├── DataMatrixReader.cpp │ ├── DataMatrixReader.h │ ├── Version.h │ ├── Version1.cpp │ ├── decoder │ │ ├── BitMatrixParser.h │ │ ├── BitMatrixParser1.cpp │ │ ├── DataBlock.h │ │ ├── DataBlock1.cpp │ │ ├── DecodedBitStreamParser.h │ │ ├── DecodedBitStreamParser1.cpp │ │ ├── Decoder.h │ │ └── Decoder2.cpp │ └── detector │ │ ├── CornerPoint.cpp │ │ ├── CornerPoint.h │ │ ├── Detector.h │ │ ├── Detector2.cpp │ │ ├── DetectorException.cpp │ │ └── DetectorException.h │ ├── multi │ ├── ByQuadrantReader.cpp │ ├── ByQuadrantReader.h │ ├── GenericMultipleBarcodeReader.cpp │ ├── GenericMultipleBarcodeReader.h │ ├── MultipleBarcodeReader.cpp │ ├── MultipleBarcodeReader.h │ └── qrcode │ │ ├── QRCodeMultiReader.cpp │ │ ├── QRCodeMultiReader.h │ │ └── detector │ │ ├── MultiDetector.cpp │ │ ├── MultiDetector.h │ │ ├── MultiFinderPatternFinder.h │ │ └── MultiFinderPatternFinder1.cpp │ ├── oned │ ├── CodaBarReader.cpp │ ├── CodaBarReader.h │ ├── Code128Reader.cpp │ ├── Code128Reader.h │ ├── Code39Reader.cpp │ ├── Code39Reader.h │ ├── Code93Reader.cpp │ ├── Code93Reader.h │ ├── EAN13Reader.cpp │ ├── EAN13Reader.h │ ├── EAN8Reader.cpp │ ├── EAN8Reader.h │ ├── ITFReader.cpp │ ├── ITFReader.h │ ├── MultiFormatOneDReader.cpp │ ├── MultiFormatOneDReader.h │ ├── MultiFormatUPCEANReader.cpp │ ├── MultiFormatUPCEANReader.h │ ├── OneDReader.cpp │ ├── OneDReader.h │ ├── OneDResultPoint.cpp │ ├── OneDResultPoint.h │ ├── UPCAReader.cpp │ ├── UPCAReader.h │ ├── UPCEANReader.cpp │ ├── UPCEANReader.h │ ├── UPCEReader.cpp │ └── UPCEReader.h │ ├── pdf417 │ ├── PDF417Reader.cpp │ ├── PDF417Reader.h │ ├── decoder │ │ ├── BitMatrixParser.h │ │ ├── BitMatrixParser2.cpp │ │ ├── DecodedBitStreamParser.h │ │ ├── DecodedBitStreamParser2.cpp │ │ ├── Decoder.h │ │ ├── Decoder3.cpp │ │ └── ec │ │ │ ├── ErrorCorrection.cpp │ │ │ ├── ErrorCorrection.h │ │ │ ├── ModulusGF.cpp │ │ │ ├── ModulusGF.h │ │ │ ├── ModulusPoly.cpp │ │ │ └── ModulusPoly.h │ └── detector │ │ ├── Detector.h │ │ ├── Detector3.cpp │ │ ├── LinesSampler.cpp │ │ └── LinesSampler.h │ └── qrcode │ ├── ErrorCorrectionLevel.cpp │ ├── ErrorCorrectionLevel.h │ ├── FormatInformation.cpp │ ├── FormatInformation.h │ ├── QRCodeReader.cpp │ ├── QRCodeReader.h │ ├── Version.h │ ├── Version2.cpp │ ├── decoder │ ├── BitMatrixParser.h │ ├── BitMatrixParser3.cpp │ ├── DataBlock.h │ ├── DataBlock2.cpp │ ├── DataMask.cpp │ ├── DataMask.h │ ├── DecodedBitStreamParser.h │ ├── DecodedBitStreamParser3.cpp │ ├── Decoder.h │ ├── Decoder4.cpp │ ├── Mode.cpp │ └── Mode.h │ └── detector │ ├── AlignmentPattern.cpp │ ├── AlignmentPattern.h │ ├── AlignmentPatternFinder.cpp │ ├── AlignmentPatternFinder.h │ ├── Detector.h │ ├── Detector4.cpp │ ├── FinderPattern.cpp │ ├── FinderPattern.h │ ├── FinderPatternFinder.h │ ├── FinderPatternFinder2.cpp │ ├── FinderPatternInfo.cpp │ └── FinderPatternInfo.h └── JQQRCodeWriter ├── JQQRCodeWriter.cpp └── qrencode ├── COPYING ├── ChangeLog ├── Doxyfile ├── NEWS ├── README ├── TODO ├── acinclude.m4 ├── aclocal.m4 ├── autogen.sh ├── bitstream.c ├── bitstream.h ├── config.h ├── configure ├── configure.ac ├── libqrencode.pc.in ├── mask.c ├── mask.h ├── mmask.c ├── mmask.h ├── mqrspec.c ├── mqrspec.h ├── qrenc.c ├── qrencode.1.in ├── qrencode.c ├── qrencode.h ├── qrencode.spec ├── qrencode.spec.in ├── qrencode_inner.h ├── qrinput.c ├── qrinput.h ├── qrspec.c ├── qrspec.h ├── rscode.c ├── rscode.h ├── split.c ├── split.h ├── tests ├── common.h ├── create_frame_pattern.c ├── create_mqr_frame_pattern.c ├── decoder.c ├── decoder.h ├── frame ├── prof_qrencode.c ├── pthread_qrencode.c ├── test_all.sh ├── test_bitstream.c ├── test_estimatebit.c ├── test_mask.c ├── test_mmask.c ├── test_monkey.c ├── test_mqrspec.c ├── test_qrencode.c ├── test_qrinput.c ├── test_qrspec.c ├── test_rs.c ├── test_split.c └── view_qrcode.c └── use ├── compile ├── config.guess ├── config.rpath ├── config.sub ├── depcomp ├── install-sh ├── ltmain.sh └── missing /.gitignore: -------------------------------------------------------------------------------- 1 | ### JQQRCode bin ### 2 | sharedlibrary/JQLibrary/bin/JQQRCode* 3 | 4 | ### C++ ### 5 | # Prerequisites 6 | *.d 7 | 8 | # Compiled Object files 9 | *.slo 10 | *.lo 11 | *.o 12 | *.obj 13 | 14 | # Precompiled Headers 15 | *.gch 16 | *.pch 17 | 18 | # Fortran module files 19 | *.mod 20 | *.smod 21 | 22 | 23 | ### Qt ### 24 | 25 | # Qt-es 26 | 27 | /.qmake.cache 28 | /.qmake.stash 29 | *.pro.user 30 | *.pro.user.* 31 | *.qbs.user 32 | *.qbs.user.* 33 | *.moc 34 | moc_*.cpp 35 | qrc_*.cpp 36 | ui_*.h 37 | Makefile* 38 | *build-* 39 | 40 | # QtCreator 41 | 42 | *.autosave 43 | 44 | # QtCtreator Qml 45 | *.qmlproject.user 46 | *.qmlproject.user.* 47 | 48 | # QtCtreator CMake 49 | CMakeLists.txt.user* 50 | 51 | ### macOS ### 52 | *.DS_Store 53 | -------------------------------------------------------------------------------- /JQQRCode.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of JQLibrary 3 | # 4 | # Library introduce: https://github.com/188080501/JQLibrary 5 | # 6 | # Copyright: Jason 7 | # 8 | # Contact email: Jason@JasonServer.com 9 | # 10 | # GitHub: https://github.com/188080501/ 11 | # 12 | 13 | TEMPLATE = subdirs 14 | 15 | SUBDIRS += builder 16 | SUBDIRS += demos 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 介绍 2 | 3 | JQQRCode,是一个给Qt开发的,二维码相关功能的封装。 4 | 5 | 其中解析/扫描二维码部分底层为zxing,生成/制作二维码部分底层为qrencode。 6 | 7 | ## 使用举例 8 | 9 | * 从图片解析二维码 10 | 11 | ``` 12 | const QImage testImage( ":/images/test.png" ); 13 | JQQRCodeReader qrCodeReader; 14 | qDebug() << "decodeImage return:" << qrCodeReader.decodeImage( testImage ); 15 | ``` 16 | 17 | * 生成二维码 18 | 19 | ``` 20 | const auto &&qrCodeImage = JQQRCodeWriter::makeQRcode( "QRCodeWriter" ); 21 | qDebug() << qrCodeImage; 22 | ``` 23 | 24 | ## 系统要求 25 | 编译本工程,请使用支持C++11的编译器 26 | 27 | 目前我测试了macOS、iOS、Windows (MinGW & VS2013)和Android,均正常工作 28 | 29 | 测试时使用的是Qt5.8 30 | 31 | 老版本Qt在iOS上可能有问题 32 | 33 | 理论上可以部署到任何Qt支持的平台上。 34 | 35 | 注意:在iOS使用的时候,一定要给Info.plist加上NSCameraUsageDescription,不然程序一调用摄像头就崩溃 36 | 37 | 本库源码均已开源在了GitHub上。 38 | 39 | GitHub地址:https://github.com/188080501/JQQRCode 40 | 41 | 方便的话,帮我点个星星,或者反馈一下使用意见,这是对我莫大的帮助。 42 | 43 | 若你遇到问题、有了更好的建议或者想要一些新功能,都可以直接在GitHub上提交Issues:https://github.com/188080501/JQQRCode/issues 44 | -------------------------------------------------------------------------------- /builder/JQQRCodeReaderBuilder/JQQRCodeReaderBuilder.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of JQLibrary 3 | # 4 | # Library introduce: https://github.com/188080501/JQQRCodeReader 5 | # 6 | # Copyright: Jason 7 | # 8 | # Contact email: Jason@JasonServer.com 9 | # 10 | # GitHub: https://github.com/188080501/ 11 | # 12 | 13 | QT += core 14 | 15 | TEMPLATE = lib 16 | 17 | CONFIG += staticlib 18 | 19 | CONFIG( debug, debug | release ) { 20 | TARGET = JQQRCodeReaderd 21 | } 22 | 23 | CONFIG( release, debug | release ) { 24 | TARGET = JQQRCodeReader 25 | } 26 | 27 | JQQRCODEREADER_COMPILE_MODE = SRC 28 | include( $$PWD/../../sharedlibrary/JQLibrary/JQQRCodeReader.pri ) 29 | 30 | DESTDIR = $$JQQRCODEREADER_BIN_DIR 31 | -------------------------------------------------------------------------------- /builder/JQQRCodeWriterBuilder/JQQRCodeWriterBuilder.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of JQLibrary 3 | # 4 | # Library introduce: https://github.com/188080501/JQLibrary 5 | # 6 | # Copyright: Jason 7 | # 8 | # Contact email: Jason@JasonServer.com 9 | # 10 | # GitHub: https://github.com/188080501/ 11 | # 12 | 13 | QT += core 14 | 15 | TEMPLATE = lib 16 | 17 | CONFIG += staticlib 18 | 19 | CONFIG( debug, debug | release ) { 20 | TARGET = JQQRCodeWriterd 21 | } 22 | 23 | CONFIG( release, debug | release ) { 24 | TARGET = JQQRCodeWriter 25 | } 26 | 27 | JQQRCODEWRITER_COMPILE_MODE = SRC 28 | include( $$PWD/../../sharedlibrary/JQLibrary/JQQRCodeWriter.pri ) 29 | 30 | DESTDIR = $$JQQRCODEWRITER_BIN_DIR 31 | -------------------------------------------------------------------------------- /builder/builder.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of JQLibrary 3 | # 4 | # Library introduce: https://github.com/188080501/JQLibrary 5 | # 6 | # Copyright: Jason 7 | # 8 | # Contact email: Jason@JasonServer.com 9 | # 10 | # GitHub: https://github.com/188080501/ 11 | # 12 | 13 | TEMPLATE = subdirs 14 | 15 | SUBDIRS += JQQRCodeWriterBuilder 16 | SUBDIRS += JQQRCodeReaderBuilder 17 | -------------------------------------------------------------------------------- /demos/QRCodeReader/QRCodeReader.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of JQLibrary 3 | # 4 | # Library introduce: https://github.com/188080501/JQLibrary 5 | # 6 | # Copyright: Jason 7 | # 8 | # Contact email: Jason@JasonServer.com 9 | # 10 | # GitHub: https://github.com/188080501/ 11 | # 12 | 13 | QT += core 14 | 15 | TEMPLATE = app 16 | 17 | #JQQRCODEWRITER_COMPILE_MODE = SRC 18 | include( $$PWD/../../sharedlibrary/JQLibrary/JQLibrary.pri ) 19 | include( $$PWD/../../sharedlibrary/JQLibrary/JQQRCodeReader.pri ) 20 | 21 | SOURCES += \ 22 | $$PWD/cpp/main.cpp 23 | 24 | RESOURCES += \ 25 | $$PWD/resources/images/images.qrc 26 | -------------------------------------------------------------------------------- /demos/QRCodeReader/cpp/main.cpp: -------------------------------------------------------------------------------- 1 | // Qt lib import 2 | #include 3 | #include 4 | #include 5 | 6 | // JQLibrary lib improt 7 | #include "JQQRCodeReader.h" 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | QCoreApplication a(argc, argv); 12 | 13 | const QImage testImage( ":/images/test.png" ); 14 | 15 | JQQRCodeReader qrCodeReader; 16 | 17 | qDebug() << "decodeImage return:" << qrCodeReader.decodeImage( testImage, JQQRCodeReader::DecodeQrCodeType ); 18 | 19 | // const QImage testImage2( "/Users/jason/Desktop/IMG_6553.PNG" ); 20 | // for ( auto currentType = 1; currentType <= 17; ++currentType ) 21 | // { 22 | // qDebug() << "decodeImage return:" << currentType << ( 1 << currentType ) << qrCodeReader.decodeImage( testImage2, ( 1 << currentType ) ); 23 | // } 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /demos/QRCodeReader/resources/images/images.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | test.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /demos/QRCodeReader/resources/images/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/188080501/JQQRCode/5e1a97c787d557b0fbd308eafbe1ca22040d5568/demos/QRCodeReader/resources/images/test.png -------------------------------------------------------------------------------- /demos/QRCodeReaderForQml/QRCodeReaderForQml.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of JQLibrary 3 | # 4 | # Library introduce: https://github.com/188080501/JQLibrary 5 | # 6 | # Copyright: Jason 7 | # 8 | # Contact email: Jason@JasonServer.com 9 | # 10 | # GitHub: https://github.com/188080501/ 11 | # 12 | 13 | QT += core qml quick concurrent multimedia 14 | 15 | TEMPLATE = app 16 | 17 | #JQQRCODEREADER_COMPILE_MODE = SRC 18 | include( $$PWD/../../sharedlibrary/JQLibrary/JQLibrary.pri ) 19 | include( $$PWD/../../sharedlibrary/JQLibrary/JQQRCodeReader.pri ) 20 | 21 | SOURCES += \ 22 | $$PWD/cpp/main.cpp 23 | 24 | RESOURCES += \ 25 | $$PWD/qml/qml.qrc 26 | 27 | ios { 28 | QMAKE_INFO_PLIST = ios/Info.plist 29 | } 30 | -------------------------------------------------------------------------------- /demos/QRCodeReaderForQml/cpp/main.cpp: -------------------------------------------------------------------------------- 1 | // Qt lib import 2 | #include 3 | #include 4 | 5 | // JQLibrary lib improt 6 | #include "JQQRCodeReaderForQml.h" 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | QGuiApplication app(argc, argv); 11 | 12 | QQmlApplicationEngine engine; 13 | 14 | JQQRCODEREADERFORQML_REGISTERTYPE( engine ); 15 | 16 | engine.load( QUrl( QStringLiteral( "qrc:/main.qml" ) ) ); 17 | 18 | return app.exec(); 19 | } 20 | -------------------------------------------------------------------------------- /demos/QRCodeReaderForQml/ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSCameraUsageDescription 6 | 需要摄像头权限才可以扫描二维码 7 | CFBundleIconFile 8 | 9 | CFBundlePackageType 10 | APPL 11 | CFBundleGetInfoString 12 | Created by Qt/QMake 13 | CFBundleSignature 14 | ???? 15 | CFBundleExecutable 16 | QRCodeReaderForQml 17 | CFBundleIdentifier 18 | jason.${PRODUCT_NAME:rfc1034identifier} 19 | CFBundleDisplayName 20 | ${PRODUCT_NAME} 21 | CFBundleName 22 | ${PRODUCT_NAME} 23 | CFBundleShortVersionString 24 | 1.0 25 | CFBundleVersion 26 | 1.0 27 | LSRequiresIPhoneOS 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationPortraitUpsideDown 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | NOTE 39 | This file was generated by Qt/QMake. 40 | 41 | 42 | -------------------------------------------------------------------------------- /demos/QRCodeReaderForQml/qml/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /demos/QRCodeWriter/QRCodeWriter.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of JQLibrary 3 | # 4 | # Library introduce: https://github.com/188080501/JQLibrary 5 | # 6 | # Copyright: Jason 7 | # 8 | # Contact email: Jason@JasonServer.com 9 | # 10 | # GitHub: https://github.com/188080501/ 11 | # 12 | 13 | QT += core 14 | 15 | TEMPLATE = app 16 | 17 | #JQQRCODEREADER_COMPILE_MODE = SRC 18 | include( $$PWD/../../sharedlibrary/JQLibrary/JQLibrary.pri ) 19 | include( $$PWD/../../sharedlibrary/JQLibrary/JQQRCodeWriter.pri ) 20 | 21 | SOURCES += \ 22 | $$PWD/cpp/main.cpp 23 | -------------------------------------------------------------------------------- /demos/QRCodeWriter/cpp/main.cpp: -------------------------------------------------------------------------------- 1 | // Qt lib import 2 | #include 3 | #include 4 | #include 5 | 6 | // JQLibrary lib improt 7 | #include "JQQRCodeWriter.h" 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | QCoreApplication a(argc, argv); 12 | 13 | const auto &&qrCodeImage = JQQRCodeWriter::makeQRcode( "QRCodeWriter" ); 14 | qDebug() << qrCodeImage; 15 | 16 | if ( qrCodeImage.isNull() ) 17 | { 18 | return -1; 19 | } 20 | 21 | qDebug() << "save png succeed:" << qrCodeImage.save( QString( "%1/test.png" ).arg( QStandardPaths::writableLocation( QStandardPaths::DesktopLocation ) ), "PNG" ); 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /demos/demos.pro: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of JQLibrary 3 | # 4 | # Library introduce: https://github.com/188080501/JQLibrary 5 | # 6 | # Copyright: Jason 7 | # 8 | # Contact email: Jason@JasonServer.com 9 | # 10 | # GitHub: https://github.com/188080501/ 11 | # 12 | 13 | TEMPLATE = subdirs 14 | 15 | SUBDIRS += QRCodeWriter 16 | SUBDIRS += QRCodeReader 17 | SUBDIRS += QRCodeReaderForQml 18 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/include/JQQRCodeWriter/JQQRCodeWriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of JQLibrary 3 | 4 | Copyright: Jason and others 5 | 6 | Contact email: 188080501@qq.com 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef JQQRCODEWRITER_H_ 29 | #define JQQRCODEWRITER_H_ 30 | 31 | // Qt lib import 32 | #include 33 | #include 34 | 35 | namespace JQQRCodeWriter 36 | { 37 | 38 | QImage makeQRcode( 39 | const QString &data, 40 | const QSize &size = QSize( 512, 512 ), 41 | const QColor &colorForPoint = QColor( "#000000" ) 42 | ); 43 | 44 | } 45 | 46 | #endif//JQQRCODEWRITER_H_ 47 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/qml/JQQRCodeReader/FlashOff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/188080501/JQQRCode/5e1a97c787d557b0fbd308eafbe1ca22040d5568/sharedlibrary/JQLibrary/qml/JQQRCodeReader/FlashOff.png -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/qml/JQQRCodeReader/FlashOn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/188080501/JQQRCode/5e1a97c787d557b0fbd308eafbe1ca22040d5568/sharedlibrary/JQLibrary/qml/JQQRCodeReader/FlashOn.png -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/qml/JQQRCodeReader/Frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/188080501/JQQRCode/5e1a97c787d557b0fbd308eafbe1ca22040d5568/sharedlibrary/JQLibrary/qml/JQQRCodeReader/Frame.png -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/qml/JQQRCodeReader/LightNeedle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/188080501/JQQRCode/5e1a97c787d557b0fbd308eafbe1ca22040d5568/sharedlibrary/JQLibrary/qml/JQQRCodeReader/LightNeedle.png -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/qml/JQQRCodeReader/qmldir: -------------------------------------------------------------------------------- 1 | module JQQRCodeReader 2 | 3 | JQQRCodeReader 1.0 JQQRCodeReader.qml 4 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/qml/JQQRCodeReaderQml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | JQQRCodeReader/JQQRCodeReader.qml 4 | JQQRCodeReader/qmldir 5 | JQQRCodeReader/Frame.png 6 | JQQRCodeReader/LightNeedle.png 7 | JQQRCodeReader/FlashOff.png 8 | JQQRCodeReader/FlashOn.png 9 | 10 | 11 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/bigint/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | sample 3 | testsuite 4 | testsuite.expected 5 | testsuite.out 6 | testsuite.err 7 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/bigint/BigIntegerAlgorithms.cc: -------------------------------------------------------------------------------- 1 | #include "BigIntegerAlgorithms.hh" 2 | 3 | BigUnsigned gcd(BigUnsigned a, BigUnsigned b) { 4 | BigUnsigned trash; 5 | // Neat in-place alternating technique. 6 | for (;;) { 7 | if (b.isZero()) 8 | return a; 9 | a.divideWithRemainder(b, trash); 10 | if (a.isZero()) 11 | return b; 12 | b.divideWithRemainder(a, trash); 13 | } 14 | } 15 | 16 | void extendedEuclidean(BigInteger m, BigInteger n, 17 | BigInteger &g, BigInteger &r, BigInteger &s) { 18 | if (&g == &r || &g == &s || &r == &s) 19 | throw "BigInteger extendedEuclidean: Outputs are aliased"; 20 | BigInteger r1(1), s1(0), r2(0), s2(1), q; 21 | /* Invariants: 22 | * r1*m(orig) + s1*n(orig) == m(current) 23 | * r2*m(orig) + s2*n(orig) == n(current) */ 24 | for (;;) { 25 | if (n.isZero()) { 26 | r = r1; s = s1; g = m; 27 | return; 28 | } 29 | // Subtract q times the second invariant from the first invariant. 30 | m.divideWithRemainder(n, q); 31 | r1 -= q*r2; s1 -= q*s2; 32 | 33 | if (m.isZero()) { 34 | r = r2; s = s2; g = n; 35 | return; 36 | } 37 | // Subtract q times the first invariant from the second invariant. 38 | n.divideWithRemainder(m, q); 39 | r2 -= q*r1; s2 -= q*s1; 40 | } 41 | } 42 | 43 | BigUnsigned modinv(const BigInteger &x, const BigUnsigned &n) { 44 | BigInteger g, r, s; 45 | extendedEuclidean(x, n, g, r, s); 46 | if (g == 1) 47 | // r*x + s*n == 1, so r*x === 1 (mod n), so r is the answer. 48 | return (r % n).getMagnitude(); // (r % n) will be nonnegative 49 | else 50 | throw "BigInteger modinv: x and n have a common factor"; 51 | } 52 | 53 | BigUnsigned modexp(const BigInteger &base, const BigUnsigned &exponent, 54 | const BigUnsigned &modulus) { 55 | BigUnsigned ans = 1, base2 = (base % modulus).getMagnitude(); 56 | BigUnsigned::Index i = exponent.bitLength(); 57 | // For each bit of the exponent, most to least significant... 58 | while (i > 0) { 59 | i--; 60 | // Square. 61 | ans *= ans; 62 | ans %= modulus; 63 | // And multiply if the bit is a 1. 64 | if (exponent.getBit(i)) { 65 | ans *= base2; 66 | ans %= modulus; 67 | } 68 | } 69 | return ans; 70 | } 71 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/bigint/BigIntegerAlgorithms.hh: -------------------------------------------------------------------------------- 1 | #ifndef BIGINTEGERALGORITHMS_H 2 | #define BIGINTEGERALGORITHMS_H 3 | 4 | #include "BigInteger.hh" 5 | 6 | /* Some mathematical algorithms for big integers. 7 | * This code is new and, as such, experimental. */ 8 | 9 | // Returns the greatest common divisor of a and b. 10 | BigUnsigned gcd(BigUnsigned a, BigUnsigned b); 11 | 12 | /* Extended Euclidean algorithm. 13 | * Given m and n, finds gcd g and numbers r, s such that r*m + s*n == g. */ 14 | void extendedEuclidean(BigInteger m, BigInteger n, 15 | BigInteger &g, BigInteger &r, BigInteger &s); 16 | 17 | /* Returns the multiplicative inverse of x modulo n, or throws an exception if 18 | * they have a common factor. */ 19 | BigUnsigned modinv(const BigInteger &x, const BigUnsigned &n); 20 | 21 | // Returns (base ^ exponent) % modulus. 22 | BigUnsigned modexp(const BigInteger &base, const BigUnsigned &exponent, 23 | const BigUnsigned &modulus); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/bigint/BigIntegerLibrary.hh: -------------------------------------------------------------------------------- 1 | // This header file includes all of the library header files. 2 | 3 | #include "NumberlikeArray.hh" 4 | #include "BigUnsigned.hh" 5 | #include "BigInteger.hh" 6 | #include "BigIntegerAlgorithms.hh" 7 | #include "BigUnsignedInABase.hh" 8 | #include "BigIntegerUtils.hh" 9 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/bigint/BigIntegerUtils.cc: -------------------------------------------------------------------------------- 1 | #include "BigIntegerUtils.hh" 2 | #include "BigUnsignedInABase.hh" 3 | 4 | std::string bigUnsignedToString(const BigUnsigned &x) { 5 | return std::string(BigUnsignedInABase(x, 10)); 6 | } 7 | 8 | std::string bigIntegerToString(const BigInteger &x) { 9 | return (x.getSign() == BigInteger::negative) 10 | ? (std::string("-") + bigUnsignedToString(x.getMagnitude())) 11 | : (bigUnsignedToString(x.getMagnitude())); 12 | } 13 | 14 | BigUnsigned stringToBigUnsigned(const std::string &s) { 15 | return BigUnsigned(BigUnsignedInABase(s, 10)); 16 | } 17 | 18 | BigInteger stringToBigInteger(const std::string &s) { 19 | // Recognize a sign followed by a BigUnsigned. 20 | return (s[0] == '-') ? BigInteger(stringToBigUnsigned(s.substr(1, s.length() - 1)), BigInteger::negative) 21 | : (s[0] == '+') ? BigInteger(stringToBigUnsigned(s.substr(1, s.length() - 1))) 22 | : BigInteger(stringToBigUnsigned(s)); 23 | } 24 | 25 | std::ostream &operator <<(std::ostream &os, const BigUnsigned &x) { 26 | BigUnsignedInABase::Base base; 27 | long osFlags = os.flags(); 28 | if (osFlags & os.dec) 29 | base = 10; 30 | else if (osFlags & os.hex) { 31 | base = 16; 32 | if (osFlags & os.showbase) 33 | os << "0x"; 34 | } else if (osFlags & os.oct) { 35 | base = 8; 36 | if (osFlags & os.showbase) 37 | os << '0'; 38 | } else 39 | throw "std::ostream << BigUnsigned: Could not determine the desired base from output-stream flags"; 40 | std::string s = std::string(BigUnsignedInABase(x, base)); 41 | os << s; 42 | return os; 43 | } 44 | 45 | std::ostream &operator <<(std::ostream &os, const BigInteger &x) { 46 | if (x.getSign() == BigInteger::negative) 47 | os << '-'; 48 | os << x.getMagnitude(); 49 | return os; 50 | } 51 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/win32/zxing/iconv.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBICONV_H 2 | #define _LIBICONV_H 3 | #include 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | typedef void* iconv_t; 8 | iconv_t iconv_open(const char *tocode, const char *fromcode); 9 | int iconv_close(iconv_t cd); 10 | size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | #endif//_LIBICONV_H -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/BarcodeFormat.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * Created by Christian Brunschen on 13/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 20 | 21 | const char* zxing::BarcodeFormat::barcodeFormatNames[] = { 22 | 0, 23 | "AZTEC", 24 | "CODABAR", 25 | "CODE_39", 26 | "CODE_93", 27 | "CODE_128", 28 | "DATA_MATRIX", 29 | "EAN_8", 30 | "EAN_13", 31 | "ITF", 32 | "MAXICODE", 33 | "PDF_417", 34 | "QR_CODE", 35 | "RSS_14", 36 | "RSS_EXPANDED", 37 | "UPC_A", 38 | "UPC_E", 39 | "UPC_EAN_EXTENSION" 40 | }; 41 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/BarcodeFormat.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __BARCODE_FORMAT_H__ 3 | #define __BARCODE_FORMAT_H__ 4 | 5 | /* 6 | * BarcodeFormat.h 7 | * zxing 8 | * 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | namespace zxing { 25 | 26 | class BarcodeFormat { 27 | public: 28 | // if you update the enum, update BarcodeFormat.cpp 29 | 30 | enum Value { 31 | NONE, 32 | AZTEC, 33 | CODABAR, 34 | CODE_39, 35 | CODE_93, 36 | CODE_128, 37 | DATA_MATRIX, 38 | EAN_8, 39 | EAN_13, 40 | ITF, 41 | MAXICODE, 42 | PDF_417, 43 | QR_CODE, 44 | RSS_14, 45 | RSS_EXPANDED, 46 | UPC_A, 47 | UPC_E, 48 | UPC_EAN_EXTENSION 49 | }; 50 | 51 | BarcodeFormat(Value v) : value(v) {} 52 | const Value value; 53 | operator Value () const {return value;} 54 | 55 | static char const* barcodeFormatNames[]; 56 | }; 57 | 58 | } 59 | 60 | #endif // __BARCODE_FORMAT_H__ 61 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/Binarizer.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * Binarizer.cpp 4 | * zxing 5 | * 6 | * Created by Ralf Kistner on 16/10/2009. 7 | * Copyright 2008 ZXing authors All rights reserved. 8 | * Modified by Lukasz Warchol on 02/02/2010. 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 24 | 25 | namespace zxing { 26 | 27 | Binarizer::Binarizer(Ref source) : source_(source) { 28 | } 29 | 30 | Binarizer::~Binarizer() { 31 | } 32 | 33 | Ref Binarizer::getLuminanceSource() const { 34 | return source_; 35 | } 36 | 37 | int Binarizer::getWidth() const { 38 | return source_->getWidth(); 39 | } 40 | 41 | int Binarizer::getHeight() const { 42 | return source_->getHeight(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/Binarizer.h: -------------------------------------------------------------------------------- 1 | #ifndef BINARIZER_H_ 2 | #define BINARIZER_H_ 3 | 4 | /* 5 | * Binarizer.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 24 | #include 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | 30 | class Binarizer : public Counted { 31 | private: 32 | Ref source_; 33 | 34 | public: 35 | Binarizer(Ref source); 36 | virtual ~Binarizer(); 37 | 38 | virtual Ref getBlackRow(int y, Ref row) = 0; 39 | virtual Ref getBlackMatrix() = 0; 40 | 41 | Ref getLuminanceSource() const ; 42 | virtual Ref createBinarizer(Ref source) = 0; 43 | 44 | int getWidth() const; 45 | int getHeight() const; 46 | 47 | }; 48 | 49 | } 50 | #endif /* BINARIZER_H_ */ 51 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/BinaryBitmap.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * Copyright 2010 ZXing authors All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | using zxing::Ref; 21 | using zxing::BitArray; 22 | using zxing::BitMatrix; 23 | using zxing::LuminanceSource; 24 | using zxing::BinaryBitmap; 25 | 26 | // VC++ 27 | using zxing::Binarizer; 28 | 29 | BinaryBitmap::BinaryBitmap(Ref binarizer) : binarizer_(binarizer) { 30 | } 31 | 32 | BinaryBitmap::~BinaryBitmap() { 33 | } 34 | 35 | Ref BinaryBitmap::getBlackRow(int y, Ref row) { 36 | return binarizer_->getBlackRow(y, row); 37 | } 38 | 39 | Ref BinaryBitmap::getBlackMatrix() { 40 | return binarizer_->getBlackMatrix(); 41 | } 42 | 43 | int BinaryBitmap::getWidth() const { 44 | return getLuminanceSource()->getWidth(); 45 | } 46 | 47 | int BinaryBitmap::getHeight() const { 48 | return getLuminanceSource()->getHeight(); 49 | } 50 | 51 | Ref BinaryBitmap::getLuminanceSource() const { 52 | return binarizer_->getLuminanceSource(); 53 | } 54 | 55 | 56 | bool BinaryBitmap::isCropSupported() const { 57 | return getLuminanceSource()->isCropSupported(); 58 | } 59 | 60 | Ref BinaryBitmap::crop(int left, int top, int width, int height) { 61 | return Ref (new BinaryBitmap(binarizer_->createBinarizer(getLuminanceSource()->crop(left, top, width, height)))); 62 | } 63 | 64 | bool BinaryBitmap::isRotateSupported() const { 65 | return getLuminanceSource()->isRotateSupported(); 66 | } 67 | 68 | Ref BinaryBitmap::rotateCounterClockwise() { 69 | return Ref (new BinaryBitmap(binarizer_->createBinarizer(getLuminanceSource()->rotateCounterClockwise()))); 70 | } 71 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/BinaryBitmap.h: -------------------------------------------------------------------------------- 1 | #ifndef __BINARYBITMAP_H__ 2 | #define __BINARYBITMAP_H__ 3 | 4 | /* 5 | * BinaryBitmap.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 24 | #include 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | 30 | class BinaryBitmap : public Counted { 31 | private: 32 | Ref binarizer_; 33 | 34 | public: 35 | BinaryBitmap(Ref binarizer); 36 | virtual ~BinaryBitmap(); 37 | 38 | Ref getBlackRow(int y, Ref row); 39 | Ref getBlackMatrix(); 40 | 41 | Ref getLuminanceSource() const; 42 | 43 | int getWidth() const; 44 | int getHeight() const; 45 | 46 | bool isRotateSupported() const; 47 | Ref rotateCounterClockwise(); 48 | 49 | bool isCropSupported() const; 50 | Ref crop(int left, int top, int width, int height); 51 | 52 | }; 53 | 54 | } 55 | 56 | #endif /* BINARYBITMAP_H_ */ 57 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/ChecksumException.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * ChecksumException.cpp 4 | * zxing 5 | * 6 | * Created by Christian Brunschen on 13/05/2008. 7 | * Copyright 2008 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | using zxing::ChecksumException; 25 | 26 | ChecksumException::ChecksumException() throw() {} 27 | ChecksumException::ChecksumException(const char *msg) throw() : ReaderException(msg) {} 28 | ChecksumException::~ChecksumException() throw() {} 29 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/ChecksumException.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef __CHECKSUM_EXCEPTION_H__ 4 | #define __CHECKSUM_EXCEPTION_H__ 5 | 6 | /* 7 | * Copyright 20011 ZXing authors 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | namespace zxing { 25 | class ChecksumException : public ReaderException { 26 | typedef ReaderException Base; 27 | public: 28 | ChecksumException() throw(); 29 | ChecksumException(const char *msg) throw(); 30 | ~ChecksumException() throw(); 31 | }; 32 | } 33 | 34 | #endif // __CHECKSUM_EXCEPTION_H__ 35 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/Exception.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * Exception.cpp 4 | * ZXing 5 | * 6 | * Created by Christian Brunschen on 03/06/2008. 7 | * Copyright 2008-2011 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | using zxing::Exception; 28 | 29 | void Exception::deleteMessage() { 30 | delete [] message; 31 | } 32 | 33 | char const* Exception::copy(char const* msg) { 34 | char* message = 0; 35 | if (msg) { 36 | int l = static_cast(strlen(msg)+1); 37 | if (l) { 38 | message = new char[l]; 39 | strcpy(message, msg); 40 | } 41 | } 42 | return message; 43 | } 44 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/Exception.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __EXCEPTION_H__ 3 | #define __EXCEPTION_H__ 4 | 5 | /* 6 | * Exception.h 7 | * ZXing 8 | * 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | 29 | class Exception : public std::exception { 30 | private: 31 | char const* const message; 32 | 33 | public: 34 | Exception() throw() : message(0) {} 35 | Exception(const char* msg) throw() : message(copy(msg)) {} 36 | Exception(Exception const& that) throw() : std::exception(that), message(copy(that.message)) {} 37 | ~Exception() throw() { 38 | if(message) { 39 | deleteMessage(); 40 | } 41 | } 42 | char const* what() const throw() {return message ? message : "";} 43 | 44 | private: 45 | static char const* copy(char const*); 46 | void deleteMessage(); 47 | }; 48 | 49 | } 50 | 51 | #endif // __EXCEPTION_H__ 52 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/FormatException.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * FormatException.cpp 4 | * zxing 5 | * 6 | * Created by Christian Brunschen on 13/05/2008. 7 | * Copyright 2008 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | namespace zxing { 25 | 26 | FormatException::FormatException() {} 27 | 28 | FormatException::FormatException(const char *msg) : 29 | ReaderException(msg) { 30 | } 31 | 32 | FormatException::~FormatException() throw() { 33 | } 34 | 35 | FormatException const& 36 | FormatException::getFormatInstance() { 37 | static FormatException instance; 38 | return instance; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/FormatException.h: -------------------------------------------------------------------------------- 1 | #ifndef __FORMAT_EXCEPTION_H__ 2 | #define __FORMAT_EXCEPTION_H__ 3 | 4 | /* 5 | * FormatException.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 24 | 25 | namespace zxing { 26 | 27 | class FormatException : public ReaderException { 28 | public: 29 | FormatException(); 30 | FormatException(const char *msg); 31 | ~FormatException() throw(); 32 | 33 | static FormatException const& getFormatInstance(); 34 | }; 35 | 36 | } 37 | #endif // __FORMAT_EXCEPTION_H__ 38 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/IllegalStateException.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef __ILLEGAL_STATE_EXCEPTION_H__ 4 | #define __ILLEGAL_STATE_EXCEPTION_H__ 5 | 6 | /* 7 | * Copyright 20011 ZXing authors 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may illegal use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | namespace zxing { 25 | 26 | class IllegalStateException : public ReaderException { 27 | public: 28 | IllegalStateException() throw() {} 29 | IllegalStateException(const char *msg) throw() : ReaderException(msg) {} 30 | ~IllegalStateException() throw() {} 31 | }; 32 | 33 | } 34 | 35 | #endif // __ILLEGAL_STATE_EXCEPTION_H__ 36 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/InvertedLuminanceSource.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __INVERTEDLUMINANCESOURCE_H__ 3 | #define __INVERTEDLUMINANCESOURCE_H__ 4 | /* 5 | * Copyright 2013 ZXing authors All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | namespace zxing { 24 | 25 | class InvertedLuminanceSource : public LuminanceSource { 26 | private: 27 | typedef LuminanceSource Super; 28 | const Ref delegate; 29 | 30 | public: 31 | InvertedLuminanceSource(Ref const&); 32 | 33 | ArrayRef getRow(int y, ArrayRef row) const; 34 | ArrayRef getMatrix() const; 35 | 36 | boolean isCropSupported() const; 37 | Ref crop(int left, int top, int width, int height) const; 38 | 39 | boolean isRotateSupported() const; 40 | 41 | virtual Ref invert() const; 42 | 43 | Ref rotateCounterClockwise() const; 44 | }; 45 | 46 | } 47 | 48 | #endif /* INVERTEDLUMINANCESOURCE_H_ */ 49 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/LuminanceSource.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __LUMINANCESOURCE_H__ 3 | #define __LUMINANCESOURCE_H__ 4 | /* 5 | * LuminanceSource.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 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | 29 | class LuminanceSource : public Counted { 30 | private: 31 | const int width; 32 | const int height; 33 | 34 | public: 35 | LuminanceSource(int width, int height); 36 | virtual ~LuminanceSource(); 37 | 38 | int getWidth() const { return width; } 39 | int getHeight() const { return height; } 40 | 41 | // Callers take ownership of the returned memory and must call delete [] on it themselves. 42 | virtual ArrayRef getRow(int y, ArrayRef row) const = 0; 43 | virtual ArrayRef getMatrix() const = 0; 44 | 45 | virtual bool isCropSupported() const; 46 | virtual Ref crop(int left, int top, int width, int height) const; 47 | 48 | virtual bool isRotateSupported() const; 49 | 50 | virtual Ref invert() const; 51 | 52 | virtual Ref rotateCounterClockwise() const; 53 | 54 | operator std::string () const; 55 | }; 56 | 57 | } 58 | 59 | #endif /* LUMINANCESOURCE_H_ */ 60 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/MultiFormatReader.h: -------------------------------------------------------------------------------- 1 | #ifndef __MULTI_FORMAT_READER_H__ 2 | #define __MULTI_FORMAT_READER_H__ 3 | 4 | /* 5 | * MultiFormatBarcodeReader.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 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace zxing { 30 | class MultiFormatReader : public Reader { 31 | private: 32 | Ref decodeInternal(Ref image); 33 | 34 | std::vector > readers_; 35 | DecodeHints hints_; 36 | 37 | public: 38 | MultiFormatReader(); 39 | 40 | Ref decode(Ref image); 41 | Ref decode(Ref image, DecodeHints hints); 42 | Ref decodeWithState(Ref image); 43 | void setHints(DecodeHints hints); 44 | ~MultiFormatReader(); 45 | }; 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/NotFoundException.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef __NOT_FOUND_EXCEPTION_H__ 4 | #define __NOT_FOUND_EXCEPTION_H__ 5 | 6 | /* 7 | * Copyright 20011 ZXing authors 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | namespace zxing { 25 | 26 | class NotFoundException : public ReaderException { 27 | public: 28 | NotFoundException() throw() {} 29 | NotFoundException(const char *msg) throw() : ReaderException(msg) {} 30 | ~NotFoundException() throw() {} 31 | }; 32 | 33 | } 34 | 35 | #endif // __NOT_FOUND_EXCEPTION_H__ 36 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/Reader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Reader.cpp 3 | * zxing 4 | * 5 | * Created by Christian Brunschen on 13/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 22 | 23 | namespace zxing { 24 | 25 | Reader::~Reader() { } 26 | 27 | Ref Reader::decode(Ref image) { 28 | return decode(image, DecodeHints::DEFAULT_HINT); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/Reader.h: -------------------------------------------------------------------------------- 1 | #ifndef __READER_H__ 2 | #define __READER_H__ 3 | 4 | /* 5 | * Reader.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 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | 29 | class Reader : public Counted { 30 | protected: 31 | Reader() {} 32 | public: 33 | virtual Ref decode(Ref image); 34 | virtual Ref decode(Ref image, DecodeHints hints) = 0; 35 | virtual ~Reader(); 36 | }; 37 | 38 | } 39 | 40 | #endif // __READER_H__ 41 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/ReaderException.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __READER_EXCEPTION_H__ 3 | #define __READER_EXCEPTION_H__ 4 | 5 | /* 6 | * ReaderException.h 7 | * zxing 8 | * 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | 26 | namespace zxing { 27 | 28 | class ReaderException : public Exception { 29 | public: 30 | ReaderException() throw() {} 31 | ReaderException(char const* msg) throw() : Exception(msg) {} 32 | ~ReaderException() throw() {} 33 | }; 34 | 35 | } 36 | 37 | #endif // __READER_EXCEPTION_H__ 38 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/Result.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * Result.cpp 4 | * zxing 5 | * 6 | * Created by Christian Brunschen on 13/05/2008. 7 | * Copyright 2008 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | using zxing::Result; 25 | using zxing::Ref; 26 | using zxing::ArrayRef; 27 | using zxing::String; 28 | using zxing::ResultPoint; 29 | 30 | // VC++ 31 | using zxing::BarcodeFormat; 32 | 33 | Result::Result(Ref text, 34 | ArrayRef rawBytes, 35 | ArrayRef< Ref > resultPoints, 36 | BarcodeFormat format) : 37 | text_(text), rawBytes_(rawBytes), resultPoints_(resultPoints), format_(format) { 38 | } 39 | 40 | Result::~Result() { 41 | } 42 | 43 | Ref Result::getText() { 44 | return text_; 45 | } 46 | 47 | ArrayRef Result::getRawBytes() { 48 | return rawBytes_; 49 | } 50 | 51 | ArrayRef< Ref > const& Result::getResultPoints() const { 52 | return resultPoints_; 53 | } 54 | 55 | ArrayRef< Ref >& Result::getResultPoints() { 56 | return resultPoints_; 57 | } 58 | 59 | zxing::BarcodeFormat Result::getBarcodeFormat() const { 60 | return format_; 61 | } 62 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/Result.h: -------------------------------------------------------------------------------- 1 | #ifndef __RESULT_H__ 2 | #define __RESULT_H__ 3 | 4 | /* 5 | * Result.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 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | namespace zxing { 31 | 32 | class Result : public Counted { 33 | private: 34 | Ref text_; 35 | ArrayRef rawBytes_; 36 | ArrayRef< Ref > resultPoints_; 37 | BarcodeFormat format_; 38 | 39 | public: 40 | Result(Ref text, 41 | ArrayRef rawBytes, 42 | ArrayRef< Ref > resultPoints, 43 | BarcodeFormat format); 44 | ~Result(); 45 | Ref getText(); 46 | ArrayRef getRawBytes(); 47 | ArrayRef< Ref > const& getResultPoints() const; 48 | ArrayRef< Ref >& getResultPoints(); 49 | BarcodeFormat getBarcodeFormat() const; 50 | 51 | friend std::ostream& operator<<(std::ostream &out, Result& result); 52 | }; 53 | 54 | } 55 | #endif // __RESULT_H__ 56 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/ResultIO.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * ResultIO.cpp 4 | * zxing 5 | * 6 | * Created by Christian Brunschen on 13/05/2008. 7 | * Copyright 2008 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | using zxing::Result; 25 | using std::ostream; 26 | 27 | ostream& zxing::operator<<(ostream &out, Result& result) { 28 | if (result.text_ != 0) { 29 | out << result.text_->getText(); 30 | } else { 31 | out << "[" << result.rawBytes_->size() << " bytes]"; 32 | } 33 | return out; 34 | } 35 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/ResultPoint.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __RESULT_POINT_H__ 3 | #define __RESULT_POINT_H__ 4 | 5 | /* 6 | * ResultPoint.h 7 | * zxing 8 | * 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | 29 | class ResultPoint : public Counted { 30 | protected: 31 | const float posX_; 32 | const float posY_; 33 | 34 | public: 35 | ResultPoint(); 36 | ResultPoint(float x, float y); 37 | ResultPoint(int x, int y); 38 | virtual ~ResultPoint(); 39 | 40 | virtual float getX() const; 41 | virtual float getY() const; 42 | 43 | bool equals(Ref other); 44 | 45 | static void orderBestPatterns(std::vector > &patterns); 46 | static float distance(Ref point1, Ref point2); 47 | static float distance(float x1, float x2, float y1, float y2); 48 | 49 | private: 50 | static float crossProductZ(Ref pointA, Ref pointB, Ref pointC); 51 | }; 52 | 53 | } 54 | 55 | #endif // __RESULT_POINT_H__ 56 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/ResultPointCallback.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ResultPointCallback.cpp 3 | * zxing 4 | * 5 | * Copyright 2010 ZXing authors All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | 22 | namespace zxing { 23 | 24 | ResultPointCallback::~ResultPointCallback() {} 25 | 26 | } 27 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/ResultPointCallback.h: -------------------------------------------------------------------------------- 1 | #ifndef __RESULT_POINT_CALLBACK_H__ 2 | #define __RESULT_POINT_CALLBACK_H__ 3 | 4 | /* 5 | * ResultPointCallback.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 24 | 25 | namespace zxing { 26 | 27 | class ResultPoint; 28 | 29 | class ResultPointCallback : public Counted { 30 | protected: 31 | ResultPointCallback() {} 32 | public: 33 | virtual void foundPossibleResultPoint(ResultPoint const& point) = 0; 34 | virtual ~ResultPointCallback(); 35 | }; 36 | 37 | } 38 | 39 | #endif // __RESULT_POINT_CALLBACK_H__ 40 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/aztec/AztecDetectorResult.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * AtztecDetecorResult.cpp 4 | * zxing 5 | * 6 | * Created by Lukas Stabe on 08/02/2012. 7 | * Copyright 2012 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | using zxing::aztec::AztecDetectorResult; 25 | 26 | // VC++ 27 | using zxing::Ref; 28 | using zxing::ArrayRef; 29 | using zxing::BitMatrix; 30 | using zxing::ResultPoint; 31 | 32 | 33 | AztecDetectorResult::AztecDetectorResult(Ref bits, 34 | ArrayRef< Ref > points, 35 | bool compact, 36 | int nbDatablocks, 37 | int nbLayers) 38 | : DetectorResult(bits, points), 39 | compact_(compact), 40 | nbDatablocks_(nbDatablocks), 41 | nbLayers_(nbLayers) { 42 | } 43 | 44 | bool AztecDetectorResult::isCompact() { 45 | return compact_; 46 | } 47 | 48 | int AztecDetectorResult::getNBDatablocks() { 49 | return nbDatablocks_; 50 | } 51 | 52 | int AztecDetectorResult::getNBLayers() { 53 | return nbLayers_; 54 | } 55 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/aztec/AztecDetectorResult.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * AtztecDetecorResult.h 4 | * zxing 5 | * 6 | * Created by Lukas Stabe on 08/02/2012. 7 | * Copyright 2012 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | #ifndef ZXingWidget_AtztecDetecorResult_h 25 | #define ZXingWidget_AtztecDetecorResult_h 26 | 27 | namespace zxing { 28 | namespace aztec { 29 | 30 | class AztecDetectorResult : public DetectorResult { 31 | private: 32 | bool compact_; 33 | int nbDatablocks_, nbLayers_; 34 | public: 35 | AztecDetectorResult(Ref bits, 36 | ArrayRef< Ref > points, 37 | bool compact, 38 | int nbDatablocks, 39 | int nbLayers); 40 | bool isCompact(); 41 | int getNBDatablocks(); 42 | int getNBLayers(); 43 | }; 44 | 45 | } 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/aztec/AztecReader.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * AztecReader.cpp 4 | * zxing 5 | * 6 | * Created by Lukas Stabe on 08/02/2012. 7 | * Copyright 2012 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | using zxing::Ref; 28 | using zxing::ArrayRef; 29 | using zxing::Result; 30 | using zxing::aztec::AztecReader; 31 | 32 | // VC++ 33 | using zxing::BinaryBitmap; 34 | using zxing::DecodeHints; 35 | 36 | AztecReader::AztecReader() : decoder_() { 37 | // nothing 38 | } 39 | 40 | Ref AztecReader::decode(Ref image) { 41 | Detector detector(image->getBlackMatrix()); 42 | 43 | Ref detectorResult(detector.detect()); 44 | 45 | ArrayRef< Ref > points(detectorResult->getPoints()); 46 | 47 | Ref decoderResult(decoder_.decode(detectorResult)); 48 | 49 | Ref result(new Result(decoderResult->getText(), 50 | decoderResult->getRawBytes(), 51 | points, 52 | BarcodeFormat::AZTEC)); 53 | 54 | return result; 55 | } 56 | 57 | Ref AztecReader::decode(Ref image, DecodeHints) { 58 | //cout << "decoding with hints not supported for aztec" << "\n" << flush; 59 | return this->decode(image); 60 | } 61 | 62 | AztecReader::~AztecReader() { 63 | // nothing 64 | } 65 | 66 | zxing::aztec::Decoder& AztecReader::getDecoder() { 67 | return decoder_; 68 | } 69 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/aztec/AztecReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * AztecReader.h 4 | * zxing 5 | * 6 | * Created by Lukas Stabe on 08/02/2012. 7 | * Copyright 2012 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #ifndef ZXingWidget_AztecReader_h 27 | #define ZXingWidget_AztecReader_h 28 | 29 | namespace zxing { 30 | namespace aztec { 31 | 32 | class AztecReader : public Reader { 33 | private: 34 | Decoder decoder_; 35 | 36 | protected: 37 | Decoder &getDecoder(); 38 | 39 | public: 40 | AztecReader(); 41 | virtual Ref decode(Ref image); 42 | virtual Ref decode(Ref image, DecodeHints hints); 43 | virtual ~AztecReader(); 44 | }; 45 | 46 | } 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/aztec/decoder/Decoder.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * Decoder.h 4 | * zxing 5 | * 6 | * Created by Lukas Stabe on 08/02/2012. 7 | * Copyright 2012 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifndef __ZXING_AZTEC_DECODER_DECODER_H__ 23 | #define __ZXING_AZTEC_DECODER_DECODER_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace zxing { 30 | 31 | class DecoderResult; 32 | 33 | namespace aztec { 34 | 35 | class Decoder : public Counted { 36 | private: 37 | enum Table { 38 | UPPER, 39 | LOWER, 40 | MIXED, 41 | DIGIT, 42 | PUNCT, 43 | BINARY 44 | }; 45 | 46 | static Table getTable(char t); 47 | static const char* getCharacter(Table table, int code); 48 | 49 | int numCodewords_; 50 | int codewordSize_; 51 | Ref ddata_; 52 | int invertedBitCount_; 53 | 54 | Ref getEncodedData(Ref correctedBits); 55 | Ref correctBits(Ref rawbits); 56 | Ref extractBits(Ref matrix); 57 | static Ref removeDashedLines(Ref matrix); 58 | static int readCode(Ref rawbits, int startIndex, int length); 59 | 60 | 61 | public: 62 | Decoder(); 63 | Ref decode(Ref detectorResult); 64 | }; 65 | 66 | } 67 | } 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/BitArray.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __BIT_ARRAY_H__ 3 | #define __BIT_ARRAY_H__ 4 | 5 | /* 6 | * Copyright 2010 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 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace zxing { 30 | 31 | class BitArray : public Counted { 32 | public: 33 | static const int bitsPerWord = std::numeric_limits::digits; 34 | 35 | private: 36 | int size; 37 | ArrayRef bits; 38 | static const int logBits = ZX_LOG_DIGITS(bitsPerWord); 39 | static const int bitsMask = (1 << logBits) - 1; 40 | 41 | public: 42 | BitArray(int size); 43 | ~BitArray(); 44 | int getSize() const; 45 | 46 | bool get(int i) const { 47 | return (bits[i >> logBits] & (1 << (i & bitsMask))) != 0; 48 | } 49 | 50 | void set(int i) { 51 | bits[i >> logBits] |= 1 << (i & bitsMask); 52 | } 53 | 54 | int getNextSet(int from); 55 | int getNextUnset(int from); 56 | 57 | void setBulk(int i, int newBits); 58 | void setRange(int start, int end); 59 | void clear(); 60 | bool isRange(int start, int end, bool value); 61 | std::vector& getBitArray(); 62 | 63 | void reverse(); 64 | 65 | class Reverse { 66 | private: 67 | Ref array; 68 | public: 69 | Reverse(Ref array); 70 | ~Reverse(); 71 | }; 72 | 73 | private: 74 | static int makeArraySize(int size); 75 | }; 76 | 77 | std::ostream& operator << (std::ostream&, BitArray const&); 78 | 79 | } 80 | 81 | #endif // __BIT_ARRAY_H__ 82 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/BitArrayIO.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * Copyright 2010 ZXing authors. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | using zxing::BitArray; 21 | using std::ostream; 22 | 23 | ostream& zxing::operator << (ostream& os, BitArray const& ba) { 24 | for (int i = 0, size = ba.getSize(); i < size; i++) { 25 | if ((i & 0x07) == 0) { 26 | os << ' '; 27 | } 28 | os << (ba.get(i) ? 'X' : '.'); 29 | } 30 | return os; 31 | } 32 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/BitSource.h: -------------------------------------------------------------------------------- 1 | #ifndef __BIT_SOURCE_H__ 2 | #define __BIT_SOURCE_H__ 3 | 4 | /* 5 | * BitSource.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 24 | 25 | namespace zxing { 26 | /** 27 | *

This provides an easy abstraction to read bits at a time from a sequence of bytes, where the 28 | * number of bits read is not often a multiple of 8.

29 | * 30 | *

This class is not thread-safe.

31 | * 32 | * @author srowen@google.com (Sean Owen) 33 | * @author christian.brunschen@gmail.com (Christian Brunschen) 34 | */ 35 | class BitSource : public Counted { 36 | typedef char byte; 37 | private: 38 | ArrayRef bytes_; 39 | int byteOffset_; 40 | int bitOffset_; 41 | public: 42 | /** 43 | * @param bytes bytes from which this will read bits. Bits will be read from the first byte first. 44 | * Bits are read within a byte from most-significant to least-significant bit. 45 | */ 46 | BitSource(ArrayRef &bytes) : 47 | bytes_(bytes), byteOffset_(0), bitOffset_(0) { 48 | } 49 | 50 | int getBitOffset() { 51 | return bitOffset_; 52 | } 53 | 54 | int getByteOffset() { 55 | return byteOffset_; 56 | } 57 | 58 | /** 59 | * @param numBits number of bits to read 60 | * @return int representing the bits read. The bits will appear as the least-significant 61 | * bits of the int 62 | * @throws IllegalArgumentException if numBits isn't in [1,32] 63 | */ 64 | int readBits(int numBits); 65 | 66 | /** 67 | * @return number of bits that can be read successfully 68 | */ 69 | int available(); 70 | }; 71 | 72 | } 73 | 74 | #endif // __BIT_SOURCE_H__ 75 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/CharacterSetECI.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef __CHARACTERSET_ECI__ 4 | #define __CHARACTERSET_ECI__ 5 | 6 | /* 7 | * Copyright 2008-2011 ZXing authors 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | namespace zxing { 26 | namespace common { 27 | 28 | class CharacterSetECI : public Counted { 29 | private: 30 | static std::map > VALUE_TO_ECI; 31 | static std::map > NAME_TO_ECI; 32 | static const bool inited; 33 | static bool init_tables(); 34 | 35 | int const* const values_; 36 | char const* const* const names_; 37 | 38 | CharacterSetECI(int const* values, char const* const* names); 39 | 40 | static void addCharacterSet(int const* value, char const* const* encodingNames); 41 | 42 | public: 43 | char const* name() const; 44 | int getValue() const; 45 | 46 | static CharacterSetECI* getCharacterSetECIByValue(int value); 47 | static CharacterSetECI* getCharacterSetECIByName(std::string const& name); 48 | }; 49 | 50 | } 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/DecoderResult.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * DecoderResult.cpp 4 | * zxing 5 | * 6 | * Created by Christian Brunschen on 20/05/2008. 7 | * Copyright 2008-2011 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | using namespace std; 25 | using namespace zxing; 26 | 27 | DecoderResult::DecoderResult(ArrayRef rawBytes, 28 | Ref text, 29 | ArrayRef< ArrayRef >& byteSegments, 30 | string const& ecLevel) : 31 | rawBytes_(rawBytes), 32 | text_(text), 33 | byteSegments_(byteSegments), 34 | ecLevel_(ecLevel) {} 35 | 36 | DecoderResult::DecoderResult(ArrayRef rawBytes, 37 | Ref text) 38 | : rawBytes_(rawBytes), text_(text) {} 39 | 40 | ArrayRef DecoderResult::getRawBytes() { 41 | return rawBytes_; 42 | } 43 | 44 | Ref DecoderResult::getText() { 45 | return text_; 46 | } 47 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/DecoderResult.h: -------------------------------------------------------------------------------- 1 | #ifndef __DECODER_RESULT_H__ 2 | #define __DECODER_RESULT_H__ 3 | 4 | /* 5 | * DecoderResult.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 24 | #include 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | 30 | class DecoderResult : public Counted { 31 | private: 32 | ArrayRef rawBytes_; 33 | Ref text_; 34 | ArrayRef< ArrayRef > byteSegments_; 35 | std::string ecLevel_; 36 | 37 | public: 38 | DecoderResult(ArrayRef rawBytes, 39 | Ref text, 40 | ArrayRef< ArrayRef >& byteSegments, 41 | std::string const& ecLevel); 42 | 43 | DecoderResult(ArrayRef rawBytes, Ref text); 44 | 45 | ArrayRef getRawBytes(); 46 | Ref getText(); 47 | }; 48 | 49 | } 50 | 51 | #endif // __DECODER_RESULT_H__ 52 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/DetectorResult.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * DetectorResult.cpp 4 | * zxing 5 | * 6 | * Created by Christian Brunschen on 14/05/2008. 7 | * Copyright 2008 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | namespace zxing { 25 | 26 | DetectorResult::DetectorResult(Ref bits, 27 | ArrayRef< Ref > points) 28 | : bits_(bits), points_(points) { 29 | } 30 | 31 | Ref DetectorResult::getBits() { 32 | return bits_; 33 | } 34 | 35 | ArrayRef< Ref > DetectorResult::getPoints() { 36 | return points_; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/DetectorResult.h: -------------------------------------------------------------------------------- 1 | #ifndef __DETECTOR_RESULT_H__ 2 | #define __DETECTOR_RESULT_H__ 3 | 4 | /* 5 | * DetectorResult.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 24 | #include 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | 30 | class DetectorResult : public Counted { 31 | private: 32 | Ref bits_; 33 | ArrayRef< Ref > points_; 34 | 35 | public: 36 | DetectorResult(Ref bits, ArrayRef< Ref > points); 37 | Ref getBits(); 38 | ArrayRef< Ref > getPoints(); 39 | }; 40 | 41 | } 42 | 43 | #endif // __DETECTOR_RESULT_H__ 44 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/GlobalHistogramBinarizer.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __GLOBALHISTOGRAMBINARIZER_H__ 3 | #define __GLOBALHISTOGRAMBINARIZER_H__ 4 | /* 5 | * GlobalHistogramBinarizer.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 24 | #include 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | 30 | class GlobalHistogramBinarizer : public Binarizer { 31 | private: 32 | ArrayRef luminances; 33 | ArrayRef buckets; 34 | public: 35 | GlobalHistogramBinarizer(Ref source); 36 | virtual ~GlobalHistogramBinarizer(); 37 | 38 | virtual Ref getBlackRow(int y, Ref row); 39 | virtual Ref getBlackMatrix(); 40 | static int estimateBlackPoint(ArrayRef const& buckets); 41 | Ref createBinarizer(Ref source); 42 | private: 43 | void initArrays(int luminanceSize); 44 | }; 45 | 46 | } 47 | 48 | #endif /* GLOBALHISTOGRAMBINARIZER_H_ */ 49 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/GreyscaleLuminanceSource.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __GREYSCALE_LUMINANCE_SOURCE__ 3 | #define __GREYSCALE_LUMINANCE_SOURCE__ 4 | /* 5 | * GreyscaleLuminanceSource.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 24 | 25 | namespace zxing { 26 | 27 | class GreyscaleLuminanceSource : public LuminanceSource { 28 | 29 | private: 30 | typedef LuminanceSource Super; 31 | ArrayRef greyData_; 32 | const int dataWidth_; 33 | const int dataHeight_; 34 | const int left_; 35 | const int top_; 36 | 37 | public: 38 | GreyscaleLuminanceSource(ArrayRef greyData, int dataWidth, int dataHeight, int left, 39 | int top, int width, int height); 40 | 41 | ArrayRef getRow(int y, ArrayRef row) const; 42 | ArrayRef getMatrix() const; 43 | 44 | bool isCropSupported() const { 45 | return true; 46 | } 47 | 48 | Ref crop(int left, int top, int width, int height) const; 49 | 50 | bool isRotateSupported() const { 51 | return true; 52 | } 53 | 54 | Ref rotateCounterClockwise() const; 55 | }; 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/GreyscaleRotatedLuminanceSource.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __GREYSCALE_ROTATED_LUMINANCE_SOURCE__ 3 | #define __GREYSCALE_ROTATED_LUMINANCE_SOURCE__ 4 | /* 5 | * GreyscaleRotatedLuminanceSource.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 | 24 | #include 25 | 26 | namespace zxing { 27 | 28 | class GreyscaleRotatedLuminanceSource : public LuminanceSource { 29 | private: 30 | typedef LuminanceSource Super; 31 | ArrayRef greyData_; 32 | const int dataWidth_; 33 | const int left_; 34 | const int top_; 35 | 36 | public: 37 | GreyscaleRotatedLuminanceSource(ArrayRef greyData, int dataWidth, int dataHeight, 38 | int left, int top, int width, int height); 39 | 40 | ArrayRef getRow(int y, ArrayRef row) const; 41 | ArrayRef getMatrix() const; 42 | }; 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/GridSampler.h: -------------------------------------------------------------------------------- 1 | #ifndef __GRID_SAMPLER_H__ 2 | #define __GRID_SAMPLER_H__ 3 | 4 | /* 5 | * GridSampler.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 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | class GridSampler { 29 | private: 30 | static GridSampler gridSampler; 31 | GridSampler(); 32 | 33 | public: 34 | Ref sampleGrid(Ref image, int dimension, Ref transform); 35 | Ref sampleGrid(Ref image, int dimensionX, int dimensionY, Ref transform); 36 | 37 | Ref sampleGrid(Ref image, int dimension, float p1ToX, float p1ToY, float p2ToX, float p2ToY, 38 | float p3ToX, float p3ToY, float p4ToX, float p4ToY, float p1FromX, float p1FromY, float p2FromX, 39 | float p2FromY, float p3FromX, float p3FromY, float p4FromX, float p4FromY); 40 | static void checkAndNudgePoints(Ref image, std::vector &points); 41 | static GridSampler &getInstance(); 42 | }; 43 | } 44 | 45 | #endif // __GRID_SAMPLER_H__ 46 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/IllegalArgumentException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IllegalArgumentException.cpp 3 | * zxing 4 | * 5 | * Created by Christian Brunschen on 06/05/2008. 6 | * Copyright 2008 Google UK. 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 22 | 23 | using zxing::IllegalArgumentException; 24 | 25 | IllegalArgumentException::IllegalArgumentException() : Exception() {} 26 | IllegalArgumentException::IllegalArgumentException(const char *msg) : Exception(msg) {} 27 | IllegalArgumentException::~IllegalArgumentException() throw() {} 28 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/IllegalArgumentException.h: -------------------------------------------------------------------------------- 1 | #ifndef __ILLEGAL_ARGUMENT_EXCEPTION_H__ 2 | #define __ILLEGAL_ARGUMENT_EXCEPTION_H__ 3 | 4 | /* 5 | * IllegalArgumentException.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 24 | 25 | namespace zxing { 26 | 27 | class IllegalArgumentException : public Exception { 28 | public: 29 | IllegalArgumentException(); 30 | IllegalArgumentException(const char *msg); 31 | ~IllegalArgumentException() throw(); 32 | }; 33 | 34 | } 35 | 36 | #endif // __ILLEGAL_ARGUMENT_EXCEPTION_H__ 37 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/PerspectiveTransform.h: -------------------------------------------------------------------------------- 1 | #ifndef __PERSPECTIVE_TANSFORM_H__ 2 | #define __PERSPECTIVE_TANSFORM_H__ 3 | 4 | /* 5 | * PerspectiveTransform.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 24 | #include 25 | 26 | namespace zxing { 27 | class PerspectiveTransform : public Counted { 28 | private: 29 | float a11, a12, a13, a21, a22, a23, a31, a32, a33; 30 | PerspectiveTransform(float a11, float a21, float a31, float a12, float a22, float a32, float a13, float a23, 31 | float a33); 32 | 33 | public: 34 | static Ref 35 | quadrilateralToQuadrilateral(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, 36 | float x0p, float y0p, float x1p, float y1p, float x2p, float y2p, float x3p, float y3p); 37 | static Ref squareToQuadrilateral(float x0, float y0, float x1, float y1, float x2, float y2, 38 | float x3, float y3); 39 | static Ref quadrilateralToSquare(float x0, float y0, float x1, float y1, float x2, float y2, 40 | float x3, float y3); 41 | Ref buildAdjoint(); 42 | Ref times(Ref other); 43 | void transformPoints(std::vector &points); 44 | 45 | friend std::ostream& operator<<(std::ostream& out, const PerspectiveTransform &pt); 46 | }; 47 | } 48 | 49 | #endif // __PERSPECTIVE_TANSFORM_H__ 50 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/Point.h: -------------------------------------------------------------------------------- 1 | #ifndef __POINT_H__ 2 | #define __POINT_H__ 3 | 4 | /* 5 | * Point.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 | namespace zxing { 24 | class PointI { 25 | public: 26 | int x; 27 | int y; 28 | }; 29 | 30 | class Point { 31 | public: 32 | Point() : x(0.0f), y(0.0f) {}; 33 | Point(float x_, float y_) : x(x_), y(y_) {}; 34 | 35 | float x; 36 | float y; 37 | }; 38 | 39 | class Line { 40 | public: 41 | Line(Point start_, Point end_) : start(start_), end(end_) {}; 42 | 43 | Point start; 44 | Point end; 45 | }; 46 | } 47 | #endif // POINT_H_ 48 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/Str.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * String.cpp 4 | * zxing 5 | * 6 | * Created by Christian Brunschen on 20/05/2008. 7 | * Copyright 2008 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | using std::string; 25 | using zxing::String; 26 | using zxing::Ref; 27 | 28 | String::String(const std::string &text) : 29 | text_(text) { 30 | } 31 | 32 | String::String(int capacity) { 33 | text_.reserve(capacity); 34 | } 35 | 36 | const std::string& String::getText() const { 37 | return text_; 38 | } 39 | 40 | char String::charAt(int i) const { return text_[i]; } 41 | 42 | int String::size() const { return text_.size(); } 43 | 44 | int String::length() const { return text_.size(); } 45 | 46 | Ref String::substring(int i) const { 47 | return Ref(new String(text_.substr(i))); 48 | } 49 | 50 | void String::append(const std::string &tail) { 51 | text_.append(tail); 52 | } 53 | 54 | void String::append(char c) { 55 | text_.append(1,c); 56 | } 57 | 58 | std::ostream& zxing::operator << (std::ostream& out, String const& s) { 59 | out << s.text_; 60 | return out; 61 | } 62 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/Str.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __STR_H__ 3 | #define __STR_H__ 4 | 5 | /* 6 | * Str.h 7 | * zxing 8 | * 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | 30 | class String; 31 | std::ostream& operator << (std::ostream& out, String const& s); 32 | 33 | class String : public Counted { 34 | private: 35 | std::string text_; 36 | public: 37 | explicit String(const std::string &text); 38 | explicit String(int); 39 | char charAt(int) const; 40 | Ref substring(int) const; 41 | const std::string& getText() const; 42 | int size() const; 43 | void append(std::string const& tail); 44 | void append(char c); 45 | int length() const; 46 | friend std::ostream& zxing::operator << (std::ostream& out, String const& s); 47 | }; 48 | 49 | } 50 | 51 | #endif // __COMMON__STRING_H__ 52 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/StringUtils.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef __STRING_UTILS__ 4 | #define __STRING_UTILS__ 5 | 6 | /* 7 | * Copyright (C) 2010-2011 ZXing authors 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace zxing { 27 | namespace common { 28 | 29 | class StringUtils { 30 | private: 31 | static char const* const PLATFORM_DEFAULT_ENCODING; 32 | 33 | StringUtils() {} 34 | 35 | public: 36 | static char const* const ASCII; 37 | static char const* const SHIFT_JIS; 38 | static char const* const GB2312; 39 | static char const* const EUC_JP; 40 | static char const* const UTF8; 41 | static char const* const ISO88591; 42 | static const bool ASSUME_SHIFT_JIS; 43 | 44 | typedef std::map Hashtable; 45 | 46 | static std::string guessEncoding(char* bytes, int length, Hashtable const& hints); 47 | }; 48 | 49 | } 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/detector/JavaMath.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __ZXING_COMMON_DETECTOR_MATH_H__ 3 | #define __ZXING_COMMON_DETECTOR_MATH_H__ 4 | /* 5 | * Copyright 2012 ZXing authors All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | 22 | namespace zxing { 23 | namespace common { 24 | namespace detector { 25 | 26 | class Math { 27 | private: 28 | Math(); 29 | ~Math(); 30 | public: 31 | 32 | // Java standard Math.round 33 | static inline int round(float a) { 34 | return (int)std::floor(a +0.5f); 35 | } 36 | 37 | }; 38 | 39 | } 40 | } 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/detector/MathUtils.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __ZXING_COMMON_DETECTOR_MATHUTILS_H__ 3 | #define __ZXING_COMMON_DETECTOR_MATHUTILS_H__ 4 | /* 5 | * Copyright 2012 ZXing authors All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | 22 | namespace zxing { 23 | namespace common { 24 | namespace detector { 25 | 26 | class MathUtils { 27 | private: 28 | MathUtils(); 29 | ~MathUtils(); 30 | public: 31 | 32 | /** 33 | * Ends up being a bit faster than {@link Math#round(float)}. This merely rounds its 34 | * argument to the nearest int, where x.5 rounds up to x+1. 35 | */ 36 | static inline int round(float d) { 37 | return (int) (d + 0.5f); 38 | } 39 | 40 | static inline float distance(float aX, float aY, float bX, float bY) { 41 | float xDiff = aX - bX; 42 | float yDiff = aY - bY; 43 | return sqrt(xDiff * xDiff + yDiff * yDiff); 44 | } 45 | 46 | static inline float distance(int aX, int aY, int bX, int bY) { 47 | int xDiff = aX - bX; 48 | int yDiff = aY - bY; 49 | return sqrt(float(xDiff * xDiff + yDiff * yDiff)); 50 | } 51 | }; 52 | 53 | } 54 | } 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/detector/MonochromeRectangleDetector.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef __MONOCHROMERECTANGLEDETECTOR_H__ 4 | #define __MONOCHROMERECTANGLEDETECTOR_H__ 5 | 6 | /* 7 | * MonochromeRectangleDetector.h 8 | * y_wmk 9 | * 10 | * Created by Luiz Silva on 09/02/2010. 11 | * Copyright 2010 y_wmk authors All rights reserved. 12 | * 13 | * Licensed under the Apache License, Version 2.0 (the "License"); 14 | * you may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at 16 | * 17 | * http://www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | namespace zxing { 34 | 35 | struct TwoInts: public Counted { 36 | int start; 37 | int end; 38 | }; 39 | 40 | class MonochromeRectangleDetector : public Counted { 41 | private: 42 | static const int MAX_MODULES = 32; 43 | Ref image_; 44 | 45 | public: 46 | MonochromeRectangleDetector(Ref image) : image_(image) { }; 47 | 48 | std::vector > detect(); 49 | 50 | private: 51 | Ref findCornerFromCenter(int centerX, int deltaX, int left, int right, 52 | int centerY, int deltaY, int top, int bottom, int maxWhiteRun); 53 | 54 | Ref blackWhiteRange(int fixedDimension, int maxWhiteRun, int minDim, int maxDim, 55 | bool horizontal); 56 | 57 | int max(int a, float b) { return (float) a > b ? a : (int) b;}; 58 | }; 59 | 60 | } 61 | 62 | #endif // __MONOCHROMERECTANGLEDETECTOR_H__ 63 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/detector/WhiteRectangleDetector.h: -------------------------------------------------------------------------------- 1 | #ifndef __WHITERECTANGLEDETECTOR_H__ 2 | #define __WHITERECTANGLEDETECTOR_H__ 3 | 4 | /* 5 | * WhiteRectangleDetector.h 6 | * 7 | * 8 | * Created by Luiz Silva on 09/02/2010. 9 | * Copyright 2010 authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | 32 | namespace zxing { 33 | 34 | class WhiteRectangleDetector : public Counted { 35 | private: 36 | static int INIT_SIZE; 37 | static int CORR; 38 | Ref image_; 39 | int width_; 40 | int height_; 41 | int leftInit_; 42 | int rightInit_; 43 | int downInit_; 44 | int upInit_; 45 | 46 | public: 47 | WhiteRectangleDetector(Ref image); 48 | WhiteRectangleDetector(Ref image, int initSize, int x, int y); 49 | std::vector > detect(); 50 | 51 | private: 52 | Ref getBlackPointOnSegment(int aX, int aY, int bX, int bY); 53 | std::vector > centerEdges(Ref y, Ref z, 54 | Ref x, Ref t); 55 | bool containsBlackPoint(int a, int b, int fixed, bool horizontal); 56 | }; 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/reedsolomon/GenericGF.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * GenericGF.h 4 | * zxing 5 | * 6 | * Created by Lukas Stabe on 13/02/2012. 7 | * Copyright 2012 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifndef GENERICGF_H 23 | #define GENERICGF_H 24 | 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | class GenericGFPoly; 30 | 31 | class GenericGF : public Counted { 32 | 33 | private: 34 | std::vector expTable; 35 | std::vector logTable; 36 | Ref zero; 37 | Ref one; 38 | int size; 39 | int primitive; 40 | int generatorBase; 41 | bool initialized; 42 | 43 | void initialize(); 44 | void checkInit(); 45 | 46 | public: 47 | static Ref AZTEC_DATA_12; 48 | static Ref AZTEC_DATA_10; 49 | static Ref AZTEC_DATA_8; 50 | static Ref AZTEC_DATA_6; 51 | static Ref AZTEC_PARAM; 52 | static Ref QR_CODE_FIELD_256; 53 | static Ref DATA_MATRIX_FIELD_256; 54 | static Ref MAXICODE_FIELD_64; 55 | 56 | GenericGF(int primitive, int size, int b); 57 | 58 | Ref getZero(); 59 | Ref getOne(); 60 | int getSize(); 61 | int getGeneratorBase(); 62 | Ref buildMonomial(int degree, int coefficient); 63 | 64 | static int addOrSubtract(int a, int b); 65 | int exp(int a); 66 | int log(int a); 67 | int inverse(int a); 68 | int multiply(int a, int b); 69 | }; 70 | } 71 | 72 | #endif //GENERICGF_H 73 | 74 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/reedsolomon/GenericGFPoly.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * GenericGFPoly.h 4 | * zxing 5 | * 6 | * Created by Lukas Stabe on 13/02/2012. 7 | * Copyright 2012 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #ifndef GENERICGFPOLY_H 23 | #define GENERICGFPOLY_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace zxing { 30 | 31 | class GenericGF; 32 | 33 | class GenericGFPoly : public Counted { 34 | private: 35 | GenericGF &field_; 36 | ArrayRef coefficients_; 37 | 38 | public: 39 | GenericGFPoly(GenericGF &field, ArrayRef coefficients); 40 | ArrayRef getCoefficients(); 41 | int getDegree(); 42 | bool isZero(); 43 | int getCoefficient(int degree); 44 | int evaluateAt(int a); 45 | Ref addOrSubtract(Ref other); 46 | Ref multiply(Ref other); 47 | Ref multiply(int scalar); 48 | Ref multiplyByMonomial(int degree, int coefficient); 49 | std::vector > divide(Ref other); 50 | 51 | 52 | }; 53 | 54 | } 55 | 56 | #endif //GENERICGFPOLY_H 57 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/reedsolomon/ReedSolomonDecoder.h: -------------------------------------------------------------------------------- 1 | #ifndef __REED_SOLOMON_DECODER_H__ 2 | #define __REED_SOLOMON_DECODER_H__ 3 | 4 | /* 5 | * ReedSolomonDecoder.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 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | namespace zxing { 31 | class GenericGFPoly; 32 | class GenericGF; 33 | 34 | class ReedSolomonDecoder { 35 | private: 36 | Ref field; 37 | public: 38 | ReedSolomonDecoder(Ref fld); 39 | ~ReedSolomonDecoder(); 40 | void decode(ArrayRef received, int twoS); 41 | std::vector > runEuclideanAlgorithm(Ref a, Ref b, int R); 42 | 43 | private: 44 | ArrayRef findErrorLocations(Ref errorLocator); 45 | ArrayRef findErrorMagnitudes(Ref errorEvaluator, ArrayRef errorLocations); 46 | }; 47 | } 48 | 49 | #endif // __REED_SOLOMON_DECODER_H__ 50 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/reedsolomon/ReedSolomonException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ReedSolomonException.cpp 3 | * zxing 4 | * 5 | * Created by Christian Brunschen on 06/05/2008. 6 | * Copyright 2008 Google UK. 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 22 | 23 | namespace zxing { 24 | ReedSolomonException::ReedSolomonException(const char *msg) throw() : 25 | Exception(msg) { 26 | } 27 | ReedSolomonException::~ReedSolomonException() throw() { 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/common/reedsolomon/ReedSolomonException.h: -------------------------------------------------------------------------------- 1 | #ifndef __REED_SOLOMON_EXCEPTION_H__ 2 | #define __REED_SOLOMON_EXCEPTION_H__ 3 | 4 | /* 5 | * ReedSolomonException.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 24 | 25 | namespace zxing { 26 | class ReedSolomonException : public Exception { 27 | public: 28 | ReedSolomonException(const char *msg) throw(); 29 | ~ReedSolomonException() throw(); 30 | }; 31 | } 32 | 33 | #endif // __REED_SOLOMON_EXCEPTION_H__ 34 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/datamatrix/DataMatrixReader.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * DataMatrixReader.cpp 4 | * zxing 5 | * 6 | * Created by Luiz Silva on 09/02/2010. 7 | * Copyright 2010 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace zxing { 27 | namespace datamatrix { 28 | 29 | using namespace std; 30 | 31 | DataMatrixReader::DataMatrixReader() : 32 | decoder_() { 33 | } 34 | 35 | Ref DataMatrixReader::decode(Ref image, DecodeHints hints) { 36 | (void)hints; 37 | Detector detector(image->getBlackMatrix()); 38 | Ref detectorResult(detector.detect()); 39 | ArrayRef< Ref > points(detectorResult->getPoints()); 40 | 41 | 42 | Ref decoderResult(decoder_.decode(detectorResult->getBits())); 43 | 44 | Ref result( 45 | new Result(decoderResult->getText(), decoderResult->getRawBytes(), points, BarcodeFormat::DATA_MATRIX)); 46 | 47 | return result; 48 | } 49 | 50 | DataMatrixReader::~DataMatrixReader() { 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/datamatrix/DataMatrixReader.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_MATRIX_READER_H__ 2 | #define __DATA_MATRIX_READER_H__ 3 | 4 | /* 5 | * DataMatrixReader.h 6 | * zxing 7 | * 8 | * Created by Luiz Silva on 09/02/2010. 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | namespace datamatrix { 30 | 31 | class DataMatrixReader : public Reader { 32 | private: 33 | Decoder decoder_; 34 | 35 | public: 36 | DataMatrixReader(); 37 | virtual Ref decode(Ref image, DecodeHints hints); 38 | virtual ~DataMatrixReader(); 39 | 40 | }; 41 | 42 | } 43 | } 44 | 45 | #endif // __DATA_MATRIX_READER_H__ 46 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/datamatrix/decoder/BitMatrixParser.h: -------------------------------------------------------------------------------- 1 | #ifndef __BIT_MATRIX_PARSER_DM_H__ 2 | #define __BIT_MATRIX_PARSER_DM_H__ 3 | 4 | /* 5 | * BitMatrixParser.h 6 | * zxing 7 | * 8 | * Created by Luiz Silva on 09/02/2010. 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | namespace zxing { 31 | namespace datamatrix { 32 | 33 | class BitMatrixParser : public Counted { 34 | private: 35 | Ref bitMatrix_; 36 | Ref parsedVersion_; 37 | Ref readBitMatrix_; 38 | 39 | int copyBit(size_t x, size_t y, int versionBits); 40 | 41 | public: 42 | BitMatrixParser(Ref bitMatrix); 43 | Ref readVersion(Ref bitMatrix); 44 | ArrayRef readCodewords(); 45 | bool readModule(int row, int column, int numRows, int numColumns); 46 | 47 | private: 48 | int readUtah(int row, int column, int numRows, int numColumns); 49 | int readCorner1(int numRows, int numColumns); 50 | int readCorner2(int numRows, int numColumns); 51 | int readCorner3(int numRows, int numColumns); 52 | int readCorner4(int numRows, int numColumns); 53 | Ref extractDataRegion(Ref bitMatrix); 54 | }; 55 | 56 | } 57 | } 58 | 59 | #endif // __BIT_MATRIX_PARSER_DM_H__ 60 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/datamatrix/decoder/DataBlock.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_BLOCK_DM_H__ 2 | #define __DATA_BLOCK_DM_H__ 3 | 4 | /* 5 | * DataBlock.h 6 | * zxing 7 | * 8 | * Created by Luiz Silva on 09/02/2010. 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace zxing { 30 | namespace datamatrix { 31 | 32 | class DataBlock : public Counted { 33 | private: 34 | int numDataCodewords_; 35 | ArrayRef codewords_; 36 | 37 | DataBlock(int numDataCodewords, ArrayRef codewords); 38 | 39 | public: 40 | static std::vector > getDataBlocks(ArrayRef rawCodewords, Version *version); 41 | 42 | int getNumDataCodewords(); 43 | ArrayRef getCodewords(); 44 | }; 45 | 46 | } 47 | } 48 | 49 | #endif // __DATA_BLOCK_DM_H__ 50 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/datamatrix/decoder/Decoder.h: -------------------------------------------------------------------------------- 1 | #ifndef __DECODER_DM_H__ 2 | #define __DECODER_DM_H__ 3 | 4 | /* 5 | * Decoder.h 6 | * zxing 7 | * 8 | * Created by Luiz Silva on 09/02/2010. 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | namespace zxing { 32 | namespace datamatrix { 33 | 34 | class Decoder { 35 | private: 36 | ReedSolomonDecoder rsDecoder_; 37 | 38 | void correctErrors(ArrayRef bytes, int numDataCodewords); 39 | 40 | public: 41 | Decoder(); 42 | 43 | Ref decode(Ref bits); 44 | }; 45 | 46 | } 47 | } 48 | 49 | #endif // __DECODER_DM_H__ 50 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/datamatrix/detector/CornerPoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CornerPoint.cpp 3 | * zxing 4 | * 5 | * Created by Luiz Silva on 09/02/2010. 6 | * Copyright 2010 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 22 | 23 | 24 | namespace zxing { 25 | namespace datamatrix { 26 | 27 | using namespace std; 28 | 29 | CornerPoint::CornerPoint(float posX, float posY) : 30 | ResultPoint(posX,posY), counter_(0) { 31 | } 32 | 33 | int CornerPoint::getCount() const { 34 | return counter_; 35 | } 36 | 37 | void CornerPoint::incrementCount() { 38 | counter_++; 39 | } 40 | 41 | bool CornerPoint::equals(Ref other) const { 42 | return posX_ == other->getX() && posY_ == other->getY(); 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/datamatrix/detector/CornerPoint.h: -------------------------------------------------------------------------------- 1 | #ifndef __CORNER_FINDER_H__ 2 | #define __CORNER_FINDER_H__ 3 | 4 | /* 5 | * CornerPoint.h 6 | * zxing 7 | * 8 | * Created by Luiz Silva on 09/02/2010. 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | namespace datamatrix { 29 | 30 | class CornerPoint : public ResultPoint { 31 | private: 32 | int counter_; 33 | 34 | public: 35 | CornerPoint(float posX, float posY); 36 | int getCount() const; 37 | void incrementCount(); 38 | bool equals(Ref other) const; 39 | }; 40 | } 41 | } 42 | 43 | #endif // __CORNER_FINDER_H__ 44 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/datamatrix/detector/DetectorException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * DetectorException.cpp 3 | * 4 | * Created on: Aug 26, 2011 5 | * Author: luiz 6 | */ 7 | 8 | #include "DetectorException.h" 9 | 10 | namespace zxing { 11 | namespace datamatrix { 12 | 13 | DetectorException::DetectorException(const char *msg) : 14 | Exception(msg) { 15 | 16 | } 17 | 18 | DetectorException::~DetectorException() throw () { 19 | // TODO Auto-generated destructor stub 20 | } 21 | 22 | } 23 | } /* namespace zxing */ 24 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/datamatrix/detector/DetectorException.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DetectorException.h 3 | * 4 | * Created on: Aug 26, 2011 5 | * Author: luiz 6 | */ 7 | 8 | #ifndef DETECTOREXCEPTION_H_ 9 | #define DETECTOREXCEPTION_H_ 10 | 11 | #include 12 | 13 | namespace zxing { 14 | namespace datamatrix { 15 | 16 | class DetectorException : public Exception { 17 | public: 18 | DetectorException(const char *msg); 19 | virtual ~DetectorException() throw(); 20 | }; 21 | } /* namespace nexxera */ 22 | } /* namespace zxing */ 23 | #endif /* DETECTOREXCEPTION_H_ */ 24 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/multi/ByQuadrantReader.h: -------------------------------------------------------------------------------- 1 | #ifndef __BY_QUADRANT_READER_H__ 2 | #define __BY_QUADRANT_READER_H__ 3 | 4 | /* 5 | * Copyright 2011 ZXing authors All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | namespace zxing { 26 | namespace multi { 27 | 28 | class ByQuadrantReader : public Reader { 29 | private: 30 | Reader& delegate_; 31 | 32 | public: 33 | ByQuadrantReader(Reader& delegate); 34 | virtual ~ByQuadrantReader(); 35 | virtual Ref decode(Ref image); 36 | virtual Ref decode(Ref image, DecodeHints hints); 37 | }; 38 | 39 | } 40 | } 41 | 42 | #endif // __BY_QUADRANT_READER_H__ 43 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/multi/GenericMultipleBarcodeReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __GENERIC_MULTIPLE_BARCODE_READER_H__ 3 | #define __GENERIC_MULTIPLE_BARCODE_READER_H__ 4 | 5 | /* 6 | * Copyright 2011 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 22 | #include 23 | 24 | namespace zxing { 25 | namespace multi { 26 | 27 | class GenericMultipleBarcodeReader : public MultipleBarcodeReader { 28 | private: 29 | static Ref translateResultPoints(Ref result, 30 | int xOffset, 31 | int yOffset); 32 | void doDecodeMultiple(Ref image, 33 | DecodeHints hints, 34 | std::vector >& results, 35 | int xOffset, 36 | int yOffset, 37 | int currentDepth); 38 | Reader& delegate_; 39 | static const int MIN_DIMENSION_TO_RECUR = 100; 40 | static const int MAX_DEPTH = 4; 41 | 42 | public: 43 | GenericMultipleBarcodeReader(Reader& delegate); 44 | virtual ~GenericMultipleBarcodeReader(); 45 | virtual std::vector > decodeMultiple(Ref image, DecodeHints hints); 46 | }; 47 | 48 | } 49 | } 50 | 51 | #endif // __GENERIC_MULTIPLE_BARCODE_READER_H__ 52 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/multi/MultipleBarcodeReader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 ZXing authors All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | namespace zxing { 20 | namespace multi { 21 | 22 | MultipleBarcodeReader::~MultipleBarcodeReader() { } 23 | 24 | std::vector > MultipleBarcodeReader::decodeMultiple(Ref image) { 25 | return decodeMultiple(image, DecodeHints::DEFAULT_HINT); 26 | } 27 | 28 | } // End zxing::multi namespace 29 | } // End zxing namespace 30 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/multi/MultipleBarcodeReader.h: -------------------------------------------------------------------------------- 1 | #ifndef __MULTIPLE_BARCODE_READER_H__ 2 | #define __MULTIPLE_BARCODE_READER_H__ 3 | 4 | /* 5 | * Copyright 2011 ZXing authors All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace zxing { 27 | namespace multi { 28 | 29 | class MultipleBarcodeReader : public Counted { 30 | protected: 31 | MultipleBarcodeReader() {} 32 | public: 33 | virtual std::vector > decodeMultiple(Ref image); 34 | virtual std::vector > decodeMultiple(Ref image, DecodeHints hints) = 0; 35 | virtual ~MultipleBarcodeReader(); 36 | }; 37 | 38 | } 39 | } 40 | 41 | #endif // __MULTIPLE_BARCODE_READER_H__ 42 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/multi/qrcode/QRCodeMultiReader.h: -------------------------------------------------------------------------------- 1 | #ifndef __QRCODE_MULTI_READER_H__ 2 | #define __QRCODE_MULTI_READER_H__ 3 | 4 | /* 5 | * Copyright 2011 ZXing authors All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | namespace zxing { 24 | namespace multi { 25 | 26 | class QRCodeMultiReader: public zxing::qrcode::QRCodeReader, public MultipleBarcodeReader { 27 | public: 28 | QRCodeMultiReader(); 29 | virtual ~QRCodeMultiReader(); 30 | virtual std::vector > decodeMultiple(Ref image, DecodeHints hints); 31 | }; 32 | 33 | } 34 | } 35 | 36 | #endif // __QRCODE_MULTI_READER_H__ 37 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/multi/qrcode/detector/MultiDetector.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 ZXing authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | namespace zxing { 22 | namespace multi { 23 | using namespace zxing::qrcode; 24 | 25 | MultiDetector::MultiDetector(Ref image) : Detector(image) {} 26 | 27 | MultiDetector::~MultiDetector(){} 28 | 29 | std::vector > MultiDetector::detectMulti(DecodeHints hints){ 30 | Ref image = getImage(); 31 | MultiFinderPatternFinder finder = MultiFinderPatternFinder(image, hints.getResultPointCallback()); 32 | std::vector > info = finder.findMulti(hints); 33 | std::vector > result; 34 | for(unsigned int i = 0; i < info.size(); i++){ 35 | try{ 36 | result.push_back(processFinderPatternInfo(info[i])); 37 | } catch (ReaderException const& e){ 38 | (void)e; 39 | // ignore 40 | } 41 | } 42 | 43 | return result; 44 | } 45 | 46 | } // End zxing::multi namespace 47 | } // End zxing namespace 48 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/multi/qrcode/detector/MultiDetector.h: -------------------------------------------------------------------------------- 1 | #ifndef __MULTI_DETECTOR_H__ 2 | #define __MULTI_DETECTOR_H__ 3 | 4 | /* 5 | * Copyright 2011 ZXing authors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace zxing { 25 | namespace multi { 26 | 27 | class MultiDetector : public zxing::qrcode::Detector { 28 | public: 29 | MultiDetector(Ref image); 30 | virtual ~MultiDetector(); 31 | virtual std::vector > detectMulti(DecodeHints hints); 32 | }; 33 | 34 | } 35 | } 36 | 37 | #endif // __MULTI_DETECTOR_H__ 38 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h: -------------------------------------------------------------------------------- 1 | #ifndef __MULTI_FINDER_PATTERN_FINDER_H__ 2 | #define __MULTI_FINDER_PATTERN_FINDER_H__ 3 | 4 | /* 5 | * Copyright 2011 ZXing authors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace zxing { 25 | namespace multi { 26 | 27 | class MultiFinderPatternFinder : zxing::qrcode::FinderPatternFinder { 28 | private: 29 | std::vector > > selectBestPatterns(); 30 | 31 | static const float MAX_MODULE_COUNT_PER_EDGE; 32 | static const float MIN_MODULE_COUNT_PER_EDGE; 33 | static const float DIFF_MODSIZE_CUTOFF_PERCENT; 34 | static const float DIFF_MODSIZE_CUTOFF; 35 | 36 | public: 37 | MultiFinderPatternFinder(Ref image, Ref resultPointCallback); 38 | virtual ~MultiFinderPatternFinder(); 39 | virtual std::vector > findMulti(DecodeHints const& hints); 40 | 41 | 42 | }; 43 | 44 | } 45 | } 46 | 47 | #endif // __MULTI_FINDER_PATTERN_FINDER_H__ 48 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/CodaBarReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __CODA_BAR_READER_H__ 3 | #define __CODA_BAR_READER_H__ 4 | /* 5 | * Copyright 2010 ZXing authors All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace zxing { 25 | namespace oned { 26 | 27 | class CodaBarReader : public OneDReader { 28 | private: 29 | static const float MAX_ACCEPTABLE; 30 | static const float PADDING; 31 | 32 | // Keep some instance variables to avoid reallocations 33 | std::string decodeRowResult; 34 | std::vector counters; 35 | int counterLength; 36 | 37 | public: 38 | CodaBarReader(); 39 | 40 | Ref decodeRow(int rowNumber, Ref row); 41 | 42 | void validatePattern(int start); 43 | 44 | private: 45 | void setCounters(Ref row); 46 | void counterAppend(int e); 47 | int findStartPattern(); 48 | 49 | static bool arrayContains(char const array[], char key); 50 | 51 | int toNarrowWidePattern(int position); 52 | }; 53 | 54 | } 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/Code128Reader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __CODE_128_READER_H__ 3 | #define __CODE_128_READER_H__ 4 | /* 5 | * Copyright 2010 ZXing authors All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace zxing { 25 | namespace oned { 26 | 27 | class Code128Reader : public OneDReader { 28 | private: 29 | static const float MAX_AVG_VARIANCE; 30 | static const float MAX_INDIVIDUAL_VARIANCE; 31 | 32 | static std::vector findStartPattern(Ref row); 33 | static int decodeCode(Ref row, 34 | std::vector& counters, 35 | int rowOffset); 36 | 37 | public: 38 | Ref decodeRow(int rowNumber, Ref row); 39 | Code128Reader(); 40 | ~Code128Reader(); 41 | 42 | BarcodeFormat getBarcodeFormat(); 43 | }; 44 | 45 | } 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/Code39Reader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __CODE_39_READER_H__ 3 | #define __CODE_39_READER_H__ 4 | /* 5 | * Code39Reader.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 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | namespace oned { 29 | 30 | /** 31 | *

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

32 | * Ported form Java (author Sean Owen) 33 | * @author Lukasz Warchol 34 | */ 35 | class Code39Reader : public OneDReader { 36 | private: 37 | bool usingCheckDigit; 38 | bool extendedMode; 39 | std::string decodeRowResult; 40 | std::vector counters; 41 | 42 | void init(bool usingCheckDigit = false, bool extendedMode = false); 43 | 44 | static std::vector findAsteriskPattern(Ref row, 45 | std::vector& counters); 46 | static int toNarrowWidePattern(std::vector& counters); 47 | static char patternToChar(int pattern); 48 | static Ref decodeExtended(std::string encoded); 49 | 50 | void append(char* s, char c); 51 | 52 | public: 53 | Code39Reader(); 54 | Code39Reader(bool usingCheckDigit_); 55 | Code39Reader(bool usingCheckDigit_, bool extendedMode_); 56 | 57 | Ref decodeRow(int rowNumber, Ref row); 58 | }; 59 | 60 | } 61 | } 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/Code93Reader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __CODE_93_READER_H__ 3 | #define __CODE_93_READER_H__ 4 | /* 5 | * Code93Reader.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 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | namespace oned { 29 | 30 | /** 31 | *

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

32 | * Ported form Java (author Sean Owen) 33 | * @author Lukasz Warchol 34 | */ 35 | class Code93Reader : public OneDReader { 36 | public: 37 | Code93Reader(); 38 | Ref decodeRow(int rowNumber, Ref row); 39 | 40 | private: 41 | std::string decodeRowResult; 42 | std::vector counters; 43 | 44 | Range findAsteriskPattern(Ref row); 45 | 46 | static int toPattern(std::vector& counters); 47 | static char patternToChar(int pattern); 48 | static Ref decodeExtended(std::string const& encoded); 49 | static void checkChecksums(std::string const& result); 50 | static void checkOneChecksum(std::string const& result, 51 | int checkPosition, 52 | int weightMax); 53 | }; 54 | 55 | } 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/EAN13Reader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __EAN_13_READER_H__ 3 | #define __EAN_13_READER_H__ 4 | 5 | /* 6 | * EAN13Reader.h 7 | * ZXing 8 | * 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | namespace oned { 29 | 30 | class EAN13Reader : public UPCEANReader { 31 | private: 32 | std::vector decodeMiddleCounters; 33 | static void determineFirstDigit(std::string& resultString, 34 | int lgPatternFound); 35 | 36 | public: 37 | EAN13Reader(); 38 | 39 | int decodeMiddle(Ref row, 40 | Range const& startRange, 41 | std::string& resultString); 42 | 43 | BarcodeFormat getBarcodeFormat(); 44 | }; 45 | 46 | } 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/EAN8Reader.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * Copyright 2010 ZXing authors All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "EAN8Reader.h" 19 | #include 20 | 21 | using std::vector; 22 | using zxing::oned::EAN8Reader; 23 | 24 | // VC++ 25 | using zxing::Ref; 26 | using zxing::BitArray; 27 | 28 | EAN8Reader::EAN8Reader() : decodeMiddleCounters(4, 0) {} 29 | 30 | int EAN8Reader::decodeMiddle(Ref row, 31 | Range const& startRange, 32 | std::string& result){ 33 | vector& counters (decodeMiddleCounters); 34 | counters[0] = 0; 35 | counters[1] = 0; 36 | counters[2] = 0; 37 | counters[3] = 0; 38 | 39 | int end = row->getSize(); 40 | int rowOffset = startRange[1]; 41 | 42 | for (int x = 0; x < 4 && rowOffset < end; x++) { 43 | int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS); 44 | result.append(1, (char) ('0' + bestMatch)); 45 | for (int i = 0, end = counters.size(); i < end; i++) { 46 | rowOffset += counters[i]; 47 | } 48 | } 49 | 50 | Range middleRange = 51 | findGuardPattern(row, rowOffset, true, MIDDLE_PATTERN); 52 | rowOffset = middleRange[1]; 53 | for (int x = 0; x < 4 && rowOffset < end; x++) { 54 | int bestMatch = decodeDigit(row, counters, rowOffset, L_PATTERNS); 55 | result.append(1, (char) ('0' + bestMatch)); 56 | for (int i = 0, end = counters.size(); i < end; i++) { 57 | rowOffset += counters[i]; 58 | } 59 | } 60 | return rowOffset; 61 | } 62 | 63 | zxing::BarcodeFormat EAN8Reader::getBarcodeFormat(){ 64 | return BarcodeFormat::EAN_8; 65 | } 66 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/EAN8Reader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __EAN_8_READER_H__ 3 | #define __EAN_8_READER_H__ 4 | 5 | /* 6 | * EAN8Reader.h 7 | * ZXing 8 | * 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | namespace oned { 29 | 30 | class EAN8Reader : public UPCEANReader { 31 | private: 32 | std::vector decodeMiddleCounters; 33 | 34 | public: 35 | EAN8Reader(); 36 | 37 | int decodeMiddle(Ref row, 38 | Range const& startRange, 39 | std::string& resultString); 40 | 41 | BarcodeFormat getBarcodeFormat(); 42 | }; 43 | 44 | } 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/ITFReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __ITF_READER_H__ 3 | #define __ITF_READER_H__ 4 | 5 | /* 6 | * Copyright 2010 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 22 | #include 23 | #include 24 | 25 | namespace zxing { 26 | namespace oned { 27 | 28 | class ITFReader : public OneDReader { 29 | private: 30 | static const float MAX_AVG_VARIANCE; 31 | static const float MAX_INDIVIDUAL_VARIANCE; 32 | 33 | // Stores the actual narrow line width of the image being decoded. 34 | int narrowLineWidth; 35 | 36 | Range decodeStart(Ref row); 37 | Range decodeEnd(Ref row); 38 | static void decodeMiddle(Ref row, int payloadStart, int payloadEnd, std::string& resultString); 39 | void validateQuietZone(Ref row, int startPattern); 40 | static int skipWhiteSpace(Ref row); 41 | 42 | static Range findGuardPattern(Ref row, int rowOffset, std::vector const& pattern); 43 | static int decodeDigit(std::vector& counters); 44 | 45 | void append(char* s, char c); 46 | public: 47 | Ref decodeRow(int rowNumber, Ref row); 48 | ITFReader(); 49 | ~ITFReader(); 50 | }; 51 | 52 | } 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/MultiFormatOneDReader.h: -------------------------------------------------------------------------------- 1 | #ifndef __MULTI_FORMAT_ONED_READER_H__ 2 | #define __MULTI_FORMAT_ONED_READER_H__ 3 | /* 4 | * MultiFormatOneDReader.h 5 | * ZXing 6 | * 7 | * Copyright 2010 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | namespace zxing { 25 | namespace oned { 26 | class MultiFormatOneDReader : public OneDReader { 27 | 28 | private: 29 | std::vector > readers; 30 | public: 31 | MultiFormatOneDReader(DecodeHints hints); 32 | 33 | Ref decodeRow(int rowNumber, Ref row); 34 | }; 35 | } 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/MultiFormatUPCEANReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __MULTI_FORMAT_UPC_EAN_READER_H__ 3 | #define __MULTI_FORMAT_UPC_EAN_READER_H__ 4 | /* 5 | * MultiFormatUPCEANReader.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 24 | 25 | namespace zxing { 26 | namespace oned { 27 | 28 | class UPCEANReader; 29 | 30 | class MultiFormatUPCEANReader : public OneDReader { 31 | private: 32 | std::vector< Ref > readers; 33 | public: 34 | MultiFormatUPCEANReader(DecodeHints hints); 35 | Ref decodeRow(int rowNumber, Ref row); 36 | }; 37 | 38 | } 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/OneDResultPoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * OneDResultPoint.cpp 3 | * ZXing 4 | * 5 | * Copyright 2010 ZXing authors All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include "OneDResultPoint.h" 21 | 22 | namespace zxing { 23 | namespace oned { 24 | 25 | OneDResultPoint::OneDResultPoint(float posX, float posY) : ResultPoint(posX,posY) { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/OneDResultPoint.h: -------------------------------------------------------------------------------- 1 | #ifndef __ONED_RESULT_POINT_H__ 2 | #define __ONED_RESULT_POINT_H__ 3 | /* 4 | * OneDResultPoint.h 5 | * ZXing 6 | * 7 | * Copyright 2010 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | #include 22 | #include 23 | 24 | namespace zxing { 25 | namespace oned { 26 | 27 | class OneDResultPoint : public ResultPoint { 28 | 29 | public: 30 | OneDResultPoint(float posX, float posY); 31 | }; 32 | } 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/UPCAReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __UPCA_READER_H__ 3 | #define __UPCA_READER_H__ 4 | /* 5 | * UPCAReader.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 24 | #include 25 | 26 | namespace zxing { 27 | namespace oned { 28 | 29 | class UPCAReader : public UPCEANReader { 30 | 31 | private: 32 | EAN13Reader ean13Reader; 33 | static Ref maybeReturnResult(Ref result); 34 | 35 | public: 36 | UPCAReader(); 37 | 38 | int decodeMiddle(Ref row, Range const& startRange, std::string& resultString); 39 | 40 | Ref decodeRow(int rowNumber, Ref row); 41 | Ref decodeRow(int rowNumber, Ref row, Range const& startGuardRange); 42 | Ref decode(Ref image, DecodeHints hints); 43 | 44 | BarcodeFormat getBarcodeFormat(); 45 | }; 46 | 47 | } 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/oned/UPCEReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __UPC_E_READER_H__ 3 | #define __UPC_E_READER_H__ 4 | 5 | /* 6 | * Copyright 2010 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 22 | #include 23 | 24 | namespace zxing { 25 | namespace oned { 26 | 27 | class UPCEReader : public UPCEANReader { 28 | private: 29 | std::vector decodeMiddleCounters; 30 | static bool determineNumSysAndCheckDigit(std::string& resultString, int lgPatternFound); 31 | 32 | protected: 33 | Range decodeEnd(Ref row, int endStart); 34 | bool checkChecksum(Ref const& s); 35 | public: 36 | UPCEReader(); 37 | 38 | int decodeMiddle(Ref row, Range const& startRange, std::string& resultString); 39 | static Ref convertUPCEtoUPCA(Ref const& upce); 40 | 41 | BarcodeFormat getBarcodeFormat(); 42 | }; 43 | 44 | } 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/pdf417/PDF417Reader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __PDF417_READER_H__ 3 | #define __PDF417_READER_H__ 4 | 5 | /* 6 | * PDF417Reader.h 7 | * zxing 8 | * 9 | * Copyright 2010,2012 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | namespace pdf417 { 30 | 31 | 32 | class PDF417Reader : public Reader { 33 | private: 34 | decoder::Decoder decoder; 35 | 36 | static Ref extractPureBits(Ref image); 37 | static int moduleSize(ArrayRef leftTopBlack, Ref image); 38 | static int findPatternStart(int x, int y, Ref image); 39 | static int findPatternEnd(int x, int y, Ref image); 40 | 41 | public: 42 | Ref decode(Ref image, DecodeHints hints); 43 | void reset(); 44 | }; 45 | 46 | } 47 | } 48 | 49 | #endif // __PDF417_READER_H__ 50 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/pdf417/decoder/Decoder.h: -------------------------------------------------------------------------------- 1 | #ifndef __DECOCER_PDF_H__ 2 | #define __DECOCER_PDF_H__ 3 | 4 | /* 5 | * Decoder.h 6 | * zxing 7 | * 8 | * Created by Hartmut Neubauer, 2012-05-25 9 | * Copyright 2010,2012 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | 32 | namespace zxing { 33 | namespace pdf417 { 34 | namespace decoder { 35 | 36 | /** 37 | *

The main class which implements PDF417 Code decoding -- as 38 | * opposed to locating and extracting the PDF417 Code from an image.

39 | * 40 | *

2012-06-27 HFN Reed-Solomon error correction activated, see class PDF417RSDecoder.

41 | *

2012-09-19 HFN Reed-Solomon error correction via ErrorCorrection/ModulusGF/ModulusPoly.

42 | */ 43 | 44 | class Decoder { 45 | private: 46 | static const int MAX_ERRORS; 47 | static const int MAX_EC_CODEWORDS; 48 | 49 | void correctErrors(ArrayRef codewords, 50 | ArrayRef erasures, int numECCodewords); 51 | static void verifyCodewordCount(ArrayRef codewords, int numECCodewords); 52 | 53 | public: 54 | 55 | Ref decode(Ref bits, DecodeHints const &hints); 56 | }; 57 | 58 | } 59 | } 60 | } 61 | 62 | #endif // __DECOCER_PDF_H__ 63 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/pdf417/decoder/ec/ModulusGF.h: -------------------------------------------------------------------------------- 1 | #ifndef __MODULUS_GF_PDF_H__ 2 | #define __MODULUS_GF_PDF_H__ 3 | /* 4 | * Copyright 2012 ZXing authors 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 | * 2012-09-17 HFN translation from Java into C++ 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace zxing { 27 | namespace pdf417 { 28 | namespace decoder { 29 | namespace ec { 30 | 31 | class ModulusPoly; 32 | 33 | /** 34 | *

A field based on powers of a generator integer, modulo some modulus.

35 | * 36 | * @author Sean Owen 37 | * @see com.google.zxing.common.reedsolomon.GenericGF 38 | */ 39 | class ModulusGF { 40 | 41 | public: 42 | static ModulusGF PDF417_GF; 43 | 44 | private: 45 | ArrayRef expTable_; 46 | ArrayRef logTable_; 47 | Ref zero_; 48 | Ref one_; 49 | int modulus_; 50 | 51 | public: 52 | ModulusGF(int modulus, int generator); 53 | Ref getZero(); 54 | Ref getOne(); 55 | Ref buildMonomial(int degree, int coefficient); 56 | 57 | int add(int a, int b); 58 | int subtract(int a, int b); 59 | int exp(int a); 60 | int log(int a); 61 | int inverse(int a); 62 | int multiply(int a, int b); 63 | int getSize(); 64 | 65 | }; 66 | 67 | } 68 | } 69 | } 70 | } 71 | 72 | #endif /* __MODULUS_GF_PDF_H__ */ 73 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/pdf417/decoder/ec/ModulusPoly.h: -------------------------------------------------------------------------------- 1 | #ifndef __MODULUS_GFPOLY_PDF_H__ 2 | #define __MODULUS_GFPOLY_PDF_H__ 3 | 4 | /* 5 | * Copyright 2012 ZXing authors 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | * 2012-09-17 HFN translation from Java into C++ 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | namespace pdf417 { 29 | namespace decoder { 30 | namespace ec { 31 | 32 | class ModulusGF; 33 | 34 | /** 35 | * @author Sean Owen 36 | * @see com.google.zxing.common.reedsolomon.GenericGFPoly 37 | */ 38 | class ModulusPoly: public Counted { 39 | 40 | private: 41 | ModulusGF &field_; 42 | ArrayRef coefficients_; 43 | public: 44 | ModulusPoly(ModulusGF& field, ArrayRef coefficients); 45 | ~ModulusPoly(); 46 | ArrayRef getCoefficients(); 47 | int getDegree(); 48 | bool isZero(); 49 | int getCoefficient(int degree); 50 | int evaluateAt(int a); 51 | Ref add(Ref other); 52 | Ref subtract(Ref other); 53 | Ref multiply(Ref other); 54 | Ref negative(); 55 | Ref multiply(int scalar); 56 | Ref multiplyByMonomial(int degree, int coefficient); 57 | std::vector > divide(Ref other); 58 | #if 0 59 | public String toString(); 60 | #endif 61 | }; 62 | 63 | } 64 | } 65 | } 66 | } 67 | 68 | #endif /* __MODULUS_GFPOLY_PDF_H__ */ 69 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/ErrorCorrectionLevel.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * ErrorCorrectionLevel.cpp 4 | * zxing 5 | * 6 | * Created by Christian Brunschen on 15/05/2008. 7 | * Copyright 2008-2011 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | using std::string; 25 | 26 | namespace zxing { 27 | namespace qrcode { 28 | 29 | ErrorCorrectionLevel::ErrorCorrectionLevel(int inOrdinal, 30 | int bits, 31 | char const* name) : 32 | ordinal_(inOrdinal), bits_(bits), name_(name) {} 33 | 34 | int ErrorCorrectionLevel::ordinal() const { 35 | return ordinal_; 36 | } 37 | 38 | int ErrorCorrectionLevel::bits() const { 39 | return bits_; 40 | } 41 | 42 | string const& ErrorCorrectionLevel::name() const { 43 | return name_; 44 | } 45 | 46 | ErrorCorrectionLevel::operator string const& () const { 47 | return name_; 48 | } 49 | 50 | ErrorCorrectionLevel& ErrorCorrectionLevel::forBits(int bits) { 51 | if (bits < 0 || bits >= N_LEVELS) { 52 | throw ReaderException("Ellegal error correction level bits"); 53 | } 54 | return *FOR_BITS[bits]; 55 | } 56 | 57 | ErrorCorrectionLevel ErrorCorrectionLevel::L(0, 0x01, "L"); 58 | ErrorCorrectionLevel ErrorCorrectionLevel::M(1, 0x00, "M"); 59 | ErrorCorrectionLevel ErrorCorrectionLevel::Q(2, 0x03, "Q"); 60 | ErrorCorrectionLevel ErrorCorrectionLevel::H(3, 0x02, "H"); 61 | ErrorCorrectionLevel *ErrorCorrectionLevel::FOR_BITS[] = { &M, &L, &H, &Q }; 62 | int ErrorCorrectionLevel::N_LEVELS = 4; 63 | 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/ErrorCorrectionLevel.h: -------------------------------------------------------------------------------- 1 | #ifndef __ERROR_CORRECTION_LEVEL_H__ 2 | #define __ERROR_CORRECTION_LEVEL_H__ 3 | 4 | /* 5 | * ErrorCorrectionLevel.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 24 | 25 | namespace zxing { 26 | namespace qrcode { 27 | 28 | class ErrorCorrectionLevel { 29 | private: 30 | int ordinal_; 31 | int bits_; 32 | std::string name_; 33 | ErrorCorrectionLevel(int inOrdinal, int bits, char const* name); 34 | static ErrorCorrectionLevel *FOR_BITS[]; 35 | static int N_LEVELS; 36 | public: 37 | static ErrorCorrectionLevel L; 38 | static ErrorCorrectionLevel M; 39 | static ErrorCorrectionLevel Q; 40 | static ErrorCorrectionLevel H; 41 | 42 | int ordinal() const; 43 | int bits() const; 44 | std::string const& name() const; 45 | operator std::string const& () const; 46 | 47 | static ErrorCorrectionLevel& forBits(int bits); 48 | }; 49 | } 50 | } 51 | 52 | #endif // __ERROR_CORRECTION_LEVEL_H__ 53 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/FormatInformation.h: -------------------------------------------------------------------------------- 1 | #ifndef __FORMAT_INFORMATION_H__ 2 | #define __FORMAT_INFORMATION_H__ 3 | 4 | /* 5 | * FormatInformation.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 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | namespace qrcode { 29 | 30 | class FormatInformation : public Counted { 31 | private: 32 | static int FORMAT_INFO_MASK_QR; 33 | static int FORMAT_INFO_DECODE_LOOKUP[][2]; 34 | static int N_FORMAT_INFO_DECODE_LOOKUPS; 35 | static int BITS_SET_IN_HALF_BYTE[]; 36 | 37 | ErrorCorrectionLevel &errorCorrectionLevel_; 38 | char dataMask_; 39 | 40 | FormatInformation(int formatInfo); 41 | 42 | public: 43 | static int numBitsDiffering(int a, int b); 44 | static Ref decodeFormatInformation(int maskedFormatInfo1, int maskedFormatInfo2); 45 | static Ref doDecodeFormatInformation(int maskedFormatInfo1, int maskedFormatInfo2); 46 | ErrorCorrectionLevel &getErrorCorrectionLevel(); 47 | char getDataMask(); 48 | friend bool operator==(const FormatInformation &a, const FormatInformation &b); 49 | friend std::ostream& operator<<(std::ostream& out, const FormatInformation& fi); 50 | }; 51 | } 52 | } 53 | 54 | #endif // __FORMAT_INFORMATION_H__ 55 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/QRCodeReader.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * QRCodeReader.cpp 4 | * zxing 5 | * 6 | * Created by Christian Brunschen on 20/05/2008. 7 | * Copyright 2008 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | namespace zxing { 28 | namespace qrcode { 29 | 30 | using namespace std; 31 | 32 | QRCodeReader::QRCodeReader() :decoder_() { 33 | } 34 | //TODO: see if any of the other files in the qrcode tree need tryHarder 35 | Ref QRCodeReader::decode(Ref image, DecodeHints hints) { 36 | Detector detector(image->getBlackMatrix()); 37 | Ref detectorResult(detector.detect(hints)); 38 | ArrayRef< Ref > points (detectorResult->getPoints()); 39 | Ref decoderResult(decoder_.decode(detectorResult->getBits())); 40 | Ref result( 41 | new Result(decoderResult->getText(), decoderResult->getRawBytes(), points, BarcodeFormat::QR_CODE)); 42 | return result; 43 | } 44 | 45 | QRCodeReader::~QRCodeReader() { 46 | } 47 | 48 | Decoder& QRCodeReader::getDecoder() { 49 | return decoder_; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/QRCodeReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __QR_CODE_READER_H__ 3 | #define __QR_CODE_READER_H__ 4 | 5 | /* 6 | * QRCodeReader.h 7 | * zxing 8 | * 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | namespace qrcode { 30 | 31 | class QRCodeReader : public Reader { 32 | private: 33 | Decoder decoder_; 34 | 35 | protected: 36 | Decoder& getDecoder(); 37 | 38 | public: 39 | QRCodeReader(); 40 | virtual ~QRCodeReader(); 41 | 42 | Ref decode(Ref image, DecodeHints hints); 43 | }; 44 | 45 | } 46 | } 47 | 48 | #endif // __QR_CODE_READER_H__ 49 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/decoder/BitMatrixParser.h: -------------------------------------------------------------------------------- 1 | #ifndef __BIT_MATRIX_PARSER_H__ 2 | #define __BIT_MATRIX_PARSER_H__ 3 | 4 | /* 5 | * BitMatrixParser.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 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | namespace zxing { 31 | namespace qrcode { 32 | 33 | class BitMatrixParser : public Counted { 34 | private: 35 | Ref bitMatrix_; 36 | Version *parsedVersion_; 37 | Ref parsedFormatInfo_; 38 | 39 | int copyBit(size_t x, size_t y, int versionBits); 40 | 41 | public: 42 | BitMatrixParser(Ref bitMatrix); 43 | Ref readFormatInformation(); 44 | Version *readVersion(); 45 | ArrayRef readCodewords(); 46 | 47 | private: 48 | BitMatrixParser(const BitMatrixParser&); 49 | BitMatrixParser& operator =(const BitMatrixParser&); 50 | 51 | }; 52 | 53 | } 54 | } 55 | 56 | #endif // __BIT_MATRIX_PARSER_H__ 57 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/decoder/DataBlock.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_BLOCK_H__ 2 | #define __DATA_BLOCK_H__ 3 | 4 | /* 5 | * DataBlock.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 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace zxing { 30 | namespace qrcode { 31 | 32 | class DataBlock : public Counted { 33 | private: 34 | int numDataCodewords_; 35 | ArrayRef codewords_; 36 | 37 | DataBlock(int numDataCodewords, ArrayRef codewords); 38 | 39 | public: 40 | static std::vector > 41 | getDataBlocks(ArrayRef rawCodewords, Version *version, ErrorCorrectionLevel &ecLevel); 42 | 43 | int getNumDataCodewords(); 44 | ArrayRef getCodewords(); 45 | }; 46 | 47 | } 48 | } 49 | 50 | #endif // __DATA_BLOCK_H__ 51 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/decoder/DataMask.h: -------------------------------------------------------------------------------- 1 | #ifndef __DATA_MASK_H__ 2 | #define __DATA_MASK_H__ 3 | 4 | /* 5 | * DataMask.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 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | namespace zxing { 30 | namespace qrcode { 31 | 32 | class DataMask : public Counted { 33 | private: 34 | static std::vector > DATA_MASKS; 35 | 36 | protected: 37 | 38 | public: 39 | static int buildDataMasks(); 40 | DataMask(); 41 | virtual ~DataMask(); 42 | void unmaskBitMatrix(BitMatrix& matrix, size_t dimension); 43 | virtual bool isMasked(size_t x, size_t y) = 0; 44 | static DataMask& forReference(int reference); 45 | }; 46 | 47 | } 48 | } 49 | 50 | #endif // __DATA_MASK_H__ 51 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/decoder/Decoder.h: -------------------------------------------------------------------------------- 1 | #ifndef __DECODER_H__ 2 | #define __DECODER_H__ 3 | 4 | /* 5 | * Decoder.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 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace zxing { 30 | namespace qrcode { 31 | 32 | class Decoder { 33 | private: 34 | ReedSolomonDecoder rsDecoder_; 35 | 36 | void correctErrors(ArrayRef bytes, int numDataCodewords); 37 | 38 | public: 39 | Decoder(); 40 | Ref decode(Ref bits); 41 | }; 42 | 43 | } 44 | } 45 | 46 | #endif // __DECODER_H__ 47 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/decoder/Mode.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __MODE_H__ 3 | #define __MODE_H__ 4 | 5 | /* 6 | * Mode.h 7 | * zxing 8 | * 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | namespace qrcode { 29 | 30 | class Mode { 31 | private: 32 | int characterCountBitsForVersions0To9_; 33 | int characterCountBitsForVersions10To26_; 34 | int characterCountBitsForVersions27AndHigher_; 35 | std::string name_; 36 | 37 | Mode(int cbv0_9, int cbv10_26, int cbv27, int bits, char const* name); 38 | 39 | public: 40 | static Mode TERMINATOR; 41 | static Mode NUMERIC; 42 | static Mode ALPHANUMERIC; 43 | static Mode STRUCTURED_APPEND; 44 | static Mode BYTE; 45 | static Mode ECI; 46 | static Mode KANJI; 47 | static Mode FNC1_FIRST_POSITION; 48 | static Mode FNC1_SECOND_POSITION; 49 | static Mode HANZI; 50 | 51 | static Mode& forBits(int bits); 52 | int getCharacterCountBits(Version *version); 53 | }; 54 | } 55 | } 56 | 57 | #endif // __MODE_H__ 58 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/detector/AlignmentPattern.cpp: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | /* 3 | * AlignmentPattern.cpp 4 | * zxing 5 | * 6 | * Created by Christian Brunschen on 13/05/2008. 7 | * Copyright 2008 ZXing authors All rights reserved. 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); 10 | * you may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | */ 21 | 22 | #include 23 | 24 | using std::abs; 25 | using zxing::Ref; 26 | using zxing::qrcode::AlignmentPattern; 27 | 28 | AlignmentPattern::AlignmentPattern(float posX, float posY, float estimatedModuleSize) : 29 | ResultPoint(posX,posY), estimatedModuleSize_(estimatedModuleSize) { 30 | } 31 | 32 | bool AlignmentPattern::aboutEquals(float moduleSize, float i, float j) const { 33 | if (abs(i - getY()) <= moduleSize && abs(j - getX()) <= moduleSize) { 34 | float moduleSizeDiff = abs(moduleSize - estimatedModuleSize_); 35 | return moduleSizeDiff <= 1.0f || moduleSizeDiff <= estimatedModuleSize_; 36 | } 37 | return false; 38 | } 39 | 40 | Ref AlignmentPattern::combineEstimate(float i, float j, float newModuleSize) const { 41 | float combinedX = (getX() + j) / 2.0f; 42 | float combinedY = (getY() + i) / 2.0f; 43 | float combinedModuleSize = (estimatedModuleSize_ + newModuleSize) / 2.0f; 44 | Ref result 45 | (new AlignmentPattern(combinedX, combinedY, combinedModuleSize)); 46 | return result; 47 | } 48 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/detector/AlignmentPattern.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef __ALIGNMENT_PATTERN_H__ 4 | #define __ALIGNMENT_PATTERN_H__ 5 | 6 | /* 7 | * AlignmentPattern.h 8 | * zxing 9 | * 10 | * Copyright 2010 ZXing authors All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | namespace qrcode { 30 | 31 | class AlignmentPattern : public ResultPoint { 32 | private: 33 | float estimatedModuleSize_; 34 | 35 | public: 36 | AlignmentPattern(float posX, float posY, float estimatedModuleSize); 37 | bool aboutEquals(float moduleSize, float i, float j) const; 38 | Ref combineEstimate(float i, float j, 39 | float newModuleSize) const; 40 | }; 41 | 42 | } 43 | } 44 | 45 | #endif // __ALIGNMENT_PATTERN_H__ 46 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/detector/AlignmentPatternFinder.h: -------------------------------------------------------------------------------- 1 | #ifndef __ALIGNMENT_PATTERN_FINDER_H__ 2 | #define __ALIGNMENT_PATTERN_FINDER_H__ 3 | 4 | /* 5 | * AlignmentPatternFinder.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 "AlignmentPattern.h" 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace zxing { 30 | namespace qrcode { 31 | 32 | class AlignmentPatternFinder : public Counted { 33 | private: 34 | static int CENTER_QUORUM; 35 | static int MIN_SKIP; 36 | static int MAX_MODULES; 37 | 38 | Ref image_; 39 | std::vector *possibleCenters_; 40 | int startX_; 41 | int startY_; 42 | int width_; 43 | int height_; 44 | float moduleSize_; 45 | 46 | static float centerFromEnd(std::vector &stateCount, int end); 47 | bool foundPatternCross(std::vector &stateCount); 48 | 49 | float crossCheckVertical(int startI, int centerJ, int maxCount, int originalStateCountTotal); 50 | 51 | Ref handlePossibleCenter(std::vector &stateCount, int i, int j); 52 | 53 | public: 54 | AlignmentPatternFinder(Ref image, int startX, int startY, int width, int height, 55 | float moduleSize, Refconst& callback); 56 | ~AlignmentPatternFinder(); 57 | Ref find(); 58 | 59 | private: 60 | AlignmentPatternFinder(const AlignmentPatternFinder&); 61 | AlignmentPatternFinder& operator =(const AlignmentPatternFinder&); 62 | 63 | Ref callback_; 64 | }; 65 | } 66 | } 67 | 68 | #endif // __ALIGNMENT_PATTERN_FINDER_H__ 69 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/detector/FinderPattern.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef __FINDER_PATTERN_H__ 3 | #define __FINDER_PATTERN_H__ 4 | 5 | /* 6 | * FinderPattern.h 7 | * zxing 8 | * 9 | * Copyright 2010 ZXing authors All rights reserved. 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | */ 23 | 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | namespace qrcode { 29 | 30 | class FinderPattern : public ResultPoint { 31 | private: 32 | float estimatedModuleSize_; 33 | int count_; 34 | 35 | FinderPattern(float posX, float posY, float estimatedModuleSize, int count); 36 | 37 | public: 38 | FinderPattern(float posX, float posY, float estimatedModuleSize); 39 | int getCount() const; 40 | float getEstimatedModuleSize() const; 41 | void incrementCount(); 42 | bool aboutEquals(float moduleSize, float i, float j) const; 43 | Ref combineEstimate(float i, float j, float newModuleSize) const; 44 | }; 45 | } 46 | } 47 | 48 | #endif // __FINDER_PATTERN_H__ 49 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/detector/FinderPatternInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * FinderPatternInfo.cpp 3 | * zxing 4 | * 5 | * Created by Christian Brunschen on 13/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 22 | 23 | namespace zxing { 24 | namespace qrcode { 25 | 26 | FinderPatternInfo::FinderPatternInfo(std::vector > patternCenters) : 27 | bottomLeft_(patternCenters[0]), topLeft_(patternCenters[1]), topRight_(patternCenters[2]) { 28 | } 29 | 30 | Ref FinderPatternInfo::getBottomLeft() { 31 | return bottomLeft_; 32 | } 33 | Ref FinderPatternInfo::getTopLeft() { 34 | return topLeft_; 35 | } 36 | Ref FinderPatternInfo::getTopRight() { 37 | return topRight_; 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeReader/zxing/zxing/qrcode/detector/FinderPatternInfo.h: -------------------------------------------------------------------------------- 1 | #ifndef __FINDER_PATTERN_INFO_H__ 2 | #define __FINDER_PATTERN_INFO_H__ 3 | 4 | /* 5 | * FinderPatternInfo.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 24 | #include 25 | #include 26 | #include 27 | 28 | namespace zxing { 29 | namespace qrcode { 30 | 31 | class FinderPatternInfo : public Counted { 32 | private: 33 | Ref bottomLeft_; 34 | Ref topLeft_; 35 | Ref topRight_; 36 | 37 | public: 38 | FinderPatternInfo(std::vector > patternCenters); 39 | 40 | Ref getBottomLeft(); 41 | Ref getTopLeft(); 42 | Ref getTopRight(); 43 | }; 44 | } 45 | } 46 | 47 | #endif // __FINDER_PATTERN_INFO_H__ 48 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/TODO: -------------------------------------------------------------------------------- 1 | Micro QR code encoding is not tested well. 2 | 3 | Documents (not only the README, but also the manual of the library) needs 4 | revision of grammer, spell or to resolve ambiguity or incomplete descriptions. 5 | Feel really free to send us your revision. 6 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/acinclude.m4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/188080501/JQQRCode/5e1a97c787d557b0fbd308eafbe1ca22040d5568/sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/acinclude.m4 -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ `uname -s` = Darwin ]; then 6 | LIBTOOLIZE=glibtoolize 7 | else 8 | LIBTOOLIZE=libtoolize 9 | fi 10 | 11 | ACLOCAL_OPT="" 12 | if [ -d /usr/local/share/aclocal ]; then 13 | ACLOCAL_OPT="-I /usr/local/share/aclocal" 14 | elif [ -d /opt/local/share/aclocal ]; then 15 | ACLOCAL_OPT="-I /opt/local/share/aclocal" 16 | elif [ -d /usr/share/aclocal ]; then 17 | ACLOCAL_OPT="-I /usr/share/aclocal" 18 | fi 19 | 20 | if [ ! -d use ]; then 21 | mkdir use 22 | fi 23 | 24 | autoheader 25 | 26 | aclocal $ACLOCAL_OPT 27 | 28 | $LIBTOOLIZE --automake --copy 29 | automake --add-missing --copy 30 | 31 | autoconf 32 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/bitstream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Binary sequence class. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __BITSTREAM_H__ 23 | #define __BITSTREAM_H__ 24 | 25 | typedef struct { 26 | int length; 27 | unsigned char *data; 28 | } BitStream; 29 | 30 | extern BitStream *BitStream_new(void); 31 | extern int BitStream_append(BitStream *bstream, BitStream *arg); 32 | extern int BitStream_appendNum(BitStream *bstream, int bits, unsigned int num); 33 | extern int BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data); 34 | #define BitStream_size(__bstream__) (__bstream__->length) 35 | extern unsigned char *BitStream_toByte(BitStream *bstream); 36 | extern void BitStream_free(BitStream *bstream); 37 | 38 | #endif /* __BITSTREAM_H__ */ 39 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/libqrencode.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libqrencode 7 | Description: A QR Code encoding library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lqrencode 10 | Libs.private: @LIBPTHREAD@ 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/mask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Masking. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __MASK_H__ 23 | #define __MASK_H__ 24 | 25 | extern unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level); 26 | extern unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level); 27 | 28 | #ifdef WITH_TESTS 29 | extern int Mask_calcN2(int width, unsigned char *frame); 30 | extern int Mask_calcN1N3(int length, int *runLength); 31 | extern int Mask_calcRunLength(int width, unsigned char *frame, int dir, int *runLength); 32 | extern int Mask_evaluateSymbol(int width, unsigned char *frame); 33 | extern int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level); 34 | extern unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask); 35 | #endif 36 | 37 | #endif /* __MASK_H__ */ 38 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/mmask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Masking for Micro QR Code. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation; either 10 | * version 2.1 of the License, or any later version. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #ifndef __MMASK_H__ 23 | #define __MMASK_H__ 24 | 25 | extern unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level); 26 | extern unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level); 27 | 28 | #ifdef WITH_TESTS 29 | extern int MMask_evaluateSymbol(int width, unsigned char *frame); 30 | extern void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level); 31 | extern unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask); 32 | #endif 33 | 34 | #endif /* __MMASK_H__ */ 35 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/rscode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Reed solomon encoder. This code is taken from Phil Karn's libfec then 5 | * editted and packed into a pair of .c and .h files. 6 | * 7 | * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q 8 | * (libfec is released under the GNU Lesser General Public License.) 9 | * 10 | * Copyright (C) 2006-2011 Kentaro Fukuchi 11 | * 12 | * This library is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU Lesser General Public 14 | * License as published by the Free Software Foundation; either 15 | * version 2.1 of the License, or any later version. 16 | * 17 | * This library is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * Lesser General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU Lesser General Public 23 | * License along with this library; if not, write to the Free Software 24 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 25 | */ 26 | 27 | #ifndef __RSCODE_H__ 28 | #define __RSCODE_H__ 29 | 30 | /* 31 | * General purpose RS codec, 8-bit symbols. 32 | */ 33 | 34 | typedef struct _RS RS; 35 | 36 | extern RS *init_rs(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad); 37 | extern void encode_rs_char(RS *rs, const unsigned char *data, unsigned char *parity); 38 | extern void free_rs_char(RS *rs); 39 | extern void free_rs_cache(void); 40 | 41 | #endif /* __RSCODE_H__ */ 42 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/split.h: -------------------------------------------------------------------------------- 1 | /* 2 | * qrencode - QR Code encoder 3 | * 4 | * Input data splitter. 5 | * Copyright (C) 2006-2011 Kentaro Fukuchi 6 | * 7 | * The following data / specifications are taken from 8 | * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004) 9 | * or 10 | * "Automatic identification and data capture techniques -- 11 | * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006) 12 | * 13 | * This library is free software; you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public 15 | * License as published by the Free Software Foundation; either 16 | * version 2.1 of the License, or any later version. 17 | * 18 | * This library is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | * Lesser General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU Lesser General Public 24 | * License along with this library; if not, write to the Free Software 25 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 | */ 27 | 28 | #ifndef __SPLIT_H__ 29 | #define __SPLIT_H__ 30 | 31 | #include "qrencode.h" 32 | 33 | /** 34 | * Split the input string (null terminated) into QRinput. 35 | * @param string input string 36 | * @param hint give QR_MODE_KANJI if the input string contains Kanji character encoded in Shift-JIS. If not, give QR_MODE_8. 37 | * @param casesensitive 0 for case-insensitive encoding (all alphabet characters are replaced to UPPER-CASE CHARACTERS. 38 | * @retval 0 success. 39 | * @retval -1 an error occurred. errno is set to indicate the error. See 40 | * Exceptions for the details. 41 | * @throw EINVAL invalid input object. 42 | * @throw ENOMEM unable to allocate memory for input objects. 43 | */ 44 | extern int Split_splitStringToQRinput(const char *string, QRinput *input, 45 | QRencodeMode hint, int casesensitive); 46 | 47 | #endif /* __SPLIT_H__ */ 48 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/tests/decoder.h: -------------------------------------------------------------------------------- 1 | #ifndef __DECODER_H__ 2 | #define __DECODER_H__ 3 | 4 | #include "../qrencode.h" 5 | 6 | typedef struct _DataChunk { 7 | QRencodeMode mode; 8 | int size; 9 | int bits; 10 | unsigned char *data; 11 | struct _DataChunk *next; 12 | } DataChunk; 13 | 14 | typedef struct { 15 | int size; 16 | unsigned char *data; 17 | int mqr; 18 | int version; 19 | QRecLevel level; 20 | DataChunk *chunks, *last; 21 | } QRdata; 22 | 23 | struct FormatInfo { 24 | int version; 25 | QRecLevel level; 26 | }; 27 | 28 | extern struct FormatInfo MQRformat[]; 29 | 30 | QRdata *QRdata_new(void); 31 | QRdata *QRdata_newMQR(void); 32 | int QRdata_decodeBitStream(QRdata *qrdata, BitStream *bstream); 33 | void QRdata_dump(QRdata *data); 34 | void QRdata_free(QRdata *data); 35 | 36 | unsigned int QRcode_decodeVersion(QRcode *code); 37 | int QRcode_decodeFormat(QRcode *code, QRecLevel *level, int *mask); 38 | unsigned char *QRcode_unmask(QRcode *code); 39 | unsigned char *QRcode_extractBits(QRcode *code, int *length); 40 | QRdata *QRcode_decodeBits(QRcode *code); 41 | QRdata *QRcode_decode(QRcode *code); 42 | 43 | int QRcode_decodeFormatMQR(QRcode *code, int *vesion, QRecLevel *level, int *mask); 44 | unsigned char *QRcode_unmaskMQR(QRcode *code); 45 | unsigned char *QRcode_extractBitsMQR(QRcode *code, int *length); 46 | QRdata *QRcode_decodeBitsMQR(QRcode *code); 47 | QRdata *QRcode_decodeMQR(QRcode *code); 48 | 49 | #endif /* __DECODER_H__ */ 50 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/tests/frame: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/188080501/JQQRCode/5e1a97c787d557b0fbd308eafbe1ca22040d5568/sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/tests/frame -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/tests/prof_qrencode.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "../qrencode.h" 7 | 8 | struct timeval tv; 9 | void timerStart(const char *str) 10 | { 11 | printf("%s: START\n", str); 12 | gettimeofday(&tv, NULL); 13 | } 14 | 15 | void timerStop(void) 16 | { 17 | struct timeval tc; 18 | 19 | gettimeofday(&tc, NULL); 20 | printf("STOP: %ld msec\n", (tc.tv_sec - tv.tv_sec) * 1000 21 | + (tc.tv_usec - tv.tv_usec) / 1000); 22 | } 23 | 24 | void prof_ver1to10(void) 25 | { 26 | QRcode *code; 27 | int i; 28 | int version; 29 | static const char *data = "This is test."; 30 | 31 | timerStart("Version 1 - 10 (500 symbols for each)"); 32 | for(i=0; i<500; i++) { 33 | for(version = 0; version < 11; version++) { 34 | code = QRcode_encodeString(data, version, QR_ECLEVEL_L, QR_MODE_8, 0); 35 | if(code == NULL) { 36 | perror("Failed to encode:"); 37 | } else { 38 | QRcode_free(code); 39 | } 40 | } 41 | } 42 | timerStop(); 43 | } 44 | 45 | void prof_ver31to40(void) 46 | { 47 | QRcode *code; 48 | int i; 49 | int version; 50 | static const char *data = "This is test."; 51 | 52 | timerStart("Version 31 - 40 (50 symbols for each)"); 53 | for(i=0; i<50; i++) { 54 | for(version = 31; version < 41; version++) { 55 | code = QRcode_encodeString(data, version, QR_ECLEVEL_L, QR_MODE_8, 0); 56 | if(code == NULL) { 57 | perror("Failed to encode:"); 58 | } else { 59 | QRcode_free(code); 60 | } 61 | } 62 | } 63 | timerStop(); 64 | } 65 | 66 | int main(void) 67 | { 68 | prof_ver1to10(); 69 | prof_ver31to40(); 70 | 71 | QRcode_clearCache(); 72 | 73 | return 0; 74 | } 75 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/tests/test_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | ./test_bitstream 3 | ./test_estimatebit 4 | ./test_qrencode 5 | ./test_qrinput 6 | ./test_qrspec 7 | ./test_rs 8 | ./test_split 9 | ./test_mask 10 | ./test_mqrspec 11 | ./test_mmask 12 | ./test_monkey 13 | -------------------------------------------------------------------------------- /sharedlibrary/JQLibrary/src/JQQRCodeWriter/qrencode/tests/test_rs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "common.h" 4 | #include "../qrencode_inner.h" 5 | #include "../qrinput.h" 6 | #include "../rscode.h" 7 | 8 | /* See pp. 73 of JIS X0510:2004 */ 9 | void test_rscode1(void) 10 | { 11 | QRinput *stream; 12 | QRRawCode *code; 13 | static const char str[9] = "01234567"; 14 | static unsigned char correct[26] = { 15 | 0x10, 0x20, 0x0c, 0x56, 0x61, 0x80, 0xec, 0x11, 0xec, 0x11, 0xec, 0x11, 16 | 0xec, 0x11, 0xec, 0x11, 0xa5, 0x24, 0xd4, 0xc1, 0xed, 0x36, 0xc7, 0x87, 17 | 0x2c, 0x55}; 18 | 19 | testStart("RS ecc test"); 20 | stream = QRinput_new(); 21 | QRinput_append(stream, QR_MODE_NUM, 8, (unsigned char *)str); 22 | QRinput_setErrorCorrectionLevel(stream, QR_ECLEVEL_M); 23 | code = QRraw_new(stream); 24 | 25 | testEnd(memcmp(correct + 16, code->rsblock[0].ecc, 10)); 26 | QRinput_free(stream); 27 | QRraw_free(code); 28 | } 29 | 30 | int main(void) 31 | { 32 | test_rscode1(); 33 | 34 | free_rs_cache(); 35 | report(); 36 | 37 | return 0; 38 | } 39 | --------------------------------------------------------------------------------