From c5431e4d321dbf0152e6826841c1ef5c1291ba5b Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 14 Jun 2022 15:38:50 +0300 Subject: Added files from project 2 (mirror) --- .../Project 2/src/Generic/ConsoleInterface/Menu.h | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Year 1/Object-oriented Programming/Project 2/src/Generic/ConsoleInterface/Menu.h (limited to 'Year 1/Object-oriented Programming/Project 2/src/Generic/ConsoleInterface/Menu.h') diff --git a/Year 1/Object-oriented Programming/Project 2/src/Generic/ConsoleInterface/Menu.h b/Year 1/Object-oriented Programming/Project 2/src/Generic/ConsoleInterface/Menu.h new file mode 100644 index 0000000..faadba9 --- /dev/null +++ b/Year 1/Object-oriented Programming/Project 2/src/Generic/ConsoleInterface/Menu.h @@ -0,0 +1,33 @@ +#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 { + List menuOptions; + +public: + //! Sets name as "Menu", leaves all flags to false and creates an empty Command list + Menu(); + //! Copies commands + Menu(const Command* commands, unsigned commandCount); + + //! Adds a command to the internal Command list + void addCommand(const Command& command); + + //! Lists commands and after user input executes an appropriate command run() function + void navigate() const; +}; + +#endif -- cgit v1.3.1-23-gd82d