|
| Buffer (std::size_t length) |
|
| Buffer (T *pMem, std::size_t length) |
|
| Buffer (const T *pMem, std::size_t length) |
|
| Buffer (const Buffer &other) |
|
| Buffer (Buffer &&other) noexcept |
|
Buffer & | operator= (const Buffer &other) |
| Assignment operator.
|
|
Buffer & | operator= (Buffer &&other) noexcept |
| Move assignment operator.
|
|
| ~Buffer () |
| Destroys the Buffer.
|
|
void | resize (std::size_t newCapacity, bool preserveContent=true) |
|
void | setCapacity (std::size_t newCapacity, bool preserveContent=true) |
|
void | assign (const T *buf, std::size_t sz) |
|
void | append (const T *buf, std::size_t sz) |
| Resizes this buffer and appends the argument buffer.
|
|
void | append (T val) |
| Resizes this buffer by one element and appends the argument value.
|
|
void | append (const Buffer &buf) |
| Resizes this buffer and appends the argument buffer.
|
|
std::size_t | capacity () const |
| Returns the allocated memory size in elements.
|
|
std::size_t | capacityBytes () const |
| Returns the allocated memory size in bytes.
|
|
void | swap (Buffer &other) |
| Swaps the buffer with another one.
|
|
bool | operator== (const Buffer &other) const |
| Compare operator.
|
|
bool | operator!= (const Buffer &other) const |
| Compare operator.
|
|
void | clear () |
| Sets the contents of the buffer to zero.
|
|
std::size_t | size () const |
| Returns the used size of the buffer in elements.
|
|
std::size_t | sizeBytes () const |
| Returns the used size of the buffer in bytes.
|
|
T * | begin () |
| Returns a pointer to the beginning of the buffer.
|
|
const T * | begin () const |
| Returns a pointer to the beginning of the buffer.
|
|
T * | end () |
| Returns a pointer to end of the buffer.
|
|
const T * | end () const |
| Returns a pointer to the end of the buffer.
|
|
bool | empty () const |
| Return true if buffer is empty.
|
|
T & | operator[] (std::size_t index) |
|
const T & | operator[] (std::size_t index) const |
|
template<class T>
class Poco::Buffer< T >
A buffer class that allocates a buffer of a given type and size in the constructor and deallocates the buffer in the destructor.
This class is useful everywhere where a temporary buffer is needed.
Definition at line 31 of file Buffer.h.
template<class T >
void Poco::Buffer< T >::resize |
( |
std::size_t | newCapacity, |
|
|
bool | preserveContent = true ) |
|
inline |
Resizes the buffer capacity and size. If preserveContent is true, the content of the old buffer is copied over to the new buffer. The new capacity can be larger or smaller than the current one; if it is smaller, capacity will remain intact. Size will always be set to the new capacity.
Buffers only wrapping externally owned storage can not be resized. If resize is attempted on those, IllegalAccessException is thrown.
Definition at line 146 of file Buffer.h.
template<class T >
void Poco::Buffer< T >::setCapacity |
( |
std::size_t | newCapacity, |
|
|
bool | preserveContent = true ) |
|
inline |
Sets the buffer capacity. If preserveContent is true, the content of the old buffer is copied over to the new buffer. The new capacity can be larger or smaller than the current one; size will be set to the new capacity only if new capacity is smaller than the current size, otherwise it will remain intact.
Buffers only wrapping externally owned storage can not be resized. If resize is attempted on those, IllegalAccessException is thrown.
Definition at line 174 of file Buffer.h.