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_; }
61 void append(
unsigned char const* data,
size_t len);
62 void append(std::string
const& str);
64 bool empty()
const {
return size_ == 0; }
65 explicit operator bool()
const {
69 void reserve(
size_t capacity);
72 unsigned char operator[](
size_t i)
const {
return pos_[i]; }
73 unsigned char & operator[](
size_t i) {
return pos_[i]; }
81 unsigned char* data_{};
82 unsigned char* pos_{};
The namespace used by libfilezilla.
Definition: apply.hpp:16
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:72