Commit 3f161879 authored by Volker Krause's avatar Volker Krause
Browse files

Add Base64 decoding utility function

Helps with decoding Thalys barcodes.
parent a3f04132
......@@ -129,6 +129,11 @@ QString JsApi::Barcode::toBase64(const QVariant &b) const
return QString::fromUtf8(b.toByteArray().toBase64());
}
QVariant JsApi::Barcode::fromBase64(const QString &s) const
{
return QByteArray::fromBase64(s.toUtf8());
}
QVariant JsApi::Barcode::toBitArray(const QVariant &b) const
{
return QVariant::fromValue(JsApi::BitArray(b.toByteArray()));
......
......@@ -71,6 +71,8 @@ public:
/** Converts the given QByteArray into an base64 encoded string. */
Q_INVOKABLE QString toBase64(const QVariant &b) const;
/** Converts a given Base64 encoded string to a QByteArray. */
Q_INVOKABLE QVariant fromBase64(const QString &s) const;
/** Converts the given QByteArray into a BitArray. */
Q_INVOKABLE QVariant toBitArray(const QVariant &b) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment