react-native-nitro-zxing 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/VisionCameraZxing.podspec +48 -0
- package/android/CMakeLists.txt +43 -0
- package/android/build.gradle +150 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/cpp/cpp-adapter.cpp +7 -0
- package/android/src/main/java/com/margelo/nitro/camera/zxing/VisionCameraZxingPackage.kt +21 -0
- package/cpp/BarcodeValueTypeClassifier.cpp +70 -0
- package/cpp/BarcodeValueTypeClassifier.hpp +14 -0
- package/cpp/FrameImageView.cpp +75 -0
- package/cpp/FrameImageView.hpp +34 -0
- package/cpp/HybridBarcode.cpp +59 -0
- package/cpp/HybridBarcode.hpp +26 -0
- package/cpp/HybridBarcodeScanner.cpp +121 -0
- package/cpp/HybridBarcodeScanner.hpp +26 -0
- package/cpp/HybridBarcodeScannerFactory.cpp +11 -0
- package/cpp/HybridBarcodeScannerFactory.hpp +14 -0
- package/cpp/ImageDownscaler.cpp +34 -0
- package/cpp/ImageDownscaler.hpp +21 -0
- package/cpp/ZXingDecoder.cpp +189 -0
- package/cpp/ZXingDecoder.hpp +72 -0
- package/cpp/zxing-core/LICENSE +202 -0
- package/cpp/zxing-core/README.md +156 -0
- package/cpp/zxing-core/core/CMakeLists.txt +784 -0
- package/cpp/zxing-core/core/Version.h.in +28 -0
- package/cpp/zxing-core/core/ZXingConfig.cmake.in +9 -0
- package/cpp/zxing-core/core/src/Barcode.cpp +255 -0
- package/cpp/zxing-core/core/src/Barcode.h +191 -0
- package/cpp/zxing-core/core/src/BarcodeData.h +100 -0
- package/cpp/zxing-core/core/src/BarcodeFormat.cpp +286 -0
- package/cpp/zxing-core/core/src/BarcodeFormat.h +272 -0
- package/cpp/zxing-core/core/src/BinaryBitmap.cpp +111 -0
- package/cpp/zxing-core/core/src/BinaryBitmap.h +66 -0
- package/cpp/zxing-core/core/src/BitArray.cpp +38 -0
- package/cpp/zxing-core/core/src/BitArray.h +181 -0
- package/cpp/zxing-core/core/src/BitMatrix.cpp +175 -0
- package/cpp/zxing-core/core/src/BitMatrix.h +199 -0
- package/cpp/zxing-core/core/src/BitMatrixCursor.h +253 -0
- package/cpp/zxing-core/core/src/BitMatrixIO.cpp +101 -0
- package/cpp/zxing-core/core/src/BitMatrixIO.h +21 -0
- package/cpp/zxing-core/core/src/BitSource.cpp +77 -0
- package/cpp/zxing-core/core/src/BitSource.h +72 -0
- package/cpp/zxing-core/core/src/ByteArray.h +42 -0
- package/cpp/zxing-core/core/src/CharacterSet.cpp +78 -0
- package/cpp/zxing-core/core/src/CharacterSet.h +58 -0
- package/cpp/zxing-core/core/src/ConcentricFinder.cpp +312 -0
- package/cpp/zxing-core/core/src/ConcentricFinder.h +156 -0
- package/cpp/zxing-core/core/src/Content.cpp +471 -0
- package/cpp/zxing-core/core/src/Content.h +82 -0
- package/cpp/zxing-core/core/src/ContentType.h +19 -0
- package/cpp/zxing-core/core/src/CreateBarcode.cpp +490 -0
- package/cpp/zxing-core/core/src/CreateBarcode.h +132 -0
- package/cpp/zxing-core/core/src/DecoderResult.h +92 -0
- package/cpp/zxing-core/core/src/DetectorResult.h +44 -0
- package/cpp/zxing-core/core/src/ECI.cpp +81 -0
- package/cpp/zxing-core/core/src/ECI.h +78 -0
- package/cpp/zxing-core/core/src/Error.cpp +29 -0
- package/cpp/zxing-core/core/src/Error.h +79 -0
- package/cpp/zxing-core/core/src/Flags.h +165 -0
- package/cpp/zxing-core/core/src/GTIN.cpp +253 -0
- package/cpp/zxing-core/core/src/GTIN.h +58 -0
- package/cpp/zxing-core/core/src/GlobalHistogramBinarizer.cpp +197 -0
- package/cpp/zxing-core/core/src/GlobalHistogramBinarizer.h +34 -0
- package/cpp/zxing-core/core/src/GridSampler.cpp +124 -0
- package/cpp/zxing-core/core/src/GridSampler.h +59 -0
- package/cpp/zxing-core/core/src/HRI.cpp +343 -0
- package/cpp/zxing-core/core/src/HRI.h +16 -0
- package/cpp/zxing-core/core/src/HybridBinarizer.cpp +315 -0
- package/cpp/zxing-core/core/src/HybridBinarizer.h +40 -0
- package/cpp/zxing-core/core/src/ImageView.h +168 -0
- package/cpp/zxing-core/core/src/JSON.cpp +154 -0
- package/cpp/zxing-core/core/src/JSON.h +66 -0
- package/cpp/zxing-core/core/src/LocalGrid.cpp +242 -0
- package/cpp/zxing-core/core/src/LocalGrid.h +91 -0
- package/cpp/zxing-core/core/src/LogMatrix.h +105 -0
- package/cpp/zxing-core/core/src/Matrix.h +125 -0
- package/cpp/zxing-core/core/src/MultiFormatReader.cpp +107 -0
- package/cpp/zxing-core/core/src/MultiFormatReader.h +34 -0
- package/cpp/zxing-core/core/src/MultiFormatWriter.cpp +111 -0
- package/cpp/zxing-core/core/src/MultiFormatWriter.h +62 -0
- package/cpp/zxing-core/core/src/Pattern.h +472 -0
- package/cpp/zxing-core/core/src/PerspectiveTransform.cpp +81 -0
- package/cpp/zxing-core/core/src/PerspectiveTransform.h +47 -0
- package/cpp/zxing-core/core/src/Point.h +185 -0
- package/cpp/zxing-core/core/src/Quadrilateral.h +215 -0
- package/cpp/zxing-core/core/src/Range.h +112 -0
- package/cpp/zxing-core/core/src/ReadBarcode.cpp +335 -0
- package/cpp/zxing-core/core/src/ReadBarcode.h +33 -0
- package/cpp/zxing-core/core/src/Reader.h +32 -0
- package/cpp/zxing-core/core/src/ReaderOptions.h +210 -0
- package/cpp/zxing-core/core/src/ReedSolomon.cpp +100 -0
- package/cpp/zxing-core/core/src/ReedSolomon.h +66 -0
- package/cpp/zxing-core/core/src/RegressionLine.h +161 -0
- package/cpp/zxing-core/core/src/ResultPoint.cpp +20 -0
- package/cpp/zxing-core/core/src/ResultPoint.h +35 -0
- package/cpp/zxing-core/core/src/StdGenerator.h +121 -0
- package/cpp/zxing-core/core/src/StdPrint.h +38 -0
- package/cpp/zxing-core/core/src/StdScope.h +55 -0
- package/cpp/zxing-core/core/src/StructuredAppend.h +19 -0
- package/cpp/zxing-core/core/src/SymbologyIdentifier.h +29 -0
- package/cpp/zxing-core/core/src/TextDecoder.cpp +59 -0
- package/cpp/zxing-core/core/src/TextDecoder.h +23 -0
- package/cpp/zxing-core/core/src/TextEncoder.cpp +75 -0
- package/cpp/zxing-core/core/src/TextEncoder.h +31 -0
- package/cpp/zxing-core/core/src/ThresholdBinarizer.h +58 -0
- package/cpp/zxing-core/core/src/TritMatrix.h +29 -0
- package/cpp/zxing-core/core/src/Utf.cpp +276 -0
- package/cpp/zxing-core/core/src/Utf.h +26 -0
- package/cpp/zxing-core/core/src/WhiteRectDetector.cpp +276 -0
- package/cpp/zxing-core/core/src/WhiteRectDetector.h +36 -0
- package/cpp/zxing-core/core/src/WriteBarcode.cpp +213 -0
- package/cpp/zxing-core/core/src/WriteBarcode.h +72 -0
- package/cpp/zxing-core/core/src/ZXAlgorithms.h +353 -0
- package/cpp/zxing-core/core/src/ZXConfig.h +17 -0
- package/cpp/zxing-core/core/src/ZXTestSupport.h +9 -0
- package/cpp/zxing-core/core/src/ZXVersion.h +14 -0
- package/cpp/zxing-core/core/src/ZXingC.cpp +460 -0
- package/cpp/zxing-core/core/src/ZXingC.h +296 -0
- package/cpp/zxing-core/core/src/ZXingCpp.cpp +18 -0
- package/cpp/zxing-core/core/src/ZXingCpp.h +76 -0
- package/cpp/zxing-core/core/src/ZXingQt.h +606 -0
- package/cpp/zxing-core/core/src/aztec/AZDecoder.cpp +376 -0
- package/cpp/zxing-core/core/src/aztec/AZDecoder.h +20 -0
- package/cpp/zxing-core/core/src/aztec/AZDetector.cpp +508 -0
- package/cpp/zxing-core/core/src/aztec/AZDetector.h +25 -0
- package/cpp/zxing-core/core/src/aztec/AZDetectorResult.h +51 -0
- package/cpp/zxing-core/core/src/aztec/AZEncoder.cpp +318 -0
- package/cpp/zxing-core/core/src/aztec/AZEncoder.h +44 -0
- package/cpp/zxing-core/core/src/aztec/AZEncodingState.h +40 -0
- package/cpp/zxing-core/core/src/aztec/AZHighLevelEncoder.cpp +377 -0
- package/cpp/zxing-core/core/src/aztec/AZHighLevelEncoder.h +36 -0
- package/cpp/zxing-core/core/src/aztec/AZReader.cpp +45 -0
- package/cpp/zxing-core/core/src/aztec/AZReader.h +21 -0
- package/cpp/zxing-core/core/src/aztec/AZToken.cpp +44 -0
- package/cpp/zxing-core/core/src/aztec/AZToken.h +39 -0
- package/cpp/zxing-core/core/src/aztec/AZWriter.cpp +38 -0
- package/cpp/zxing-core/core/src/aztec/AZWriter.h +55 -0
- package/cpp/zxing-core/core/src/datamatrix/DMBitLayout.cpp +194 -0
- package/cpp/zxing-core/core/src/datamatrix/DMBitLayout.h +21 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDataBlock.cpp +63 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDataBlock.h +41 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDecoder.cpp +457 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDecoder.h +19 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDetector.cpp +1230 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDetector.h +23 -0
- package/cpp/zxing-core/core/src/datamatrix/DMECEncoder.cpp +137 -0
- package/cpp/zxing-core/core/src/datamatrix/DMECEncoder.h +26 -0
- package/cpp/zxing-core/core/src/datamatrix/DMEncoderContext.h +128 -0
- package/cpp/zxing-core/core/src/datamatrix/DMHighLevelEncoder.cpp +919 -0
- package/cpp/zxing-core/core/src/datamatrix/DMHighLevelEncoder.h +29 -0
- package/cpp/zxing-core/core/src/datamatrix/DMReader.cpp +40 -0
- package/cpp/zxing-core/core/src/datamatrix/DMReader.h +21 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolInfo.cpp +141 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolInfo.h +78 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolShape.h +17 -0
- package/cpp/zxing-core/core/src/datamatrix/DMVersion.cpp +82 -0
- package/cpp/zxing-core/core/src/datamatrix/DMVersion.h +76 -0
- package/cpp/zxing-core/core/src/datamatrix/DMWriter.cpp +114 -0
- package/cpp/zxing-core/core/src/datamatrix/DMWriter.h +62 -0
- package/cpp/zxing-core/core/src/librscpp/README.md +65 -0
- package/cpp/zxing-core/core/src/librscpp/decode.h +258 -0
- package/cpp/zxing-core/core/src/librscpp/encode.h +124 -0
- package/cpp/zxing-core/core/src/librscpp/field.h +158 -0
- package/cpp/zxing-core/core/src/librscpp/poly.h +194 -0
- package/cpp/zxing-core/core/src/libzint/2of5inter.c +1 -0
- package/cpp/zxing-core/core/src/libzint/2of5inter_based.c +1 -0
- package/cpp/zxing-core/core/src/libzint/aztec.c +1 -0
- package/cpp/zxing-core/core/src/libzint/aztec.h +1 -0
- package/cpp/zxing-core/core/src/libzint/big5.h +1 -0
- package/cpp/zxing-core/core/src/libzint/codabar.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code128.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code128.h +1 -0
- package/cpp/zxing-core/core/src/libzint/common.c +1 -0
- package/cpp/zxing-core/core/src/libzint/common.h +1 -0
- package/cpp/zxing-core/core/src/libzint/dmatrix.c +1 -0
- package/cpp/zxing-core/core/src/libzint/dmatrix.h +1 -0
- package/cpp/zxing-core/core/src/libzint/dxfilmedge.c +1 -0
- package/cpp/zxing-core/core/src/libzint/eci.c +1 -0
- package/cpp/zxing-core/core/src/libzint/eci.h +1 -0
- package/cpp/zxing-core/core/src/libzint/eci_sb.h +1 -0
- package/cpp/zxing-core/core/src/libzint/filemem.c +1 -0
- package/cpp/zxing-core/core/src/libzint/filemem.h +1 -0
- package/cpp/zxing-core/core/src/libzint/fonts/normal_woff2.h +1 -0
- package/cpp/zxing-core/core/src/libzint/fonts/upcean_woff2.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gb18030.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gb2312.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gbk.h +1 -0
- package/cpp/zxing-core/core/src/libzint/general_field.c +1 -0
- package/cpp/zxing-core/core/src/libzint/general_field.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1.c +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1_lint.h +1 -0
- package/cpp/zxing-core/core/src/libzint/iso3166.h +1 -0
- package/cpp/zxing-core/core/src/libzint/iso4217.h +1 -0
- package/cpp/zxing-core/core/src/libzint/ksx1001.h +1 -0
- package/cpp/zxing-core/core/src/libzint/large.c +1 -0
- package/cpp/zxing-core/core/src/libzint/large.h +1 -0
- package/cpp/zxing-core/core/src/libzint/library.c +1 -0
- package/cpp/zxing-core/core/src/libzint/maxicode.c +1 -0
- package/cpp/zxing-core/core/src/libzint/maxicode.h +1 -0
- package/cpp/zxing-core/core/src/libzint/medical.c +1 -0
- package/cpp/zxing-core/core/src/libzint/output.c +1 -0
- package/cpp/zxing-core/core/src/libzint/output.h +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417.c +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417.h +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417_tabs.h +1 -0
- package/cpp/zxing-core/core/src/libzint/qr.c +1 -0
- package/cpp/zxing-core/core/src/libzint/qr.h +1 -0
- package/cpp/zxing-core/core/src/libzint/raster.c +1 -0
- package/cpp/zxing-core/core/src/libzint/raster_font.h +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol.c +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol.h +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol_logs.h +1 -0
- package/cpp/zxing-core/core/src/libzint/rss.c +1 -0
- package/cpp/zxing-core/core/src/libzint/rss.h +1 -0
- package/cpp/zxing-core/core/src/libzint/sjis.h +1 -0
- package/cpp/zxing-core/core/src/libzint/stubs.c +137 -0
- package/cpp/zxing-core/core/src/libzint/svg.c +1 -0
- package/cpp/zxing-core/core/src/libzint/telepen.c +1 -0
- package/cpp/zxing-core/core/src/libzint/upcean.c +1 -0
- package/cpp/zxing-core/core/src/libzint/vector.c +1 -0
- package/cpp/zxing-core/core/src/libzint/zfiletypes.h +1 -0
- package/cpp/zxing-core/core/src/libzint/zint.h +1 -0
- package/cpp/zxing-core/core/src/libzint/zintconfig.h +1 -0
- package/cpp/zxing-core/core/src/libzueci/README.md +11 -0
- package/cpp/zxing-core/core/src/libzueci/zueci.c +1718 -0
- package/cpp/zxing-core/core/src/libzueci/zueci.h +179 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_big5.h +3884 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_common.h +31 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gb18030.h +264 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gb2312.h +2381 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gbk.h +4047 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_ksx1001.h +2932 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_sb.h +1112 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_sjis.h +2286 -0
- package/cpp/zxing-core/core/src/maxicode/MCBitMatrixParser.cpp +68 -0
- package/cpp/zxing-core/core/src/maxicode/MCBitMatrixParser.h +30 -0
- package/cpp/zxing-core/core/src/maxicode/MCDecoder.cpp +329 -0
- package/cpp/zxing-core/core/src/maxicode/MCDecoder.h +19 -0
- package/cpp/zxing-core/core/src/maxicode/MCReader.cpp +65 -0
- package/cpp/zxing-core/core/src/maxicode/MCReader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarReader.cpp +102 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarReader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarWriter.cpp +136 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Patterns.h +130 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Reader.cpp +236 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Reader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Writer.cpp +261 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Reader.cpp +213 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Reader.h +26 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Writer.cpp +176 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Patterns.h +80 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Reader.cpp +112 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Reader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Writer.cpp +192 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Writer.h +32 -0
- package/cpp/zxing-core/core/src/oned/ODDXFilmEdgeReader.cpp +246 -0
- package/cpp/zxing-core/core/src/oned/ODDXFilmEdgeReader.h +26 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarCommon.cpp +172 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarCommon.h +204 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedBitDecoder.cpp +253 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedBitDecoder.h +19 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedReader.cpp +383 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarLimitedReader.cpp +163 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarLimitedReader.h +23 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarReader.cpp +240 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODEAN13Writer.cpp +62 -0
- package/cpp/zxing-core/core/src/oned/ODEAN13Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODEAN8Writer.cpp +51 -0
- package/cpp/zxing-core/core/src/oned/ODEAN8Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODITFReader.cpp +97 -0
- package/cpp/zxing-core/core/src/oned/ODITFReader.h +33 -0
- package/cpp/zxing-core/core/src/oned/ODITFWriter.cpp +78 -0
- package/cpp/zxing-core/core/src/oned/ODITFWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODMultiUPCEANReader.cpp +323 -0
- package/cpp/zxing-core/core/src/oned/ODMultiUPCEANReader.h +32 -0
- package/cpp/zxing-core/core/src/oned/ODReader.cpp +259 -0
- package/cpp/zxing-core/core/src/oned/ODReader.h +35 -0
- package/cpp/zxing-core/core/src/oned/ODRowReader.h +222 -0
- package/cpp/zxing-core/core/src/oned/ODTelepenReader.cpp +199 -0
- package/cpp/zxing-core/core/src/oned/ODTelepenReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODUPCAWriter.cpp +33 -0
- package/cpp/zxing-core/core/src/oned/ODUPCAWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEANCommon.cpp +80 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEANCommon.h +129 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEWriter.cpp +56 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODWriterHelper.cpp +39 -0
- package/cpp/zxing-core/core/src/oned/ODWriterHelper.h +48 -0
- package/cpp/zxing-core/core/src/pdf417/MicroPDFReader.cpp +796 -0
- package/cpp/zxing-core/core/src/pdf417/MicroPDFReader.h +23 -0
- package/cpp/zxing-core/core/src/pdf417/PDF417.cpp +85 -0
- package/cpp/zxing-core/core/src/pdf417/PDF417.h +81 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeMetadata.h +53 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeValue.cpp +48 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeValue.h +38 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBoundingBox.cpp +116 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBoundingBox.h +75 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodeword.h +71 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodewordDecoder.cpp +588 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodewordDecoder.h +41 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCompaction.h +20 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCustomData.h +32 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDecoder.cpp +725 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDecoder.h +20 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResult.cpp +247 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResult.h +74 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResultColumn.cpp +321 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResultColumn.h +83 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetector.cpp +371 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetector.h +45 -0
- package/cpp/zxing-core/core/src/pdf417/PDFEncoder.cpp +570 -0
- package/cpp/zxing-core/core/src/pdf417/PDFEncoder.h +182 -0
- package/cpp/zxing-core/core/src/pdf417/PDFHighLevelEncoder.cpp +570 -0
- package/cpp/zxing-core/core/src/pdf417/PDFHighLevelEncoder.h +32 -0
- package/cpp/zxing-core/core/src/pdf417/PDFReader.cpp +333 -0
- package/cpp/zxing-core/core/src/pdf417/PDFReader.h +28 -0
- package/cpp/zxing-core/core/src/pdf417/PDFScanningDecoder.cpp +559 -0
- package/cpp/zxing-core/core/src/pdf417/PDFScanningDecoder.h +41 -0
- package/cpp/zxing-core/core/src/pdf417/PDFWriter.cpp +170 -0
- package/cpp/zxing-core/core/src/pdf417/PDFWriter.h +74 -0
- package/cpp/zxing-core/core/src/pdf417/ZXBigInteger.cpp +623 -0
- package/cpp/zxing-core/core/src/pdf417/ZXBigInteger.h +81 -0
- package/cpp/zxing-core/core/src/pdf417/ZXNullable.h +105 -0
- package/cpp/zxing-core/core/src/qrcode/QRBitMatrixParser.cpp +294 -0
- package/cpp/zxing-core/core/src/qrcode/QRBitMatrixParser.h +41 -0
- package/cpp/zxing-core/core/src/qrcode/QRCodecMode.cpp +95 -0
- package/cpp/zxing-core/core/src/qrcode/QRCodecMode.h +59 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataBlock.cpp +93 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataBlock.h +52 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataMask.h +50 -0
- package/cpp/zxing-core/core/src/qrcode/QRDecoder.cpp +359 -0
- package/cpp/zxing-core/core/src/qrcode/QRDecoder.h +19 -0
- package/cpp/zxing-core/core/src/qrcode/QRDetector.cpp +920 -0
- package/cpp/zxing-core/core/src/qrcode/QRDetector.h +45 -0
- package/cpp/zxing-core/core/src/qrcode/QRECB.h +52 -0
- package/cpp/zxing-core/core/src/qrcode/QREncodeResult.h +33 -0
- package/cpp/zxing-core/core/src/qrcode/QREncoder.cpp +568 -0
- package/cpp/zxing-core/core/src/qrcode/QREncoder.h +21 -0
- package/cpp/zxing-core/core/src/qrcode/QRErrorCorrectionLevel.cpp +51 -0
- package/cpp/zxing-core/core/src/qrcode/QRErrorCorrectionLevel.h +39 -0
- package/cpp/zxing-core/core/src/qrcode/QRFormatInformation.cpp +160 -0
- package/cpp/zxing-core/core/src/qrcode/QRFormatInformation.h +61 -0
- package/cpp/zxing-core/core/src/qrcode/QRMaskUtil.cpp +156 -0
- package/cpp/zxing-core/core/src/qrcode/QRMaskUtil.h +15 -0
- package/cpp/zxing-core/core/src/qrcode/QRMatrixUtil.cpp +318 -0
- package/cpp/zxing-core/core/src/qrcode/QRMatrixUtil.h +25 -0
- package/cpp/zxing-core/core/src/qrcode/QRReader.cpp +149 -0
- package/cpp/zxing-core/core/src/qrcode/QRReader.h +21 -0
- package/cpp/zxing-core/core/src/qrcode/QRVersion.cpp +754 -0
- package/cpp/zxing-core/core/src/qrcode/QRVersion.h +127 -0
- package/cpp/zxing-core/core/src/qrcode/QRWriter.cpp +51 -0
- package/cpp/zxing-core/core/src/qrcode/QRWriter.h +74 -0
- package/cpp/zxing-core/core/version.rc.in +34 -0
- package/cpp/zxing-core/core/zxing.pc.in +8 -0
- package/cpp/zxing-core/wrappers/ios/README.md +25 -0
- package/cpp/zxing-core/wrappers/ios/Sources/Wrapper/Version.h +29 -0
- package/cpp/zxing-core/zxing-cpp.podspec +45 -0
- package/lib/factory.d.ts +10 -0
- package/lib/factory.js +12 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +9 -0
- package/lib/specs/Barcode.nitro.d.ts +63 -0
- package/lib/specs/Barcode.nitro.js +1 -0
- package/lib/specs/BarcodeFormat.d.ts +11 -0
- package/lib/specs/BarcodeFormat.js +1 -0
- package/lib/specs/BarcodeScanner.nitro.d.ts +89 -0
- package/lib/specs/BarcodeScanner.nitro.js +1 -0
- package/lib/specs/BarcodeScannerFactory.nitro.d.ts +26 -0
- package/lib/specs/BarcodeScannerFactory.nitro.js +1 -0
- package/lib/specs/BarcodeValueType.d.ts +9 -0
- package/lib/specs/BarcodeValueType.js +1 -0
- package/lib/specs/Point.d.ts +14 -0
- package/lib/specs/Point.js +1 -0
- package/lib/specs/Rect.d.ts +22 -0
- package/lib/specs/Rect.js +1 -0
- package/lib/useBarcodeScanner.d.ts +23 -0
- package/lib/useBarcodeScanner.js +25 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/VisionCameraZxing+autolinking.cmake +83 -0
- package/nitrogen/generated/android/VisionCameraZxing+autolinking.gradle +27 -0
- package/nitrogen/generated/android/VisionCameraZxingOnLoad.cpp +49 -0
- package/nitrogen/generated/android/VisionCameraZxingOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/zxing/VisionCameraZxingOnLoad.kt +35 -0
- package/nitrogen/generated/ios/VisionCameraZxing+autolinking.rb +62 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/VisionCameraZxingAutolinking.mm +35 -0
- package/nitrogen/generated/ios/VisionCameraZxingAutolinking.swift +16 -0
- package/nitrogen/generated/shared/c++/BarcodeFormat.hpp +124 -0
- package/nitrogen/generated/shared/c++/BarcodeScannerOptions.hpp +85 -0
- package/nitrogen/generated/shared/c++/BarcodeValueType.hpp +120 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeSpec.hpp +82 -0
- package/nitrogen/generated/shared/c++/HybridZXingBarcodeScannerFactorySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridZXingBarcodeScannerFactorySpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/Point.hpp +87 -0
- package/nitrogen/generated/shared/c++/Rect.hpp +95 -0
- package/nitrogen/generated/shared/c++/TargetBarcodeFormat.hpp +124 -0
- package/package.json +108 -0
- package/react-native.config.js +16 -0
- package/src/factory.ts +26 -0
- package/src/index.ts +9 -0
- package/src/specs/Barcode.nitro.ts +70 -0
- package/src/specs/BarcodeFormat.ts +31 -0
- package/src/specs/BarcodeScanner.nitro.ts +91 -0
- package/src/specs/BarcodeScannerFactory.nitro.ts +27 -0
- package/src/specs/BarcodeValueType.ts +25 -0
- package/src/specs/Point.ts +14 -0
- package/src/specs/Rect.ts +22 -0
- package/src/useBarcodeScanner.ts +36 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
* Copyright 2022 Axel Waggershauser
|
|
5
|
+
*/
|
|
6
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
|
|
8
|
+
#include "AZDecoder.h"
|
|
9
|
+
|
|
10
|
+
#include "AZDetectorResult.h"
|
|
11
|
+
#include "Barcode.h"
|
|
12
|
+
#include "BitArray.h"
|
|
13
|
+
#include "BitMatrix.h"
|
|
14
|
+
#include "DecoderResult.h"
|
|
15
|
+
#include "ReedSolomon.h"
|
|
16
|
+
#include "ZXTestSupport.h"
|
|
17
|
+
#include "ZXAlgorithms.h"
|
|
18
|
+
|
|
19
|
+
#include <cstring>
|
|
20
|
+
#include <numeric>
|
|
21
|
+
#include <string>
|
|
22
|
+
#include <tuple>
|
|
23
|
+
#include <utility>
|
|
24
|
+
#include <vector>
|
|
25
|
+
|
|
26
|
+
namespace ZXing::Aztec {
|
|
27
|
+
|
|
28
|
+
enum class Table
|
|
29
|
+
{
|
|
30
|
+
UPPER,
|
|
31
|
+
LOWER,
|
|
32
|
+
MIXED,
|
|
33
|
+
DIGIT,
|
|
34
|
+
PUNCT,
|
|
35
|
+
BINARY
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
static const char* UPPER_TABLE[] = {
|
|
39
|
+
"CTRL_PS", " ", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
|
|
40
|
+
"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "CTRL_LL", "CTRL_ML", "CTRL_DL", "CTRL_BS"
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
static const char* LOWER_TABLE[] = {
|
|
44
|
+
"CTRL_PS", " ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
|
|
45
|
+
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "CTRL_US", "CTRL_ML", "CTRL_DL", "CTRL_BS"
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
static const char* MIXED_TABLE[] = {
|
|
49
|
+
"CTRL_PS", " ", "\1", "\2", "\3", "\4", "\5", "\6", "\7", "\b", "\t", "\n",
|
|
50
|
+
"\13", "\f", "\r", "\33", "\34", "\35", "\36", "\37", "@", "\\", "^", "_",
|
|
51
|
+
"`", "|", "~", "\177", "CTRL_LL", "CTRL_UL", "CTRL_PL", "CTRL_BS"
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
static const char* PUNCT_TABLE[] = {
|
|
55
|
+
"FLGN", "\r", "\r\n", ". ", ", ", ": ", "!", "\"", "#", "$", "%", "&", "'", "(", ")",
|
|
56
|
+
"*", "+", ",", "-", ".", "/", ":", ";", "<", "=", ">", "?", "[", "]", "{", "}", "CTRL_UL"
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
static const char* DIGIT_TABLE[] = {
|
|
60
|
+
"CTRL_PS", " ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ",", ".", "CTRL_UL", "CTRL_US"
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
static int TotalBitsInLayer(int layers, bool compact)
|
|
64
|
+
{
|
|
65
|
+
return ((compact ? 88 : 112) + 16 * layers) * layers;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Gets the array of bits from an Aztec Code matrix
|
|
70
|
+
*
|
|
71
|
+
* @return the array of bits
|
|
72
|
+
*/
|
|
73
|
+
static BitArray ExtractBits(const DetectorResult& ddata)
|
|
74
|
+
{
|
|
75
|
+
bool compact = ddata.isCompact();
|
|
76
|
+
int layers = ddata.nbLayers();
|
|
77
|
+
int baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines
|
|
78
|
+
std::vector<int> map(baseMatrixSize, 0);
|
|
79
|
+
|
|
80
|
+
if (compact) {
|
|
81
|
+
std::iota(map.begin(), map.end(), 0);
|
|
82
|
+
} else {
|
|
83
|
+
int matrixSize = baseMatrixSize + 1 + 2 * ((baseMatrixSize / 2 - 1) / 15);
|
|
84
|
+
int origCenter = baseMatrixSize / 2;
|
|
85
|
+
int center = matrixSize / 2;
|
|
86
|
+
for (int i = 0; i < origCenter; i++) {
|
|
87
|
+
int newOffset = i + i / 15;
|
|
88
|
+
map[origCenter - i - 1] = center - newOffset - 1;
|
|
89
|
+
map[origCenter + i] = center + newOffset + 1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
auto& matrix = ddata.bits();
|
|
93
|
+
BitArray rawbits(TotalBitsInLayer(layers, compact));
|
|
94
|
+
for (int i = 0, rowOffset = 0; i < layers; i++) {
|
|
95
|
+
int rowSize = (layers - i) * 4 + (compact ? 9 : 12);
|
|
96
|
+
// The top-left most point of this layer is <low, low> (not including alignment lines)
|
|
97
|
+
int low = i * 2;
|
|
98
|
+
// The bottom-right most point of this layer is <high, high> (not including alignment lines)
|
|
99
|
+
int high = baseMatrixSize - 1 - low;
|
|
100
|
+
// We pull bits from the two 2 x rowSize columns and two rowSize x 2 rows
|
|
101
|
+
for (int j = 0; j < rowSize; j++) {
|
|
102
|
+
int colOffset = j * 2;
|
|
103
|
+
for (int k = 0; k < 2; k++) {
|
|
104
|
+
// left column
|
|
105
|
+
rawbits.set(rowOffset + 0 * rowSize + colOffset + k, matrix.get(map[low + k], map[low + j]));
|
|
106
|
+
// bottom row
|
|
107
|
+
rawbits.set(rowOffset + 2 * rowSize + colOffset + k, matrix.get(map[low + j], map[high - k]));
|
|
108
|
+
// right column
|
|
109
|
+
rawbits.set(rowOffset + 4 * rowSize + colOffset + k, matrix.get(map[high - k], map[high - j]));
|
|
110
|
+
// top row
|
|
111
|
+
rawbits.set(rowOffset + 6 * rowSize + colOffset + k, matrix.get(map[high - j], map[low + k]));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
rowOffset += rowSize * 8;
|
|
115
|
+
}
|
|
116
|
+
return rawbits;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @brief Performs RS error correction on an array of bits.
|
|
121
|
+
*/
|
|
122
|
+
static std::tuple<BitArray, int, double> CorrectBits(const DetectorResult& ddata, const BitArray& rawbits)
|
|
123
|
+
{
|
|
124
|
+
int codewordSize = 0;
|
|
125
|
+
|
|
126
|
+
if (ddata.nbLayers() <= 2) {
|
|
127
|
+
codewordSize = 6;
|
|
128
|
+
} else if (ddata.nbLayers() <= 8) {
|
|
129
|
+
codewordSize = 8;
|
|
130
|
+
} else if (ddata.nbLayers() <= 22) {
|
|
131
|
+
codewordSize = 10;
|
|
132
|
+
} else {
|
|
133
|
+
codewordSize = 12;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
int numCodewords = Size(rawbits) / codewordSize;
|
|
137
|
+
int numDataCodewords = ddata.nbDatablocks();
|
|
138
|
+
int numECCodewords = numCodewords - numDataCodewords;
|
|
139
|
+
|
|
140
|
+
if (numCodewords < numDataCodewords)
|
|
141
|
+
throw FormatError("Invalid number of code words");
|
|
142
|
+
|
|
143
|
+
auto dataWords = ToInts<int>(rawbits, codewordSize, numCodewords, Size(rawbits) % codewordSize);
|
|
144
|
+
auto uec = ReedSolomonDecode(GF2nAztec(codewordSize), dataWords, numECCodewords);
|
|
145
|
+
|
|
146
|
+
if (!uec)
|
|
147
|
+
throw ChecksumError();
|
|
148
|
+
|
|
149
|
+
// drop the ECCodewords from the dataWords array
|
|
150
|
+
dataWords.resize(numDataCodewords);
|
|
151
|
+
|
|
152
|
+
// Now perform the unstuffing operation.
|
|
153
|
+
BitArray correctedBits;
|
|
154
|
+
// correctedBits.reserve(numDataCodewords * codewordSize - stuffedBits);
|
|
155
|
+
for (int dataWord : dataWords) {
|
|
156
|
+
if (dataWord == 0 || dataWord == (1 << codewordSize) - 1)
|
|
157
|
+
return {};
|
|
158
|
+
else if (dataWord == 1) // next codewordSize-1 bits are all zeros or all ones
|
|
159
|
+
correctedBits.appendBits(0, codewordSize - 1);
|
|
160
|
+
else if (dataWord == (1 << codewordSize) - 2)
|
|
161
|
+
correctedBits.appendBits(0xffffffff, codewordSize - 1);
|
|
162
|
+
else
|
|
163
|
+
correctedBits.appendBits(dataWord, codewordSize);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return {std::move(correctedBits), numECCodewords * 100 / numCodewords, *uec};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* gets the table corresponding to the char passed
|
|
171
|
+
*/
|
|
172
|
+
static Table GetTable(char t)
|
|
173
|
+
{
|
|
174
|
+
switch (t) {
|
|
175
|
+
case 'L': return Table::LOWER;
|
|
176
|
+
case 'P': return Table::PUNCT;
|
|
177
|
+
case 'M': return Table::MIXED;
|
|
178
|
+
case 'D': return Table::DIGIT;
|
|
179
|
+
case 'B': return Table::BINARY;
|
|
180
|
+
case 'U':
|
|
181
|
+
default: return Table::UPPER;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Gets the character (or string) corresponding to the passed code in the given table
|
|
187
|
+
*
|
|
188
|
+
* @param table the table used
|
|
189
|
+
* @param code the code of the character
|
|
190
|
+
*/
|
|
191
|
+
static const char* GetCharacter(Table table, int code)
|
|
192
|
+
{
|
|
193
|
+
switch (table) {
|
|
194
|
+
case Table::UPPER: return UPPER_TABLE[code];
|
|
195
|
+
case Table::LOWER: return LOWER_TABLE[code];
|
|
196
|
+
case Table::MIXED: return MIXED_TABLE[code];
|
|
197
|
+
case Table::PUNCT: return PUNCT_TABLE[code];
|
|
198
|
+
case Table::DIGIT: return DIGIT_TABLE[code];
|
|
199
|
+
case Table::BINARY: return nullptr; // should not happen
|
|
200
|
+
}
|
|
201
|
+
// silence gcc warning/error (this code can not be reached)
|
|
202
|
+
return nullptr;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* See ISO/IEC 24778:2008 Section 10.1
|
|
207
|
+
*/
|
|
208
|
+
static ECI ParseECIValue(BitArrayView& bits, const int flg)
|
|
209
|
+
{
|
|
210
|
+
int eci = 0;
|
|
211
|
+
for (int i = 0; i < flg; i++)
|
|
212
|
+
eci = 10 * eci + bits.readBits(4) - 2;
|
|
213
|
+
return ECI(eci);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* See ISO/IEC 24778:2008 Section 8
|
|
218
|
+
*/
|
|
219
|
+
static StructuredAppendInfo ParseStructuredAppend(Content& res)
|
|
220
|
+
{
|
|
221
|
+
std::string text(res.bytes.begin(), res.bytes.end());
|
|
222
|
+
StructuredAppendInfo sai;
|
|
223
|
+
std::string::size_type i = 0;
|
|
224
|
+
|
|
225
|
+
if (text[0] == ' ') { // Space-delimited id
|
|
226
|
+
std::string::size_type sp = text.find(' ', 1);
|
|
227
|
+
if (sp == std::string::npos)
|
|
228
|
+
return {};
|
|
229
|
+
|
|
230
|
+
sai.id = text.substr(1, sp - 1); // Strip space delimiters
|
|
231
|
+
i = sp + 1;
|
|
232
|
+
}
|
|
233
|
+
if (i + 1 >= text.size() || !IsUpper(text[i]) || !IsUpper(text[i + 1]))
|
|
234
|
+
return {};
|
|
235
|
+
|
|
236
|
+
sai.index = text[i] - 'A';
|
|
237
|
+
sai.count = text[i + 1] - 'A' + 1;
|
|
238
|
+
|
|
239
|
+
if (sai.count == 1 || sai.count <= sai.index) // If info doesn't make sense
|
|
240
|
+
sai.count = 0; // Choose to mark count as unknown
|
|
241
|
+
|
|
242
|
+
res.erase(0, narrow_cast<int>(i + 2)); // Remove
|
|
243
|
+
|
|
244
|
+
return sai;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
static void DecodeContent(const BitArray& bits, Content& res, bool &haveFNC1)
|
|
248
|
+
{
|
|
249
|
+
Table latchTable = Table::UPPER; // table most recently latched to
|
|
250
|
+
Table shiftTable = Table::UPPER; // table to use for the next read
|
|
251
|
+
|
|
252
|
+
auto remBits = BitArrayView(bits);
|
|
253
|
+
haveFNC1 = false;
|
|
254
|
+
|
|
255
|
+
while (remBits.size() >= (shiftTable == Table::DIGIT ? 4 : 5)) { // see ISO/IEC 24778:2008 7.3.1.2 regarding padding bits
|
|
256
|
+
if (shiftTable == Table::BINARY) {
|
|
257
|
+
if (remBits.size() <= 6) // padding bits
|
|
258
|
+
break;
|
|
259
|
+
int length = remBits.readBits(5);
|
|
260
|
+
if (length == 0)
|
|
261
|
+
length = remBits.readBits(11) + 31;
|
|
262
|
+
for (int i = 0; i < length; i++)
|
|
263
|
+
res.push_back(remBits.readBits(8));
|
|
264
|
+
// Go back to whatever mode we had been in
|
|
265
|
+
shiftTable = latchTable;
|
|
266
|
+
} else {
|
|
267
|
+
int size = shiftTable == Table::DIGIT ? 4 : 5;
|
|
268
|
+
int code = remBits.readBits(size);
|
|
269
|
+
const char* str = GetCharacter(shiftTable, code);
|
|
270
|
+
if (std::strncmp(str, "CTRL_", 5) == 0) {
|
|
271
|
+
// Table changes
|
|
272
|
+
// ISO/IEC 24778:2008 prescribes ending a shift sequence in the mode from which it was invoked.
|
|
273
|
+
// That's including when that mode is a shift.
|
|
274
|
+
// Our test case dlusbs.png for issue #642 exercises that.
|
|
275
|
+
latchTable = shiftTable; // Latch the current mode, so as to return to Upper after U/S B/S
|
|
276
|
+
shiftTable = GetTable(str[5]);
|
|
277
|
+
if (str[6] == 'L')
|
|
278
|
+
latchTable = shiftTable;
|
|
279
|
+
} else if (std::strcmp(str, "FLGN") == 0) {
|
|
280
|
+
int flg = remBits.readBits(3);
|
|
281
|
+
if (flg == 0) { // FNC1
|
|
282
|
+
haveFNC1 = true;
|
|
283
|
+
res.push_back(29); // May be removed at end if first/second FNC1
|
|
284
|
+
} else if (flg <= 6) {
|
|
285
|
+
// FLG(1) to FLG(6) ECI
|
|
286
|
+
res.switchEncoding(ParseECIValue(remBits, flg));
|
|
287
|
+
} else {
|
|
288
|
+
// FLG(7) is invalid
|
|
289
|
+
}
|
|
290
|
+
shiftTable = latchTable;
|
|
291
|
+
} else {
|
|
292
|
+
res.append(str);
|
|
293
|
+
// Go back to whatever mode we had been in
|
|
294
|
+
shiftTable = latchTable;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
ZXING_EXPORT_TEST_ONLY
|
|
301
|
+
DecoderResult Decode(const BitArray& bits)
|
|
302
|
+
{
|
|
303
|
+
Content res;
|
|
304
|
+
res.symbology = {'z', '0', 3};
|
|
305
|
+
bool haveFNC1;
|
|
306
|
+
|
|
307
|
+
try {
|
|
308
|
+
DecodeContent(bits, res, haveFNC1);
|
|
309
|
+
} catch (std::out_of_range&) { // see BitArrayView::readBits
|
|
310
|
+
return FormatError("Truncated bit stream");
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
if (res.bytes.empty())
|
|
314
|
+
return FormatError("Empty symbol content");
|
|
315
|
+
|
|
316
|
+
// Check for Structured Append - need 4 5-bit words, beginning with ML UL, ending with index and count
|
|
317
|
+
bool haveStructuredAppend = Size(bits) > 20 && ToInt(bits, 0, 5) == 29 // latch to MIXED (from UPPER)
|
|
318
|
+
&& ToInt(bits, 5, 5) == 29; // latch back to UPPER (from MIXED)
|
|
319
|
+
|
|
320
|
+
StructuredAppendInfo sai = haveStructuredAppend ? ParseStructuredAppend(res) : StructuredAppendInfo();
|
|
321
|
+
|
|
322
|
+
if (res.bytes.empty())
|
|
323
|
+
return FormatError("Empty symbol content after removing Structured Append info");
|
|
324
|
+
|
|
325
|
+
if (haveFNC1) {
|
|
326
|
+
if (res.bytes[0] == 29) {
|
|
327
|
+
res.symbology.modifier = '1'; // GS1
|
|
328
|
+
res.symbology.aiFlag = AIFlag::GS1;
|
|
329
|
+
res.erase(0, 1); // Remove FNC1
|
|
330
|
+
} else if (res.bytes.size() > 1 && IsAlpha(res.bytes[0]) && res.bytes[1] == 29) {
|
|
331
|
+
// FNC1 following single upper/lowercase letter (the AIM Application Indicator)
|
|
332
|
+
res.symbology.modifier = '2'; // AIM
|
|
333
|
+
res.symbology.aiFlag = AIFlag::AIM;
|
|
334
|
+
res.erase(1, 1); // Remove FNC1,
|
|
335
|
+
// The AIM Application Indicator character "A"-"Z"/"a"-"z" is left in the stream (ISO/IEC 24778:2008 16.2)
|
|
336
|
+
} else if (res.bytes.size() > 2 && IsDigit(res.bytes[0]) && IsDigit(res.bytes[1]) && res.bytes[2] == 29) {
|
|
337
|
+
// FNC1 following 2 digits (the AIM Application Indicator)
|
|
338
|
+
res.symbology.modifier = '2'; // AIM
|
|
339
|
+
res.symbology.aiFlag = AIFlag::AIM;
|
|
340
|
+
res.erase(2, 1); // Remove FNC1
|
|
341
|
+
// The AIM Application Indicator characters "00"-"99" are left in the stream (ISO/IEC 24778:2008 16.2)
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (sai.index != -1)
|
|
346
|
+
res.symbology.modifier += 6; // TODO: this is wrong as long as we remove the sai info from the content in ParseStructuredAppend
|
|
347
|
+
|
|
348
|
+
return DecoderResult(std::move(res)).setStructuredAppend(sai);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
DecoderResult DecodeRune(const DetectorResult& detectorResult) {
|
|
352
|
+
Content res;
|
|
353
|
+
res.symbology = {'z', 'C', 0}; // Runes cannot have ECI
|
|
354
|
+
|
|
355
|
+
// Bizarrely, this is what it says to do in the spec
|
|
356
|
+
auto runeString = ToString(detectorResult.runeValue(), 3);
|
|
357
|
+
res.append(runeString);
|
|
358
|
+
|
|
359
|
+
return DecoderResult(std::move(res));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
DecoderResult Decode(const DetectorResult& detectorResult)
|
|
363
|
+
{
|
|
364
|
+
try {
|
|
365
|
+
if (detectorResult.nbLayers() == 0) {
|
|
366
|
+
// This is a rune - just return the rune value
|
|
367
|
+
return DecodeRune(detectorResult);
|
|
368
|
+
}
|
|
369
|
+
auto [bits, ecLevel, uec] = CorrectBits(detectorResult, ExtractBits(detectorResult));
|
|
370
|
+
return Decode(bits).setEcLevel(std::to_string(ecLevel) + "%").addExtra(BarcodeExtra::UEC, uec, -1.0);
|
|
371
|
+
} catch (Error e) {
|
|
372
|
+
return e;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
} // namespace ZXing::Aztec
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2016 Nu-book Inc.
|
|
3
|
+
* Copyright 2016 ZXing authors
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#pragma once
|
|
8
|
+
|
|
9
|
+
namespace ZXing {
|
|
10
|
+
|
|
11
|
+
class DecoderResult;
|
|
12
|
+
|
|
13
|
+
namespace Aztec {
|
|
14
|
+
|
|
15
|
+
class DetectorResult;
|
|
16
|
+
|
|
17
|
+
DecoderResult Decode(const DetectorResult& detectorResult);
|
|
18
|
+
|
|
19
|
+
} // Aztec
|
|
20
|
+
} // ZXing
|