KItinerary

barcode.h
1/*
2 SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <KItinerary/BarcodeDecoder>
10
11#include <QDateTime>
12#include <QJSValue>
13#include <QObject>
14
15namespace KItinerary {
16
17class BarcodeDecoder;
18
19namespace JsApi {
20
21/** Barcode decoding functions. */
22class Barcode : public QObject
23{
25public:
26 /** Decode a PDF417 barcode image.
27 * @param img An image containing the barcode, e.g. a PdfImage instance.
28 */
29 Q_INVOKABLE QString decodePdf417(const QVariant &img) const;
30 /** Decode a Aztec barcode image.
31 * @param img An image containing the barcode, e.g. a PdfImage instance.
32 */
33 Q_INVOKABLE QString decodeAztec(const QVariant &img) const;
34 /** Decode a Aztec barcode image containing binary data.
35 * @param img An image containing the barcode, e.g. a PdfImage instance.
36 * @return a JS ArrayBuffer
37 */
39 /** Decode as QR barcode image.
40 * @param img An image containing the barcode, e.g. a PdfImage instance.
41 */
42 Q_INVOKABLE QString decodeQR(const QVariant &img) const;
43 /** Decode a DataMatrix barcode image.
44 * @param img An image containing the barcode, e.g. a PdfImage instance.
45 */
47 /** Attempts to decode any barcode found in the given image.
48 * This is the most expensive of the above option, and should only be
49 * used if no other alternative is available.
50 * @param img An image containing the barcode, e.g. a PdfImage instance.
51 */
53
54 ///@cond internal
55 void setDecoder(const BarcodeDecoder *decoder);
56 ///@endcond
57
58private:
59 QString decodeBarcode(const QVariant &img, BarcodeDecoder::BarcodeTypes hints) const;
60
61 const BarcodeDecoder *m_decoder = nullptr;
62};
63
64}
65}
66
Barcode decoding with result caching.
Barcode decoding functions.
Definition barcode.h:23
Q_INVOKABLE QJSValue decodeAztecBinary(const QVariant &img) const
Decode a Aztec barcode image containing binary data.
Definition barcode.cpp:32
Q_INVOKABLE QString decodeAztec(const QVariant &img) const
Decode a Aztec barcode image.
Definition barcode.cpp:27
Q_INVOKABLE QString decodePdf417(const QVariant &img) const
Decode a PDF417 barcode image.
Definition barcode.cpp:22
Q_INVOKABLE QString decodeQR(const QVariant &img) const
Decode as QR barcode image.
Definition barcode.cpp:49
Q_INVOKABLE QString decodeDataMatrix(const QVariant &img) const
Decode a DataMatrix barcode image.
Definition barcode.cpp:54
Q_INVOKABLE QString decodeAnyBarcode(const QVariant &img) const
Attempts to decode any barcode found in the given image.
Definition barcode.cpp:59
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:36 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.