4#ifndef GREM_CORE_SYSTEM_FILESYSTEM_HPP
5#define GREM_CORE_SYSTEM_FILESYSTEM_HPP
277 return file.readBytesIntoAllocation();
319 return file.readBytesIntoArrayList();
361 return file.readBytesIntoBuffer();
403 return file.readBytesIntoString();
446 return file.readBytesIntoCString();
Definition Allocation.hpp:25
Definition ArrayList.hpp:27
Base interface for a file in a Filesystem.
Definition File.hpp:31
constexpr Filesystem() noexcept=default
Default constructor.
Allocation< char > tryReadInputFileCString(CStringView filepath) const
Try to open an input file in the virtual filesystem for reading and read its full contents into an al...
Definition Filesystem.hpp:444
virtual void deleteOutputFile(CStringView filepath)=0
Delete a host file or directory relative to the current output directory.
virtual void createOutputDirectory(CStringView filepath)=0
Create a new host directory relative to the current output directory, while also creating any missing...
virtual CStringView findInputArchiveOfFile(CStringView filepath) const noexcept=0
Get the host filepath of the mounted input archive on the host filesystem that contains a given virtu...
Allocation< char > readInputFileCString(CStringView filepath) const
Open an input file in the virtual filesystem for reading and read its full contents into an allocated...
Definition Filesystem.hpp:425
String readInputFileString(CStringView filepath) const
Open an input file in the virtual filesystem for reading and read its full contents into a string of ...
Definition Filesystem.hpp:382
Buffer< byte > readInputFileBuffer(CStringView filepath) const
Open an input file in the virtual filesystem for reading and read its full contents into a buffer of ...
Definition Filesystem.hpp:340
virtual InputFileHandle tryOpenInputFile(CStringView filepath) const =0
Try to open an input file in the virtual filesystem for reading.
virtual void forEachInputFilenameInDirectory(CStringView filepath, FunctionView< bool(CStringView filename)> callback) const =0
Iterate the filenames of all readable virtual filepaths that are direct children of a given directory...
virtual void createParentOutputDirectories(CStringView filepath)=0
Create any missing parent directories above a host directory relative to the current output directory...
virtual File::Metadata getFileMetadata(CStringView filepath) const =0
Get the metadata of a file that is mounted at a given virtual filepath.
ArrayList< byte > readInputFileArrayList(CStringView filepath) const
Open an input file in the virtual filesystem for reading and read its full contents into an array lis...
Definition Filesystem.hpp:298
virtual InputFileHandle openInputFile(CStringView filepath) const =0
Open an input file in the virtual filesystem for reading.
Optional< String > tryReadInputFileString(CStringView filepath) const
Try to open an input file in the virtual filesystem for reading and read its full contents into a str...
Definition Filesystem.hpp:401
Allocation< byte > readInputFile(CStringView filepath) const
Open an input file in the virtual filesystem for reading and read its full contents into an array of ...
Definition Filesystem.hpp:256
virtual void createEmptyOutputFile(CStringView filepath)=0
Create an empty file relative to the current output directory, overwriting any existing file at the s...
Optional< Allocation< byte > > tryReadInputFile(CStringView filepath) const
Try to open an input file in the virtual filesystem for reading and read its full contents into an ar...
Definition Filesystem.hpp:275
Optional< ArrayList< byte > > tryReadInputFileArrayList(CStringView filepath) const
Try to open an input file in the virtual filesystem for reading and read its full contents into an ar...
Definition Filesystem.hpp:317
Optional< Buffer< byte > > tryReadInputFileBuffer(CStringView filepath) const
Try to open an input file in the virtual filesystem for reading and read its full contents into a buf...
Definition Filesystem.hpp:359
virtual bool inputFileExists(CStringView filepath) const =0
Check if a given virtual filepath has a corresponding host file mounted.
virtual OutputFileHandle openEmptyOutputFile(CStringView filepath)=0
Create a file relative to the current output directory and open it for writing, overwriting any exist...
virtual OutputFileHandle openOutputFileForAppending(CStringView filepath)=0
Open a file relative to the current output directory for appended writing, or create an empty file an...
virtual CStringView getOutputDirectory() const noexcept=0
Get the current output directory of the filesystem.
Definition FunctionView.hpp:29
Optional value type that holds either a value or no value.
Definition Optional.hpp:58
Generic boxed unique handle to a writable file in any filesystem.
Definition File.hpp:686
StringBase< char, std::char_traits< char >, std::allocator< char > > String
Definition String.hpp:17
CStringViewBase< char, std::char_traits< char > > CStringView
Definition CStringView.hpp:635