dmtools/lib/base/io/MemoryStream.hpp

31 lines
522 B
C++
Raw Permalink Normal View History

#include <base/io/Stream.hpp>
namespace dmtools::io {
struct MemoryStream : public Stream {
MemoryStream(u8* memory, usize size);
virtual ~MemoryStream();
StreamDiff ReadSome(u8* buffer, usize length) override;
StreamDiff WriteSome(const u8* buffer, usize length) override;
StreamDiff Seek(StreamDiff where, StreamSeekDirection dir) override;
StreamDiff Tell() const override;
bool Ok() const override;
bool Eof() const override;
private:
u8* beg;
u8* cur;
u8* end;
usize size;
};
}