1 #ifndef LIBFILEZILLA_BUFFER_HEADER
2 #define LIBFILEZILLA_BUFFER_HEADER
25 explicit buffer(
size_t capacity);
30 ~
buffer() {
delete data_; }
36 unsigned char*
get() {
return pos_; }
42 unsigned char*
get(
size_t write_size);
45 void add(
size_t added);
51 void consume(
size_t consumed);
53 size_t size()
const {
return size_; }
64 void append(
unsigned char const* data,
size_t len);
65 void append(std::string
const& str);
67 bool empty()
const {
return size_ == 0; }
68 explicit operator bool()
const {
72 void reserve(
size_t capacity);
75 unsigned char operator[](
size_t i)
const {
return pos_[i]; }
76 unsigned char & operator[](
size_t i) {
return pos_[i]; }
84 unsigned char* data_{};
85 unsigned char* pos_{};
Sets some global macros and further includes string.hpp.
The buffer class is a simple buffer where data can be appended at the end and consumed at the front...
Definition: buffer.hpp:19
unsigned char operator[](size_t i) const
Gets element at offset i. Does not do bounds checking.
Definition: buffer.hpp:75