3#include "../StringView.h"
4#include "../Memory/MemoryBuffer.h"
23 using Ptr = std::unique_ptr<FileContents>;
30 size_t mimeTypeHash = 0;
45 [[nodiscard]]
constexpr const void*
data()
const {
return ptr; }
#define COGSFOUNDATION_API
Definition: FoundationBase.h:31
Definition: MemoryBuffer.h:23
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Main Cogs namespace.
Definition: MortonCode.h:5
FileContentsHints
Definition: FileContents.h:11
@ BrotliDecompress
A hint that the contents are Brotli (Google) compressed and is allowed to be decompressed during tran...
@ ZStdDecompress
A hint that the contents are Zstandard (Facebook) compressed and is allowed to be decompressed during...
Abstract base class storing data read from a file.
Definition: FileContents.h:20
FileContents(const uint8_t *ptr, size_t size, FileContentsHints hints)
Definition: FileContents.h:35
std::unique_ptr< FileContents > Ptr
Definition: FileContents.h:23
FileContents & operator=(const FileContents &)=delete
size_t size
Number of data bytes.
Definition: FileContents.h:29
constexpr const void * data() const
Access to buffer data. Cast to actual type using static_cast<const MyType*>(..)
Definition: FileContents.h:45
virtual Memory::MemoryBuffer take()=0
Take ownership of underlying memorybuffer if exists.
virtual ~FileContents()=default
FileContents(const FileContents &)=delete
virtual StringView origin()=0
const uint8_t * ptr
Start of buffer storing file data. Use.
Definition: FileContents.h:27
std::function< void(Ptr &&)> Callback
Definition: FileContents.h:24