Add two convenient methods which may be used instead of testing or setting the
buffer length.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70407
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
size_t GetBufSize() const { return m_bufdata->m_size; }
size_t GetDataLen() const { return m_bufdata->m_len; }
+ bool IsEmpty() const { return GetDataLen() == 0; }
+
void SetBufSize(size_t size) { m_bufdata->ResizeIfNeeded(size); }
void SetDataLen(size_t len)
{
m_bufdata->m_len = len;
}
+ void Clear() { SetDataLen(0); }
+
// Ensure the buffer is big enough and return a pointer to it
void *GetWriteBuf(size_t sizeNeeded)
{
*/
void AppendData(const void *data, size_t len);
+ /**
+ Clear the buffer contents.
+
+ The buffer won't contain any data after this method is called.
+
+ @see IsEmpty()
+
+ @since 2.9.4
+ */
+ void Clear();
+
/**
Ensure that the buffer is big enough and return a pointer to the start
of the empty space in the buffer. This pointer can be used to directly
*/
void* GetWriteBuf(size_t sizeNeeded);
+ /**
+ Returns true if the buffer contains no data.
+
+ @see Clear()
+
+ @since 2.9.4
+ */
+ bool IsEmpty() const;
+
/**
Ensures the buffer has at least @a size bytes available.
*/