Cogs.Foundation
|
Abstract base class storing data read from a file. More...
#include <FileContents.h>
Public Types | |
using | Ptr = std::unique_ptr< FileContents > |
using | Callback = std::function< void(Ptr &&)> |
Public Member Functions | |
FileContents ()=delete | |
FileContents (const uint8_t *ptr, size_t size, FileContentsHints hints) | |
FileContents (const FileContents &)=delete | |
virtual | ~FileContents ()=default |
FileContents & | operator= (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 | |
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 |
Abstract base class storing data read from a file.
using Cogs::FileContents::Callback = std::function<void(Ptr&&)> |
using Cogs::FileContents::Ptr = std::unique_ptr<FileContents> |
|
delete |
|
inline |
|
delete |
|
virtualdefault |
|
inlineconstexpr |
Access to buffer data. Cast to actual type using static_cast<const MyType*>(..)
|
delete |
|
pure virtual |
Implemented in Cogs::MemoryBufferBackedFileContents, and Cogs::MMapBackedFileContents.
|
pure virtual |
Take ownership of underlying memorybuffer if exists.
Implemented in Cogs::MemoryBufferBackedFileContents, and Cogs::MMapBackedFileContents.
Cogs::Memory::MemoryBuffer Cogs::FileContents::takeCopy | ( | ) |
References Cogs::Memory::MemoryBuffer::data(), ptr, and size.
Referenced by Cogs::MMapBackedFileContents::take().
FileContentsHints Cogs::FileContents::hints = FileContentsHints::None |
size_t Cogs::FileContents::mimeTypeHash = 0 |
const uint8_t* Cogs::FileContents::ptr |
Start of buffer storing file data. Use.
Referenced by takeCopy().
size_t Cogs::FileContents::size |
Number of data bytes.
Referenced by takeCopy().