1 #ifndef LIBFILEZILLA_NONOWNING_BUFFER_HEADER 2 #define LIBFILEZILLA_NONOWNING_BUFFER_HEADER 38 if (size > capacity) {
52 size_t capacity()
const {
return capacity_; }
53 size_t size()
const {
return size_; }
54 bool empty()
const {
return size_ == 0; }
55 explicit operator bool()
const {
return !empty(); }
63 void resize(
size_t size);
66 uint8_t
operator[](
size_t offset) {
return *(buffer_ + start_ + offset); }
69 uint8_t
const*
get()
const {
return buffer_ + start_; }
70 uint8_t *
get() {
return buffer_ + start_; }
80 uint8_t*
get(
size_t bytes);
87 void add(
size_t bytes);
93 void consume(
size_t bytes);
97 void append(uint8_t
const* data,
size_t len);
98 void append(uint8_t c) { append(&c, 1); }
Similar to fz::buffer, but does not own memory.
Definition: nonowning_buffer.hpp:22
uint8_t operator[](size_t offset)
Gets element at offset. No safety check.
Definition: nonowning_buffer.hpp:66
The namespace used by libfilezilla.
Definition: apply.hpp:17
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:25