![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
File System to make managing files easier. More...
#include <VirtualFileSystem.hpp>
Collaboration diagram for galaxy::VirtualFileSystem:Public Member Functions | |
| VirtualFileSystem () noexcept | |
| Constructor. | |
| ~VirtualFileSystem () noexcept | |
| Destructor. | |
| std::string | read (const std::string &file) |
| Read a file. | |
| std::vector< std::uint8_t > | read_binary (const std::string &file) |
| Read a binary file. | |
| bool | write (const std::string &data, const std::string &file) |
| Writes a file to disk. | |
| bool | write_binary (std::span< std::uint8_t > data, const std::string &file) |
| Writes a binary file to disk. | |
| bool | write_raw (const void *data, const std::size_t size, const std::string &file) |
| Raw data writing. | |
| void | mkdir (const std::string &dir) noexcept |
| Creates an empty folder in the filesystem relative to the root. | |
| void | remove (const std::string &path) noexcept |
| Delete a file or folder. | |
| bool | exists (const std::string &file) noexcept |
| Does the file exist in the vfs. | |
| bool | is_dir (const std::string &path) noexcept |
| Checks if a file is a folder. | |
| std::vector< std::string > | list (const std::string &dir) |
| Get assets in an asset folder. | |
| void | alert () noexcept |
| Trigger a standard filesystem audio alert. | |
| void | notification (const std::string &title, const std::string &msg, const DialogIcon icon) noexcept |
| Trigger a system notification. | |
| int | message_box (const std::string &title, const std::string &msg, const DialogType type, const DialogIcon icon, const DialogButton btn) noexcept |
| Opens a platform specific message box. | |
| std::string | input_box (const std::string &title, const std::string &msg, const std::string &default_text="", const bool password=false) noexcept |
| Opens a platform specific text input box. | |
| std::string | open_save_dialog (const std::string &default_filename, const std::vector< const char * > &filters={}) |
| Open a save file dialog. | |
| std::string | open_file_dialog (const std::vector< const char * > &filters={}, const std::string &def_path="") |
| Open a file dialog. | |
| std::string | select_folder_dialog (const std::string &def_path="") |
| Select a folder using a dialog. | |
Private Member Functions | |
| VirtualFileSystem (const VirtualFileSystem &)=delete | |
| Copy constructor. | |
| VirtualFileSystem (VirtualFileSystem &&)=delete | |
| Move constructor. | |
| VirtualFileSystem & | operator= (const VirtualFileSystem &)=delete |
| Copy assignment operator. | |
| VirtualFileSystem & | operator= (VirtualFileSystem &&)=delete |
| Move assignment operator. | |
File System to make managing files easier.
Definition at line 24 of file VirtualFileSystem.hpp.
|
noexcept |
Constructor.
Definition at line 29 of file VirtualFileSystem.cpp.
Here is the call graph for this function:
|
noexcept |
Destructor.
Definition at line 81 of file VirtualFileSystem.cpp.
Here is the call graph for this function:
|
privatedelete |
Copy constructor.
|
privatedelete |
Move constructor.
|
nodiscard |
Read a file.
| file | File to read from. |
Definition at line 86 of file VirtualFileSystem.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
nodiscard |
Read a binary file.
| file | File to read from. |
Definition at line 122 of file VirtualFileSystem.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
nodiscard |
Writes a file to disk.
Checks for existing file to overwrite first.
| data | Data to write to file. |
| file | Path to write to, including path from root. |
Definition at line 158 of file VirtualFileSystem.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
nodiscard |
Writes a binary file to disk.
Checks for existing file to overwrite first.
| data | Data to write to file. |
| file | Path to write to, including path from root. |
Definition at line 163 of file VirtualFileSystem.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
nodiscard |
Raw data writing.
| data | Data to write to file. |
| size | Size of data to write. |
| file | Path to write to, including path from root. |
Definition at line 168 of file VirtualFileSystem.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
Creates an empty folder in the filesystem relative to the root.
All missing parent directories are also created if they don't exist.
| dir | Directory(s) to create. |
Definition at line 200 of file VirtualFileSystem.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
Delete a file or folder.
Relative to the root. I.e. "textures/test.png" will become ROOT/textures/test.png.
| path | File or folder to delete. |
Definition at line 208 of file VirtualFileSystem.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
nodiscardnoexcept |
Does the file exist in the vfs.
| file | File to check. |
Definition at line 213 of file VirtualFileSystem.cpp.
Here is the caller graph for this function:
|
nodiscardnoexcept |
Checks if a file is a folder.
| path | File/folder to check. |
Definition at line 218 of file VirtualFileSystem.cpp.
Here is the caller graph for this function:
|
nodiscard |
Get assets in an asset folder.
| dir | Directory to fetch assets from. |
Definition at line 223 of file VirtualFileSystem.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:
|
noexcept |
Trigger a standard filesystem audio alert.
Definition at line 247 of file VirtualFileSystem.cpp.
Here is the caller graph for this function:
|
noexcept |
Trigger a system notification.
| title | Notification title. |
| msg | Body text of notification. |
| icon | Icon to display alongside text. |
Definition at line 252 of file VirtualFileSystem.cpp.
Here is the caller graph for this function:
|
nodiscardnoexcept |
Opens a platform specific message box.
| title | Notification title. |
| msg | Body text of notification. |
| type | Type of message box. |
| icon | Icon to display alongside text. |
| btn | Button to show on message box. |
Definition at line 258 of file VirtualFileSystem.cpp.
Here is the caller graph for this function:
|
nodiscardnoexcept |
Opens a platform specific text input box.
| title | Notification title. |
| msg | Body text of notification. |
| default_text | Default text displayed in input box. |
| password | True to obscure input. Note that enabling this disables default_text. |
Definition at line 266 of file VirtualFileSystem.cpp.
Here is the caller graph for this function:
|
nodiscard |
Open a save file dialog.
| default_filename | Default name to save file as. |
| filters | List of filters for dialog, i.e. "*.png", "*.jpg", etc. |
Definition at line 272 of file VirtualFileSystem.cpp.
Here is the caller graph for this function:
|
nodiscard |
Open a file dialog.
| filters | List of filters for dialog, i.e. "*.png", "*.jpg", etc. |
| def_path | Default starting path to open dialog at. |
Definition at line 287 of file VirtualFileSystem.cpp.
Here is the caller graph for this function:
|
nodiscard |
Select a folder using a dialog.
| def_path | Default starting path to open dialog at. |
Definition at line 304 of file VirtualFileSystem.cpp.
Here is the caller graph for this function:
|
privatedelete |
Copy assignment operator.
|
privatedelete |
Move assignment operator.