diff options
| author | Stefan Boberg <[email protected]> | 2021-05-23 17:11:56 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-05-23 17:11:56 +0200 |
| commit | 32822a4f6b93f23228af4b2d15f698cc5fe0c0ed (patch) | |
| tree | 7a1de5f1cd3130a878d4cf6dc613a39e87a00ae0 /zencore/include | |
| parent | Tiny comment fix (diff) | |
| download | zen-32822a4f6b93f23228af4b2d15f698cc5fe0c0ed.tar.xz zen-32822a4f6b93f23228af4b2d15f698cc5fe0c0ed.zip | |
Added IoBuffer::operator MemoryView for convenience
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/iobuffer.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/zencore/include/zencore/iobuffer.h b/zencore/include/zencore/iobuffer.h index 861ace575..38a31317f 100644 --- a/zencore/include/zencore/iobuffer.h +++ b/zencore/include/zencore/iobuffer.h @@ -5,6 +5,7 @@ #include <memory.h> #include "refcount.h" #include "zencore.h" +#include <zencore/memory.h> namespace zen { @@ -306,6 +307,7 @@ public: ZENCORE_API IoBuffer(EBorrowedFileTag, void* FileHandle, uint64_t ChunkFileOffset, uint64_t ChunkSize); inline operator bool() const { return !m_Core->IsNull(); } + inline operator MemoryView() const & { return MemoryView(m_Core->DataPointer(), m_Core->DataBytes()); } inline void MakeOwned() { return m_Core->MakeOwned(); } [[nodiscard]] inline bool IsOwned() const { return m_Core->IsOwned(); } [[nodiscard]] inline bool IsWholeFile() const { return m_Core->IsWholeFile(); } |