2018-07-11 23:09:22 -04:00
|
|
|
#ifndef VARICODE_H
|
|
|
|
#define VARICODE_H
|
|
|
|
|
2018-07-12 09:54:56 -04:00
|
|
|
/**
|
|
|
|
* (C) 2018 Jordan Sherer <kn4crd@gmail.com> - All Rights Reserved
|
|
|
|
**/
|
|
|
|
|
|
|
|
#include <QBitArray>
|
2018-07-12 15:14:41 -04:00
|
|
|
#include <QRegularExpression>
|
|
|
|
#include <QRegExp>
|
2018-07-11 23:09:22 -04:00
|
|
|
#include <QString>
|
2018-07-12 09:54:56 -04:00
|
|
|
#include <QVector>
|
2018-07-11 23:09:22 -04:00
|
|
|
|
2018-07-12 15:14:41 -04:00
|
|
|
|
2018-07-11 23:09:22 -04:00
|
|
|
class Varicode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//Varicode();
|
|
|
|
|
2018-07-12 15:14:41 -04:00
|
|
|
static QStringList parseCallsigns(QString const &input);
|
|
|
|
static QStringList parseGrids(QString const &input);
|
|
|
|
|
2018-07-12 20:31:45 -04:00
|
|
|
static QList<QVector<bool>> huffEncode(QString const& text);
|
|
|
|
static QVector<bool> huffFlatten(QList<QVector<bool>> &list);
|
2018-07-12 18:02:54 -04:00
|
|
|
static QString huffDecode(QVector<bool> const& bitvec);
|
2018-07-12 15:14:41 -04:00
|
|
|
|
2018-07-12 18:02:54 -04:00
|
|
|
static QVector<bool> strToBits(QString const& bitvec);
|
|
|
|
static QString bitsToStr(QVector<bool> const& bitvec);
|
2018-07-12 09:54:56 -04:00
|
|
|
|
2018-07-12 18:02:54 -04:00
|
|
|
static QVector<bool> intToBits(quint64 value, int expected=0);
|
|
|
|
static quint64 bitsToInt(QVector<bool> const value);
|
2018-07-12 09:54:56 -04:00
|
|
|
|
2018-07-12 18:02:54 -04:00
|
|
|
static quint8 unpack5bits(QString const& value);
|
|
|
|
static QString pack5bits(quint8 packed);
|
2018-07-12 09:54:56 -04:00
|
|
|
|
2018-07-12 18:02:54 -04:00
|
|
|
static quint16 unpack16bits(QString const& value);
|
|
|
|
static QString pack16bits(quint16 packed);
|
2018-07-12 09:54:56 -04:00
|
|
|
|
2018-07-12 18:02:54 -04:00
|
|
|
static quint32 unpack32bits(QString const& value);
|
|
|
|
static QString pack32bits(quint32 packed);
|
|
|
|
|
|
|
|
static quint64 unpack64bits(QString const& value);
|
|
|
|
static QString pack64bits(quint64 packed);
|
2018-07-13 00:55:48 -04:00
|
|
|
|
|
|
|
static quint32 packCallsign(QString const& value);
|
|
|
|
static QString unpackCallsign(quint32 value);
|
|
|
|
|
2018-07-13 04:42:23 -04:00
|
|
|
static QString packDirectedMessage(QString const& text, int *n);
|
|
|
|
static QStringList unpackDirectedMessage(QString const& text);
|
2018-07-11 23:09:22 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VARICODE_H
|