diff options
| author | Stefan Boberg <[email protected]> | 2021-05-23 12:51:42 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-05-23 12:51:42 +0200 |
| commit | ac7871e0b0f478da1a36da40a1a56a9f98b284df (patch) | |
| tree | 813025a218a45b6e44b36fb4a4d44dbf0504d3b6 /zencore/include | |
| parent | Added static_assert to ensure content type fits in allocated space (diff) | |
| download | zen-ac7871e0b0f478da1a36da40a1a56a9f98b284df.tar.xz zen-ac7871e0b0f478da1a36da40a1a56a9f98b284df.zip | |
Added content type to IoBuffer payloads from http server
Also added some additional logic for flagging buffer immutability
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/iobuffer.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/zencore/include/zencore/iobuffer.h b/zencore/include/zencore/iobuffer.h index a515f7af8..861ace575 100644 --- a/zencore/include/zencore/iobuffer.h +++ b/zencore/include/zencore/iobuffer.h @@ -305,15 +305,17 @@ public: ZENCORE_API IoBuffer(EFileTag, void* FileHandle, uint64_t ChunkFileOffset, uint64_t ChunkSize); ZENCORE_API IoBuffer(EBorrowedFileTag, void* FileHandle, uint64_t ChunkFileOffset, uint64_t ChunkSize); - inline operator bool() const { return !m_Core->IsNull(); } - ZENCORE_API void MakeOwned() { return m_Core->MakeOwned(); } - inline bool IsOwned() const { return m_Core->IsOwned(); } - inline bool IsWholeFile() const { return m_Core->IsWholeFile(); } - const void* Data() const { return m_Core->DataPointer(); } - const size_t Size() const { return m_Core->DataBytes(); } - inline void SetContentType(ZenContentType ContentType) { m_Core->SetContentType(ContentType); } - inline ZenContentType GetContentType() const { return m_Core->GetContentType(); } - ZENCORE_API bool GetFileReference(IoBufferFileReference& OutRef) const; + inline operator bool() const { return !m_Core->IsNull(); } + 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(); } + [[nodiscard]] void* MutableData() const { return m_Core->MutableDataPointer(); } + void MakeImmutable() { m_Core->SetIsImmutable(true); } + [[nodiscard]] const void* Data() const { return m_Core->DataPointer(); } + [[nodiscard]] const size_t Size() const { return m_Core->DataBytes(); } + inline void SetContentType(ZenContentType ContentType) { m_Core->SetContentType(ContentType); } + [[nodiscard]] inline ZenContentType GetContentType() const { return m_Core->GetContentType(); } + [[nodiscard]] ZENCORE_API bool GetFileReference(IoBufferFileReference& OutRef) const; private: RefPtr<IoBufferCore> m_Core = new IoBufferCore; |