Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / ConsoleInterface / Menu.h
diff options
context:
space:
mode:
Commit6c31ce8db2f8b969f030e5d9d04c9ae511333a06 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 16:12:55 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-08 16:12:55 +0300
Filesd981ce8f9f7b827c37b8624a64c31ab611084476 /src/Generic/ConsoleInterface/Menu.h
FMI-OOP-P1_TicketSystem-6c31ce8db2f8b969f030e5d9d04c9ae511333a06.tar
FMI-OOP-P1_TicketSystem-6c31ce8db2f8b969f030e5d9d04c9ae511333a06.tar.gz
FMI-OOP-P1_TicketSystem-6c31ce8db2f8b969f030e5d9d04c9ae511333a06.zip
Parent517458f1cba81297f6a9472dda7b09586faba7d6 (diff)
Documented ConsoleInterface
1 files changed, 19 insertions, 0 deletions
-rw-r--r--src/Generic/ConsoleInterface/Menu.h19
diff --git a/src/Generic/ConsoleInterface/Menu.h b/src/Generic/ConsoleInterface/Menu.h
index 2501871..e0ea685 100644
--- a/src/Generic/ConsoleInterface/Menu.h
+++ b/src/Generic/ConsoleInterface/Menu.h
@@ -1,9 +1,19 @@
#ifndef HEADER_CONSOLEINTERFACE_MENU
#define HEADER_CONSOLEINTERFACE_MENU
+/*! \file Menu.h
+ * \brief Stores the declaration of class Menu
+ */
+
#include "Command.h"
#include "../List/List.hpp"
+/*! \brief Handles navigation between multiple commands
+ *
+ * Shows the title, then below it an Error/Warning/Success message if set,
+ * lists all command options as an enumerated list, takes command index
+ * and calls the chosen command's run() function.
+ */
class Menu {
char title[256];
List<Command> menuOptions;
@@ -12,15 +22,24 @@ class Menu {
bool isSubMenu;
public:
+ //! Sets name as "Menu", leaves all flags to false and creates an empty Command list
Menu();
+ //! Copies title, saves flags and creates and empty Command list
Menu(const char* title, bool backExistsApp, bool isSubMenu);
+ //! Copies title, saves flags and copies commands
Menu(const char* title, bool backExistsApp, bool isSubMenu, const Command* commands, unsigned commandCount);
+ //! Adds a command to the internal Command list
void addCommand(const Command& command);
+ //! Tell Menu to show an error message next time it prints
void registerError(const char* message) const;
+ //! Tell Menu to show a warning message next time it prints
void registerWarning(const char* message) const;
+ //! Tell Menu to show a success message next time it prints
void registerSuccess(const char* message) const;
+
+ //! Lists commands and after user input executes an appropriate command run() function
void navigate() const;
};