#ifndef CORE_BUFFER_H #define CORE_BUFFER_H #include "utils/Utility.h" namespace Core { class Buffer final { int length; int capacity; char* buffer; public: Buffer(int initialSize = 32); Buffer(const Buffer& other) = delete; Buffer(Buffer&& other); ~Buffer(); Buffer& operator=(const Buffer& other) = delete; Buffer& operator=(Buffer&& other); check_return Error copyFrom(const Buffer& other); check_return Error add(const void* data, int size); template check_return Error add(const T& t) { return add(&t, sizeof(T)); } int getLength() const; operator const char*() const; const char* getData() const; void clear(); private: void swap(Buffer& other); }; } #endif