 |
libfilezilla
|
Go to the documentation of this file. 1 #ifndef LIBFILEZILLA_BUFFER_HEADER
2 #define LIBFILEZILLA_BUFFER_HEADER
31 explicit buffer(
size_t capacity);
36 ~
buffer() {
delete[] data_; }
42 unsigned char const*
get()
const {
return pos_; }
43 unsigned char* get() {
return pos_; }
63 unsigned char* get(
size_t write_size);
66 void add(
size_t added);
72 void consume(
size_t consumed);
74 size_t size()
const {
return size_; }
85 void append(
unsigned char const* data,
size_t len);
86 void append(std::string_view
const& str);
87 void append(std::vector<uint8_t>
const& data);
88 void append(
unsigned char v);
90 bool empty()
const {
return size_ == 0; }
91 explicit operator bool()
const {
95 size_t capacity()
const {
return capacity_; }
96 void reserve(
size_t capacity);
98 void resize(
size_t size);
102 unsigned char & operator[](
size_t i) {
return pos_[i]; }
106 bool operator!=(buffer
const& rhs)
const {
107 return !(*
this == rhs);
116 unsigned char* data_{};
117 unsigned char* pos_{};
bool operator==(symmetric_key const &lhs, symmetric_key const &rhs)
Side-channel safe comparison.
The buffer class is a simple buffer where data can be appended at the end and consumed at the front....
Definition: buffer.hpp:25
unsigned char operator[](size_t i) const
Gets element at offset i. Does not do bounds checking.
Definition: buffer.hpp:101
Sets some global macros and further includes string.hpp.
The namespace used by libfilezilla.
Definition: apply.hpp:17
unsigned char const * get() const
Undefined if buffer is empty.
Definition: buffer.hpp:42