├── examples ├── QZXingDragNDropTest │ ├── qtc_packaging │ │ └── debian_fremantle │ │ │ ├── compat │ │ │ ├── changelog │ │ │ ├── README │ │ │ ├── control │ │ │ └── copyright │ ├── qml │ │ └── QZXingDragNDropTest │ │ │ └── ToggleButton.qml │ ├── droparea.h │ ├── main.cpp │ ├── qtquick2applicationviewer │ │ └── qtquick2applicationviewer.h │ ├── qmlapplicationviewer │ │ └── qmlapplicationviewer.h │ └── droparea.cpp ├── QZXingLive │ ├── icons │ │ ├── qzxing_icon.png │ │ ├── qzxing_icon_dpi.png │ │ └── qzxing_icon_hdpi.png │ ├── android │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ └── icon.png │ │ │ ├── drawable-ldpi │ │ │ │ └── icon.png │ │ │ ├── drawable-mdpi │ │ │ │ └── icon.png │ │ │ └── values │ │ │ │ └── libs.xml │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ └── src │ │ │ └── org │ │ │ └── ftylitak │ │ │ └── qzxing │ │ │ ├── NativeFunctions.java │ │ │ ├── QZXingLiveActivity.java │ │ │ └── Utilities.java │ ├── qml.qrc │ ├── README.md │ ├── deployment.pri │ ├── native.h │ ├── main.cpp │ ├── application.h │ └── Info.plist ├── BarcodeEncoder │ ├── qml.qrc │ ├── qtquickcontrols2.conf │ ├── main.cpp │ └── BarcodeEncoder.pro ├── QMLBarcodeScanner │ ├── QMLBarcodeReader.sis │ ├── images │ │ ├── toolbutton.png │ │ ├── toolbutton.sci │ │ ├── camera_auto_mode.png │ │ ├── camera_flash_auto.png │ │ ├── camera_flash_fill.png │ │ ├── camera_flash_off.png │ │ ├── camera_flash_redeye.png │ │ ├── camera_camera_setting.png │ │ ├── camera_white_balance_cloudy.png │ │ ├── camera_white_balance_sunny.png │ │ ├── camera_white_balance_flourescent.png │ │ └── camera_white_balance_incandescent.png │ ├── QMLBarcodeReader_installer.sis │ ├── declarative-camera.qmlproject │ ├── MessageDialog.qml │ ├── QMLBarcodeReader.rss │ ├── QMLBarcodeReader.pro │ └── declarative-camera.qrc └── QQrDecoder │ └── readme.md ├── .lgtm.yml ├── .gitmodules ├── tests └── src │ └── QZXingTests │ ├── qzxing_decode_3_0_alpha_0_2_test_results.log │ ├── qzxing_decode_3_0_alpha_0_3_test_results.log │ ├── TestCase.cpp │ ├── zxing │ ├── qrcode │ │ └── encoder │ │ │ ├── QRCodeTests.h │ │ │ ├── MaskUtilTests.h │ │ │ ├── BitVectorTests.h │ │ │ ├── MatrixUtilTests.h │ │ │ └── EncoderTests.h │ └── common │ │ ├── BitArrayTests.h │ │ └── reedsolomon │ │ └── ReedSolomonEncoderTests.h │ ├── EncodeValidator.h │ ├── ValidationStats.h │ ├── QZXingTests.pro │ ├── main.cpp │ ├── EncodeValidator.cpp │ ├── ValidationStats.cpp │ ├── DecodeValidator.h │ └── EncoderStressTest.h ├── src ├── QZXing ├── zxing │ ├── zxing │ │ ├── EncodeHint.cpp │ │ ├── common │ │ │ ├── Types.h │ │ │ ├── reedsolomon │ │ │ │ ├── ReedSolomonEncoder.h │ │ │ │ ├── ReedSolomonException.cpp │ │ │ │ └── ReedSolomonException.h │ │ │ ├── BitArrayIO.cpp │ │ │ ├── IllegalArgumentException.cpp │ │ │ ├── IllegalArgumentException.h │ │ │ ├── Point.h │ │ │ ├── detector │ │ │ │ └── JavaMath.h │ │ │ ├── DetectorResult.cpp │ │ │ ├── ByteArray.h │ │ │ ├── DetectorResult.h │ │ │ ├── Str.h │ │ │ ├── StringUtils.h │ │ │ └── GreyscaleRotatedLuminanceSource.h │ │ ├── oned │ │ │ ├── rss │ │ │ │ ├── expanded │ │ │ │ │ ├── decoders │ │ │ │ │ │ ├── DecodedObject.cpp │ │ │ │ │ │ ├── AnyAIDecoder.cpp │ │ │ │ │ │ ├── DecodedChar.cpp │ │ │ │ │ │ ├── AI013103decoder.cpp │ │ │ │ │ │ ├── AI01320xDecoder.cpp │ │ │ │ │ │ ├── AI013x0xDecoder.cpp │ │ │ │ │ │ ├── BlockParsedResult.cpp │ │ │ │ │ │ ├── AI01AndOtherAIs.cpp │ │ │ │ │ │ ├── AI01weightDecoder.cpp │ │ │ │ │ │ ├── AI01392xDecoder.cpp │ │ │ │ │ │ ├── CurrentParsingState.cpp │ │ │ │ │ │ ├── DecodedInformation.cpp │ │ │ │ │ │ ├── DecodedNumeric.cpp │ │ │ │ │ │ ├── DecodedObject.h │ │ │ │ │ │ ├── AI01decoder.cpp │ │ │ │ │ │ ├── DecodedChar.h │ │ │ │ │ │ ├── AI01320xDecoder.h │ │ │ │ │ │ ├── AI013103decoder.h │ │ │ │ │ │ ├── AI01393xDecoder.cpp │ │ │ │ │ │ ├── AnyAIDecoder.h │ │ │ │ │ │ ├── BlockParsedResult.h │ │ │ │ │ │ ├── FieldParser.h │ │ │ │ │ │ └── AI01393xDecoder.h │ │ │ │ │ ├── BitArrayBuilder.h │ │ │ │ │ ├── ExpandedRow.cpp │ │ │ │ │ └── BitArrayBuilder.cpp │ │ │ │ ├── Pair.cpp │ │ │ │ ├── DataCharacter.cpp │ │ │ │ ├── RSSUtils.h │ │ │ │ ├── Pair.h │ │ │ │ ├── DataCharacter.h │ │ │ │ └── FinderPattern.cpp │ │ │ ├── OneDResultPoint.cpp │ │ │ ├── OneDResultPoint.h │ │ │ ├── UPCEANExtensionSupport.h │ │ │ ├── UPCEANExtension2Support.h │ │ │ ├── UPCEANExtension5Support.h │ │ │ ├── EANManufacturerOrgSupport.h │ │ │ ├── MultiFormatOneDReader.h │ │ │ ├── EAN8Reader.h │ │ │ ├── MultiFormatUPCEANReader.h │ │ │ ├── EAN13Reader.h │ │ │ ├── UPCEReader.h │ │ │ ├── Code128Reader.h │ │ │ ├── UPCEANExtensionSupport.cpp │ │ │ └── UPCAReader.h │ │ ├── WriterException.h │ │ ├── UnsupportedEncodingException.h │ │ ├── datamatrix │ │ │ ├── detector │ │ │ │ ├── DataMatrixDetectorException.cpp │ │ │ │ ├── DetectorException.h │ │ │ │ ├── CornerPoint.h │ │ │ │ └── DataMatrixCornerPoint.cpp │ │ │ ├── DataMatrixReader.h │ │ │ └── decoder │ │ │ │ ├── Decoder.h │ │ │ │ └── DataBlock.h │ │ ├── ResultPointCallback.cpp │ │ ├── qrcode │ │ │ ├── encoder │ │ │ │ ├── ByteMatrix.h │ │ │ │ ├── BlockPair.h │ │ │ │ └── QRCode.h │ │ │ ├── decoder │ │ │ │ ├── Decoder.h │ │ │ │ ├── DataMask.h │ │ │ │ └── DataBlock.h │ │ │ ├── QRCodeReader.h │ │ │ └── detector │ │ │ │ ├── QRFinderPatternInfo.cpp │ │ │ │ ├── FinderPatternInfo.h │ │ │ │ ├── AlignmentPattern.h │ │ │ │ └── FinderPattern.h │ │ ├── Reader.cpp │ │ ├── ReaderException.cpp │ │ ├── WriterException.cpp │ │ ├── NotFoundException.cpp │ │ ├── multi │ │ │ ├── MultipleBarcodeReader.cpp │ │ │ ├── qrcode │ │ │ │ ├── detector │ │ │ │ │ └── MultiDetector.h │ │ │ │ └── QRCodeMultiReader.h │ │ │ ├── ByQuadrantReader.h │ │ │ └── MultipleBarcodeReader.h │ │ ├── IllegalStateException.cpp │ │ ├── ChecksumException.cpp │ │ ├── FormatException.h │ │ ├── ChecksumException.h │ │ ├── NotFoundException.h │ │ ├── ResultIO.cpp │ │ ├── ResultPointCallback.h │ │ ├── UnsupportedEncodingException.cpp │ │ ├── IllegalStateException.h │ │ ├── ReaderException.h │ │ ├── Reader.h │ │ ├── BarcodeFormat.cpp │ │ ├── FormatException.cpp │ │ ├── Binarizer.cpp │ │ ├── Exception.h │ │ ├── aztec │ │ │ ├── AztecReader.h │ │ │ └── AztecDetectorResult.h │ │ ├── Binarizer.h │ │ ├── BarcodeFormat.h │ │ ├── EncodeHint.h │ │ ├── pdf417 │ │ │ └── PDF417Reader.h │ │ └── MultiFormatReader.h │ ├── win32 │ │ ├── CMakeLists.txt │ │ └── zxing │ │ │ └── iconv.h │ └── bigint │ │ ├── BigIntegerLibrary.hh │ │ ├── CMakeLists.txt │ │ ├── BigIntegerAlgorithms.hh │ │ └── BigIntegerUtils.cc ├── README.md ├── QZXing.pri ├── QZXing_global.h ├── QZXingImageProvider.h ├── QZXing.pro └── ImageHandler.h ├── .gitignore ├── ci └── build_env.sh └── .travis.yml /examples/QZXingDragNDropTest/qtc_packaging/debian_fremantle/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /.lgtm.yml: -------------------------------------------------------------------------------- 1 | extraction: 2 | cpp: 3 | configure: 4 | command: "qmake -o Makefile CONFIG+=Release src/QZXing.pro" 5 | -------------------------------------------------------------------------------- /examples/QZXingLive/icons/qzxing_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QZXingLive/icons/qzxing_icon.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tests/resources"] 2 | path = tests/resources 3 | url = https://github.com/ftylitak/qzxing-test-resources 4 | -------------------------------------------------------------------------------- /examples/BarcodeEncoder/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/QZXingLive/icons/qzxing_icon_dpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QZXingLive/icons/qzxing_icon_dpi.png -------------------------------------------------------------------------------- /examples/QZXingLive/icons/qzxing_icon_hdpi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QZXingLive/icons/qzxing_icon_hdpi.png -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/QMLBarcodeReader.sis: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/QMLBarcodeReader.sis -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/toolbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/toolbutton.png -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/toolbutton.sci: -------------------------------------------------------------------------------- 1 | border.left: 15 2 | border.top: 4 3 | border.bottom: 4 4 | border.right: 15 5 | source: toolbutton.png 6 | -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/camera_auto_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/camera_auto_mode.png -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/camera_flash_auto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/camera_flash_auto.png -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/camera_flash_fill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/camera_flash_fill.png -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/camera_flash_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/camera_flash_off.png -------------------------------------------------------------------------------- /examples/QZXingLive/android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QZXingLive/android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /examples/QZXingLive/android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QZXingLive/android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /examples/QZXingLive/android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QZXingLive/android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/QMLBarcodeReader_installer.sis: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/QMLBarcodeReader_installer.sis -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/camera_flash_redeye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/camera_flash_redeye.png -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/camera_camera_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/camera_camera_setting.png -------------------------------------------------------------------------------- /examples/QZXingLive/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QZXingLive/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /examples/QZXingLive/qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | main_qt6_2.qml 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/camera_white_balance_cloudy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/camera_white_balance_cloudy.png -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/camera_white_balance_sunny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/camera_white_balance_sunny.png -------------------------------------------------------------------------------- /tests/src/QZXingTests/qzxing_decode_3_0_alpha_0_2_test_results.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/tests/src/QZXingTests/qzxing_decode_3_0_alpha_0_2_test_results.log -------------------------------------------------------------------------------- /tests/src/QZXingTests/qzxing_decode_3_0_alpha_0_3_test_results.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/tests/src/QZXingTests/qzxing_decode_3_0_alpha_0_3_test_results.log -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/camera_white_balance_flourescent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/camera_white_balance_flourescent.png -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/images/camera_white_balance_incandescent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftylitak/qzxing/HEAD/examples/QMLBarcodeScanner/images/camera_white_balance_incandescent.png -------------------------------------------------------------------------------- /examples/QZXingLive/README.md: -------------------------------------------------------------------------------- 1 | Supported only for Qt 5 projects since Qt Multimedia module has been removed in Qt 6. 2 | 3 | In case it gets re-supported for Qt 6, the examples will be updated. 4 | -------------------------------------------------------------------------------- /examples/QZXingDragNDropTest/qtc_packaging/debian_fremantle/changelog: -------------------------------------------------------------------------------- 1 | qzxingtestapp (0.0.1) unstable; urgency=low 2 | 3 | * Initial Release. 4 | 5 | -- unknown <> Sun, 16 Mar 2014 13:53:58 +0200 6 | -------------------------------------------------------------------------------- /src/QZXing: -------------------------------------------------------------------------------- 1 | #include "QZXing.h" 2 | #ifdef QZXING_QML 3 | #include "QZXingImageProvider.h" 4 | #endif //QZXING_QML 5 | #ifdef QZXING_MULTIMEDIA 6 | #include "QZXingFilter.h" 7 | #endif //QZXING_MULTIMEDIA 8 | -------------------------------------------------------------------------------- /src/zxing/zxing/EncodeHint.cpp: -------------------------------------------------------------------------------- 1 | #include "EncodeHint.h" 2 | 3 | namespace zxing { 4 | 5 | EncodeHint::EncodeHint() : 6 | errorCorrectionLevel_(NULL), characterSet_(""), margin_(0) 7 | {} 8 | 9 | } 10 | -------------------------------------------------------------------------------- /examples/QZXingDragNDropTest/qtc_packaging/debian_fremantle/README: -------------------------------------------------------------------------------- 1 | The Debian Package qzxingtestapp 2 | ---------------------------- 3 | 4 | Comments regarding the Package 5 | 6 | -- unknown <> Sun, 16 Mar 2014 13:53:58 +0200 7 | -------------------------------------------------------------------------------- /examples/QQrDecoder/readme.md: -------------------------------------------------------------------------------- 1 | this project is deprecated thus removed. It is replaced by [QZXingLive](../QZXingLive/) 2 | 3 | NOTE: the folder is preserved since there are links in forum threads that point to this project. Will be removed in future version -------------------------------------------------------------------------------- /examples/QZXingLive/android/src/org/ftylitak/qzxing/NativeFunctions.java: -------------------------------------------------------------------------------- 1 | package org.ftylitak.qzxing; 2 | 3 | public class NativeFunctions { 4 | public static native void onPermissionsGranted(); 5 | public static native void onPermissionsDenied(); 6 | } 7 | -------------------------------------------------------------------------------- /src/zxing/win32/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(SOURCES 2 | 3 | ${WIN32_DIR}/iconv.h 4 | ${WIN32_DIR}/win_iconv.c 5 | ) 6 | 7 | if(MSVC) 8 | LIST(APPEND SOURCES ${WIN32_DIR}/msvc/stdint.h) 9 | endif(MSVC) 10 | 11 | target_sources(qzxing PRIVATE ${SOURCES}) 12 | -------------------------------------------------------------------------------- /examples/QZXingLive/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | moc/ 2 | obj/ 3 | rcc/ 4 | tmp/ 5 | ui/ 6 | .make.cache 7 | *.BAT 8 | *.inf 9 | Makefile 10 | *.mk 11 | *.loc 12 | *.user 13 | *.mmp 14 | *.pkg 15 | QZXing-build-* 16 | build-* 17 | *.Debug 18 | *.Release 19 | debug/ 20 | *.pdb 21 | *.sdf 22 | *.sln 23 | *.suo 24 | *.vcxproj* 25 | .gradle 26 | .idea 27 | .build 28 | .obj 29 | -------------------------------------------------------------------------------- /examples/QZXingLive/deployment.pri: -------------------------------------------------------------------------------- 1 | unix:!android { 2 | isEmpty(target.path) { 3 | qnx { 4 | target.path = /tmp/$${TARGET}/bin 5 | } else { 6 | target.path = /opt/$${TARGET}/bin 7 | } 8 | export(target.path) 9 | } 10 | INSTALLS += target 11 | } 12 | 13 | export(INSTALLS) 14 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/TestCase.cpp: -------------------------------------------------------------------------------- 1 | #include "TestCase.h" 2 | #include /* srand, rand */ 3 | #include /* time */ 4 | 5 | namespace zxing{ 6 | 7 | void TestCase::initializeRandom() 8 | { 9 | srand(time(NULL)); 10 | } 11 | 12 | int TestCase::generateRandomNumber(int range) 13 | { 14 | return rand() % range; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/zxing/zxing/common/Types.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_TYPES_H 3 | #define ZXING_TYPES_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace zxing { 10 | 11 | typedef uint8_t byte; 12 | typedef bool boolean; 13 | 14 | } 15 | 16 | #endif // ZXING_TYPES_H 17 | -------------------------------------------------------------------------------- /src/README.md: -------------------------------------------------------------------------------- 1 | Qt wrapper library for the ZXing decoding library. 2 | 3 | # How to use 4 | 5 | ## To compile as dynamic library 6 | qmake src/QZXing.pro 7 | make 8 | 9 | ## Include the complete code to your project 10 | In the .pro file of your project add the following line (update the path to point to the correct location of QZXing src): 11 | include(../../src/QZXing.pri) 12 | -------------------------------------------------------------------------------- /src/QZXing.pri: -------------------------------------------------------------------------------- 1 | #For backward compatibility, when using QZXing.pri, enable the complete 2 | # library functionality 3 | CONFIG += enable_decoder_1d_barcodes \ 4 | enable_decoder_qr_code \ 5 | enable_decoder_data_matrix \ 6 | enable_decoder_aztec \ 7 | enable_decoder_pdf17 \ 8 | enable_encoder_qr_code 9 | 10 | include(./QZXing-components.pri) 11 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/DecodedObject.cpp: -------------------------------------------------------------------------------- 1 | #include "DecodedObject.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | DecodedObject::DecodedObject(int newPosition) 8 | : m_newPosition(newPosition) 9 | { 10 | 11 | } 12 | 13 | int DecodedObject::getNewPosition() const 14 | { 15 | return m_newPosition; 16 | } 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/BarcodeEncoder/qtquickcontrols2.conf: -------------------------------------------------------------------------------- 1 | ; This file can be edited to change the style of the application 2 | ; See Styling Qt Quick Controls 2 in the documentation for details: 3 | ; http://doc.qt.io/qt-5/qtquickcontrols2-styles.html 4 | 5 | [Controls] 6 | Style=Default 7 | 8 | [Universal] 9 | Theme=Light 10 | ;Accent=Steel 11 | 12 | [Material] 13 | Theme=Light 14 | ;Accent=BlueGrey 15 | ;Primary=BlueGray 16 | -------------------------------------------------------------------------------- /src/zxing/zxing/WriterException.h: -------------------------------------------------------------------------------- 1 | #ifndef WRITEREXCEPTION_H 2 | #define WRITEREXCEPTION_H 3 | 4 | #include 5 | 6 | namespace zxing { 7 | 8 | class WriterException : public Exception { 9 | public: 10 | WriterException() ZXING_NOEXCEPT; 11 | WriterException(char const* msg) ZXING_NOEXCEPT; 12 | ~WriterException() ZXING_NOEXCEPT; 13 | }; 14 | 15 | } 16 | 17 | #endif // WRITEREXCEPTION_H 18 | -------------------------------------------------------------------------------- /src/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 -------------------------------------------------------------------------------- /examples/QZXingLive/native.h: -------------------------------------------------------------------------------- 1 | #ifndef NATIVE_H 2 | #define NATIVE_H 3 | 4 | #include 5 | 6 | class NativeHelpers { 7 | public: 8 | static void registerApplicationInstance(QObject *app_p) { 9 | application_p_ = app_p; 10 | } 11 | 12 | static QObject* getApplicationInstance() { 13 | return application_p_; 14 | } 15 | 16 | private: 17 | static QObject *application_p_; 18 | }; 19 | 20 | #endif // NATIVE_H 21 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AnyAIDecoder.cpp: -------------------------------------------------------------------------------- 1 | #include "AnyAIDecoder.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | AnyAIDecoder::AnyAIDecoder(QSharedPointer information) 8 | : AbstractExpandedDecoder(information) 9 | { 10 | 11 | } 12 | 13 | String AnyAIDecoder::parseInformation() 14 | { 15 | String buf(""); 16 | return getGeneralDecoder().decodeAllCodes(buf, HEADER_SIZE); 17 | } 18 | 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/DecodedChar.cpp: -------------------------------------------------------------------------------- 1 | #include "DecodedChar.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | DecodedChar::DecodedChar(int newPosition, char value) 8 | : DecodedObject (newPosition), m_value(value) 9 | { 10 | 11 | } 12 | 13 | char DecodedChar::getValue() const 14 | { 15 | return m_value; 16 | } 17 | 18 | bool DecodedChar::isFNC1() const 19 | { 20 | return m_value == FNC1; 21 | } 22 | 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/zxing/zxing/UnsupportedEncodingException.h: -------------------------------------------------------------------------------- 1 | #ifndef UNSUPPORTEDENCODINGEXCEPTION_H 2 | #define UNSUPPORTEDENCODINGEXCEPTION_H 3 | 4 | #include 5 | 6 | namespace zxing { 7 | 8 | class UnsupportedEncodingException : public Exception { 9 | public: 10 | UnsupportedEncodingException() ZXING_NOEXCEPT; 11 | UnsupportedEncodingException(char const* msg) ZXING_NOEXCEPT; 12 | ~UnsupportedEncodingException() ZXING_NOEXCEPT; 13 | }; 14 | 15 | } 16 | 17 | #endif // UNSUPPORTEDENCODINGEXCEPTION_H 18 | -------------------------------------------------------------------------------- /examples/BarcodeEncoder/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "QZXing.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 8 | QGuiApplication app(argc, argv); 9 | 10 | QQmlApplicationEngine engine; 11 | 12 | QZXing::registerQMLTypes(); 13 | QZXing::registerQMLImageProvider(engine); 14 | 15 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 16 | 17 | return app.exec(); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/declarative-camera.qmlproject: -------------------------------------------------------------------------------- 1 | /* File generated by QtCreator */ 2 | 3 | import QmlProject 1.0 4 | 5 | Project { 6 | /* Include .qml, .js, and image files from current directory and subdirectories */ 7 | QmlFiles { 8 | directory: "." 9 | } 10 | JavaScriptFiles { 11 | directory: "." 12 | } 13 | ImageFiles { 14 | directory: "." 15 | } 16 | /* List of plugin directories passed to QML runtime */ 17 | // importPaths: [ "../exampleplugin" ] 18 | } 19 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/zxing/qrcode/encoder/QRCodeTests.h: -------------------------------------------------------------------------------- 1 | #ifndef QRCODETESTS_H 2 | #define QRCODETESTS_H 3 | 4 | #include "TestCase.h" 5 | 6 | namespace zxing{ 7 | namespace qrcode{ 8 | namespace tests{ 9 | 10 | class QRCodeTests : public TestCase 11 | { 12 | public: 13 | QRCodeTests(); 14 | 15 | void execute(); 16 | private: 17 | void test(); 18 | void testToString1(); 19 | void testToString2(); 20 | void testIsValidMaskPattern(); 21 | }; 22 | 23 | } 24 | } 25 | } 26 | 27 | #endif // QRCODETESTS_H 28 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI013103decoder.cpp: -------------------------------------------------------------------------------- 1 | #include "AI013103decoder.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | AI013103decoder::AI013103decoder(QSharedPointer information) 8 | : AI013x0xDecoder(information) 9 | { 10 | 11 | } 12 | 13 | void AI013103decoder::addWeightCode(String &buf, int /*weight*/) 14 | { 15 | buf.append("(3103)"); 16 | } 17 | 18 | int AI013103decoder::checkWeight(int weight) 19 | { 20 | return weight; 21 | } 22 | 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/QZXingLive/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | #include "QZXing.h" 9 | #include "application.h" 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); 14 | QGuiApplication app(argc, argv); 15 | 16 | QZXing::registerQMLTypes(); 17 | 18 | Application customApp; 19 | customApp.checkPermissions(); 20 | 21 | return app.exec(); 22 | } 23 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/EncodeValidator.h: -------------------------------------------------------------------------------- 1 | #ifndef ENCODEVALIDATOR_H 2 | #define ENCODEVALIDATOR_H 3 | 4 | #include "QZXing.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace zxing { 14 | namespace tests{ 15 | 16 | class EncodeValidator : public TestCase 17 | { 18 | public: 19 | EncodeValidator(); 20 | void execute() override; 21 | }; 22 | 23 | } 24 | } 25 | 26 | #endif // ENCODEVALIDATOR_H 27 | -------------------------------------------------------------------------------- /examples/QZXingDragNDropTest/qtc_packaging/debian_fremantle/control: -------------------------------------------------------------------------------- 1 | Source: qzxingtestapp 2 | Section: user/hidden 3 | Priority: optional 4 | Maintainer: unknown <> 5 | Build-Depends: debhelper (>= 5), libqt4-dev 6 | Standards-Version: 3.7.3 7 | Homepage: 8 | 9 | Package: qzxingtestapp 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Description: 13 | 14 | XB-Maemo-Display-Name: QZXingTestApp 15 | -------------------------------------------------------------------------------- /examples/QZXingLive/application.h: -------------------------------------------------------------------------------- 1 | #ifndef APPLICATION_H 2 | #define APPLICATION_H 3 | 4 | #include 5 | #include 6 | 7 | class Application : public QObject 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | Application(); 13 | 14 | void checkPermissions(); 15 | 16 | public slots: 17 | void initializeQML(); 18 | 19 | signals: 20 | void onPermissionsGranted(); 21 | void onPermissionsDenied(); 22 | 23 | private: 24 | QQmlApplicationEngine engine; 25 | }; 26 | 27 | #endif // APPLICATION_H 28 | -------------------------------------------------------------------------------- /src/zxing/zxing/datamatrix/detector/DataMatrixDetectorException.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 | -------------------------------------------------------------------------------- /src/zxing/bigint/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(SOURCES 2 | ${BIGINT_DIR}/BigInteger.hh 3 | ${BIGINT_DIR}/BigInteger.cc 4 | ${BIGINT_DIR}/BigIntegerAlgorithms.hh 5 | ${BIGINT_DIR}/BigIntegerAlgorithms.cc 6 | ${BIGINT_DIR}/BigIntegerLibrary.hh 7 | ${BIGINT_DIR}/BigIntegerUtils.hh 8 | ${BIGINT_DIR}/BigIntegerUtils.cc 9 | ${BIGINT_DIR}/BigUnsigned.hh 10 | ${BIGINT_DIR}/BigUnsigned.cc 11 | ${BIGINT_DIR}/BigUnsignedInABase.hh 12 | ${BIGINT_DIR}/BigUnsignedInABase.cc 13 | ${BIGINT_DIR}/NumberlikeArray.hh 14 | ) 15 | 16 | target_sources(qzxing PRIVATE ${SOURCES}) 17 | -------------------------------------------------------------------------------- /src/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() ZXING_NOEXCEPT; 20 | }; 21 | } /* namespace nexxera */ 22 | } /* namespace zxing */ 23 | #endif /* DETECTOREXCEPTION_H_ */ 24 | -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/MessageDialog.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 1.1 2 | import com.nokia.symbian 1.1 3 | 4 | CommonDialog { 5 | id: dialog 6 | titleText: "Decoded message" 7 | //titleIcon: "images/QrButton_toolbar.svg" 8 | buttonTexts: ["OK"] 9 | 10 | property alias text: messageLabel.text 11 | 12 | content: Rectangle { 13 | height: messageLabel.height 14 | width: messageLabel.width 15 | color: "#ff000000" 16 | anchors.horizontalCenter: parent.horizontalCenter 17 | 18 | Text{ 19 | id: messageLabel 20 | color: "white" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI01320xDecoder.cpp: -------------------------------------------------------------------------------- 1 | #include "AI01320xDecoder.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | AI01320xDecoder::AI01320xDecoder(QSharedPointer information) 8 | : AI013x0xDecoder(information) 9 | { 10 | 11 | } 12 | 13 | void AI01320xDecoder::addWeightCode(String &buf, int weight) 14 | { 15 | if (weight < 10000) { 16 | buf.append("(3202)"); 17 | } else { 18 | buf.append("(3203)"); 19 | } 20 | } 21 | 22 | int AI01320xDecoder::checkWeight(int weight) 23 | { 24 | if (weight < 10000) { 25 | return weight; 26 | } 27 | return weight - 10000; 28 | } 29 | 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI013x0xDecoder.cpp: -------------------------------------------------------------------------------- 1 | #include "AI013x0xDecoder.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | AI013x0xDecoder::AI013x0xDecoder(QSharedPointer information) 8 | : AI01weightDecoder(information) 9 | { 10 | 11 | } 12 | 13 | String AI013x0xDecoder::parseInformation() 14 | { 15 | if (getInformation()->getSize() != HEADER_SIZE + GTIN_SIZE + WEIGHT_SIZE) { 16 | throw NotFoundException(); 17 | } 18 | 19 | String buf(""); 20 | 21 | encodeCompressedGtin(buf, HEADER_SIZE); 22 | encodeCompressedWeight(buf, HEADER_SIZE + GTIN_SIZE, WEIGHT_SIZE); 23 | 24 | return buf; 25 | } 26 | 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/zxing/qrcode/encoder/MaskUtilTests.h: -------------------------------------------------------------------------------- 1 | #ifndef MASKUTILTESTS_H 2 | #define MASKUTILTESTS_H 3 | 4 | #include "TestCase.h" 5 | 6 | namespace zxing{ 7 | namespace qrcode{ 8 | namespace tests{ 9 | 10 | class MaskUtilTests : public TestCase 11 | { 12 | public: 13 | MaskUtilTests(); 14 | 15 | void execute(); 16 | 17 | private: 18 | void testApplyMaskPenaltyRule1(); 19 | void testApplyMaskPenaltyRule2(); 20 | void testApplyMaskPenaltyRule3(); 21 | void testApplyMaskPenaltyRule4(); 22 | void testGetDataMaskBit(); 23 | 24 | static bool TestGetDataMaskBitInternal(int maskPattern, int expected[][6]); 25 | }; 26 | 27 | } 28 | } 29 | } 30 | 31 | #endif // MASKUTILTESTS_H 32 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/BlockParsedResult.cpp: -------------------------------------------------------------------------------- 1 | #include "BlockParsedResult.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | BlockParsedResult::BlockParsedResult(bool finished) 8 | : m_decodedInformation(nullptr), m_finished(finished) 9 | { 10 | 11 | } 12 | 13 | BlockParsedResult::BlockParsedResult(const DecodedInformation &information, bool finished) 14 | { 15 | m_finished = finished; 16 | m_decodedInformation = information; 17 | } 18 | 19 | DecodedInformation BlockParsedResult::getDecodedInformation() 20 | { 21 | return m_decodedInformation; 22 | } 23 | 24 | bool BlockParsedResult::isFinished() 25 | { 26 | return m_finished; 27 | } 28 | 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/zxing/zxing/common/reedsolomon/ReedSolomonEncoder.h: -------------------------------------------------------------------------------- 1 | #ifndef REEDSOLOMONENCODER_H 2 | #define REEDSOLOMONENCODER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace zxing { 9 | 10 | class ReedSolomonEncoder 11 | { 12 | private: 13 | QSharedPointer field_; 14 | std::vector< QSharedPointer< GenericGFPoly > >cachedGenerators_; 15 | 16 | QSharedPointer buildGenerator(int degree); 17 | 18 | public: 19 | ReedSolomonEncoder(QSharedPointer field); 20 | 21 | void encode(std::vector &toEncode, int ecBytes); 22 | }; 23 | 24 | } 25 | 26 | #endif // REEDSOLOMONENCODER_H 27 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/zxing/qrcode/encoder/BitVectorTests.h: -------------------------------------------------------------------------------- 1 | #ifndef BITVECTORTESTS_H 2 | #define BITVECTORTESTS_H 3 | 4 | #include "TestCase.h" 5 | #include "zxing/common/BitArray.h" 6 | 7 | namespace zxing{ 8 | namespace qrcode{ 9 | namespace tests{ 10 | 11 | class BitVectorTests : public TestCase 12 | { 13 | public: 14 | BitVectorTests(); 15 | 16 | void execute(); 17 | 18 | private: 19 | static long unsigned int getUnsignedInt(BitArray &v, int index); 20 | 21 | void testAppendBit(); 22 | void testAppendBits(); 23 | void testNumBytes(); 24 | void testAppendBitVector(); 25 | void testXOR(); 26 | void testXOR2(); 27 | void testAt(); 28 | void testToString(); 29 | }; 30 | 31 | } 32 | } 33 | } 34 | 35 | #endif // BITVECTORTESTS_H 36 | -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/QMLBarcodeReader.rss: -------------------------------------------------------------------------------- 1 | // ============================================================================ 2 | // * Generated by qmake (2.01a) (Qt 4.7.4) on: 2012-05-19T19:03:01 3 | // * This file is generated by qmake and should not be modified by the 4 | // * user. 5 | // ============================================================================ 6 | 7 | CHARACTER_SET UTF8 8 | #include 9 | #include "QMLBarcodeReader.loc" 10 | 11 | RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info 12 | { 13 | short_caption = STRING_r_short_caption; 14 | caption_and_icon = 15 | CAPTION_AND_ICON_INFO 16 | { 17 | caption = STRING_r_caption; 18 | number_of_icons = 0; 19 | icon_file = "\\resource\\apps\\QMLBarcodeReader.mif"; 20 | }; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/Pair.cpp: -------------------------------------------------------------------------------- 1 | #include "Pair.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | Pair::Pair(int value, int checksumPortion, FinderPattern finderPattern) 8 | : DataCharacter (value, checksumPortion), m_finderPattern(finderPattern), m_count(0) 9 | { 10 | 11 | } 12 | 13 | Pair::Pair() 14 | : DataCharacter (0, 0), m_finderPattern(FinderPattern()), m_count(0) 15 | { 16 | 17 | } 18 | 19 | FinderPattern& Pair::getFinderPattern() 20 | { 21 | return m_finderPattern; 22 | } 23 | 24 | int Pair::getCount() const 25 | { 26 | return m_count; 27 | } 28 | 29 | void Pair::incrementCount() 30 | { 31 | m_count++; 32 | } 33 | 34 | bool Pair::isValid() const 35 | { 36 | return m_finderPattern.isValid(); 37 | } 38 | 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/QZXingLive/android/res/values/libs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | https://download.qt.io/ministro/android/qt5/qt-5.7 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/zxing/qrcode/encoder/MatrixUtilTests.h: -------------------------------------------------------------------------------- 1 | #ifndef MATRIXUTILTESTS_H 2 | #define MATRIXUTILTESTS_H 3 | 4 | #include "TestCase.h" 5 | 6 | namespace zxing{ 7 | namespace qrcode{ 8 | namespace tests{ 9 | 10 | class MatrixUtilTests : public TestCase 11 | { 12 | public: 13 | MatrixUtilTests(); 14 | 15 | void execute(); 16 | 17 | private: 18 | void testClearMatrix(); 19 | void testEmbedBasicPatterns1(); 20 | void testEmbedBasicPatterns2(); 21 | void testEmbedTypeInfo(); 22 | void testEmbedVersionInfo(); 23 | void testEmbedDataBits(); 24 | void testBuildMatrix(); 25 | void testFindMSBSet(); 26 | void testCalculateBCHCode(); 27 | void testMakeVersionInfoBits(); 28 | void testMakeTypeInfoInfoBits(); 29 | }; 30 | 31 | } 32 | } 33 | } 34 | 35 | #endif // MATRIXUTILTESTS_H 36 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI01AndOtherAIs.cpp: -------------------------------------------------------------------------------- 1 | #include "AI01AndOtherAIs.h" 2 | #include 3 | 4 | namespace zxing { 5 | namespace oned { 6 | namespace rss { 7 | 8 | AI01AndOtherAIs::AI01AndOtherAIs(QSharedPointer information) 9 | : AI01decoder(information) 10 | { 11 | 12 | } 13 | 14 | String AI01AndOtherAIs::parseInformation() 15 | { 16 | String buff("(01)"); 17 | 18 | int initialGtinPosition = buff.length(); 19 | int firstGtinDigit = getGeneralDecoder().extractNumericValueFromBitArray(HEADER_SIZE, 4); 20 | buff.append(common::StringUtils::intToStr(firstGtinDigit)); 21 | 22 | encodeCompressedGtinWithoutAI(buff, HEADER_SIZE + 4, initialGtinPosition); 23 | 24 | return getGeneralDecoder().decodeAllCodes(buff, HEADER_SIZE + 44); 25 | } 26 | 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/QZXing_global.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 QZXing 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 | #ifndef QZXING_GLOBAL_H 18 | #define QZXING_GLOBAL_H 19 | 20 | #include 21 | 22 | #if defined(QZXING_LIBRARY) 23 | # define QZXINGSHARED_EXPORT Q_DECL_EXPORT 24 | #else 25 | # define QZXINGSHARED_EXPORT Q_DECL_IMPORT 26 | #endif 27 | 28 | #endif //QZXING_GLOBAL_H 29 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/QMLBarcodeReader.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE=app 2 | 3 | VERSION = 1.1.0 4 | 5 | QT += declarative network 6 | 7 | !maemo5 { 8 | contains(QT_CONFIG, opengl) { 9 | # QT += opengl 10 | } 11 | } 12 | 13 | win32 { 14 | #required by Qt SDK to resolve Mobility libraries 15 | CONFIG+=mobility 16 | MOBILITY+=multimedia 17 | } 18 | 19 | SOURCES += $$PWD/qmlcamera.cpp 20 | !mac:TARGET = QMLBarcodeReader 21 | else:TARGET = QMLBarcodeReader 22 | 23 | RESOURCES += declarative-camera.qrc 24 | 25 | symbian { 26 | TARGET.CAPABILITY = UserEnvironment NetworkServices Location ReadUserData WriteUserData 27 | TARGET.EPOCHEAPSIZE = 0x20000 0x3000000 28 | 29 | LIBS += -lqzxing 30 | 31 | customrules.pkg_prerules = \ 32 | ";QZXing" \ 33 | "@\"$$(EPOCROOT)Epoc32/InstallToDevice/QZXing_selfsigned.sis\",(0xE618743C)"\ 34 | " " 35 | DEPLOYMENT += customrules 36 | } 37 | 38 | ICON = QMLBarcodeReader.svg 39 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/encoder/ByteMatrix.h: -------------------------------------------------------------------------------- 1 | #ifndef BYTEMATRIX_H 2 | #define BYTEMATRIX_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace zxing { 10 | namespace qrcode { 11 | 12 | class ByteMatrix 13 | { 14 | private: 15 | std::vector< std::vector > bytes_; 16 | size_t width_; 17 | size_t height_; 18 | 19 | public: 20 | 21 | ByteMatrix(size_t width, size_t height); 22 | 23 | size_t getHeight() const; 24 | size_t getWidth() const; 25 | zxing::byte get(size_t x, size_t y) const; 26 | 27 | std::vector > getArray() const; 28 | void set(size_t x, size_t y, const zxing::byte value); 29 | void set(size_t x, size_t y, size_t value); 30 | void set(size_t x, size_t y, bool value); 31 | void clear(const zxing::byte value); 32 | const std::string toString() const; 33 | 34 | }; 35 | 36 | } 37 | } 38 | 39 | #endif //BYTEMATRIX_H 40 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/ValidationStats.h: -------------------------------------------------------------------------------- 1 | #ifndef VALIDATIONSTATS_H 2 | #define VALIDATIONSTATS_H 3 | 4 | #include 5 | #include 6 | 7 | class ValidationStats 8 | { 9 | private: 10 | QString imagePath; 11 | QString expectedOutput; 12 | bool operationSuccess; 13 | bool resultMatch; 14 | QString errorMessage; 15 | int64_t elaspedTime; 16 | 17 | public: 18 | ValidationStats(); 19 | bool getOperationSuccess() const; 20 | bool getResultMatch() const; 21 | QString getErrorMessage() const; 22 | int64_t getElaspedTime() const; 23 | QString getExpectedOutput() const; 24 | QString getImagePath() const; 25 | 26 | void setOperationSuccess(bool value); 27 | void setResultMatch(bool value); 28 | void setErrorMessage(const QString &value); 29 | void setElaspedTime(const int64_t &value); 30 | void setExpectedOutput(const QString &value); 31 | void setImagePath(const QString &value); 32 | }; 33 | 34 | #endif // VALIDATIONSTATS_H 35 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI01weightDecoder.cpp: -------------------------------------------------------------------------------- 1 | #include "AI01weightDecoder.h" 2 | #include 3 | 4 | namespace zxing { 5 | namespace oned { 6 | namespace rss { 7 | 8 | AI01weightDecoder::AI01weightDecoder(QSharedPointer information) 9 | : AI01decoder(information) 10 | { 11 | 12 | } 13 | 14 | void AI01weightDecoder::encodeCompressedWeight(String &buf, int currentPos, int weightSize) 15 | { 16 | int originalWeightNumeric = getGeneralDecoder().extractNumericValueFromBitArray(currentPos, weightSize); 17 | addWeightCode(buf, originalWeightNumeric); 18 | 19 | int weightNumeric = checkWeight(originalWeightNumeric); 20 | 21 | int currentDivisor = 100000; 22 | for (int i = 0; i < 5; ++i) { 23 | if (weightNumeric / currentDivisor == 0) { 24 | buf.append('0'); 25 | } 26 | currentDivisor /= 10; 27 | } 28 | buf.append(common::StringUtils::intToStr(weightNumeric)); 29 | } 30 | 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/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 | QSharedPointer Reader::decode(QSharedPointer image) { 28 | return decode(image, DecodeHints::DEFAULT_HINT); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/QZXingImageProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 QZXing 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 | #ifndef QZXINGIMAGEPROVIDER_H 18 | #define QZXINGIMAGEPROVIDER_H 19 | 20 | #include 21 | #include 22 | 23 | class QZXingImageProvider : public QQuickImageProvider 24 | { 25 | public: 26 | QZXingImageProvider(); 27 | QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize); 28 | }; 29 | 30 | #endif // QZXINGIMAGEPROVIDER_H 31 | -------------------------------------------------------------------------------- /examples/QZXingLive/android/src/org/ftylitak/qzxing/QZXingLiveActivity.java: -------------------------------------------------------------------------------- 1 | package org.ftylitak.qzxing; 2 | 3 | import android.Manifest; 4 | import android.content.pm.PackageManager; 5 | import org.qtproject.qt5.android.bindings.QtActivity; 6 | import static org.ftylitak.qzxing.Utilities.REQUEST_CAMERA; 7 | 8 | public class QZXingLiveActivity extends QtActivity { 9 | @Override 10 | public void onRequestPermissionsResult(int requestCode, 11 | String permissions[], int[] grantResults) { 12 | switch (requestCode) { 13 | case REQUEST_CAMERA: { 14 | // If request is cancelled, the result arrays are empty. 15 | if (grantResults.length > 0 16 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) { 17 | NativeFunctions.onPermissionsGranted(); 18 | } else { 19 | NativeFunctions.onPermissionsDenied(); 20 | } 21 | return; 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/zxing/common/BitArrayTests.h: -------------------------------------------------------------------------------- 1 | #ifndef BITARRAYTESTS_H 2 | #define BITARRAYTESTS_H 3 | 4 | #include "TestCase.h" 5 | #include 6 | #include 7 | #include 8 | 9 | namespace zxing{ 10 | namespace tests{ 11 | 12 | class BitArrayTests : public TestCase 13 | { 14 | public: 15 | BitArrayTests(); 16 | 17 | void execute(); 18 | 19 | private: 20 | 21 | void testGetSet(); 22 | void testGetNextSet1(); 23 | void testGetNextSet2(); 24 | void testGetNextSet3(); 25 | void testGetNextSet4(); 26 | //void testGetNextSet5(); 27 | void testSetBulk(); 28 | void testClear(); 29 | void testGetArray(); 30 | void testIsRange(); 31 | void reverseAlgorithmTest(); 32 | 33 | private: 34 | static std::vector reverseOriginal(std::vector &oldBits, int size); 35 | static bool bitSet(std::vector &bits, int i); 36 | static bool arraysAreEqual(std::vector &left, std::vector &right, int size); 37 | }; 38 | 39 | } 40 | } 41 | 42 | #endif // BITARRAYTESTS_H 43 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/DataCharacter.cpp: -------------------------------------------------------------------------------- 1 | #include "DataCharacter.h" 2 | #include 3 | 4 | namespace zxing { 5 | namespace oned { 6 | namespace rss { 7 | 8 | DataCharacter::DataCharacter(int value, int checksumPortion) 9 | : m_value(value), m_checksumPortion(checksumPortion) 10 | { 11 | 12 | } 13 | 14 | DataCharacter::DataCharacter() 15 | : m_value(0), m_checksumPortion(0) 16 | { 17 | 18 | } 19 | 20 | int DataCharacter::getValue() const 21 | { 22 | return m_value; 23 | } 24 | 25 | int DataCharacter::getChecksumPortion() const 26 | { 27 | return m_checksumPortion; 28 | } 29 | 30 | String DataCharacter::toString() const 31 | { 32 | return String(common::StringUtils::intToStr(m_value) + '(' + common::StringUtils::intToStr(m_checksumPortion) + ')'); 33 | } 34 | 35 | bool DataCharacter::equals(const DataCharacter &other) const 36 | { 37 | return m_value == other.m_value && m_checksumPortion == other.m_checksumPortion; 38 | } 39 | 40 | int DataCharacter::hashCode() const 41 | { 42 | return m_value & m_checksumPortion; 43 | } 44 | 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/zxing/zxing/ReaderException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ReaderException.cpp 3 | * zxing 4 | * 5 | * Created by Alexander Stillich on 05/11/2018. 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 | #include 21 | 22 | zxing::ReaderException::ReaderException() ZXING_NOEXCEPT { 23 | } 24 | 25 | zxing::ReaderException::ReaderException(const char *msg) ZXING_NOEXCEPT 26 | : Exception(msg) { 27 | } 28 | 29 | zxing::ReaderException::~ReaderException() ZXING_NOEXCEPT { 30 | } 31 | -------------------------------------------------------------------------------- /src/zxing/zxing/WriterException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * UnsupportedEncodingException.cpp 3 | * zxing 4 | * 5 | * Created by Alexander Stillich on 05/11/2018. 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 | #include 21 | 22 | zxing::WriterException::WriterException() ZXING_NOEXCEPT { 23 | } 24 | 25 | zxing::WriterException::WriterException(const char *msg) ZXING_NOEXCEPT 26 | : Exception(msg) { 27 | } 28 | 29 | zxing::WriterException::~WriterException() ZXING_NOEXCEPT { 30 | } 31 | -------------------------------------------------------------------------------- /src/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) ZXING_NOEXCEPT : 25 | Exception(msg) { 26 | } 27 | ReedSolomonException::~ReedSolomonException() ZXING_NOEXCEPT { 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /examples/QZXingDragNDropTest/qml/QZXingDragNDropTest/ToggleButton.qml: -------------------------------------------------------------------------------- 1 | // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5 2 | import QtQuick 2.0 3 | 4 | Rectangle { 5 | id: rect 6 | property alias text: label.text 7 | property bool isPressed: false 8 | 9 | width: label.width + 20 10 | height: label.height + 10 11 | border.color: "black" 12 | border.width: 1 13 | radius: 5 14 | 15 | property int decoderHint; 16 | 17 | Text{ 18 | id: label 19 | color: "white" 20 | anchors.centerIn: parent 21 | } 22 | 23 | MouseArea{ 24 | anchors.fill: parent 25 | onClicked: rect.isPressed = !rect.isPressed 26 | } 27 | 28 | states: [ 29 | State{ 30 | name: "pressed" 31 | when: isPressed 32 | PropertyChanges {target: rect; color:"gray"} 33 | }, 34 | State{ 35 | name: "normal" 36 | when: !isPressed 37 | PropertyChanges {target: rect; color:"darkgray"} 38 | } 39 | ] 40 | 41 | onIsPressedChanged: parent.updateDecoderHints(decoderHint) 42 | } 43 | -------------------------------------------------------------------------------- /src/zxing/zxing/NotFoundException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IllegalStateException.cpp 3 | * zxing 4 | * 5 | * Created by Alexander Stillich on 05/11/2018. 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 | #include 21 | 22 | zxing::NotFoundException::NotFoundException() ZXING_NOEXCEPT { 23 | } 24 | 25 | zxing::NotFoundException::NotFoundException(const char *msg) ZXING_NOEXCEPT 26 | : ReaderException(msg) { 27 | } 28 | 29 | zxing::NotFoundException::~NotFoundException() ZXING_NOEXCEPT { 30 | } 31 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/OneDResultPoint.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_ONED_RESULT_POINT_H 2 | #define ZXING_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 // ZXING_ONED_RESULT_POINT_H 36 | 37 | -------------------------------------------------------------------------------- /src/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(QSharedPointer image) { 25 | return decodeMultiple(image, DecodeHints::DEFAULT_HINT); 26 | } 27 | 28 | } // End zxing::multi namespace 29 | } // End zxing namespace 30 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/QZXing.pro: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2011 QZXing 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 | CONFIG += \ 18 | enable_decoder_1d_barcodes \ 19 | enable_decoder_qr_code \ 20 | enable_decoder_data_matrix \ 21 | enable_decoder_aztec \ 22 | enable_decoder_pdf17 \ 23 | enable_encoder_qr_code \ 24 | #staticlib \ 25 | #qzxing_qml \ 26 | #qzxing_multimedia \ 27 | 28 | VERSION = 3.3 29 | 30 | TARGET = QZXing 31 | TEMPLATE = lib 32 | 33 | include(QZXing-components.pri) 34 | 35 | DEFINES -= DISABLE_LIBRARY_FEATURES 36 | -------------------------------------------------------------------------------- /ci/build_env.sh: -------------------------------------------------------------------------------- 1 | #Author: Kang Lin(kl222@126.com) 2 | 3 | SOURCE_DIR="`pwd`" 4 | echo $SOURCE_DIR 5 | TOOLS_DIR=${SOURCE_DIR}/Tools 6 | 7 | cd ${TOOLS_DIR} 8 | 9 | case "${BUILD_TARGERT}" in 10 | unix) 11 | if [ "$DOWNLOAD_QT" = "APT" ]; then 12 | export QT_ROOT=/usr/lib/`uname -m`-linux-gnu/qt5 13 | elif [ "$DOWNLOAD_QT" = "TRUE" ]; then 14 | QT_DIR=${TOOLS_DIR}/Qt/${QT_VERSION} 15 | export QT_ROOT=${QT_DIR}/${QT_VERSION}/gcc_64 16 | else 17 | #source /opt/qt${QT_VERSION_DIR}/bin/qt${QT_VERSION_DIR}-env.sh 18 | export QT_ROOT=/opt/qt${QT_VERSION_DIR} 19 | fi 20 | export PATH=$QT_ROOT/bin:$PATH 21 | export LD_LIBRARY_PATH=$QT_ROOT/lib/i386-linux-gnu:$QT_ROOT/lib:$LD_LIBRARY_PATH 22 | ;; 23 | android) 24 | export ANDROID_NDK_ROOT=`pwd`/android-ndk 25 | export ANDROID_NDK=$ANDROID_NDK_ROOT 26 | 27 | export ANDROID_SDK_ROOT=`pwd`/android-sdk 28 | export ANDROID_SDK=$ANDROID_SDK_ROOT 29 | 30 | QT_DIR=`pwd`/Qt/${QT_VERSION} 31 | export QT_ROOT=${QT_DIR}/${QT_VERSION}/android_armv7 32 | ;; 33 | esac -------------------------------------------------------------------------------- /src/zxing/zxing/oned/UPCEANExtensionSupport.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_UPCEAN_EXTENSION_SUPPORT_H 2 | #define ZXING_UPCEAN_EXTENSION_SUPPORT_H 3 | /* 4 | * Copyright 2008 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 | * 2019-05-08 translation from Java into C++ 19 | */ 20 | #include 21 | 22 | namespace zxing { 23 | 24 | class Result; 25 | class BitArray; 26 | 27 | namespace oned { 28 | 29 | class UPCEANExtensionSupport 30 | { 31 | public: 32 | static QSharedPointer decodeRow(int rowNumber, QSharedPointer row, int rowOffset); 33 | }; 34 | 35 | } 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /examples/QZXingDragNDropTest/droparea.h: -------------------------------------------------------------------------------- 1 | #ifndef DROPAREA_H 2 | #define DROPAREA_H 3 | 4 | #include 5 | //#include 6 | #include 7 | 8 | /** 9 | An oversimplified prototype Item which accepts any drop that includes 10 | data with mime type of text/plain, and just emits the text. 11 | */ 12 | //class DropArea : public QDeclarativeItem 13 | class DropArea : public QQuickItem 14 | { 15 | Q_OBJECT 16 | Q_PROPERTY(bool acceptingDrops READ isAcceptingDrops WRITE setAcceptingDrops NOTIFY acceptingDropsChanged) 17 | 18 | public: 19 | DropArea(QQuickItem *parent=0); 20 | bool isAcceptingDrops() const { return m_accepting; } 21 | void setAcceptingDrops(bool accepting); 22 | 23 | signals: 24 | void fileDroped(QString url); 25 | void acceptingDropsChanged(); 26 | 27 | protected: 28 | void dropEvent(QDropEvent * event); 29 | // void dragEnterEvent(QGraphicsSceneDragDropEvent *event); 30 | // void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); 31 | // void dropEvent(QGraphicsSceneDragDropEvent *event); 32 | 33 | private: 34 | bool m_accepting; 35 | }; 36 | 37 | #endif // DROPAREA_H 38 | -------------------------------------------------------------------------------- /src/zxing/zxing/IllegalStateException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * IllegalStateException.cpp 3 | * zxing 4 | * 5 | * Created by Alexander Stillich on 05/11/2018. 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 | #include 21 | 22 | zxing::IllegalStateException::IllegalStateException() ZXING_NOEXCEPT { 23 | } 24 | 25 | zxing::IllegalStateException::IllegalStateException(const char *msg) ZXING_NOEXCEPT 26 | : ReaderException(msg) { 27 | } 28 | 29 | zxing::IllegalStateException::~IllegalStateException() ZXING_NOEXCEPT { 30 | } 31 | -------------------------------------------------------------------------------- /src/zxing/zxing/common/reedsolomon/ReedSolomonException.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_REED_SOLOMON_EXCEPTION_H 2 | #define ZXING_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) ZXING_NOEXCEPT; 29 | ~ReedSolomonException() ZXING_NOEXCEPT; 30 | }; 31 | } 32 | 33 | #endif // ZXING_REED_SOLOMON_EXCEPTION_H 34 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI01392xDecoder.cpp: -------------------------------------------------------------------------------- 1 | #include "AI01392xDecoder.h" 2 | #include 3 | 4 | namespace zxing { 5 | namespace oned { 6 | namespace rss { 7 | 8 | AI01392xDecoder::AI01392xDecoder(QSharedPointer information) 9 | : AI01decoder(information) 10 | { 11 | 12 | } 13 | 14 | String AI01392xDecoder::parseInformation() 15 | { 16 | if (getInformation()->getSize() < HEADER_SIZE + GTIN_SIZE) { 17 | throw NotFoundException(); 18 | } 19 | 20 | String buf(""); 21 | 22 | encodeCompressedGtin(buf, HEADER_SIZE); 23 | 24 | int lastAIdigit = 25 | getGeneralDecoder().extractNumericValueFromBitArray(HEADER_SIZE + GTIN_SIZE, LAST_DIGIT_SIZE); 26 | buf.append("(392"); 27 | buf.append(common::StringUtils::intToStr(lastAIdigit)); 28 | buf.append(')'); 29 | 30 | String stub(""); 31 | 32 | DecodedInformation decodedInformation = 33 | getGeneralDecoder().decodeGeneralPurposeField(HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE, stub); 34 | buf.append(decodedInformation.getNewString().getText()); 35 | 36 | return buf; 37 | } 38 | 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/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() ZXING_NOEXCEPT {} 28 | -------------------------------------------------------------------------------- /src/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() ZXING_NOEXCEPT {} 27 | ChecksumException::ChecksumException(const char *msg) ZXING_NOEXCEPT : ReaderException(msg) {} 28 | ChecksumException::~ChecksumException() ZXING_NOEXCEPT {} 29 | -------------------------------------------------------------------------------- /src/zxing/zxing/FormatException.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_FORMAT_EXCEPTION_H 2 | #define ZXING_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() ZXING_NOEXCEPT; 32 | 33 | static FormatException const& getFormatInstance(); 34 | }; 35 | 36 | } 37 | #endif // ZXING_FORMAT_EXCEPTION_H 38 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/UPCEANExtension2Support.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_UPCEAN_EXTENSION_2_SUPPORT_H 2 | #define ZXING_UPCEAN_EXTENSION_2_SUPPORT_H 3 | /* 4 | * Copyright 2008 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 | * 2019-05-08 translation from Java into C++ 19 | */ 20 | #include 21 | 22 | namespace zxing { 23 | 24 | class Result; 25 | class BitArray; 26 | 27 | namespace oned { 28 | 29 | class UPCEANExtension2Support 30 | { 31 | public: 32 | static QSharedPointer decodeRow(int rowNumber, QSharedPointer row, int extStartRangeBegin, int extStartRangeEnd); 33 | }; 34 | 35 | } 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/UPCEANExtension5Support.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_UPCEAN_EXTENSION_5_SUPPORT_H 2 | #define ZXING_UPCEAN_EXTENSION_5_SUPPORT_H 3 | /* 4 | * Copyright 2008 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 | * 2019-05-08 translation from Java into C++ 19 | */ 20 | #include 21 | 22 | namespace zxing { 23 | 24 | class Result; 25 | class BitArray; 26 | 27 | namespace oned { 28 | 29 | class UPCEANExtension5Support 30 | { 31 | public: 32 | static QSharedPointer decodeRow(int rowNumber, QSharedPointer row, int extStartRangeBegin, int extStartRangeEnd); 33 | }; 34 | 35 | } 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/zxing/zxing/ChecksumException.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef ZXING_CHECKSUM_EXCEPTION_H 4 | #define ZXING_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 | public: 27 | ChecksumException() ZXING_NOEXCEPT; 28 | ChecksumException(const char *msg) ZXING_NOEXCEPT; 29 | ~ChecksumException() ZXING_NOEXCEPT; 30 | }; 31 | } 32 | 33 | #endif // ZXING_CHECKSUM_EXCEPTION_H 34 | -------------------------------------------------------------------------------- /src/zxing/zxing/NotFoundException.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef ZXING_NOT_FOUND_EXCEPTION_H 4 | #define ZXING_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() ZXING_NOEXCEPT; 29 | NotFoundException(const char *msg) ZXING_NOEXCEPT; 30 | ~NotFoundException() ZXING_NOEXCEPT; 31 | }; 32 | 33 | } 34 | 35 | #endif // ZXING_NOT_FOUND_EXCEPTION_H 36 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/EANManufacturerOrgSupport.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_EAN_MANUFACTURER_ORG_SUPPORT_H 2 | #define ZXING_EAN_MANUFACTURER_ORG_SUPPORT_H 3 | /* 4 | * Copyright 2008 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 | * 2019-05-08 translation from Java into C++ 19 | */ 20 | 21 | #include 22 | 23 | #include 24 | #include 25 | 26 | namespace zxing { 27 | 28 | class String; 29 | 30 | namespace oned { 31 | 32 | class EANManufacturerOrgSupport 33 | { 34 | public: 35 | static QSharedPointer lookupCountryIdentifier(QSharedPointer &productCode); 36 | }; 37 | 38 | } 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/RSSUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef RSS_UTILS_H 2 | #define RSS_UTILS_H 3 | 4 | /* 5 | * Copyright 2009 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | #include 23 | 24 | namespace zxing { 25 | 26 | namespace oned { 27 | 28 | namespace rss { 29 | 30 | /** Adapted from listings in ISO/IEC 24724 Appendix B and Appendix G. */ 31 | class RSSUtils 32 | { 33 | 34 | public: 35 | static int getRSSvalue(std::vector widths, int maxWidth, bool noNarrow); 36 | 37 | static int combins(int n, int r); 38 | }; 39 | 40 | } 41 | } 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/zxing/zxing/ResultPointCallback.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_RESULT_POINT_CALLBACK_H 2 | #define ZXING_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 { 30 | protected: 31 | ResultPointCallback() {} 32 | public: 33 | virtual void foundPossibleResultPoint(ResultPoint const& point) = 0; 34 | virtual ~ResultPointCallback(); 35 | }; 36 | 37 | } 38 | 39 | #endif // ZXING_RESULT_POINT_CALLBACK_H 40 | -------------------------------------------------------------------------------- /src/zxing/zxing/common/IllegalArgumentException.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_ILLEGAL_ARGUMENT_EXCEPTION_H 2 | #define ZXING_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() ZXING_NOEXCEPT; 32 | }; 33 | 34 | } 35 | 36 | #endif // ZXING_ILLEGAL_ARGUMENT_EXCEPTION_H 37 | -------------------------------------------------------------------------------- /src/zxing/zxing/UnsupportedEncodingException.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * UnsupportedEncodingException.cpp 3 | * zxing 4 | * 5 | * Created by Alexander Stillich on 05/11/2018. 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 | #include 21 | 22 | zxing::UnsupportedEncodingException::UnsupportedEncodingException() ZXING_NOEXCEPT { 23 | } 24 | 25 | zxing::UnsupportedEncodingException::UnsupportedEncodingException(const char *msg) ZXING_NOEXCEPT 26 | : Exception(msg) { 27 | } 28 | 29 | zxing::UnsupportedEncodingException::~UnsupportedEncodingException() ZXING_NOEXCEPT { 30 | } 31 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/encoder/BlockPair.h: -------------------------------------------------------------------------------- 1 | #ifndef BLOCKPAIR_H 2 | #define BLOCKPAIR_H 3 | 4 | #include 5 | #include 6 | 7 | using namespace std; 8 | 9 | namespace zxing { 10 | namespace qrcode { 11 | 12 | class BlockPair 13 | { 14 | private: 15 | QSharedPointer> data_; 16 | QSharedPointer> errorCorrection_; 17 | 18 | public: 19 | BlockPair(QSharedPointer> data, QSharedPointer> errorCorrection) : 20 | data_(data), errorCorrection_(errorCorrection) {} 21 | 22 | BlockPair(const BlockPair& other) : data_(other.data_), errorCorrection_(other.errorCorrection_) {} 23 | 24 | QSharedPointer> getDataBytes() { return data_; } 25 | 26 | QSharedPointer> getErrorCorrectionBytes() { return errorCorrection_; } 27 | 28 | BlockPair& operator=(const BlockPair &other) { 29 | data_->clear(); 30 | errorCorrection_->clear(); 31 | 32 | data_ = other.data_; 33 | errorCorrection_ = other.errorCorrection_; 34 | 35 | return *this; 36 | } 37 | }; 38 | 39 | } 40 | } 41 | 42 | #endif //BLOCKPAIR_H 43 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/QZXingTests.pro: -------------------------------------------------------------------------------- 1 | TARGET = QZXingTests 2 | CONFIG += console 3 | CONFIG -= app_bundle 4 | 5 | QT += concurrent 6 | 7 | TEMPLATE = app 8 | 9 | HEADERS += \ 10 | DecodeValidator.h \ 11 | ValidationStats.h \ 12 | EncodeValidator.h \ 13 | TestCase.h \ 14 | zxing/qrcode/encoder/MatrixUtilTests.h \ 15 | zxing/qrcode/encoder/MaskUtilTests.h \ 16 | zxing/qrcode/encoder/QRCodeTests.h \ 17 | zxing/qrcode/encoder/EncoderTests.h \ 18 | zxing/common/reedsolomon/ReedSolomonEncoderTests.h \ 19 | zxing/common/BitArrayTests.h \ 20 | zxing/qrcode/encoder/BitVectorTests.h \ 21 | EncoderStressTest.h 22 | #\backward.hpp 23 | 24 | SOURCES += main.cpp \ 25 | DecodeValidator.cpp \ 26 | ValidationStats.cpp \ 27 | EncodeValidator.cpp \ 28 | TestCase.cpp \ 29 | zxing/qrcode/encoder/MatrixUtilTests.cpp \ 30 | zxing/qrcode/encoder/MaskUtilTests.cpp \ 31 | zxing/qrcode/encoder/QRCodeTests.cpp \ 32 | zxing/qrcode/encoder/EncoderTests.cpp \ 33 | zxing/common/reedsolomon/ReedSolomonEncoderTests.cpp \ 34 | zxing/common/BitArrayTests.cpp \ 35 | zxing/qrcode/encoder/BitVectorTests.cpp \ 36 | EncoderStressTest.cpp 37 | 38 | include(../../../src/QZXing.pri) 39 | -------------------------------------------------------------------------------- /src/zxing/zxing/IllegalStateException.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef ZXING_ILLEGAL_STATE_EXCEPTION_H 4 | #define ZXING_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() ZXING_NOEXCEPT; 29 | IllegalStateException(const char *msg) ZXING_NOEXCEPT; 30 | ~IllegalStateException() ZXING_NOEXCEPT; 31 | }; 32 | 33 | } 34 | 35 | #endif // ZXING_ILLEGAL_STATE_EXCEPTION_H 36 | -------------------------------------------------------------------------------- /src/zxing/zxing/ReaderException.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_READER_EXCEPTION_H 3 | #define ZXING_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() ZXING_NOEXCEPT; 31 | ReaderException(char const* msg) ZXING_NOEXCEPT; 32 | ~ReaderException() ZXING_NOEXCEPT; 33 | }; 34 | 35 | } 36 | 37 | #endif // ZXING_READER_EXCEPTION_H 38 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/CurrentParsingState.cpp: -------------------------------------------------------------------------------- 1 | #include "CurrentParsingState.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | CurrentParsingState::CurrentParsingState() 8 | { 9 | position = 0; 10 | encoding = State::NUMERIC; 11 | } 12 | 13 | int CurrentParsingState::getPosition() const 14 | { 15 | return position; 16 | } 17 | 18 | void CurrentParsingState::setPosition(int _position) 19 | { 20 | position = _position; 21 | } 22 | 23 | void CurrentParsingState::incrementPosition(int delta) 24 | { 25 | position += delta; 26 | } 27 | 28 | bool CurrentParsingState::isAlpha() const 29 | { 30 | return encoding == State::ALPHA; 31 | } 32 | 33 | bool CurrentParsingState::isNumeric() const 34 | { 35 | return encoding == State::NUMERIC; 36 | } 37 | 38 | bool CurrentParsingState::isIsoIec646() const 39 | { 40 | return encoding == State::ISO_IEC_646; 41 | } 42 | 43 | void CurrentParsingState::setNumeric() 44 | { 45 | encoding = State::NUMERIC; 46 | } 47 | 48 | void CurrentParsingState::setAlpha() 49 | { 50 | encoding = State::ALPHA; 51 | } 52 | 53 | void CurrentParsingState::setIsoIec646() 54 | { 55 | encoding = State::ISO_IEC_646; 56 | } 57 | 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/zxing/zxing/common/Point.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_POINT_H 2 | #define ZXING_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 // ZXING_POINT_H 48 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/zxing/qrcode/encoder/EncoderTests.h: -------------------------------------------------------------------------------- 1 | #ifndef ENCODERTESTS_H 2 | #define ENCODERTESTS_H 3 | 4 | #include "TestCase.h" 5 | #include 6 | 7 | namespace zxing{ 8 | namespace qrcode{ 9 | namespace tests{ 10 | 11 | class EncoderTests; 12 | class EncoderHack : public Encoder { 13 | friend class zxing::qrcode::tests::EncoderTests; 14 | }; 15 | 16 | class EncoderTests : public TestCase 17 | { 18 | 19 | public: 20 | EncoderTests(); 21 | 22 | void execute(); 23 | 24 | private: 25 | void testGetAlphanumericCode(); 26 | void testChooseMode(); 27 | void testEncode(); 28 | //void testSimpleUTF8ECI(); 29 | void testAppendModeInfo(); 30 | void testAppendLengthInfo(); 31 | void testAppendBytes(); 32 | void testTerminateBits(); 33 | void testGetNumDataBytesAndNumECBytesForBlockID(); 34 | void testInterleaveWithECBytes(); 35 | void testAppendNumericBytes(); 36 | void testAppendAlphanumericBytes(); 37 | void testAppend8BitBytes(); 38 | //void testAppendKanjiBytes(); not yet supported 39 | void testGenerateECBytes(); 40 | 41 | static std::string shiftJISString(byte bytes[]); 42 | }; 43 | 44 | } 45 | } 46 | } 47 | 48 | #endif // ENCODERTESTS_H 49 | -------------------------------------------------------------------------------- /src/zxing/zxing/Reader.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_READER_H 2 | #define ZXING_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 { 30 | protected: 31 | Reader() {} 32 | public: 33 | virtual QSharedPointer decode(QSharedPointer image); 34 | virtual QSharedPointer decode(QSharedPointer image, DecodeHints hints) = 0; 35 | virtual ~Reader(); 36 | }; 37 | 38 | } 39 | 40 | #endif // ZXING_READER_H 41 | -------------------------------------------------------------------------------- /src/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 | "ASSUME_GS1" 41 | }; 42 | -------------------------------------------------------------------------------- /examples/QMLBarcodeScanner/declarative-camera.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | declarative-camera.qml 4 | CameraButton.qml 5 | CameraPropertyPopup.qml 6 | CameraPropertyButton.qml 7 | CaptureControls.qml 8 | ExposureCompensationButton.qml 9 | FlickableList.qml 10 | FocusButton.qml 11 | PhotoPreview.qml 12 | ZoomControl.qml 13 | images/camera_auto_mode.png 14 | images/camera_camera_setting.png 15 | images/camera_flash_auto.png 16 | images/camera_flash_fill.png 17 | images/camera_flash_off.png 18 | images/camera_flash_redeye.png 19 | images/camera_white_balance_cloudy.png 20 | images/camera_white_balance_flourescent.png 21 | images/camera_white_balance_incandescent.png 22 | images/camera_white_balance_sunny.png 23 | images/toolbutton.png 24 | images/toolbutton.sci 25 | MessageDialog.qml 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/zxing/zxing/multi/qrcode/detector/MultiDetector.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_MULTI_DETECTOR_H 2 | #define ZXING_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(QSharedPointer image); 30 | virtual ~MultiDetector(); 31 | virtual std::vector > detectMulti(DecodeHints hints); 32 | }; 33 | 34 | } 35 | } 36 | 37 | #endif // ZXING_MULTI_DETECTOR_H 38 | -------------------------------------------------------------------------------- /src/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 // ZXING_COMMON_DETECTOR_MATH_H 44 | 45 | -------------------------------------------------------------------------------- /examples/BarcodeEncoder/BarcodeEncoder.pro: -------------------------------------------------------------------------------- 1 | QT += qml quick 2 | 3 | CONFIG += qzxing_qml 4 | 5 | SOURCES += main.cpp 6 | 7 | RESOURCES += qml.qrc 8 | 9 | # Additional import path used to resolve QML modules in Qt Creator's code model 10 | QML_IMPORT_PATH = 11 | 12 | # Additional import path used to resolve QML modules just for Qt Quick Designer 13 | QML_DESIGNER_IMPORT_PATH = 14 | 15 | # The following define makes your compiler emit warnings if you use 16 | # any feature of Qt which as been marked deprecated (the exact warnings 17 | # depend on your compiler). Please consult the documentation of the 18 | # deprecated API in order to know how to port your code away from it. 19 | DEFINES += QT_DEPRECATED_WARNINGS 20 | 21 | # You can also make your code fail to compile if you use deprecated APIs. 22 | # In order to do so, uncomment the following line. 23 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 24 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 25 | 26 | # Default rules for deployment. 27 | qnx: target.path = /tmp/$${TARGET}/bin 28 | else: unix:!android: target.path = /opt/$${TARGET}/bin 29 | !isEmpty(target.path): INSTALLS += target 30 | 31 | CONFIG += enable_encoder_qr_code 32 | 33 | include(../../src/QZXing-components.pri) 34 | -------------------------------------------------------------------------------- /examples/QZXingDragNDropTest/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) 3 | #include 4 | #include "qmlapplicationviewer.h" 5 | #include 6 | #include 7 | #include 8 | #else 9 | #include 10 | #include "qtquick2applicationviewer.h" 11 | #endif 12 | #include "droparea.h" 13 | 14 | #include "QZXing.h" 15 | 16 | Q_DECL_EXPORT int main(int argc, char *argv[]) 17 | { 18 | #if (QT_VERSION < QT_VERSION_CHECK(5,0,0)) 19 | QScopedPointer app(createApplication(argc, argv)); 20 | 21 | QZXing::registerQMLTypes(); 22 | 23 | QmlApplicationViewer viewer; 24 | viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); 25 | qmlRegisterType("DropArea", 1, 0, "DropArea"); 26 | viewer.setMainQmlFile(QLatin1String("qml/QZXingDragNDropTest/main_QtQuick1.qml")); 27 | #else 28 | QGuiApplication* app = new QGuiApplication(argc, argv); 29 | 30 | QZXing::registerQMLTypes(); 31 | 32 | QtQuick2ApplicationViewer viewer; 33 | qmlRegisterType("DropArea", 1, 0, "DropArea"); 34 | viewer.setMainQmlFile(QStringLiteral("qml/QZXingDragNDropTest/main_QtQuick2.qml")); 35 | #endif 36 | viewer.showExpanded(); 37 | 38 | return app->exec(); 39 | } 40 | -------------------------------------------------------------------------------- /src/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() ZXING_NOEXCEPT { 33 | } 34 | 35 | FormatException const& 36 | FormatException::getFormatInstance() { 37 | static FormatException instance; 38 | return instance; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/zxing/zxing/multi/qrcode/QRCodeMultiReader.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_QRCODE_MULTI_READER_H 2 | #define ZXING_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(QSharedPointer image, DecodeHints hints); 31 | }; 32 | 33 | } 34 | } 35 | 36 | #endif // ZXING_QRCODE_MULTI_READER_H 37 | -------------------------------------------------------------------------------- /src/zxing/zxing/datamatrix/detector/CornerPoint.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_CORNER_FINDER_H 2 | #define ZXING_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(QSharedPointer other) const; 39 | }; 40 | } 41 | } 42 | 43 | #endif // ZXING_CORNER_FINDER_H 44 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/MultiFormatOneDReader.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_MULTI_FORMAT_ONED_READER_H 2 | #define ZXING_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 | QSharedPointer decodeRow(int rowNumber, QSharedPointer row, DecodeHints hints); 34 | }; 35 | } 36 | } 37 | 38 | #endif // ZXING_MULTI_FORMAT_ONED_READER_H 39 | 40 | -------------------------------------------------------------------------------- /examples/QZXingDragNDropTest/qtquick2applicationviewer/qtquick2applicationviewer.h: -------------------------------------------------------------------------------- 1 | // checksum 0xfde6 version 0x90005 2 | /* 3 | This file was generated by the Qt Quick 2 Application wizard of Qt Creator. 4 | QtQuick2ApplicationViewer is a convenience class containing mobile device specific 5 | code such as screen orientation handling. Also QML paths and debugging are 6 | handled here. 7 | It is recommended not to modify this file, since newer versions of Qt Creator 8 | may offer an updated version of it. 9 | */ 10 | 11 | #ifndef QTQUICK2APPLICATIONVIEWER_H 12 | #define QTQUICK2APPLICATIONVIEWER_H 13 | 14 | #include 15 | #include 16 | 17 | #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) 18 | #include 19 | #endif 20 | 21 | class QtQuick2ApplicationViewer 22 | #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) 23 | : public QQuickView 24 | #endif 25 | { 26 | Q_OBJECT 27 | #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) 28 | public: 29 | explicit QtQuick2ApplicationViewer(QWindow *parent = 0); 30 | virtual ~QtQuick2ApplicationViewer(); 31 | 32 | void setMainQmlFile(const QString &file); 33 | void addImportPath(const QString &path); 34 | 35 | void showExpanded(); 36 | 37 | private: 38 | class QtQuick2ApplicationViewerPrivate *d; 39 | #endif 40 | }; 41 | 42 | #endif // QTQUICK2APPLICATIONVIEWER_H 43 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/zxing/common/reedsolomon/ReedSolomonEncoderTests.h: -------------------------------------------------------------------------------- 1 | #ifndef REEDSOLOMONENCODERTESTS_H 2 | #define REEDSOLOMONENCODERTESTS_H 3 | 4 | #include "TestCase.h" 5 | #include 6 | 7 | namespace zxing{ 8 | namespace tests{ 9 | 10 | class ReedSolomonTests : public TestCase 11 | { 12 | private: 13 | static const int DECODER_RANDOM_TEST_ITERATIONS; 14 | static const int DECODER_TEST_ITERATIONS; 15 | 16 | public: 17 | ReedSolomonTests(); 18 | 19 | void execute(); 20 | 21 | protected: 22 | void testQRCode(); 23 | 24 | private: 25 | void corrupt(std::vector &received, int howMany, int max); 26 | void testEncodeDecodeRandom(QSharedPointer field, int dataSize, int ecSize); 27 | void testEncodeDecode(QSharedPointer field, 28 | const std::vector &dataWords, 29 | const std::vector & ecWords); 30 | void testEncoder(QSharedPointer field, 31 | const std::vector &dataWords, 32 | const std::vector & ecWords); 33 | void testDecoder(QSharedPointer field, 34 | const std::vector &dataWords, 35 | const std::vector & ecWords); 36 | }; 37 | 38 | } 39 | } 40 | 41 | #endif // REEDSOLOMONENCODERTESTS_H 42 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/Pair.h: -------------------------------------------------------------------------------- 1 | #ifndef RSS_PAIR_H 2 | #define RSS_PAIR_H 3 | 4 | /* 5 | * Copyright 2009 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | #include "DataCharacter.h" 23 | #include "FinderPattern.h" 24 | 25 | namespace zxing { 26 | 27 | namespace oned { 28 | 29 | namespace rss { 30 | 31 | class Pair : public DataCharacter 32 | { 33 | 34 | public: 35 | Pair(int value, int checksumPortion, FinderPattern finderPattern); 36 | Pair(); 37 | 38 | FinderPattern &getFinderPattern(); 39 | 40 | int getCount() const; 41 | 42 | void incrementCount(); 43 | 44 | bool isValid() const; 45 | 46 | private: 47 | FinderPattern m_finderPattern; 48 | int m_count; 49 | 50 | }; 51 | 52 | } 53 | } 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/decoder/Decoder.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_DECODER_H 2 | #define ZXING_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 | 28 | namespace zxing { 29 | namespace qrcode { 30 | 31 | class Decoder { 32 | private: 33 | ReedSolomonDecoder rsDecoder_; 34 | 35 | void correctErrors(QSharedPointer> bytes, int numDataCodewords); 36 | 37 | public: 38 | Decoder(); 39 | QSharedPointer decode(QSharedPointer bits); 40 | }; 41 | 42 | } 43 | } 44 | 45 | #endif // ZXING_DECODER_H 46 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "DecodeValidator.h" 6 | #include "EncoderStressTest.h" 7 | 8 | int main(int argc, char **argv) 9 | { 10 | QCoreApplication application(argc, argv); 11 | QCoreApplication::setApplicationName("QZXingTests"); 12 | 13 | QCommandLineParser parser; 14 | parser.setApplicationDescription("Executes unit tests for QZXing library"); 15 | parser.addHelpOption(); 16 | parser.addVersionOption(); 17 | 18 | QCommandLineOption encoderStressTestOption(QStringList() << "encoder-stress", 19 | QCoreApplication::translate("main", "Execute stress test for Qr Code encoding and decoding")); 20 | 21 | parser.addOption(encoderStressTestOption); 22 | 23 | parser.process(application); 24 | 25 | bool isEncoderStressTestEnabled = parser.isSet(encoderStressTestOption); 26 | 27 | if(isEncoderStressTestEnabled) 28 | { 29 | zxing::tests::EncoderStressTest encoderStressTest; 30 | encoderStressTest.execute(); 31 | } 32 | else 33 | { 34 | DecodeValidator decodeValidator; 35 | decodeValidator.executeTests("../../resources/resources/"); 36 | 37 | zxing::tests::EncodeValidator encodeValidator; 38 | encodeValidator.execute(); 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/encoder/QRCode.h: -------------------------------------------------------------------------------- 1 | #ifndef QRCODE_H 2 | #define QRCODE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "ByteMatrix.h" 8 | #include 9 | #include 10 | 11 | namespace zxing { 12 | namespace qrcode { 13 | 14 | class QRCode 15 | { 16 | private: 17 | 18 | Mode mode_; 19 | QSharedPointer ecLevel_ptr_; 20 | QSharedPointer version_ptr_; 21 | int maskPattern_; 22 | QSharedPointer matrix_ptr_; 23 | 24 | public: 25 | static const int NUM_MASK_PATTERNS = 8; 26 | 27 | QRCode(); 28 | ~QRCode(); 29 | Mode getMode() const; 30 | QSharedPointer getECLevel() const; 31 | QSharedPointer getVersion() const; 32 | int getMaskPattern() const; 33 | QSharedPointer getMatrix() const; 34 | std::string toString() const; 35 | void setMode(const Mode &value); 36 | void setECLevel(QSharedPointer value); 37 | void setVersion(QSharedPointer version); 38 | void setMaskPattern(int value); 39 | void setMatrix(QSharedPointer value); 40 | 41 | static bool isValidMaskPattern(int maskPattern) 42 | { 43 | return maskPattern >= 0 && maskPattern < NUM_MASK_PATTERNS; 44 | } 45 | 46 | }; 47 | 48 | } 49 | } 50 | 51 | #endif //QRCODE_H 52 | -------------------------------------------------------------------------------- /src/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(QSharedPointer bits, 27 | QSharedPointer> > points) 28 | : bits_(bits), points_(points) { 29 | } 30 | 31 | QSharedPointer DetectorResult::getBits() { 32 | return bits_; 33 | } 34 | 35 | QSharedPointer> > DetectorResult::getPoints() { 36 | return points_; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/zxing/zxing/datamatrix/DataMatrixReader.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_DATA_MATRIX_READER_H 2 | #define ZXING_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 QSharedPointer decode(QSharedPointer image, DecodeHints hints); 38 | virtual ~DataMatrixReader(); 39 | 40 | }; 41 | 42 | } 43 | } 44 | 45 | #endif // ZXING_DATA_MATRIX_READER_H 46 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/EncodeValidator.cpp: -------------------------------------------------------------------------------- 1 | #include "EncodeValidator.h" 2 | #include 3 | #include 4 | #include 5 | #include "TestCase.h" 6 | #include "zxing/qrcode/encoder/MatrixUtilTests.h" 7 | #include "zxing/qrcode/encoder/MaskUtilTests.h" 8 | #include "zxing/qrcode/encoder/BitVectorTests.h" 9 | #include "zxing/qrcode/encoder/QRCodeTests.h" 10 | #include "zxing/qrcode/encoder/EncoderTests.h" 11 | #include "zxing/common/reedsolomon/ReedSolomonEncoderTests.h" 12 | #include "zxing/common/BitArrayTests.h" 13 | 14 | namespace zxing { 15 | namespace tests{ 16 | 17 | EncodeValidator::EncodeValidator() : TestCase() 18 | { 19 | 20 | } 21 | 22 | void EncodeValidator::execute() 23 | { 24 | try{ 25 | qrcode::tests::MatrixUtilTests t; 26 | t.execute(); 27 | 28 | qrcode::tests::MaskUtilTests t1; 29 | t1.execute(); 30 | 31 | qrcode::tests::BitVectorTests t2; 32 | t2.execute(); 33 | 34 | qrcode::tests::QRCodeTests t3; 35 | t3.execute(); 36 | 37 | ReedSolomonTests t4; 38 | t4.execute(); 39 | 40 | BitArrayTests t6; 41 | t6.execute(); 42 | 43 | qrcode::tests::EncoderTests t5; 44 | t5.execute(); 45 | 46 | } catch(zxing::Exception &e) { 47 | qDebug() << "Exception: " << e.what(); 48 | } 49 | } 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/zxing/zxing/multi/ByQuadrantReader.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_BY_QUADRANT_READER_H 2 | #define ZXING_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 QSharedPointer decode(QSharedPointer image); 36 | virtual QSharedPointer decode(QSharedPointer image, DecodeHints hints); 37 | }; 38 | 39 | } 40 | } 41 | 42 | #endif // ZXING_BY_QUADRANT_READER_H 43 | -------------------------------------------------------------------------------- /src/zxing/zxing/datamatrix/detector/DataMatrixCornerPoint.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(QSharedPointer other) const { 42 | return posX_ == other->getX() && posY_ == other->getY(); 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/decoder/DataMask.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_DATA_MASK_H 2 | #define ZXING_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 | 26 | #include 27 | 28 | namespace zxing { 29 | namespace qrcode { 30 | 31 | class DataMask { 32 | private: 33 | static std::vector > DATA_MASKS; 34 | 35 | protected: 36 | 37 | public: 38 | static int buildDataMasks(); 39 | DataMask(); 40 | virtual ~DataMask(); 41 | void unmaskBitMatrix(BitMatrix& matrix, size_t dimension); 42 | virtual bool isMasked(size_t x, size_t y) = 0; 43 | static DataMask& forReference(int reference); 44 | }; 45 | 46 | } 47 | } 48 | 49 | #endif // ZXING_DATA_MASK_H 50 | -------------------------------------------------------------------------------- /src/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(QSharedPointer source) : source_(source) { 28 | } 29 | 30 | Binarizer::~Binarizer() { 31 | } 32 | 33 | QSharedPointer 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 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/DecodedInformation.cpp: -------------------------------------------------------------------------------- 1 | #include "DecodedInformation.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | DecodedInformation::DecodedInformation(const DecodedInformation *other) 8 | : DecodedObject (other == nullptr ? 0 : other->m_newPosition), 9 | m_newString(other == nullptr ? String("") : other->m_newString) 10 | { 11 | m_newString = other == nullptr ? String("") : other->m_newString; 12 | m_remaining = other == nullptr ? false : other->m_remaining; 13 | m_remainingValue = other == nullptr ? 0 : other->m_remainingValue; 14 | } 15 | 16 | DecodedInformation::DecodedInformation(int newPosition, String newString) 17 | : DecodedObject (newPosition), 18 | m_newString(newString), 19 | m_remainingValue(0), 20 | m_remaining(false) 21 | { 22 | 23 | } 24 | 25 | DecodedInformation::DecodedInformation(int newPosition, String newString, int remainingValue) 26 | : DecodedObject (newPosition), 27 | m_newString(newString), 28 | m_remainingValue(remainingValue), 29 | m_remaining(true) 30 | { 31 | 32 | } 33 | 34 | String DecodedInformation::getNewString() const 35 | { 36 | return m_newString; 37 | } 38 | 39 | bool DecodedInformation::isRemaining() const 40 | { 41 | return m_remaining; 42 | } 43 | 44 | int DecodedInformation::getRemainingValue() const 45 | { 46 | return m_remainingValue; 47 | } 48 | 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/zxing/zxing/common/ByteArray.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_BYTE_ARRAY_H 2 | #define ZXING_BYTE_ARRAY_H 3 | /* 4 | * Copyright 2008 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 | * 2019-05-08 translation from Java into C++ 19 | */ 20 | 21 | #include 22 | #include 23 | #include "Types.h" 24 | 25 | namespace zxing { 26 | 27 | /** 28 | * ByteArray is an extension of std::vector. 29 | */ 30 | class ByteArray : public std::vector 31 | { 32 | public: 33 | ByteArray() {} 34 | ByteArray(std::initializer_list list) : std::vector(list) {} 35 | explicit ByteArray(int len) : std::vector(len, 0) {} 36 | int length() const { return static_cast(size()); } 37 | const zxing::byte* bytePtr() const { return data(); } 38 | zxing::byte* bytePtr() { return data(); } 39 | }; 40 | 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/zxing/zxing/common/DetectorResult.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_DETECTOR_RESULT_H 2 | #define ZXING_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 | 27 | namespace zxing { 28 | 29 | class DetectorResult { 30 | private: 31 | QSharedPointer bits_; 32 | QSharedPointer> > points_; 33 | 34 | public: 35 | DetectorResult(QSharedPointer bits, QSharedPointer> > points); 36 | QSharedPointer getBits(); 37 | QSharedPointer> > getPoints(); 38 | }; 39 | 40 | } 41 | 42 | #endif // ZXING_DETECTOR_RESULT_H 43 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/EAN8Reader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_EAN_8_READER_H 3 | #define ZXING_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(QSharedPointer row, 38 | Range const& startRange, 39 | std::string& resultString); 40 | 41 | BarcodeFormat getBarcodeFormat(); 42 | }; 43 | 44 | } 45 | } 46 | 47 | #endif // ZXING_EAN_8_READER_H 48 | 49 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/MultiFormatUPCEANReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_MULTI_FORMAT_UPC_EAN_READER_H 3 | #define ZXING_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< QSharedPointer > readers; 33 | public: 34 | MultiFormatUPCEANReader(DecodeHints hints); 35 | QSharedPointer decodeRow(int rowNumber, QSharedPointer row, DecodeHints hints); 36 | }; 37 | 38 | } 39 | } 40 | 41 | #endif // ZXING_MULTI_FORMAT_UPC_EAN_READER_H 42 | 43 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/QRCodeReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_QR_CODE_READER_H 3 | #define ZXING_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 | QSharedPointer decode(QSharedPointer image, DecodeHints hints); 43 | }; 44 | 45 | } 46 | } 47 | 48 | #endif // ZXING_QR_CODE_READER_H 49 | -------------------------------------------------------------------------------- /src/zxing/zxing/datamatrix/decoder/Decoder.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_DECODER_DM_H 2 | #define ZXING_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 | 29 | 30 | namespace zxing { 31 | namespace datamatrix { 32 | 33 | class Decoder { 34 | private: 35 | ReedSolomonDecoder rsDecoder_; 36 | 37 | void correctErrors(QSharedPointer> bytes, int numDataCodewords); 38 | 39 | public: 40 | Decoder(); 41 | 42 | QSharedPointer decode(QSharedPointer bits); 43 | }; 44 | 45 | } 46 | } 47 | 48 | #endif // ZXING_DECODER_DM_H 49 | -------------------------------------------------------------------------------- /src/zxing/zxing/multi/MultipleBarcodeReader.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_MULTIPLE_BARCODE_READER_H 2 | #define ZXING_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 { 30 | protected: 31 | MultipleBarcodeReader() {} 32 | public: 33 | virtual std::vector > decodeMultiple(QSharedPointer image); 34 | virtual std::vector > decodeMultiple(QSharedPointer image, DecodeHints hints) = 0; 35 | virtual ~MultipleBarcodeReader(); 36 | }; 37 | 38 | } 39 | } 40 | 41 | #endif // ZXING_MULTIPLE_BARCODE_READER_H 42 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/DecodedNumeric.cpp: -------------------------------------------------------------------------------- 1 | #include "DecodedNumeric.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | DecodedNumeric::DecodedNumeric(int newPosition, int firstDigit, int secondDigit) 8 | : DecodedObject(newPosition) 9 | { 10 | 11 | if (firstDigit < 0 || firstDigit > 10 || secondDigit < 0 || secondDigit > 10) { 12 | throw FormatException::getFormatInstance(); 13 | } 14 | 15 | m_newPosition = newPosition; 16 | m_firstDigit = firstDigit; 17 | m_secondDigit = secondDigit; 18 | } 19 | 20 | DecodedNumeric::DecodedNumeric(const QSharedPointer other) 21 | : DecodedObject (other.isNull() ? 0 : other->m_newPosition) 22 | { 23 | m_newPosition = other.isNull() ? 0 : other->m_newPosition; 24 | m_firstDigit = other.isNull() ? 0 : other->m_firstDigit; 25 | m_secondDigit = other.isNull() ? 0 : other->m_secondDigit; 26 | } 27 | 28 | int DecodedNumeric::getFirstDigit() const 29 | { 30 | return m_firstDigit; 31 | } 32 | 33 | int DecodedNumeric::getSecondDigit() const 34 | { 35 | return m_secondDigit; 36 | } 37 | 38 | int DecodedNumeric::getValue() const 39 | { 40 | return m_firstDigit * 10 + m_secondDigit; 41 | } 42 | 43 | bool DecodedNumeric::isFirstDigitFNC1() const 44 | { 45 | return m_firstDigit == FNC1; 46 | } 47 | 48 | bool DecodedNumeric::isSecondDigitFNC1() const 49 | { 50 | return m_secondDigit == FNC1; 51 | } 52 | 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/zxing/zxing/Exception.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_EXCEPTION_H 3 | #define ZXING_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 | 26 | #include 27 | #include 28 | 29 | namespace zxing { 30 | 31 | class Exception : public std::exception { 32 | private: 33 | char const* const message; 34 | 35 | public: 36 | Exception() ZXING_NOEXCEPT; 37 | Exception(const char* msg) ZXING_NOEXCEPT; 38 | Exception(Exception const& that) ZXING_NOEXCEPT; 39 | ~Exception() ZXING_NOEXCEPT; 40 | char const* what() const ZXING_NOEXCEPT; 41 | 42 | private: 43 | static char const* copy(char const*); 44 | void deleteMessage(); 45 | }; 46 | 47 | } 48 | 49 | #endif // ZXING_EXCEPTION_H 50 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/detector/QRFinderPatternInfo.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 | QSharedPointer FinderPatternInfo::getBottomLeft() { 31 | return bottomLeft_; 32 | } 33 | QSharedPointer FinderPatternInfo::getTopLeft() { 34 | return topLeft_; 35 | } 36 | QSharedPointer FinderPatternInfo::getTopRight() { 37 | return topRight_; 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/QZXingDragNDropTest/qmlapplicationviewer/qmlapplicationviewer.h: -------------------------------------------------------------------------------- 1 | // checksum 0xc67a version 0x80016 2 | /* 3 | This file was generated by the Qt Quick Application wizard of Qt Creator. 4 | QmlApplicationViewer is a convenience class containing mobile device specific 5 | code such as screen orientation handling. Also QML paths and debugging are 6 | handled here. 7 | It is recommended not to modify this file, since newer versions of Qt Creator 8 | may offer an updated version of it. 9 | */ 10 | 11 | #ifndef QMLAPPLICATIONVIEWER_H 12 | #define QMLAPPLICATIONVIEWER_H 13 | 14 | #include 15 | 16 | class QmlApplicationViewer : public QDeclarativeView 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | enum ScreenOrientation { 22 | ScreenOrientationLockPortrait, 23 | ScreenOrientationLockLandscape, 24 | ScreenOrientationAuto 25 | }; 26 | 27 | explicit QmlApplicationViewer(QWidget *parent = 0); 28 | virtual ~QmlApplicationViewer(); 29 | 30 | static QmlApplicationViewer *create(); 31 | 32 | void setMainQmlFile(const QString &file); 33 | void addImportPath(const QString &path); 34 | 35 | // Note that this will only have an effect on Fremantle. 36 | void setOrientation(ScreenOrientation orientation); 37 | 38 | void showExpanded(); 39 | 40 | private: 41 | class QmlApplicationViewerPrivate *d; 42 | }; 43 | 44 | QApplication *createApplication(int &argc, char **argv); 45 | 46 | #endif // QMLAPPLICATIONVIEWER_H 47 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/DecodedObject.h: -------------------------------------------------------------------------------- 1 | #ifndef DECODED_OBJECT_H 2 | #define DECODED_OBJECT_H 3 | 4 | /* 5 | * Copyright (C) 2010 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | /* 23 | * These authors would like to acknowledge the Spanish Ministry of Industry, 24 | * Tourism and Trade, for the support in the project TSI020301-2008-2 25 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 26 | * Mobile Dynamic Environments", led by Treelogic 27 | * ( http://www.treelogic.com/ ): 28 | * 29 | * http://www.piramidepse.com/ 30 | */ 31 | namespace zxing { 32 | 33 | namespace oned { 34 | 35 | namespace rss { 36 | 37 | class DecodedObject 38 | { 39 | 40 | public: 41 | DecodedObject(int newPosition); 42 | 43 | int getNewPosition() const; 44 | 45 | protected: 46 | int m_newPosition; 47 | }; 48 | 49 | } 50 | } 51 | } 52 | #endif 53 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | #Author: KangLin(kl222@126.com) 2 | 3 | #sudo: required 4 | dist: bionic 5 | 6 | services: 7 | - xvfb 8 | 9 | language: cpp 10 | 11 | cache: 12 | - apt 13 | - directories: 14 | - Package 15 | 16 | compiler: 17 | - g++ 18 | 19 | jdk: oraclejdk7 20 | 21 | addons: 22 | ssh_known_hosts: 23 | - github.com 24 | 25 | env: 26 | jobs: 27 | - BUILD_TARGERT="unix" DOWNLOAD_QT=APT 28 | - BUILD_TARGERT="unix" QT_VERSION_DIR=512 QT_VERSION=5.12.6 DOWNLOAD_QT=FALSE 29 | - BUILD_TARGERT="unix" QT_VERSION_DIR=511 QT_VERSION=5.11.3 DOWNLOAD_QT=FALSE 30 | 31 | before_install: 32 | - echo "TRAVIS_OS_NAME=${TRAVIS_OS_NAME}" 33 | - export DISPLAY=:99.0 34 | - sudo apt-get install -y libgl1-mesa-glx libgl1-mesa-dev 35 | - cmake --version 36 | 37 | install: 38 | - bash ${TRAVIS_BUILD_DIR}/ci/build-install-tools.sh #> /dev/null 39 | 40 | before_script: 41 | - source ${TRAVIS_BUILD_DIR}/ci/build_env.sh 42 | 43 | script: 44 | # Test qmake 45 | - mkdir ${TRAVIS_BUILD_DIR}/build_qamke 46 | - cd ${TRAVIS_BUILD_DIR}/build_qamke 47 | - ${QT_ROOT}/bin/qmake CONFIG+=Release PRFIEX=`pwd`/install ${TRAVIS_BUILD_DIR}/src 48 | - make install 49 | 50 | # Test cmake (deactivated for now) 51 | # - mkdir ${TRAVIS_BUILD_DIR}/build_camke 52 | # - cd ${TRAVIS_BUILD_DIR}/build_camke 53 | # - cmake -DQt5_DIR=${QT_ROOT}/lib/cmake/Qt5 -DCMAKE_INSTALL_PREFIX=`pwd`/install ${TRAVIS_BUILD_DIR}/src 54 | # - cmake --build . --config Release 55 | # - cmake --build . --config Release --target install 56 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/DataCharacter.h: -------------------------------------------------------------------------------- 1 | #ifndef DATA_CHARACTER_H 2 | #define DATA_CHARACTER_H 3 | 4 | /* 5 | * Copyright 2009 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | #include 23 | 24 | namespace zxing { 25 | 26 | namespace oned { 27 | 28 | namespace rss { 29 | 30 | /** 31 | * Encapsulates a since character value in an RSS barcode, including its checksum information. 32 | */ 33 | class DataCharacter 34 | { 35 | 36 | public: 37 | DataCharacter(int value, int checksumPortion); 38 | 39 | DataCharacter(); 40 | 41 | int getValue() const; 42 | 43 | int getChecksumPortion() const; 44 | 45 | String toString() const; 46 | 47 | bool equals(const DataCharacter& other) const; 48 | 49 | int hashCode() const; 50 | 51 | private: 52 | int m_value; 53 | int m_checksumPortion; 54 | 55 | }; 56 | 57 | } 58 | } 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/detector/FinderPatternInfo.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_FINDER_PATTERN_INFO_H 2 | #define ZXING_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 | 27 | namespace zxing { 28 | namespace qrcode { 29 | 30 | class FinderPatternInfo { 31 | private: 32 | QSharedPointer bottomLeft_; 33 | QSharedPointer topLeft_; 34 | QSharedPointer topRight_; 35 | 36 | public: 37 | FinderPatternInfo(std::vector > patternCenters); 38 | 39 | QSharedPointer getBottomLeft(); 40 | QSharedPointer getTopLeft(); 41 | QSharedPointer getTopRight(); 42 | }; 43 | } 44 | } 45 | 46 | #endif // ZXING_FINDER_PATTERN_INFO_H 47 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/detector/AlignmentPattern.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef ZXING_ALIGNMENT_PATTERN_H 4 | #define ZXING_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 | QSharedPointer combineEstimate(float i, float j, 39 | float newModuleSize) const; 40 | }; 41 | 42 | } 43 | } 44 | 45 | #endif // ZXING_ALIGNMENT_PATTERN_H 46 | -------------------------------------------------------------------------------- /examples/QZXingLive/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIconFile 6 | 7 | CFBundlePackageType 8 | APPL 9 | CFBundleGetInfoString 10 | Created by Qt/QMake 11 | CFBundleSignature 12 | ???? 13 | CFBundleExecutable 14 | QZXingLive 15 | CFBundleIdentifier 16 | com.ftylitak.${PRODUCT_NAME:rfc1034identifier} 17 | CFBundleDisplayName 18 | ${PRODUCT_NAME} 19 | CFBundleName 20 | ${PRODUCT_NAME} 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationPortraitUpsideDown 33 | UIInterfaceOrientationLandscapeLeft 34 | UIInterfaceOrientationLandscapeRight 35 | 36 | NOTE 37 | This file was generated by Qt/QMake. 38 | NSCameraUsageDescription 39 | Scan barcodes 40 | 41 | 42 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/ValidationStats.cpp: -------------------------------------------------------------------------------- 1 | #include "ValidationStats.h" 2 | 3 | bool ValidationStats::getOperationSuccess() const 4 | { 5 | return operationSuccess; 6 | } 7 | 8 | void ValidationStats::setOperationSuccess(bool value) 9 | { 10 | operationSuccess = value; 11 | } 12 | 13 | bool ValidationStats::getResultMatch() const 14 | { 15 | return resultMatch; 16 | } 17 | 18 | void ValidationStats::setResultMatch(bool value) 19 | { 20 | resultMatch = value; 21 | } 22 | 23 | QString ValidationStats::getErrorMessage() const 24 | { 25 | return errorMessage; 26 | } 27 | 28 | void ValidationStats::setErrorMessage(const QString &value) 29 | { 30 | errorMessage = value; 31 | } 32 | 33 | int64_t ValidationStats::getElaspedTime() const 34 | { 35 | return elaspedTime; 36 | } 37 | 38 | void ValidationStats::setElaspedTime(const int64_t &value) 39 | { 40 | elaspedTime = value; 41 | } 42 | 43 | QString ValidationStats::getExpectedOutput() const 44 | { 45 | return expectedOutput; 46 | } 47 | 48 | void ValidationStats::setExpectedOutput(const QString &value) 49 | { 50 | expectedOutput = value; 51 | } 52 | 53 | QString ValidationStats::getImagePath() const 54 | { 55 | return imagePath; 56 | } 57 | 58 | void ValidationStats::setImagePath(const QString &value) 59 | { 60 | imagePath = value; 61 | } 62 | 63 | ValidationStats::ValidationStats(): 64 | imagePath(""), 65 | expectedOutput(""), 66 | operationSuccess(false), 67 | resultMatch(false), 68 | errorMessage(""), 69 | elaspedTime(0) 70 | { 71 | 72 | } 73 | 74 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/EAN13Reader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_EAN_13_READER_H 3 | #define ZXING_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(QSharedPointer row, 40 | Range const& startRange, 41 | std::string& resultString); 42 | 43 | BarcodeFormat getBarcodeFormat(); 44 | }; 45 | 46 | } 47 | } 48 | 49 | #endif // ZXING_EAN_13_READER_H 50 | 51 | -------------------------------------------------------------------------------- /examples/QZXingDragNDropTest/qtc_packaging/debian_fremantle/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by unknown <> on 2 | Sun, 16 Mar 2014 13:53:58 +0200. 3 | 4 | It was downloaded from 5 | 6 | Upstream Author(s): 7 | 8 | 9 | 10 | 11 | Copyright: 12 | 13 | 14 | 15 | 16 | License: 17 | 18 | This package is free software; you can redistribute it and/or modify 19 | it under the terms of the GNU General Public License as published by 20 | the Free Software Foundation; either version 2 of the License, or 21 | (at your option) any later version. 22 | 23 | This package is distributed in the hope that it will be useful, 24 | but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | GNU General Public License for more details. 27 | 28 | You should have received a copy of the GNU General Public License 29 | along with this package; if not, write to the Free Software 30 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 31 | 32 | On Debian systems, the complete text of the GNU General 33 | Public License can be found in `/usr/share/common-licenses/GPL'. 34 | 35 | The Debian packaging is (C) 2014, unknown <> and 36 | is licensed under the GPL, see above. 37 | 38 | 39 | # Please also look if there are files or directories which have a 40 | # different copyright/license attached and list them here. 41 | -------------------------------------------------------------------------------- /src/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 QSharedPointer decode(QSharedPointer image); 42 | virtual QSharedPointer decode(QSharedPointer image, DecodeHints hints); 43 | virtual ~AztecReader(); 44 | }; 45 | 46 | } 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/BitArrayBuilder.h: -------------------------------------------------------------------------------- 1 | #ifndef BIT_ARRAY_BUILDER_H 2 | #define BIT_ARRAY_BUILDER_H 3 | 4 | /* 5 | * Copyright (C) 2010 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | /* 23 | * These authors would like to acknowledge the Spanish Ministry of Industry, 24 | * Tourism and Trade, for the support in the project TSI020301-2008-2 25 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 26 | * Mobile Dynamic Environments", led by Treelogic 27 | * ( http://www.treelogic.com/ ): 28 | * 29 | * http://www.piramidepse.com/ 30 | */ 31 | 32 | #include 33 | #include "ExpandedPair.h" 34 | 35 | #include 36 | 37 | namespace zxing { 38 | 39 | namespace oned { 40 | 41 | namespace rss { 42 | 43 | class BitArrayBuilder 44 | { 45 | 46 | public: 47 | static QSharedPointer buildBitArray(std::vector pairs); 48 | }; 49 | 50 | } 51 | } 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/zxing/zxing/datamatrix/decoder/DataBlock.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_DATA_BLOCK_DM_H 2 | #define ZXING_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 | 28 | namespace zxing { 29 | namespace datamatrix { 30 | 31 | class DataBlock { 32 | private: 33 | int numDataCodewords_; 34 | QSharedPointer> codewords_; 35 | 36 | DataBlock(int numDataCodewords, QSharedPointer> codewords); 37 | 38 | public: 39 | static std::vector > getDataBlocks(QSharedPointer> rawCodewords, QSharedPointerversion); 40 | 41 | int getNumDataCodewords(); 42 | QSharedPointer> getCodewords(); 43 | }; 44 | 45 | } 46 | } 47 | 48 | #endif // ZXING_DATA_BLOCK_DM_H 49 | -------------------------------------------------------------------------------- /examples/QZXingDragNDropTest/droparea.cpp: -------------------------------------------------------------------------------- 1 | #include "droparea.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | DropArea::DropArea(QQuickItem *parent) : QQuickItem(parent), 8 | m_accepting(true) 9 | { 10 | setAcceptingDrops(m_accepting); 11 | } 12 | 13 | //void DropArea::dragEnterEvent(QGraphicsSceneDragDropEvent *event) 14 | //{ 15 | // event->acceptProposedAction(); 16 | // setCursor(Qt::DragMoveCursor); 17 | //} 18 | 19 | //void DropArea::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) 20 | //{ 21 | // unsetCursor(); 22 | //} 23 | 24 | //void DropArea::dropEvent(QGraphicsSceneDragDropEvent *event) 25 | //{ 26 | // qDebug("File!"); 27 | // QList list = event->mimeData()->urls(); 28 | // for(int i=0; i list = event->mimeData()->urls(); 52 | for(int i=0; i 7 | #include 8 | #include 9 | #include 10 | 11 | class DecodeValidator 12 | { 13 | private: 14 | QZXing decoder; 15 | std::map decoderCorrelationMap; 16 | std::map>> testResults; 17 | 18 | void initializeDecoderCorrelation(); 19 | 20 | QString getDataFromTextFile(const QString &filePath); 21 | 22 | std::shared_ptr testDecodeWithExpectedOutput(QZXing::DecoderFormat enabledDecoder, 23 | const QImage &imageToDecode, 24 | const QString &expectedOutput); 25 | 26 | QZXing::DecoderFormat getDecoderForFolder(const QString &folderName); 27 | 28 | void printResults(); 29 | 30 | public: 31 | DecodeValidator(); 32 | 33 | std::shared_ptr testDecodeWithExpectedOutput(QZXing::DecoderFormat enabledDecoder, 34 | const QString &imageToDecodePath, 35 | const QString &expectedOutputFilePath); 36 | 37 | void decodeAllImagesInForderWithValidator(QZXing::DecoderFormat enabledDecode, 38 | const QString &folderPath); 39 | 40 | void executeTests(const QString &folderPath); 41 | }; 42 | 43 | #endif // DECODEVALIDATOR_H 44 | -------------------------------------------------------------------------------- /src/ImageHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 QZXing 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 | #ifndef IMAGEHANDLER_H 18 | #define IMAGEHANDLER_H 19 | 20 | #include 21 | #include 22 | #if QT_VERSION >= 0x050000 23 | #include 24 | #include 25 | #endif 26 | 27 | class ImageHandler : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit ImageHandler(QObject *parent = 0); 32 | 33 | QImage extractQImage(QObject *imageObj, 34 | int offsetX = 0, int offsetY = 0, 35 | int width = 0, int height = 0); 36 | 37 | public slots: 38 | void save(QObject *imageObj, const QString &path, 39 | const int offsetX = 0, const int offsetY = 0, 40 | const int width = 0, const int height = 0); 41 | private: 42 | #if QT_VERSION >= 0x050000 43 | void imageGrabberReady(); 44 | QSet pendingGrabbers; 45 | QReadWriteLock pendingGrabbersLocker; 46 | #endif 47 | }; 48 | 49 | #endif // IMAGEHANDLER_H 50 | -------------------------------------------------------------------------------- /src/zxing/zxing/common/Str.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_STR_H 3 | #define ZXING_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 { 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 | QSharedPointer substring(int, int = -1) 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 // ZXING_STR_H 52 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/decoder/DataBlock.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_DATA_BLOCK_H 2 | #define ZXING_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 | 28 | namespace zxing { 29 | namespace qrcode { 30 | 31 | class DataBlock { 32 | private: 33 | int numDataCodewords_; 34 | QSharedPointer> codewords_; 35 | 36 | DataBlock(int numDataCodewords, QSharedPointer> codewords); 37 | 38 | public: 39 | static std::vector > 40 | getDataBlocks(QSharedPointer> rawCodewords, QSharedPointerversion, ErrorCorrectionLevel &ecLevel); 41 | 42 | int getNumDataCodewords(); 43 | QSharedPointer> getCodewords(); 44 | }; 45 | 46 | } 47 | } 48 | 49 | #endif // ZXING_DATA_BLOCK_H 50 | -------------------------------------------------------------------------------- /src/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 { 31 | private: 32 | QSharedPointer source_; 33 | 34 | public: 35 | Binarizer(QSharedPointer source); 36 | virtual ~Binarizer(); 37 | 38 | virtual QSharedPointer getBlackRow(int y, QSharedPointer row) = 0; 39 | virtual QSharedPointer getBlackMatrix() = 0; 40 | 41 | QSharedPointer getLuminanceSource() const ; 42 | virtual QSharedPointer createBinarizer(QSharedPointer source) = 0; 43 | 44 | int getWidth() const; 45 | int getHeight() const; 46 | 47 | }; 48 | 49 | } 50 | #endif /* BINARIZER_H_ */ 51 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/FinderPattern.cpp: -------------------------------------------------------------------------------- 1 | #include "FinderPattern.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | FinderPattern::FinderPattern(int value, std::vector startEnd, int start, int end, int rowNumber) 8 | : m_value(value), 9 | m_startEnd(startEnd) 10 | { 11 | QSharedPointer>> resultPoints(new std::vector>(2)); 12 | (*resultPoints)[0].reset(new OneDResultPoint(start, rowNumber)); 13 | (*resultPoints)[1].reset(new OneDResultPoint(end, rowNumber)); 14 | m_resultPoints = resultPoints; 15 | } 16 | 17 | FinderPattern::FinderPattern(const FinderPattern *other) 18 | { 19 | m_value = other != nullptr ? other->m_value : 0; 20 | m_startEnd = other != nullptr ? other->m_startEnd : std::vector (); 21 | m_resultPoints = other != nullptr ? other->m_resultPoints : QSharedPointer>>(); 22 | } 23 | 24 | int FinderPattern::getValue() const 25 | { 26 | return m_value; 27 | } 28 | 29 | std::vector& FinderPattern::getStartEnd() 30 | { 31 | return m_startEnd; 32 | } 33 | 34 | QSharedPointer> >& FinderPattern::getResultPoints() 35 | { 36 | return m_resultPoints; 37 | } 38 | 39 | bool FinderPattern::equals(const FinderPattern &other) const 40 | { 41 | return m_value == other.m_value; 42 | } 43 | 44 | int FinderPattern::hashCode() const 45 | { 46 | return m_value; 47 | } 48 | 49 | bool FinderPattern::isValid() const 50 | { 51 | return m_startEnd.size() != 0; 52 | } 53 | 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/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(QSharedPointer bits, 36 | QSharedPointer> > 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 | -------------------------------------------------------------------------------- /examples/QZXingLive/android/src/org/ftylitak/qzxing/Utilities.java: -------------------------------------------------------------------------------- 1 | package org.ftylitak.qzxing; 2 | 3 | import android.Manifest; 4 | import android.app.Activity; 5 | import android.content.pm.PackageManager; 6 | import android.support.v4.app.ActivityCompat; 7 | import android.support.v4.content.ContextCompat; 8 | 9 | import java.util.ArrayList; 10 | 11 | public class Utilities { 12 | 13 | public static final int REQUEST_CAMERA = 0; 14 | 15 | public static final String[] requiredPermissionsModifyPhoneState = { 16 | Manifest.permission.CAMERA, 17 | Manifest.permission.READ_EXTERNAL_STORAGE, 18 | Manifest.permission.WRITE_EXTERNAL_STORAGE 19 | }; 20 | 21 | public static void checkAndRequestPermissionList(Activity activity, String[] permissions) { 22 | ArrayList permissionsToRequest = new ArrayList<>(); 23 | for (int i = 0; i < permissions.length; i++) { 24 | if (ContextCompat.checkSelfPermission(activity, permissions[i]) 25 | != PackageManager.PERMISSION_GRANTED) 26 | permissionsToRequest.add(permissions[i]); 27 | } 28 | 29 | if (permissionsToRequest.size() != 0) 30 | ActivityCompat.requestPermissions(activity, 31 | permissionsToRequest.toArray(new String[0]), 32 | REQUEST_CAMERA); 33 | else 34 | NativeFunctions.onPermissionsGranted(); 35 | } 36 | 37 | public static void requestQZXingPermissions(Activity activity) { 38 | checkAndRequestPermissionList(activity, requiredPermissionsModifyPhoneState); 39 | } 40 | 41 | 42 | } -------------------------------------------------------------------------------- /src/zxing/zxing/BarcodeFormat.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_BARCODE_FORMAT_H 3 | #define ZXING_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 | ASSUME_GS1 50 | }; 51 | 52 | BarcodeFormat(Value v) : value(v) {} 53 | const Value value; 54 | operator Value () const {return value;} 55 | 56 | static char const* barcodeFormatNames[]; 57 | }; 58 | 59 | } 60 | 61 | #endif // ZXING_BARCODE_FORMAT_H 62 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/ExpandedRow.cpp: -------------------------------------------------------------------------------- 1 | #include "ExpandedRow.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | ExpandedRow::ExpandedRow(std::vector pairs, int rowNumber, bool wasReversed) 8 | : m_pairs(pairs), 9 | m_rowNumber(rowNumber), 10 | m_wasReversed(wasReversed) 11 | { 12 | 13 | } 14 | 15 | ExpandedRow::ExpandedRow(const ExpandedRow *other) 16 | { 17 | m_pairs = other != nullptr ? other->m_pairs : std::vector(); 18 | m_rowNumber = other != nullptr ? other->m_rowNumber : 0; 19 | m_wasReversed = other != nullptr ? other->m_wasReversed : false; 20 | } 21 | 22 | std::vector &ExpandedRow::getPairs() 23 | { 24 | return m_pairs; 25 | } 26 | 27 | int ExpandedRow::getRowNumber() 28 | { 29 | return m_rowNumber; 30 | } 31 | 32 | bool ExpandedRow::isEquivalent(std::vector otherPairs) const 33 | { 34 | if (m_pairs.size() != otherPairs.size()) { 35 | return false; 36 | } 37 | 38 | for (size_t i = 0; i < m_pairs.size(); i++) { 39 | if (!m_pairs[i].equals(otherPairs[i])) { 40 | return false; 41 | } 42 | } 43 | 44 | return true; 45 | } 46 | 47 | String ExpandedRow::toString() 48 | { 49 | String result("{ "); 50 | for (const ExpandedPair &i : m_pairs) { 51 | result.append(i.toString().getText()); 52 | } 53 | result.append(" }"); 54 | return result; 55 | } 56 | 57 | bool ExpandedRow::equals(const ExpandedRow &other) const 58 | { 59 | return isEquivalent(other.m_pairs) && m_wasReversed == other.m_wasReversed; 60 | } 61 | 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/BitArrayBuilder.cpp: -------------------------------------------------------------------------------- 1 | #include "BitArrayBuilder.h" 2 | 3 | namespace zxing { 4 | namespace oned { 5 | namespace rss { 6 | 7 | QSharedPointer BitArrayBuilder::buildBitArray(std::vector pairs) 8 | { 9 | int charNumber = static_cast(pairs.size() * 2) - 1; 10 | if (pairs[pairs.size() - 1].getRightChar().getValue() == 0) { 11 | charNumber -= 1; 12 | } 13 | 14 | int size = 12 * charNumber; 15 | 16 | QSharedPointer binary(new BitArray(int(size))); 17 | int accPos = 0; 18 | 19 | ExpandedPair firstPair = pairs[0]; 20 | int firstValue = firstPair.getRightChar().getValue(); 21 | for (int i = 11; i >= 0; --i) { 22 | if ((firstValue & (1 << i)) != 0) { 23 | binary->set(accPos); 24 | } 25 | accPos++; 26 | } 27 | 28 | for (size_t i = 1; i < pairs.size(); ++i) { 29 | ExpandedPair currentPair = pairs[i]; 30 | 31 | int leftValue = currentPair.getLeftChar().getValue(); 32 | for (int j = 11; j >= 0; --j) { 33 | if ((leftValue & (1 << j)) != 0) { 34 | binary->set(accPos); 35 | } 36 | accPos++; 37 | } 38 | 39 | if (currentPair.getRightChar().getValue() != 0) { 40 | int rightValue = currentPair.getRightChar().getValue(); 41 | for (int j = 11; j >= 0; --j) { 42 | if ((rightValue & (1 << j)) != 0) { 43 | binary->set(accPos); 44 | } 45 | accPos++; 46 | } 47 | } 48 | } 49 | return binary; 50 | } 51 | 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/zxing/zxing/qrcode/detector/FinderPattern.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_FINDER_PATTERN_H 3 | #define ZXING_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 | QSharedPointer combineEstimate(float i, float j, float newModuleSize) const; 44 | }; 45 | } 46 | } 47 | 48 | #endif // ZXING_FINDER_PATTERN_H 49 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/UPCEReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_UPC_E_READER_H 3 | #define ZXING_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(QSharedPointer row, int endStart); 34 | bool checkChecksum(QSharedPointer const& s); 35 | public: 36 | UPCEReader(); 37 | 38 | int decodeMiddle(QSharedPointer row, Range const& startRange, std::string& resultString); 39 | static QSharedPointer convertUPCEtoUPCA(QSharedPointer const& upce); 40 | 41 | BarcodeFormat getBarcodeFormat(); 42 | }; 43 | 44 | } 45 | } 46 | 47 | #endif // ZXING_UPC_E_READER_H 48 | 49 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI01decoder.cpp: -------------------------------------------------------------------------------- 1 | #include "AI01decoder.h" 2 | #include 3 | 4 | namespace zxing { 5 | namespace oned { 6 | namespace rss { 7 | 8 | AI01decoder::AI01decoder(QSharedPointer information) 9 | : AbstractExpandedDecoder(information) 10 | { 11 | 12 | } 13 | 14 | void AI01decoder::encodeCompressedGtin(String &buf, int currentPos) 15 | { 16 | buf.append("(01)"); 17 | int initialPosition = buf.length(); 18 | buf.append('9'); 19 | 20 | encodeCompressedGtinWithoutAI(buf, currentPos, initialPosition); 21 | } 22 | 23 | void AI01decoder::encodeCompressedGtinWithoutAI(String &buf, int currentPos, int initialBufferPosition) 24 | { 25 | for (int i = 0; i < 4; ++i) { 26 | int currentBlock = getGeneralDecoder().extractNumericValueFromBitArray(currentPos + 10 * i, 10); 27 | if (currentBlock / 100 == 0) { 28 | buf.append("0"); 29 | } 30 | if (currentBlock / 10 == 0) { 31 | buf.append("0"); 32 | } 33 | buf.append(common::StringUtils::intToStr(currentBlock)); 34 | } 35 | 36 | appendCheckDigit(buf, initialBufferPosition); 37 | } 38 | 39 | void AI01decoder::appendCheckDigit(String &buf, int currentPos) 40 | { 41 | int checkDigit = 0; 42 | for (int i = 0; i < 13; i++) { 43 | int digit = buf.charAt(i + currentPos) - '0'; 44 | checkDigit += (i & 0x01) == 0 ? 3 * digit : digit; 45 | } 46 | 47 | checkDigit = 10 - (checkDigit % 10); 48 | if (checkDigit == 10) { 49 | checkDigit = 0; 50 | } 51 | 52 | buf.append(common::StringUtils::intToStr(checkDigit)); 53 | } 54 | 55 | 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/Code128Reader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_CODE_128_READER_H 3 | #define ZXING_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 int MAX_AVG_VARIANCE; 30 | static const int MAX_INDIVIDUAL_VARIANCE; 31 | 32 | static std::vector findStartPattern(QSharedPointer row); 33 | static int decodeCode(QSharedPointer row, 34 | std::vector& counters, 35 | int rowOffset); 36 | 37 | public: 38 | QSharedPointer decodeRow(int rowNumber, QSharedPointer row, DecodeHints hints); 39 | Code128Reader(); 40 | ~Code128Reader(); 41 | 42 | BarcodeFormat getBarcodeFormat(); 43 | }; 44 | 45 | } 46 | } 47 | 48 | #endif // ZXING_CODE_128_READER_H 49 | 50 | -------------------------------------------------------------------------------- /tests/src/QZXingTests/EncoderStressTest.h: -------------------------------------------------------------------------------- 1 | #ifndef ENCODERSTRESSTEST_H 2 | #define ENCODERSTRESSTEST_H 3 | 4 | #include "QZXing.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace zxing { 21 | namespace tests{ 22 | 23 | struct TestRunData { 24 | QString data; 25 | QZXing::EncodeErrorCorrectionLevel errorCorrectionLevel; 26 | qrcode::Mode mode; 27 | 28 | bool successful; 29 | 30 | public: 31 | TestRunData(): data(""), errorCorrectionLevel(QZXing::EncodeErrorCorrectionLevel_L), 32 | mode(qrcode::Mode::BYTE), successful(false) {} 33 | }; 34 | 35 | class EncoderStressTest : public TestCase 36 | { 37 | public: 38 | EncoderStressTest(); 39 | void execute() override; 40 | 41 | protected: 42 | int getMaxCharacterNumber(QZXing::EncodeErrorCorrectionLevel errorCorrectionLevel, zxing::qrcode::Mode &mode); 43 | char getCharacterForQrMode(zxing::qrcode::Mode &mode); 44 | 45 | void runTests(zxing::qrcode::Mode &mode); 46 | void runTests(QZXing::EncodeErrorCorrectionLevel errorCorrectionLevel, zxing::qrcode::Mode &mode); 47 | 48 | static void runTest(TestRunData &testData); 49 | 50 | private: 51 | QVector> maxCharacterNumberMap_; 52 | size_t sumOfSuccessfullTests_; 53 | size_t totalExecutedTests_; 54 | 55 | static QMutex printLockMutex; 56 | }; 57 | 58 | } 59 | } 60 | 61 | #endif // ENCODERSTRESSTEST_H 62 | -------------------------------------------------------------------------------- /src/zxing/zxing/EncodeHint.h: -------------------------------------------------------------------------------- 1 | #ifndef ENCODEHINTTYPE_H 2 | #define ENCODEHINTTYPE_H 3 | 4 | #include 5 | #include 6 | 7 | namespace zxing { 8 | 9 | class EncodeHint 10 | { 11 | private: 12 | /** 13 | * Specifies what degree of error correction to use, for example in QR Codes. 14 | * Type depends on the encoder. For example for QR codes it's type 15 | * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}. 16 | * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words. 17 | * Note: an Aztec symbol should have a minimum of 25% EC words. 18 | */ 19 | zxing::qrcode::ErrorCorrectionLevel* errorCorrectionLevel_; 20 | 21 | /** 22 | * Specifies what character encoding to use where applicable (type {@link String}) 23 | */ 24 | std::string characterSet_; 25 | 26 | /** 27 | * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary 28 | * by format; for example it controls margin before and after the barcode horizontally for 29 | * most 1D formats. (Type {@link Integer}). 30 | */ 31 | int margin_; 32 | 33 | public: 34 | EncodeHint(); 35 | 36 | std::string getCharacterSet() const { return characterSet_; } 37 | const zxing::qrcode::ErrorCorrectionLevel* getErrorCorrectionLevel() { return errorCorrectionLevel_; } 38 | 39 | void setCharacterSet(const std::string& characterSet) { characterSet_ = characterSet; } 40 | void setErrorCorrectionLevel(zxing::qrcode::ErrorCorrectionLevel* errorCorectionLevel) 41 | { errorCorrectionLevel_ = errorCorectionLevel; } 42 | }; 43 | 44 | } 45 | 46 | #endif //ENCODEHINTTYPE_H 47 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/DecodedChar.h: -------------------------------------------------------------------------------- 1 | #ifndef DECODED_CHAR_H 2 | #define DECODED_CHAR_H 3 | 4 | /* 5 | * Copyright (C) 2010 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | /* 23 | * These authors would like to acknowledge the Spanish Ministry of Industry, 24 | * Tourism and Trade, for the support in the project TSI020301-2008-2 25 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 26 | * Mobile Dynamic Environments", led by Treelogic 27 | * ( http://www.treelogic.com/ ): 28 | * 29 | * http://www.piramidepse.com/ 30 | */ 31 | 32 | #include "DecodedObject.h" 33 | 34 | namespace zxing { 35 | 36 | namespace oned { 37 | 38 | namespace rss { 39 | 40 | class DecodedChar : public DecodedObject 41 | { 42 | 43 | public: 44 | static const char FNC1 = '$'; // It's not in Alphanumeric neither in ISO/IEC 646 charset 45 | 46 | DecodedChar(int newPosition, char value); 47 | 48 | char getValue() const; 49 | 50 | bool isFNC1() const; 51 | 52 | private: 53 | char m_value; 54 | 55 | }; 56 | 57 | } 58 | } 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI01320xDecoder.h: -------------------------------------------------------------------------------- 1 | #ifndef AI013_20X_DECODER_H 2 | #define AI013_20X_DECODER_H 3 | /* 4 | * Copyright (C) 2010 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 | * 2019-07-17 translation from Java into C++ 19 | */ 20 | 21 | /* 22 | * These authors would like to acknowledge the Spanish Ministry of Industry, 23 | * Tourism and Trade, for the support in the project TSI020301-2008-2 24 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 25 | * Mobile Dynamic Environments", led by Treelogic 26 | * ( http://www.treelogic.com/ ): 27 | * 28 | * http://www.piramidepse.com/ 29 | */ 30 | 31 | #include "AI013x0xDecoder.h" 32 | #include 33 | 34 | namespace zxing { 35 | 36 | namespace oned { 37 | 38 | namespace rss { 39 | 40 | class AI01320xDecoder : public AI013x0xDecoder 41 | { 42 | 43 | public: 44 | AI01320xDecoder(QSharedPointer information); 45 | 46 | protected: 47 | virtual void addWeightCode(String &buf, int weight) override; 48 | 49 | virtual int checkWeight(int weight) override; 50 | 51 | }; 52 | 53 | } 54 | } 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/zxing/zxing/common/StringUtils.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | 3 | #ifndef ZXING_STRING_UTILS_H 4 | #define ZXING_STRING_UTILS_H 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 | #include 26 | 27 | namespace zxing { 28 | namespace common { 29 | 30 | class StringUtils { 31 | private: 32 | static char const* const PLATFORM_DEFAULT_ENCODING; 33 | 34 | StringUtils() {} 35 | 36 | public: 37 | static char const* const ASCII; 38 | static char const* const SHIFT_JIS; 39 | static char const* const GB2312; 40 | static char const* const EUC_JP; 41 | static char const* const UTF8; 42 | static char const* const ISO88591; 43 | static const bool ASSUME_SHIFT_JIS; 44 | 45 | typedef std::map Hashtable; 46 | 47 | static std::string guessEncoding(zxing::byte *bytes, int length, Hashtable const& hints); 48 | 49 | static std::string intToStr(int number); 50 | }; 51 | 52 | } 53 | } 54 | 55 | #endif // ZXING_STRING_UTILS_H 56 | 57 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI013103decoder.h: -------------------------------------------------------------------------------- 1 | #ifndef AI013_103X_DECODER_H 2 | #define AI013_103X_DECODER_H 3 | 4 | /* 5 | * Copyright (C) 2010 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | /* 23 | * These authors would like to acknowledge the Spanish Ministry of Industry, 24 | * Tourism and Trade, for the support in the project TSI020301-2008-2 25 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 26 | * Mobile Dynamic Environments", led by Treelogic 27 | * ( http://www.treelogic.com/ ): 28 | * 29 | * http://www.piramidepse.com/ 30 | */ 31 | #include "AI013x0xDecoder.h" 32 | #include 33 | 34 | namespace zxing { 35 | 36 | namespace oned { 37 | 38 | namespace rss { 39 | 40 | class AI013103decoder : public AI013x0xDecoder 41 | { 42 | 43 | public: 44 | AI013103decoder(QSharedPointer information); 45 | 46 | protected: 47 | virtual void addWeightCode(String &buf, int) override; 48 | 49 | protected: 50 | virtual int checkWeight(int weight) override; 51 | }; 52 | 53 | } 54 | } 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI01393xDecoder.cpp: -------------------------------------------------------------------------------- 1 | #include "AI01393xDecoder.h" 2 | 3 | #include "DecodedInformation.h" 4 | #include 5 | #include 6 | #include 7 | 8 | namespace zxing { 9 | namespace oned { 10 | namespace rss { 11 | 12 | AI01393xDecoder::AI01393xDecoder(QSharedPointer information) 13 | : AI01decoder(information) 14 | { 15 | 16 | } 17 | 18 | String AI01393xDecoder::parseInformation() 19 | { 20 | if (getInformation()->getSize() < HEADER_SIZE + GTIN_SIZE) { 21 | throw NotFoundException(); 22 | } 23 | 24 | String buf(""); 25 | 26 | encodeCompressedGtin(buf, HEADER_SIZE); 27 | 28 | int lastAIdigit = 29 | getGeneralDecoder().extractNumericValueFromBitArray(HEADER_SIZE + GTIN_SIZE, LAST_DIGIT_SIZE); 30 | 31 | buf.append("(393"); 32 | buf.append(common::StringUtils::intToStr(lastAIdigit)); 33 | buf.append(')'); 34 | 35 | int firstThreeDigits = getGeneralDecoder().extractNumericValueFromBitArray( 36 | HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE, FIRST_THREE_DIGITS_SIZE); 37 | if (firstThreeDigits / 100 == 0) { 38 | buf.append('0'); 39 | } 40 | if (firstThreeDigits / 10 == 0) { 41 | buf.append('0'); 42 | } 43 | buf.append(common::StringUtils::intToStr(firstThreeDigits)); 44 | 45 | String stub(""); 46 | 47 | DecodedInformation generalInformation = getGeneralDecoder().decodeGeneralPurposeField( 48 | HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE + FIRST_THREE_DIGITS_SIZE, stub); 49 | buf.append(generalInformation.getNewString().getText()); 50 | 51 | return buf; 52 | } 53 | 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/zxing/zxing/pdf417/PDF417Reader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_PDF417_READER_H 3 | #define ZXING_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 QSharedPointer extractPureBits(QSharedPointer image); 37 | static int moduleSize(QSharedPointer> leftTopBlack, QSharedPointer image); 38 | static int findPatternStart(int x, int y, QSharedPointer image); 39 | static int findPatternEnd(int x, int y, QSharedPointer image); 40 | 41 | public: 42 | QSharedPointer decode(QSharedPointer image, DecodeHints hints); 43 | void reset(); 44 | }; 45 | 46 | } 47 | } 48 | 49 | #endif // ZXING_PDF417_READER_H 50 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/zxing/zxing/common/GreyscaleRotatedLuminanceSource.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_GREYSCALE_ROTATED_LUMINANCE_SOURCE 3 | #define ZXING_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 | QSharedPointer> greyData_; 32 | const int dataWidth_; 33 | const int left_; 34 | const int top_; 35 | 36 | public: 37 | GreyscaleRotatedLuminanceSource(QSharedPointer> greyData, int dataWidth, int dataHeight, 38 | int left, int top, int width, int height); 39 | 40 | QSharedPointer> getRow(int y, QSharedPointer> row) const; 41 | QSharedPointer> getMatrix() const; 42 | }; 43 | 44 | } 45 | 46 | #endif // ZXING_GREYSCALE_ROTATED_LUMINANCE_SOURCE 47 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AnyAIDecoder.h: -------------------------------------------------------------------------------- 1 | #ifndef ANY_AI_DECODER_H 2 | #define ANY_AI_DECODER_H 3 | 4 | /* 5 | * Copyright (C) 2010 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | /* 23 | * These authors would like to acknowledge the Spanish Ministry of Industry, 24 | * Tourism and Trade, for the support in the project TSI020301-2008-2 25 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 26 | * Mobile Dynamic Environments", led by Treelogic 27 | * ( http://www.treelogic.com/ ): 28 | * 29 | * http://www.piramidepse.com/ 30 | */ 31 | 32 | #include 33 | #include 34 | #include 35 | #include "AbstractExpandedDecoder.h" 36 | 37 | namespace zxing { 38 | 39 | namespace oned { 40 | 41 | namespace rss { 42 | 43 | class AnyAIDecoder : public AbstractExpandedDecoder 44 | { 45 | static const int HEADER_SIZE = 2 + 1 + 2; 46 | 47 | public: 48 | AnyAIDecoder(QSharedPointer information); 49 | 50 | String parseInformation() override; 51 | }; 52 | 53 | } 54 | } 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/UPCEANExtensionSupport.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 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 | * 2019-05-08 translation from Java into C++ 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace zxing { 28 | namespace oned { 29 | 30 | static const std::vector EXTENSION_START_PATTERN = { 1, 1, 2 }; 31 | 32 | QSharedPointer UPCEANExtensionSupport::decodeRow(int rowNumber, QSharedPointer row, int rowOffset) 33 | { 34 | UPCEANReader::Range extStartRange = UPCEANReader::findGuardPattern(row, rowOffset, false, EXTENSION_START_PATTERN); 35 | 36 | try { 37 | return UPCEANExtension5Support::decodeRow(rowNumber, row, extStartRange[0], extStartRange[1]); 38 | } catch (NotFoundException const& /*nfe*/) { 39 | return UPCEANExtension2Support::decodeRow(rowNumber, row, extStartRange[0], extStartRange[1]); 40 | } 41 | } 42 | 43 | } // oned 44 | } // zxing 45 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/BlockParsedResult.h: -------------------------------------------------------------------------------- 1 | #ifndef BLOCK_PARSED_RESULT_H 2 | #define BLOCK_PARSED_RESULT_H 3 | 4 | /* 5 | * Copyright (C) 2010 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | /* 23 | * These authors would like to acknowledge the Spanish Ministry of Industry, 24 | * Tourism and Trade, for the support in the project TSI020301-2008-2 25 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 26 | * Mobile Dynamic Environments", led by Treelogic 27 | * ( http://www.treelogic.com/ ): 28 | * 29 | * http://www.piramidepse.com/ 30 | */ 31 | 32 | #include "DecodedInformation.h" 33 | 34 | namespace zxing { 35 | 36 | namespace oned { 37 | 38 | namespace rss { 39 | 40 | class BlockParsedResult 41 | { 42 | 43 | public: 44 | 45 | BlockParsedResult(bool finished); 46 | 47 | BlockParsedResult(const DecodedInformation& information, bool finished); 48 | 49 | DecodedInformation getDecodedInformation(); 50 | 51 | bool isFinished(); 52 | 53 | private: 54 | DecodedInformation m_decodedInformation; 55 | bool m_finished; 56 | }; 57 | 58 | } 59 | } 60 | } 61 | #endif 62 | -------------------------------------------------------------------------------- /src/zxing/zxing/MultiFormatReader.h: -------------------------------------------------------------------------------- 1 | #ifndef ZXING_MULTI_FORMAT_READER_H 2 | #define ZXING_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 | QSharedPointer decodeInternal(QSharedPointer image); 33 | 34 | std::vector > readers_; 35 | DecodeHints hints_; 36 | 37 | public: 38 | MultiFormatReader(); 39 | 40 | QSharedPointer decode(QSharedPointer image); 41 | QSharedPointer decode(QSharedPointer image, DecodeHints hints); 42 | QSharedPointer decodeWithState(QSharedPointer image); 43 | void setHints(DecodeHints hints); 44 | void enableReaders(DecodeHints hints, bool allowAll = false); 45 | ~MultiFormatReader(); 46 | }; 47 | } 48 | 49 | #endif // ZXING_MULTI_FORMAT_READER_H 50 | 51 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/UPCAReader.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*- 2 | #ifndef ZXING_UPCA_READER_H 3 | #define ZXING_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 QSharedPointer maybeReturnResult(QSharedPointer result); 34 | 35 | public: 36 | UPCAReader(); 37 | 38 | int decodeMiddle(QSharedPointer row, Range const& startRange, std::string& resultString); 39 | 40 | QSharedPointer decodeRow(int rowNumber, QSharedPointer row, DecodeHints hints); 41 | QSharedPointer decodeRow(int rowNumber, QSharedPointer row, Range const& startGuardRange); 42 | QSharedPointer decode(QSharedPointer image, DecodeHints hints); 43 | 44 | BarcodeFormat getBarcodeFormat(); 45 | }; 46 | 47 | } 48 | } 49 | 50 | #endif // ZXING_UPCA_READER_H 51 | 52 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/FieldParser.h: -------------------------------------------------------------------------------- 1 | #ifndef FIELD_PARSER_H 2 | #define FIELD_PARSER_H 3 | 4 | /* 5 | * Copyright (C) 2010 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | /* 23 | * These authors would like to acknowledge the Spanish Ministry of Industry, 24 | * Tourism and Trade, for the support in the project TSI020301-2008-2 25 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 26 | * Mobile Dynamic Environments", led by Treelogic 27 | * ( http://www.treelogic.com/ ): 28 | * 29 | * http://www.piramidepse.com/ 30 | */ 31 | 32 | #include 33 | #include 34 | 35 | #include 36 | 37 | namespace zxing { 38 | 39 | namespace oned { 40 | 41 | namespace rss { 42 | 43 | class FieldParser 44 | { 45 | 46 | public: 47 | 48 | static String parseFieldsInGeneralPurpose(String rawInformation); 49 | 50 | static String processFixedAI(int aiSize, int fieldSize, String rawInformation); 51 | 52 | static String processVariableAI(int aiSize, int variableFieldSize, String rawInformation); 53 | }; 54 | 55 | } 56 | } 57 | } 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /src/zxing/zxing/oned/rss/expanded/decoders/AI01393xDecoder.h: -------------------------------------------------------------------------------- 1 | #ifndef AI01_393X_DECODER_H 2 | #define AI01_393X_DECODER_H 3 | 4 | /* 5 | * Copyright (C) 2010 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 | * 2019-07-17 translation from Java into C++ 20 | */ 21 | 22 | /* 23 | * These authors would like to acknowledge the Spanish Ministry of Industry, 24 | * Tourism and Trade, for the support in the project TSI020301-2008-2 25 | * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled 26 | * Mobile Dynamic Environments", led by Treelogic 27 | * ( http://www.treelogic.com/ ): 28 | * 29 | * http://www.piramidepse.com/ 30 | */ 31 | 32 | #include "AI01decoder.h" 33 | 34 | #include 35 | 36 | namespace zxing { 37 | 38 | namespace oned { 39 | 40 | namespace rss { 41 | 42 | class AI01393xDecoder : public AI01decoder 43 | { 44 | static const int HEADER_SIZE = 5 + 1 + 2; 45 | static const int LAST_DIGIT_SIZE = 2; 46 | static const int FIRST_THREE_DIGITS_SIZE = 10; 47 | 48 | public: 49 | AI01393xDecoder(QSharedPointer information); 50 | 51 | virtual String parseInformation() override; 52 | }; 53 | 54 | } 55 | } 56 | } 57 | 58 | #endif 59 | --------------------------------------------------------------------------------