diff options
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/iobuffer.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/zencore/include/zencore/iobuffer.h b/zencore/include/zencore/iobuffer.h index 7e7182997..7cf497527 100644 --- a/zencore/include/zencore/iobuffer.h +++ b/zencore/include/zencore/iobuffer.h @@ -90,6 +90,7 @@ public: } inline bool IsImmutable() const { return !(m_Flags & kIsMutable); } + inline bool IsWholeFile() const { return !!(m_Flags & kIsWholeFile); } inline bool IsNull() const { return m_DataBytes == 0; } inline IoBufferExtendedCore* ExtendedCore(); @@ -123,6 +124,18 @@ public: } } + inline void SetIsWholeFile(bool NewState) + { + if (NewState) + { + m_Flags |= kIsWholeFile; + } + else + { + m_Flags |= ~kIsWholeFile; + } + } + inline uint32_t GetRefCount() const { return m_RefCount; } protected: @@ -139,6 +152,7 @@ protected: kIsExtended = 1 << 2, // Is actually a SharedBufferExtendedCore kIsMaterialized = 1 << 3, // Data pointers are valid kLowLevelAlloc = 1 << 4, // Using direct memory allocation + kIsWholeFile = 1 << 5, // References an entire file }; void* AllocateBuffer(size_t InSize, size_t Alignment); @@ -262,6 +276,7 @@ public: 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(); } ZENCORE_API bool GetFileReference(IoBufferFileReference& OutRef) const; @@ -272,6 +287,7 @@ private: IoBuffer(IoBufferCore* Core) : m_Core(Core) {} friend class SharedBuffer; + friend class IoBufferBuilder; }; class IoBufferBuilder @@ -281,8 +297,6 @@ public: ZENCORE_API static IoBuffer MakeFromTemporaryFile(const wchar_t* FileName, uint64_t Offset = 0, uint64_t Size = ~0ull); ZENCORE_API static IoBuffer MakeFromFileHandle(void* FileHandle, uint64_t Offset = 0, uint64_t Size = ~0ull); inline static IoBuffer MakeCloneFromMemory(const void* Ptr, size_t Sz) { return IoBuffer(IoBuffer::Clone, Ptr, Sz); } - -private: }; void iobuffer_forcelink(); |