File indexing completed on 2024-12-29 04:49:57

0001 /*
0002     SPDX-FileCopyrightText: 2018-2022 Volker Krause <vkrause@kde.org>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 #ifndef KITINERARY_TOKEN_H
0007 #define KITINERARY_TOKEN_H
0008 
0009 #include "kitinerary_export.h"
0010 
0011 #include <qobjectdefs.h>
0012 
0013 class QStringView;
0014 class QVariant;
0015 
0016 namespace KItinerary {
0017 
0018 /** Barcode token utilities.
0019  *  @see Ticket
0020  *  @see ProgramMembership
0021  *  @since 5.20.41
0022  */
0023 class KITINERARY_EXPORT Token
0024 {
0025     Q_GADGET
0026 public:
0027     /** Token format. */
0028     enum TokenType {
0029         Unknown, ///< Unknown or empty ticket token
0030         Url, ///< A download URL, if shown in a barcode its format can be determined by the application.
0031         QRCode, ///< QR code
0032         AztecCode, ///< Aztec code. Binary content is handled transparently by tokenData().
0033         Code128, ///< Code 128 barcode
0034         DataMatrix, ///< A DataMatrix barcode
0035         PDF417, ///< A PDF417 barcode
0036         Code39, ///< A Code 39 barcode
0037         EAN13, ///< A EAN13 barcode
0038     };
0039     Q_ENUM(TokenType)
0040 
0041     /** Determine token type for the given token. */
0042     static TokenType tokenType(QStringView token);
0043     /** Determine token content for the given token. */
0044     static QVariant tokenData(const QString &token);
0045 };
0046 
0047 }
0048 
0049 #endif // KITINERARY_TOKEN_H