|
libqi-api
2.1.0.18
|
Class to read const buffer. More...
#include <bufferreader.hpp>
Public Member Functions | |
| BufferReader (const Buffer &buf) | |
| Constructor. | |
| ~BufferReader () | |
| Default destructor. | |
| size_t | read (void *data, size_t length) |
| read and store data from the buffer. | |
| void * | read (size_t offset) |
| read data from buffer. | |
| bool | seek (size_t offset) |
| Move forward the buffer cursor by the given offset. | |
| void * | peek (size_t offset) const |
| Check if we can read from the actual position toward offset bytes. | |
| bool | hasSubBuffer () const |
| Check if there is sub-buffer at the actual position. | |
| const Buffer & | subBuffer () |
| return the sub-buffer at the actual position. | |
| size_t | position () const |
| return the actual position in the buffer. | |
Class to read const buffer.
This class is intendeed to read buffer. It store an internal data cursor and an internal sub-buffer index. All offset are relative to the current position.Definition at line 15 of file bufferreader.hpp.
| qi::BufferReader::BufferReader | ( | const Buffer & | buf | ) | [explicit] |
Constructor.
| buf | The buffer to copy. |
Default destructor.
| qi::BufferReader::hasSubBuffer | ( | ) | const |
Check if there is sub-buffer at the actual position.
| qi::BufferReader::peek | ( | size_t | offset | ) | const |
Check if we can read from the actual position toward offset bytes.
| offset | The relative offset. |
| qi::BufferReader::position | ( | ) | const |
return the actual position in the buffer.
| qi::BufferReader::read | ( | void * | data, |
| size_t | length | ||
| ) |
read and store data from the buffer.
| data | A pre-allocated pointer to store read data. |
| length | Size of the object pointed by data or size to read. |
| qi::BufferReader::read | ( | size_t | offset | ) |
read data from buffer.
| offset | Number of bytes to read. |
| qi::BufferReader::seek | ( | size_t | offset | ) |
Move forward the buffer cursor by the given offset.
| offset | Value for move forward the cursor. \ return Return true if succeed, false otherwise. |
return the sub-buffer at the actual position.
If there is no sub-buffer at actual position throw a std::runtime-error.