GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
NativeFilesystem.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Ivar Härnqvist
2// SPDX-License-Identifier: MIT
3
4#ifndef GREM_CORE_SYSTEM_NATIVE_FILESYSTEM_HPP
5#define GREM_CORE_SYSTEM_NATIVE_FILESYSTEM_HPP
6
8
15
16namespace grem {
17
22public:
24 constexpr NativeFilesystem() noexcept = default;
25
27 ~NativeFilesystem() override = default;
28
31
34
36 NativeFilesystem& operator=(const NativeFilesystem&) = delete;
37
39 NativeFilesystem& operator=(NativeFilesystem&&) = delete;
40
41 [[nodiscard]] GREM_API(core) CStringView getOutputDirectory() const noexcept override;
42
43 [[nodiscard]] GREM_API(core) CStringView findInputArchiveOfFile(CStringView filepath) const noexcept override;
44
45 GREM_API(core) void createOutputDirectory(CStringView filepath) override;
46 GREM_API(core) void createParentOutputDirectories(CStringView filepath) override;
47 GREM_API(core) void deleteOutputFile(CStringView filepath) override;
48
49 [[nodiscard]] GREM_API(core) bool inputFileExists(CStringView filepath) const override;
50 [[nodiscard]] GREM_API(core) File::Metadata getFileMetadata(CStringView filepath) const override;
51 GREM_API(core) void forEachInputFilenameInDirectory(CStringView filepath, FunctionView<bool(CStringView filename)> callback) const override;
52
53 [[nodiscard]] GREM_API(core) InputFileHandle openInputFile(CStringView filepath) const override;
54 [[nodiscard]] GREM_API(core) InputFileHandle tryOpenInputFile(CStringView filepath) const override;
55 [[nodiscard]] GREM_API(core) OutputFileHandle openEmptyOutputFile(CStringView filepath) override;
56 GREM_API(core) void createEmptyOutputFile(CStringView filepath) override;
57 [[nodiscard]] GREM_API(core) OutputFileHandle openOutputFileForAppending(CStringView filepath) override;
58};
59
60} // namespace grem
61
62#endif
Base interface for a file in a Filesystem.
Definition File.hpp:31
constexpr Filesystem() noexcept=default
Default constructor.
Definition FunctionView.hpp:29
Generic boxed unique handle to a readable file in any filesystem.
Definition File.hpp:363
void createOutputDirectory(CStringView filepath) override
Create a new host directory relative to the current output directory, while also creating any missing...
CStringView findInputArchiveOfFile(CStringView filepath) const noexcept override
Get the host filepath of the mounted input archive on the host filesystem that contains a given virtu...
void createEmptyOutputFile(CStringView filepath) override
Create an empty file relative to the current output directory, overwriting any existing file at the s...
CStringView getOutputDirectory() const noexcept override
Get the current output directory of the filesystem.
InputFileHandle openInputFile(CStringView filepath) const override
Open an input file in the virtual filesystem for reading.
void deleteOutputFile(CStringView filepath) override
Delete a host file or directory relative to the current output directory.
OutputFileHandle openOutputFileForAppending(CStringView filepath) override
Open a file relative to the current output directory for appended writing, or create an empty file an...
void createParentOutputDirectories(CStringView filepath) override
Create any missing parent directories above a host directory relative to the current output directory...
constexpr NativeFilesystem() noexcept=default
Default constructor.
InputFileHandle tryOpenInputFile(CStringView filepath) const override
Try to open an input file in the virtual filesystem for reading.
OutputFileHandle openEmptyOutputFile(CStringView filepath) override
Create a file relative to the current output directory and open it for writing, overwriting any exist...
void forEachInputFilenameInDirectory(CStringView filepath, FunctionView< bool(CStringView filename)> callback) const override
Iterate the filenames of all readable virtual filepaths that are direct children of a given directory...
File::Metadata getFileMetadata(CStringView filepath) const override
Get the metadata of a file that is mounted at a given virtual filepath.
bool inputFileExists(CStringView filepath) const override
Check if a given virtual filepath has a corresponding host file mounted.
Generic boxed unique handle to a writable file in any filesystem.
Definition File.hpp:686
Definition aliases.hpp:9
CStringViewBase< char, std::char_traits< char > > CStringView
Definition CStringView.hpp:635