29#include <sptk5/BufferStorage.h>
107 void append(
char ch)
override
119 void append(
const char* data,
size_t sz = 0)
override
131 void append(
const uint8_t* data,
size_t sz)
override
145 append((
char*) &val,
sizeof(val));
156 return append(str.c_str(), str.length());
167 return append(str.c_str(), str.length());
178 return append(buffer.
data(), buffer.
bytes());
187 return data()[index];
196 return data()[index];
244 return String((
const char*) data(), bytes());
248using SBuffer = std::shared_ptr<Buffer>;
Definition: BufferStorage.h:44
BufferStorage()
Definition: BufferStorage.h:51
size_t bytes() const
Definition: BufferStorage.h:213
virtual void append(char ch)
uint8_t * data()
Definition: BufferStorage.h:106
Buffer & operator=(const char *str)
void append(const uint8_t *data, size_t sz) override
Definition: Buffer.h:131
void loadFromFile(const fs::path &fileName)
Buffer(const String &str)
void append(const std::string &str)
Definition: Buffer.h:154
void saveToFile(const fs::path &fileName) const
Buffer & operator=(const String &str)
bool operator!=(const Buffer &other) const
const uint8_t & operator[](size_t index) const
Definition: Buffer.h:194
~Buffer() noexcept override=default
void append(T val)
Definition: Buffer.h:143
void append(const String &str)
Definition: Buffer.h:165
Buffer(Buffer &&other) noexcept=default
Buffer(const Buffer &other)=default
void append(const Buffer &buffer)
Definition: Buffer.h:176
bool operator==(const Buffer &other) const
void append(const char *data, size_t sz=0) override
Definition: Buffer.h:119
uint8_t & operator[](size_t index)
Definition: Buffer.h:185
SP_EXPORT std::ostream & operator<<(std::ostream &, const Buffer &buffer)