diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-02-04 23:11:08 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-02-04 23:11:08 +0100 |
| commit | 79553ab1fa3d707612e80dd03bf95ca65fa0c411 (patch) | |
| tree | f44bec41548d569cfca43c44e0e4ffa7b72ed4ed /lib/nes/app/file-browser.hh | |
| parent | 9c45e9c7df1efa5bc1c8e73b6eaef4726b828d3e (diff) | |
refactor file browser
Diffstat (limited to 'lib/nes/app/file-browser.hh')
| -rw-r--r-- | lib/nes/app/file-browser.hh | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/nes/app/file-browser.hh b/lib/nes/app/file-browser.hh index 6ce55aa..ef5343c 100644 --- a/lib/nes/app/file-browser.hh +++ b/lib/nes/app/file-browser.hh @@ -2,6 +2,8 @@ #include "nes/common/types.hh" #include "nes/common/span.hh" +#include "nes/common/status.hh" +#include <string_view> namespace nes { @@ -10,6 +12,7 @@ namespace nes namespace nes::app { + /// A file browser that has a current directory whose items are iterated. class file_browser { public: @@ -46,12 +49,23 @@ namespace nes::app auto operator=(file_browser const&) -> file_browser& = delete; auto operator=(file_browser&&) -> file_browser& = delete; + /// Get the path components of the current working directory. virtual auto get_path() const -> path_view = 0; + + /// Go to directory entry at the given index. virtual auto seek(u32) -> void = 0; + + /// Read the directory entry at the current index. virtual auto read_next(item* out_item) -> bool = 0; - virtual auto navigate_up() -> void = 0; - virtual auto navigate(std::string_view) -> void = 0; - virtual auto load(std::string_view, span<u8>) -> u32 = 0; + + /// Change the current working directory to the parent directory. + virtual auto navigate_up() -> status = 0; + + /// Change the current working directory to an item. + virtual auto navigate(std::string_view) -> status = 0; + + /// Load a file in the current working directory into memory. + virtual auto load(std::string_view, span<u8>, u32* out_length) -> status = 0; protected: explicit file_browser() = default; |
