Class to read const buffer.
More...
#include <bufferreader.hpp>
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 |
qi::BufferReader::~BufferReader |
( |
| ) |
|
qi::BufferReader::hasSubBuffer |
( |
| ) |
const |
Check if there is sub-buffer at the actual position.
- Returns
- true if there is sub-buffer, false otherwise.
qi::BufferReader::peek |
( |
size_t |
offset | ) |
const |
Check if we can read from the actual position toward offset bytes.
- Warning
- This function doesn't move the internal pointer.
- Parameters
-
offset | The relative offset. |
- Returns
- The pointer if it succeed. If actual position + offset exceed size of buffer return 0.
qi::BufferReader::position |
( |
| ) |
const |
return the actual position in the buffer.
- Returns
- The current offset.
qi::BufferReader::read |
( |
void * |
data, |
|
|
size_t |
length |
|
) |
| |
read and store data from the buffer.
- Parameters
-
data | A pre-allocated pointer to store read data. |
length | Size of the object pointed by data or size to read. |
- Returns
- size of really read and stored data.
qi::BufferReader::read |
( |
size_t |
offset | ) |
|
read data from buffer.
- Parameters
-
offset | Number of bytes to read. |
- Returns
- a pointer to data at the given
qi::BufferReader::seek |
( |
size_t |
offset | ) |
|
Move forward the buffer cursor by the given offset.
- Parameters
-
offset | Value for move forward the cursor. \ return Return true if succeed, false otherwise. |
qi::BufferReader::subBuffer |
( |
| ) |
|
return the sub-buffer at the actual position.
If there is no sub-buffer at actual position throw a std::runtime-error.
- Returns
- Return the sub-buffer if any.
The documentation for this class was generated from the following files: