STXXL
1.4.1
|
binary_reader represents a binary_buffer_ref with an additional cursor with which the memory can be read incrementally.
Definition at line 480 of file binary_buffer.h.
Public Member Functions | |
binary_reader (const binary_buffer_ref &br) | |
Constructor, assign memory area from binary_buffer. More... | |
binary_reader (const void *data, size_t n) | |
Constructor, assign memory area from pointer and length. More... | |
binary_reader (const std::string &str) | |
Constructor, assign memory area from string, does NOT copy. More... | |
void | check_available (size_t n) const |
Throws a std::underflow_error unless n bytes are available at the cursor. More... | |
size_t | curr () const |
Return the current read cursor. More... | |
bool | cursor_available (size_t n) const |
Check that n bytes are available at the cursor. More... | |
bool | empty () const |
Return true if the cursor is at the end of the buffer. More... | |
template<typename Type > | |
Type | get () |
Fetch a single item of the template type Type from the buffer, advancing the cursor. Be careful with implicit type conversions! More... | |
binary_buffer_ref | get_binary_buffer_ref () |
Fetch a binary_buffer_ref to a binary string or blob which was put via put_string(). Does NOT copy the data. More... | |
std::string | get_string () |
Fetch a string which was put via put_string(). More... | |
uint32 | get_varint () |
Fetch a varint with up to 32-bit from the buffer at the cursor. More... | |
uint64 | get_varint64 () |
Fetch a 64-bit varint from the buffer at the cursor. More... | |
binary_reader & | read (void *outdata, size_t datalen) |
Fetch a number of unstructured bytes from the buffer, advancing the cursor. More... | |
std::string | read (size_t datalen) |
Fetch a number of unstructured bytes from the buffer as std::string, advancing the cursor. More... | |
binary_reader & | rewind () |
Reset the read cursor. More... | |
binary_reader & | skip (size_t n) |
Advance the cursor given number of bytes without reading them. More... | |
Public Member Functions inherited from stxxl::binary_buffer_ref | |
binary_buffer_ref (const binary_buffer &bb) | |
Constructor, assign memory area from binary_buffer. More... | |
binary_buffer_ref (const void *data, size_t n) | |
Constructor, assign memory area from pointer and length. More... | |
binary_buffer_ref (const std::string &str) | |
Constructor, assign memory area from string, does NOT copy. More... | |
const void * | data () const |
Return a pointer to the currently kept memory area. More... | |
bool | operator!= (const binary_buffer_ref &br) const |
Compare contents of two binary_buffer_refs. More... | |
bool | operator== (const binary_buffer_ref &br) const |
Compare contents of two binary_buffer_refs. More... | |
size_t | size () const |
Return the currently valid length in bytes. More... | |
std::string | str () const |
Explicit conversion to std::string (copies memory of course). More... | |
Protected Attributes | |
size_t | m_curr |
Current read cursor. More... | |
Protected Attributes inherited from stxxl::binary_buffer_ref | |
const char * | m_data |
Allocated buffer pointer. More... | |
size_t | m_size |
Size of valid data. More... | |
|
inline |
Constructor, assign memory area from binary_buffer.
Definition at line 488 of file binary_buffer.h.
|
inline |
Constructor, assign memory area from pointer and length.
Definition at line 493 of file binary_buffer.h.
|
inline |
Constructor, assign memory area from string, does NOT copy.
Definition at line 498 of file binary_buffer.h.
|
inline |
Throws a std::underflow_error unless n bytes are available at the cursor.
Definition at line 523 of file binary_buffer.h.
|
inline |
Return the current read cursor.
Definition at line 503 of file binary_buffer.h.
|
inline |
Check that n bytes are available at the cursor.
Definition at line 516 of file binary_buffer.h.
|
inline |
Return true if the cursor is at the end of the buffer.
Definition at line 530 of file binary_buffer.h.
|
inline |
Fetch a single item of the template type Type from the buffer, advancing the cursor. Be careful with implicit type conversions!
Definition at line 568 of file binary_buffer.h.
|
inline |
Fetch a binary_buffer_ref to a binary string or blob which was put via put_string(). Does NOT copy the data.
Definition at line 635 of file binary_buffer.h.
|
inline |
Fetch a string which was put via put_string().
Definition at line 627 of file binary_buffer.h.
|
inline |
Fetch a varint with up to 32-bit from the buffer at the cursor.
Definition at line 579 of file binary_buffer.h.
|
inline |
Fetch a 64-bit varint from the buffer at the cursor.
Definition at line 598 of file binary_buffer.h.
|
inline |
Fetch a number of unstructured bytes from the buffer, advancing the cursor.
Definition at line 546 of file binary_buffer.h.
|
inline |
Fetch a number of unstructured bytes from the buffer as std::string, advancing the cursor.
Definition at line 557 of file binary_buffer.h.
|
inline |
Reset the read cursor.
Definition at line 509 of file binary_buffer.h.
|
inline |
Advance the cursor given number of bytes without reading them.
Definition at line 536 of file binary_buffer.h.
|
protected |
Current read cursor.
Definition at line 484 of file binary_buffer.h.