39 if (size == std::numeric_limits<size_t>::max())
81 return *
reinterpret_cast<char *
>(
data.
index(pos));
86 return *
reinterpret_cast<const char *
>(
data.
c_index(pos));
130 data.
write((
unsigned char *)s, std::strlen(s));
179template <
typename Elem,
typename Traits>
180std::basic_ostream<Elem, Traits> &
operator<<(std::basic_ostream<Elem, Traits> &os,
#define OPENVPN_BUFFER_THROW(exc)
void clear()
Clears the contents of the buffer.
void init(const size_t capacity, const unsigned int flags)
Initializes the buffer with the specified capacity and flags.
bool defined() const
Returns true if the buffer is not empty.
void set_trailer(const T &value)
Place a T object after the last object in the array, with possible resize to contain it....
const T * c_data() const
Returns a const pointer to the start of the buffer.
void append(const B &other)
Append data from another buffer to this buffer.
void push_back(const T &value)
Append a T object to the end of the array, resizing the array if necessary.
ConstBufferType range(size_t offset, size_t len) const
Get a range of the buffer as a ConstBufferType object.
void reserve(const size_t n)
Reserve additional memory for the buffer.
bool allocated() const
Returns true if the data memory is defined (allocated).
size_t size() const
Returns the size of the buffer in T objects.
void write(const T *data, const size_t size)
Write data to the buffer.
const T * c_index(const size_t index) const
Get a const pointer to the element at the specified index in the array.
T * index(const size_t index)
Get a mutable index into the array.
A string-like type that clears the buffer contents on delete.
char & operator[](size_t pos)
const char * c_str() const
bool operator==(const std::string &str) const
SafeString & append(const SafeString &str)
static constexpr unsigned int BUF_FLAGS
bool operator!=(const char *str) const
static constexpr size_t INITIAL_CAPACITY
bool operator!=(const std::string &str) const
SafeString(const std::string &str)
std::string to_string() const
SafeString & append(const char *s)
SafeString & operator+=(const SafeString &str)
const char & operator[](size_t pos) const
SafeString(const char *str)
void reserve(const size_t n)
SafeString & append(const SafeString &str, size_t subpos, size_t sublen)
SafeString(const char *str, const size_t size)
SafeString & operator+=(char c)
bool operator==(const char *str) const
SafeString & operator+=(const char *s)
bool str_neq(const char *s1, const char *s2)
Support deferred server-side state creation when client connects.
std::basic_ostream< Elem, Traits > & operator<<(std::basic_ostream< Elem, Traits > &os, const SafeString &ss)
std::string buf_to_string(const Buffer &buf)
@ DESTRUCT_ZERO
if enabled, destructor will zero data before deletion
@ GROW
if enabled, buffer will grow (otherwise buffer_full exception will be thrown)