From 8ab990b7c6fb5348b09f451878a80e2c70695876 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 19 Aug 2016 17:51:10 +0200 Subject: 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. --- torrentparser.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 torrentparser.h (limited to 'torrentparser.h') 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 +#include +#include +#include +#include +#include + +class TorrentParser : public QObject { + Q_OBJECT + public: + TorrentParser(const QString file, QObject *parent = 0); + const QList parse(); + const QString lastError() const { return mLastError; } + + private: + const QVariant parseObject(); + const QByteArray parseString(); + int parseInt(); + const QList parseList(); + const QHash parseDict(); + QString mFile; + QString mLastError; + QByteArray mData; + int mPos; + bool mOk; +}; + +#endif // TORRENTPARSER_H -- cgit v1.2.3-70-g09d2