49 lines
1021 B
C++
49 lines
1021 B
C++
|
/***
|
||
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: BlobWriter.hpp
|
||
|
Date: 2021-6-10
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#pragma once
|
||
|
|
||
|
namespace Aurora::IO::Buffered
|
||
|
{
|
||
|
class BlobWriter : public IStreamWriter
|
||
|
{
|
||
|
public:
|
||
|
AU_NO_COPY_NO_MOVE(BlobWriter)
|
||
|
|
||
|
BlobWriter() {}
|
||
|
~BlobWriter() {}
|
||
|
|
||
|
virtual EStreamError Open() override
|
||
|
{
|
||
|
return EStreamError::eErrorNone;
|
||
|
}
|
||
|
|
||
|
virtual EStreamError Write(const void *buffer, AuUInt32 len) override
|
||
|
{
|
||
|
auto idx = buffer_.size();
|
||
|
buffer_.resize(idx + len);
|
||
|
std::memcpy(buffer_.data() + idx, buffer, len);
|
||
|
return EStreamError::eErrorNone;
|
||
|
}
|
||
|
|
||
|
virtual void Flush() override
|
||
|
{
|
||
|
}
|
||
|
|
||
|
virtual void Close() override
|
||
|
{
|
||
|
}
|
||
|
|
||
|
const AuList<AuUInt8> &GetBuffer()
|
||
|
{
|
||
|
return this->buffer_;
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
AuList<AuUInt8> buffer_;
|
||
|
};
|
||
|
}
|