1 #ifndef LIBFILEZILLA_BUFFER_HEADER 2 #define LIBFILEZILLA_BUFFER_HEADER 29 explicit buffer(
size_t capacity);
34 ~
buffer() {
delete[] data_; }
40 unsigned char const*
get()
const {
return pos_; }
41 unsigned char*
get() {
return pos_; }
61 unsigned char*
get(
size_t write_size);
64 void add(
size_t added);
70 void consume(
size_t consumed);
72 size_t size()
const {
return size_; }
83 void append(
unsigned char const* data,
size_t len);
84 void append(std::string
const& str);
86 bool empty()
const {
return size_ == 0; }
87 explicit operator bool()
const {
91 void reserve(
size_t capacity);
94 unsigned char operator[](
size_t i)
const {
return pos_[i]; }
95 unsigned char & operator[](
size_t i) {
return pos_[i]; }
97 bool operator==(buffer
const& rhs)
const;
99 bool operator!=(buffer
const& rhs)
const {
100 return !(*
this == rhs);
109 unsigned char* data_{};
110 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:23
unsigned char operator[](size_t i) const
Gets element at offset i. Does not do bounds checking.
Definition: buffer.hpp:94