26 #include <util/constants.h>
27 #include <ktorrent_export.h>
91 const Value & data()
const {
return value;}
107 QList<DictEntry> children;
113 QList<QByteArray>
keys()
const;
157 QString
getString(
const QByteArray& key,QTextCodec* tc);
172 QList<BNode*> children;
void setLength(Uint32 l)
Set the length.
void printDebugInfo() override
Print some debugging info.
QString getString(Uint32 idx, QTextCodec *tc)
Same as getValue, except directly returns a QString, if something goes wrong, an error will be thrown...
Base class for a node in a b-encoded piece of data.
Type getType() const
Get the type of node.
QByteArray getByteArray(Uint32 idx)
Same as getValue, except directly returns an QByteArray, if something goes wrong, an error will be th...
void printDebugInfo() override
Print some debugging info.
QList< QByteArray > keys() const
Get a list of keys.
Uint32 getLength() const
Get the length this node takes up in the bytearray.
QString getString(const QByteArray &key, QTextCodec *tc)
Same as getValue, except directly returns a QString, if something goes wrong, an error will be thrown...
BValueNode * getValue(Uint32 idx)
BNode(Type type, Uint32 off)
Uint32 getNumChildren() const
Get the number of nodes in the list.
qint64 getInt64(Uint32 idx)
Same as getValue, except directly returns a qint64, if something goes wrong, an error will be thrown.
BListNode * getList(const QByteArray &key)
BNode * getChild(Uint32 idx)
BListNode * getList(Uint32 idx)
BNode * getData(const QByteArray &key)
BDictNode * getDict(Uint32 idx)
qint64 getInt64(const QByteArray &key)
Same as getValue, except directly returns a qint64, if something goes wrong, an error will be thrown.
Represents a value (string,bytearray or int) in bencoded data.
virtual void printDebugInfo()=0
Print some debugging info.
BDictNode * getDict(const QByteArray &key)
int getInt(Uint32 idx)
Same as getValue, except directly returns an int, if something goes wrong, an error will be thrown.
Represents a list in bencoded data.
void insert(const QByteArray &key, BNode *node)
Represents a dictionary in bencoded data.
int getInt(const QByteArray &key)
Same as getValue, except directly returns an int, if something goes wrong, an error will be thrown.
BValueNode * getValue(const QByteArray &key)
QByteArray getByteArray(const QByteArray &key)
Same as getValue, except directly returns an QByteArray, if something goes wrong, an error will be th...
Uint32 getOffset() const
Get the offset in the bytearray where this node starts.
void printDebugInfo() override
Print some debugging info.