summaryrefslogtreecommitdiff
path: root/lib/nes/app/ui/action.hh
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-02-04 23:39:24 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-02-04 23:39:24 +0100
commit64308c9e520dbd8e72b675d0ba064ecdaf9bd494 (patch)
treeff8dc176d62340df9565e424f19b9d6349c4e8b8 /lib/nes/app/ui/action.hh
parent79553ab1fa3d707612e80dd03bf95ca65fa0c411 (diff)
add error handling to ui
Diffstat (limited to 'lib/nes/app/ui/action.hh')
-rw-r--r--lib/nes/app/ui/action.hh58
1 files changed, 0 insertions, 58 deletions
diff --git a/lib/nes/app/ui/action.hh b/lib/nes/app/ui/action.hh
deleted file mode 100644
index 66f77f8..0000000
--- a/lib/nes/app/ui/action.hh
+++ /dev/null
@@ -1,58 +0,0 @@
-#pragma once
-
-#include "nes/common/status.hh"
-#include <string_view>
-
-namespace nes::app
-{
- /// An action for the application to process after a scene has handled its events.
- class action
- {
- public:
- enum class type
- {
- none,
- go_to_title,
- go_to_browser,
- go_to_settings,
- go_to_help,
- launch_game,
- show_error,
- };
-
- private:
- type type_{ type::none };
- std::string_view file_name_;
- status error_{ status::success };
-
- public:
- explicit action() = default;
-
- static auto go_to_title() -> action { return action{ type::go_to_title, "", status::success }; }
- static auto go_to_browser() -> action { return action{ type::go_to_browser, "", status::success }; }
- static auto go_to_settings() -> action { return action{ type::go_to_settings, "", status::success }; }
- static auto go_to_help() -> action { return action{ type::go_to_help, "", status::success }; }
-
- static auto launch_game(std::string_view const file_name) -> action
- {
- return action{ type::launch_game, file_name, status::success };
- }
-
- static auto show_error(status const error)
- {
- return action{ type::show_error, "", error };
- }
-
- auto get_type() const -> type { return type_; }
- auto get_file_name() const -> std::string_view { return file_name_; }
- auto get_error() const -> status { return error_; }
-
- private:
- explicit action(type const type, std::string_view const file_name, status const error)
- : type_{ type }
- , file_name_{ file_name }
- , error_{ error }
- {
- }
- };
-} // namespace nes::app \ No newline at end of file