diff options
Diffstat (limited to 'source/libs/asura-lib-utils/filesystem/data_buffer.cpp')
-rw-r--r-- | source/libs/asura-lib-utils/filesystem/data_buffer.cpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/source/libs/asura-lib-utils/filesystem/data_buffer.cpp b/source/libs/asura-lib-utils/filesystem/data_buffer.cpp deleted file mode 100644 index 32a123f..0000000 --- a/source/libs/asura-lib-utils/filesystem/data_buffer.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include <cstdlib> -#include <cstring> -#include "data_buffer.h" - -namespace AsuraEngine -{ - namespace Filesystem - { - - DataBuffer::DataBuffer(DataBuffer& src) - { - Load(src); - } - - DataBuffer::DataBuffer(std::size_t size) - : mSize(size) - , mBytes(nullptr) - { - mBytes = new byte[size]; - memset(mBytes, 0, size); - } - - DataBuffer::DataBuffer(const void* data, std::size_t size) - : mSize(size) - , mBytes(nullptr) - { - Load(data, size); - } - - DataBuffer::~DataBuffer() - { - delete[] mBytes; - } - - void DataBuffer::Load(DataBuffer& db) - { - Load(db.GetBuffer(), db.GetSize()); - } - - void DataBuffer::Load(const void* data, std::size_t size) - { - if (!mBytes || mSize != size) - { - delete[] mBytes; - mBytes = new byte[size]; - } - memcpy(mBytes, data, size); - } - - byte* DataBuffer::GetBuffer() - { - return mBytes; - } - - void DataBuffer::Clear() - { - if (mBytes) - memset(mBytes, 0, mSize); - } - - std::size_t DataBuffer::GetSize() - { - return mSize; - } - - } -}
\ No newline at end of file |