#include <auto_buf.h>
Public Types | |
enum | seekdir { beg, cur, end } |
Direction constants for seekp. More... | |
Public Member Functions | |
auto_buf () | |
Default constructor to create an empty buffer. | |
auto_buf (const E *s) | |
Constructor that copies a zero terminated element string using write. | |
auto_buf (const E *s, size_t n) | |
Constructor that copies an element string using write. | |
auto_buf (const auto_buf &rhs) | |
Constructor to copy one buffer to another. | |
auto_buf & | operator= (const auto_buf &rhs) |
Assignment operator, copies one buffer to another. | |
~auto_buf () | |
Destructor that frees any allocated storage. | |
size_t | length () const |
Returns the length of the controlled sequence. | |
size_t | count () const |
Returns the length of the controlled sequence. | |
size_t | size () const |
Returns the length of the controlled sequence. | |
E * | detach () |
Detach the encapsulated buffer and return. | |
void | attach (E *buf, size_t capacity) |
Attach the given buffer. | |
void | resize (size_t n) |
Resize the controlled sequence to N elements. | |
void | reserve (size_t n) |
Reserve space for at least N chars. | |
size_t | capacity () const |
Return the reserved size of the buffer. | |
void | clear () |
Clear the buffer. | |
void | reset () |
Reset the buffer. | |
void | put (E c) |
Put a single element. | |
size_t | write (const E *s, size_t n) |
Put a block of elements. | |
size_t | write (const E *s) |
Put a block of elements, terminated by a 0. | |
size_t | tellp () const |
Return the current seek position. | |
void | seekp (size_t p) |
Seek to an absolute offset. | |
void | seekp (int off, seekdir way) |
Seek to an absolute offset. | |
E * | str () const |
Return a pointer to the base of the controlled sequence. | |
E * | cstr () const |
Return a pointer to the current buffer position. | |
auto_buf & | operator<< (const E &c) |
Insertion operator for a single element. | |
auto_buf & | operator<< (const E *s) |
Insertion operator for a 0 terminated element string. | |
E & | operator[] (size_t offset) |
Array operator. | |
const E & | operator[] (size_t offset) const |
Array operator (const version). | |
Protected Member Functions | |
void | grow (size_t n) |
Reserve at least n bytes in the buffer. | |
void | extendp (size_t n) |
Extend the buffer by n bytes from the current position. | |
Protected Attributes | |
size_t | m_length |
Length of the controlled sequence. | |
size_t | m_capacity |
Reserved space. | |
size_t | m_pos |
Current output position. | |
E * | m_buf |
The base of the controlled sequence. |
E | The type of element to store |
|
Direction constants for seekp.
|
|
Default constructor to create an empty buffer. Throws no exceptions. |
|
Constructor that copies a zero terminated element string using write.
|
|
Constructor that copies an element string using write.
|
|
Constructor to copy one buffer to another.
|
|
Attach the given buffer.
The encapsulated buffer will be freed with free(). |
|
Return the reserved size of the buffer.
|
|
Clear the buffer. Note: does not reallocate, buffer will keep the same reserve capacity. See also reset. |
|
Returns the length of the controlled sequence.
|
|
Return a pointer to the current buffer position.
|
|
Detach the encapsulated buffer and return.
|
|
Extend the buffer by n bytes from the current position.
|
|
Reserve at least n bytes in the buffer.
|
|
Returns the length of the controlled sequence.
|
|
Insertion operator for a 0 terminated element string.
Reimplemented in OW32::auto_byte_buf. |
|
Insertion operator for a single element.
Reimplemented in OW32::auto_byte_buf. |
|
Assignment operator, copies one buffer to another.
|
|
Array operator (const version).
|
|
Array operator.
|
|
Put a single element.
|
|
Reserve space for at least N chars.
|
|
Reset the buffer. As for clear, but frees any allocated storage. |
|
Resize the controlled sequence to N elements.
|
|
Seek to an absolute offset.
|
|
Seek to an absolute offset.
|
|
Returns the length of the controlled sequence.
|
|
Return a pointer to the base of the controlled sequence.
|
|
Return the current seek position.
|
|
Put a block of elements, terminated by a 0.
Reimplemented in OW32::auto_byte_buf. |
|
Put a block of elements.
|