Cogs.Foundation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
Cogs::FileContents Struct Referenceabstract

Abstract base class storing data read from a file. More...

#include <FileContents.h>

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

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
 
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

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
 

Detailed Description

Abstract base class storing data read from a file.

Member Typedef Documentation

◆ Callback

using Cogs::FileContents::Callback = std::function<void(Ptr&&)>

◆ Ptr

using Cogs::FileContents::Ptr = std::unique_ptr<FileContents>

Constructor & Destructor Documentation

◆ FileContents() [1/3]

Cogs::FileContents::FileContents ( )
delete

◆ FileContents() [2/3]

Cogs::FileContents::FileContents ( const uint8_t *  ptr,
size_t  size,
FileContentsHints  hints 
)
inline

◆ FileContents() [3/3]

Cogs::FileContents::FileContents ( const FileContents )
delete

◆ ~FileContents()

virtual Cogs::FileContents::~FileContents ( )
virtualdefault

Member Function Documentation

◆ data()

constexpr const void * Cogs::FileContents::data ( ) const
inlineconstexpr

Access to buffer data. Cast to actual type using static_cast<const MyType*>(..)

◆ operator=()

FileContents & Cogs::FileContents::operator= ( const FileContents )
delete

◆ origin()

virtual StringView Cogs::FileContents::origin ( )
pure virtual

◆ take()

virtual Memory::MemoryBuffer Cogs::FileContents::take ( )
pure virtual

Take ownership of underlying memorybuffer if exists.

Implemented in Cogs::MemoryBufferBackedFileContents, and Cogs::MMapBackedFileContents.

◆ takeCopy()

Cogs::Memory::MemoryBuffer Cogs::FileContents::takeCopy ( )

Member Data Documentation

◆ hints

FileContentsHints Cogs::FileContents::hints = FileContentsHints::None

◆ mimeTypeHash

size_t Cogs::FileContents::mimeTypeHash = 0

◆ ptr

const uint8_t* Cogs::FileContents::ptr

Start of buffer storing file data. Use.

See also
data() to ease casting to actual data type.

Referenced by takeCopy().

◆ size

size_t Cogs::FileContents::size

Number of data bytes.

Referenced by takeCopy().


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