26 explicit WvBufBase(WvBufStore *store) :
27 WvBufBaseCommonImpl<unsigned char>(store) { }
34 void putstr(WVSTRING_FORMAT_DECL)
67 {
return int(
get()); }
77 {
put((
unsigned char)ch); }
88 {
return int(
peek(offset)); }
106 size_t match(
const void *bytelist,
size_t numbytes)
107 {
return _match(bytelist, numbytes,
false); }
116 {
return match(chlist, strlen(chlist)); }
125 size_t notmatch(
const void *bytelist,
size_t numbytes)
126 {
return _match(bytelist, numbytes,
true); }
135 {
return notmatch(chlist, strlen(chlist)); }
139 void put(
unsigned char value)
141 void put(
const void *data,
size_t count)
143 (
const unsigned char*)data, count); }
144 void move(
void *data,
size_t count)
146 (
unsigned char*)data, count); }
147 void poke(
void *data,
int offset,
size_t count)
149 (
unsigned char*)data, offset, count); }
153 size_t _match(
const void *bytelist,
size_t numbytes,
bool reverse);
167 WvInPlaceBuf(
void *_data,
size_t _avail,
size_t _size,
168 bool _autofree =
false) :
170 _avail, _size, _autofree) { }
171 explicit WvInPlaceBuf(
size_t _size) :
175 void reset(
void *_data,
size_t _avail,
size_t _size,
176 bool _autofree =
false)
179 (
unsigned char*)_data, _avail, _size, _autofree);
190 WvConstInPlaceBuf(
const void *_data,
size_t _avail) :
192 (const unsigned char*)_data, _avail) { }
193 WvConstInPlaceBuf() :
195 void reset(
const void *_data,
size_t _avail)
198 (
const unsigned char*)_data, _avail);
209 WvCircularBuf(
void *_data,
size_t _avail,
size_t _size,
210 bool _autofree =
false) :
212 _avail, _size, _autofree) { }
213 explicit WvCircularBuf(
size_t _size) :
217 void reset(
void *_data,
size_t _avail,
size_t _size,
218 bool _autofree =
false)
221 (
unsigned char*)_data, _avail, _size, _autofree);
An abstract generic buffer template.
void poke(const T *data, int offset, size_t count)
Efficiently copies the specified number of elements from the specified storage location into the buff...
void put(const T *data, size_t count)
Writes the specified number of elements from the specified storage location into the buffer at its ta...
const T * peek(int offset, size_t count)
Returns a const pointer into the buffer at the specified offset to the specified number of elements w...
T get()
Reads the next element from the buffer.
void move(T *buf, size_t count)
Efficiently copies the specified number of elements from the buffer to the specified UNINITIALIZED st...
int getch()
Returns a single character from the buffer as an int.
WvString getstr(size_t len)
Returns the first len characters in the buffer.
size_t strchr(int ch)
Returns the number of characters that would have to be read to find the first instance of the charact...
size_t notmatch(const char *chlist)
Returns the number of leading buffer elements that do not match any of those in the list.
size_t notmatch(const void *bytelist, size_t numbytes)
Returns the number of leading buffer elements that do not match any of those in the list.
int peekch(int offset=0)
Peeks a single character from the buffer as an int.
WvString getstr()
Returns the entire buffer as a null-terminated WvString.
void putch(int ch)
Puts a single character into the buffer as an int.
size_t match(const char *chlist)
Returns the number of leading buffer elements that match any of those in the list.
size_t match(const void *bytelist, size_t numbytes)
Returns the number of leading buffer elements that match any of those in the list.
void putstr(WvStringParm str)
Copies a WvString into the buffer, excluding the null-terminator.
The generic buffer base type.
A buffer that acts like a cursor over a portion of another buffer.
A buffer that provides a read-write view over another buffer with a different datatype.
A buffer that wraps a pre-allocated array and provides read-write access to its elements using a circ...
void reset(T *_data, size_t _avail, size_t _size, bool _autofree=false)
Resets the underlying buffer pointer and properties.
WvCircularBufBase(unsigned char *_data, size_t _avail, size_t _size, bool _autofree=false)
The circular in place raw memory buffer type.
A buffer that wraps a pre-allocated array and provides read-only access to its elements.
void reset(const T *_data, size_t _avail)
Resets the underlying buffer pointer and properties.
WvConstInPlaceBufBase(const unsigned char *_data, size_t _avail)
The const in place raw memory buffer type.
A raw memory read-only buffer backed by a constant WvString.
WvConstStringBuffer(WvStringParm _str)
Creates a new buffer backed by a constant string.
WvConstStringBuffer()
Creates a new empty buffer backed by a null string.
void reset(WvStringParm _str)
Resets the buffer contents to a new string.
WvString str()
Returns the string that backs the array.
A buffer that dynamically grows and shrinks based on demand.
A buffer that wraps a pre-allocated array and provides read-write access to its elements.
void reset(T *_data, size_t _avail, size_t _size, bool _autofree=false)
Resets the underlying buffer pointer and properties.
WvInPlaceBufBase(unsigned char *_data, size_t _avail, size_t _size, bool _autofree=false)
The in place raw memory buffer type.
A buffer that is always empty.
WvString is an implementation of a simple and efficient printable-string class.