Cogs.Foundation
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Cogs::MemoryBufferBackedFileContents Struct Reference

#include <MemoryBufferBackedFileContents.h>

Inheritance diagram for Cogs::MemoryBufferBackedFileContents:
Cogs::FileContents

Public Member Functions

 MemoryBufferBackedFileContents (Memory::MemoryBuffer &&buffer, const std::string &path, FileContentsHints hints)
 Create a file contents object that takes ownership of an existing memorybuffer.
 
 MemoryBufferBackedFileContents (size_t size, const std::string &path, FileContentsHints hints)
 
 MemoryBufferBackedFileContents (void *data, size_t size, FileContentsHints hints)
 
Memory::MemoryBuffer take () override
 Take ownership of underlying memorybuffer if exists.
 
StringView origin () override
 
- Public Member Functions inherited from Cogs::FileContents
 FileContents ()=delete
 
 FileContents (const uint8_t *ptr, size_t size, FileContentsHints hints)
 
 FileContents (const FileContents &)=delete
 
virtual ~FileContents ()=default
 
FileContentsoperator= (const FileContents &)=delete
 
Memory::MemoryBuffer takeCopy ()
 
constexpr const void * data () const
 Access to buffer data. Cast to actual type using static_cast<const MyType*>(..)
 
virtual Memory::MemoryBuffer take ()=0
 Take ownership of underlying memorybuffer if exists.
 
virtual StringView origin ()=0
 

Public Attributes

Memory::MemoryBuffer bytes
 
std::string path
 
- Public Attributes inherited from Cogs::FileContents
const uint8_t * ptr
 Start of buffer storing file data. Use.
 
size_t size
 Number of data bytes.
 
size_t mimeTypeHash = 0
 
FileContentsHints hints = FileContentsHints::None
 

Additional Inherited Members

- Public Types inherited from Cogs::FileContents
using Ptr = std::unique_ptr< FileContents >
 
using Callback = std::function< void(Ptr &&)>
 

Constructor & Destructor Documentation

◆ MemoryBufferBackedFileContents() [1/3]

Cogs::MemoryBufferBackedFileContents::MemoryBufferBackedFileContents ( Memory::MemoryBuffer &&  buffer,
const std::string &  path,
FileContentsHints  hints 
)
inline

Create a file contents object that takes ownership of an existing memorybuffer.

◆ MemoryBufferBackedFileContents() [2/3]

Cogs::MemoryBufferBackedFileContents::MemoryBufferBackedFileContents ( size_t  size,
const std::string &  path,
FileContentsHints  hints 
)
inline

◆ MemoryBufferBackedFileContents() [3/3]

Cogs::MemoryBufferBackedFileContents::MemoryBufferBackedFileContents ( void *  data,
size_t  size,
FileContentsHints  hints 
)
inline

Member Function Documentation

◆ origin()

StringView Cogs::MemoryBufferBackedFileContents::origin ( )
inlineoverridevirtual

Implements Cogs::FileContents.

◆ take()

Memory::MemoryBuffer Cogs::MemoryBufferBackedFileContents::take ( )
inlineoverridevirtual

Take ownership of underlying memorybuffer if exists.

Implements Cogs::FileContents.

References Cogs::Memory::MemoryBuffer::data().

Member Data Documentation

◆ bytes

Memory::MemoryBuffer Cogs::MemoryBufferBackedFileContents::bytes

◆ path

std::string Cogs::MemoryBufferBackedFileContents::path

The documentation for this struct was generated from the following file: