57 explicit Buffer(
size_t initialCapacity);
63 explicit Buffer(
const std::string& s);
98 bool Append(
const uint8_t *data,
const size_t datalen);
115 bool Insert(
const size_t index,
const char *s);
126 bool Insert(
const size_t index,
const std::string &s);
139 Insert(
const size_t index,
const uint8_t *data,
const size_t datalen);
150 bool Insert(
const size_t index,
const uint8_t c);
157 bool Remove(
const size_t index,
const size_t count);
223 size_t mustGrow(
size_t delta)
const;
225 bool shiftRight(
size_t offset,
size_t delta);
227 bool shiftLeft(
size_t offset,
size_t delta);
Basic line buffer.
Definition Buffer.h:48
size_t Capacity() const
Return the amount of memory allocated for the Buffer.
void HexDump(std::ostream &os)
uint8_t * Contents() const
Retrieve the buffer's contents.
Buffer(const char *s)
Construct with a C-style string.
std::string ToString() const
Buffer()
Construct an empty buffer with no memory allocated.
Buffer(const std::string &s)
\buffer Construct with an initial string.
size_t Length() const
The length of data stored in the buffer.
friend bool operator==(const Buffer &lhs, const Buffer &rhs)
bool Append(const uint8_t *data, const size_t datalen)
Append a byte buffer to the end of the buffer.
bool Append(const uint8_t c)
Append a single character to the end of the buffer.
uint8_t & operator[](size_t index)
bool Append(const std::string &s)
bool Insert(const size_t index, const std::string &s)
Insert a string into the buffer at index.
size_t Trim()
Resize the Buffer capacity based on its length.
void Resize(size_t newCapacity)
Changes the capacity of the buffer to newCapacity.
Buffer(size_t initialCapacity)
bool Append(const char *s)
Append a C-style string to the end of the buffer.
bool Remove(const size_t index, const size_t count)
Remove count bytes from the buffer at index.
bool Remove(size_t index)
Remove removes a single byte from the buffer.
bool Insert(const size_t index, const uint8_t *data, const size_t datalen)
Insert a uint8_t buffer into the buffer at index.
bool Insert(const size_t index, const char *s)
Insert a C-style string into the buffer at index.
bool Insert(const size_t index, const uint8_t c)
Insert a character into the buffer at index.
scsl is the top-level namespace containing all the code in this library.
Definition scsl.h:43
std::ostream & operator<<(std::ostream &os, Arena &arena)
bool operator!=(const Buffer &lhs, const Buffer &rhs)
Definition Buffer.h:240