KItinerary

bytearray.h
1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KITINERARY_JSAPI_BYTEARRAY_H
8#define KITINERARY_JSAPI_BYTEARRAY_H
9
10#include <QObject>
11#include <QJSValue>
12#include <QVariant>
13
14class QByteArray;
15
16namespace KItinerary {
17namespace JsApi {
18
19/** API for dealing with QByteArray and/or JS ArrayBuffer objects. */
20class ByteArray : public QObject
21{
23public:
24 /** Perform zlib decompression on the given byte array.
25 * @returns a JS ArrayBuffer with the decompressed result.
26 */
27 Q_INVOKABLE QJSValue inflate(const QByteArray &input) const;
28
29 /** Converts the given QByteArray or JS ArrayBuffer into an base64 encoded string. */
30 Q_INVOKABLE QString toBase64(const QByteArray &input) const;
31 /** Converts a given Base64 encoded string to a JS ArrayBuffer. */
32 Q_INVOKABLE QJSValue fromBase64(const QString &b64) const;
33
34 /** Convert a QByteArray/ArrayBuffer to a string, assuming UTF-8 encoding. */
35 Q_INVOKABLE QString decodeUtf8(const QByteArray &input) const;
36 /** Convert a QByteArray/ArrayBuffer to a string, assuming Latin1 encoding. */
37 Q_INVOKABLE QString decodeLatin1(const QByteArray &input) const;
38
39 /** Converts the given QByteArray or JS ArrayBuffer into a BitArray. */
40 Q_INVOKABLE QVariant toBitArray(const QByteArray &input) const;
41
42 /** Creates a Protocol Buffers stream reader for the given JS ArrayBuffer. */
44
45 /** Decode/decrypt a UK RSP-6 ticket barcode. */
47
48 /** Convert a QByteArray to a JS ArrayBuffer.
49 * This is mainly a migration aid until we return ArrayBuffers everywhere.
50 */
51 Q_INVOKABLE QJSValue toArrayBuffer(const QByteArray &input) const;
52};
53
54}}
55
56#endif // KITINERARY_JSAPI_BYTEARRAY_H
API for dealing with QByteArray and/or JS ArrayBuffer objects.
Definition bytearray.h:21
Q_INVOKABLE QJSValue inflate(const QByteArray &input) const
Perform zlib decompression on the given byte array.
Definition bytearray.cpp:20
Q_INVOKABLE QJSValue fromBase64(const QString &b64) const
Converts a given Base64 encoded string to a JS ArrayBuffer.
Definition bytearray.cpp:53
Q_INVOKABLE QString decodeLatin1(const QByteArray &input) const
Convert a QByteArray/ArrayBuffer to a string, assuming Latin1 encoding.
Definition bytearray.cpp:65
Q_INVOKABLE QJSValue toArrayBuffer(const QByteArray &input) const
Convert a QByteArray to a JS ArrayBuffer.
Definition bytearray.cpp:87
Q_INVOKABLE QJSValue decodeRsp6Ticket(const QString &text) const
Decode/decrypt a UK RSP-6 ticket barcode.
Definition bytearray.cpp:82
Q_INVOKABLE QString toBase64(const QByteArray &input) const
Converts the given QByteArray or JS ArrayBuffer into an base64 encoded string.
Definition bytearray.cpp:48
Q_INVOKABLE QVariant toProtobufStreamReader(const QByteArray &input) const
Creates a Protocol Buffers stream reader for the given JS ArrayBuffer.
Definition bytearray.cpp:77
Q_INVOKABLE QString decodeUtf8(const QByteArray &input) const
Convert a QByteArray/ArrayBuffer to a string, assuming UTF-8 encoding.
Definition bytearray.cpp:58
Q_INVOKABLE QVariant toBitArray(const QByteArray &input) const
Converts the given QByteArray or JS ArrayBuffer into a BitArray.
Definition bytearray.cpp:72
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 Fri Nov 22 2024 12:00:34 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.