31 lines
522 B
C++
31 lines
522 B
C++
|
#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;
|
||
|
};
|
||
|
|
||
|
}
|