#include <BDecoder.h> [code]
This class encapsulates some functions, which would make it easier to read bencoded data out of raw data buffers.
It is safe to read pass the end of the underlying raw data. Use hasReadPastEnd() to check whether such event occurred. Use hasReadAll() to check whether all underlying data has been read.
If you want to change the binary format used by some function or add support for further user types, derive a new class from this one.
Definition at line 52 of file BDecoder.h.
Public Member Functions | |
| BDecoder (const QByteArray &rawData) | |
| Constructs a BDecoder object for rawData. | |
| ~BDecoder () | |
| Destructor of BDecoder. | |
| auto_ptr< BItem > | readNext () |
| Reads the next BItem form the underlying raw data. | |
| bool | hasReadPassEnd () const |
| Tells whether a read would have read past the end of the data buffer. | |
| bool | hasReadAll () const |
| Tells whether all data from the underlying data buffer has been read. | |
| bool | hasReadAllCorrectly () const |
| Tells whether everything has been read correctly. | |
Private Member Functions | |
| BDecoder (const BDecoder &) | |
| BDecoder & | operator= (const BDecoder &) |
Private Attributes | |
| auto_ptr< BinaryReader > | binaryReader |
|
|
|
|
|
Constructs a BDecoder object for rawData. Creates a BinaryReader object. Initializes the underlying raw data buffer of the BinaryReader object using rawData and sets the byte order to little endean. Definition at line 39 of file BDecoder.cpp. |
|
|
Destructor of BDecoder. Deletes the created BinaryReader object. Definition at line 48 of file BDecoder.cpp. |
|
|
Tells whether all data from the underlying data buffer has been read.
Definition at line 74 of file BDecoder.cpp. |
|
|
Tells whether everything has been read correctly.
Definition at line 82 of file BDecoder.cpp. |
|
|
Tells whether a read would have read past the end of the data buffer.
Definition at line 66 of file BDecoder.cpp. |
|
|
|
|
|
Reads the next BItem form the underlying raw data. Reads the next item or returns an invalid object if the data is invalid. It will not read beyond the end of the buffer and if it would have done so, then hasReadPastEnd() would return true. Definition at line 58 of file BDecoder.cpp. |
|
|
Definition at line 66 of file BDecoder.h. |