diff options
Diffstat (limited to 'include/cru/common/io/Stream.hpp')
-rw-r--r-- | include/cru/common/io/Stream.hpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/cru/common/io/Stream.hpp b/include/cru/common/io/Stream.hpp new file mode 100644 index 00000000..e13e5388 --- /dev/null +++ b/include/cru/common/io/Stream.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include "../Base.hpp" + +#include <cstddef> + +namespace cru::io { +class CRU_BASE_API Stream : public Object { + public: + enum class SeekOrigin { Current, Begin, End }; + + Stream() = default; + + CRU_DELETE_COPY(Stream) + CRU_DELETE_MOVE(Stream) + + ~Stream() override = default; + + public: + virtual bool CanSeek() = 0; + virtual Index Tell() = 0; + virtual void Seek(Index offset, SeekOrigin origin = SeekOrigin::Current) = 0; + virtual void Rewind(); + virtual Index GetSize(); + + virtual bool CanRead() = 0; + virtual Index Read(std::byte* buffer, Index offset, Index size) = 0; + virtual Index Read(std::byte* buffer, Index size); + + virtual bool CanWrite() = 0; + virtual Index Write(const std::byte* buffer, Index offset, Index size) = 0; + virtual Index Write(const std::byte* buffer, Index size); + + virtual void Flush() = 0; +}; +} // namespace cru::io |