#include </home/zeitlin/src/wx/github/interface/wx/buffer.h>
wxCharTypeBuffer<T> is a template class for storing characters.
The difference from wxScopedCharTypeBuffer<T> is that this class doesn't have non-owned mode and the data stored in it are valid for as long as the buffer instance exists. Other than that, this class' behaviour is the same as wxScopedCharTypeBuffer<T>'s -- in particular, the data are reference-counted and copying the buffer is cheap.
wxScopedCharTypeBuffer<T> buffers can be converted into wxCharTypeBuffer<T>.
T | The type of the characters stored in this class. |
Public Member Functions | |
wxCharTypeBuffer (const CharType *str=NULL, size_t len=wxNO_LEN) | |
Creates (owned) buffer from str and takes ownership of it. | |
wxCharTypeBuffer (size_t len) | |
Creates (owned) buffer of size len. | |
wxCharTypeBuffer (const wxCharTypeBuffer &src) | |
Copy constructor. | |
wxCharTypeBuffer (const wxScopedCharTypeBuffer< T > &src) | |
Makes a copy of scoped buffer src. | |
wxCharTypeBuffer & | operator= (const CharType *str) |
Assigns str to this buffer and takes ownership of it (i.e. | |
wxCharTypeBuffer & | operator= (const wxCharTypeBuffer &src) |
Assignment operator behaves in the same way as the copy constructor. | |
wxCharTypeBuffer & | operator= (const wxScopedCharTypeBuffer< T > &src) |
Assigns a scoped buffer to this buffer. | |
bool | extend (size_t len) |
Extends the buffer to have size len. | |
bool | shrink (size_t len) |
Shrinks the buffer to have size len and NUL-terminates the string at this length. |
wxCharTypeBuffer< T >::wxCharTypeBuffer | ( | const CharType * | str = NULL , |
size_t | len = wxNO_LEN |
||
) |
Creates (owned) buffer from str and takes ownership of it.
str | String data. |
len | If specified, length of the string, otherwise the string is considered to be NUL-terminated. |
wxCharTypeBuffer< T >::wxCharTypeBuffer | ( | size_t | len | ) |
Creates (owned) buffer of size len.
wxCharTypeBuffer< T >::wxCharTypeBuffer | ( | const wxCharTypeBuffer< T > & | src | ) |
Copy constructor.
Increases reference count on the data, does not make wxStrdup() copy of the data.
wxCharTypeBuffer< T >::wxCharTypeBuffer | ( | const wxScopedCharTypeBuffer< T > & | src | ) |
Makes a copy of scoped buffer src.
If src is a non-owned buffer, a copy of its data is made using wxStrdup(). If src is an owned buffer, this constructor behaves in the usual way (reference count on buffer data is incremented).
bool wxCharTypeBuffer< T >::extend | ( | size_t | len | ) |
Extends the buffer to have size len.
Can only be called on buffers that don't share data with another buffer (i.e. reference count of the data is 1).
wxCharTypeBuffer& wxCharTypeBuffer< T >::operator= | ( | const CharType * | str | ) |
Assigns str to this buffer and takes ownership of it (i.e.
the buffer becomes "owned").
wxCharTypeBuffer& wxCharTypeBuffer< T >::operator= | ( | const wxCharTypeBuffer< T > & | src | ) |
Assignment operator behaves in the same way as the copy constructor.
wxCharTypeBuffer& wxCharTypeBuffer< T >::operator= | ( | const wxScopedCharTypeBuffer< T > & | src | ) |
Assigns a scoped buffer to this buffer.
If src is a non-owned buffer, a copy of its data is made using wxStrdup(). If src is an owned buffer, the assignment behaves in the usual way (reference count on buffer data is incremented).
Reimplemented from wxScopedCharTypeBuffer< T >.
bool wxCharTypeBuffer< T >::shrink | ( | size_t | len | ) |
Shrinks the buffer to have size len and NUL-terminates the string at this length.
Can only be called on buffers that don't share data with another buffer (i.e. reference count of the data is 1).
len | Length to shrink to. Must not be larger than current length. |