// Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #ifndef BENCODEPARSER_H #define BENCODEPARSER_H #include #include #include #include #include typedef QMap Dictionary; Q_DECLARE_METATYPE(Dictionary) class BencodeParser { public: BencodeParser(); bool parse(const QByteArray &content); QString errorString() const; QMap dictionary() const; QByteArray infoSection() const; private: bool getByteString(QByteArray *byteString); bool getInteger(qint64 *integer); bool getList(QList *list); bool getDictionary(QMap *dictionary); QMap dictionaryValue; QString errString; QByteArray content; int index; int infoStart; int infoLength; }; #endif