diff options
| author | Arno <arno@disconnect.de> | 2016-08-19 17:51:10 +0200 |
|---|---|---|
| committer | Arno <arno@disconnect.de> | 2016-08-19 17:51:10 +0200 |
| commit | 8ab990b7c6fb5348b09f451878a80e2c70695876 (patch) | |
| tree | 8a90c848308c09e729d9256a6af921abfeb786b3 /torrentparser.h | |
| parent | cead61f9598302a83fa72e99f82f7bfa2c0b19cb (diff) | |
| download | ShemovCleaner-8ab990b7c6fb5348b09f451878a80e2c70695876.tar.gz ShemovCleaner-8ab990b7c6fb5348b09f451878a80e2c70695876.tar.bz2 ShemovCleaner-8ab990b7c6fb5348b09f451878a80e2c70695876.zip | |
Added torrent support
The BEncode parser is loosely based on this:
https://github.com/jif/Bencode/blob/master/bencode.cpp
Not perfect, but enough to display all the essential data in the shiny
new TorrentDisplay dialog.
Diffstat (limited to 'torrentparser.h')
| -rw-r--r-- | torrentparser.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/torrentparser.h b/torrentparser.h new file mode 100644 index 0000000..02129fb --- /dev/null +++ b/torrentparser.h @@ -0,0 +1,31 @@ +#ifndef TORRENTPARSER_H +#define TORRENTPARSER_H + +#include <QObject> +#include <QString> +#include <QByteArray> +#include <QList> +#include <QVariant> +#include <QHash> + +class TorrentParser : public QObject { + Q_OBJECT + public: + TorrentParser(const QString file, QObject *parent = 0); + const QList<QVariant> parse(); + const QString lastError() const { return mLastError; } + + private: + const QVariant parseObject(); + const QByteArray parseString(); + int parseInt(); + const QList<QVariant> parseList(); + const QHash<QString,QVariant> parseDict(); + QString mFile; + QString mLastError; + QByteArray mData; + int mPos; + bool mOk; +}; + +#endif // TORRENTPARSER_H |
