FMI Ticket System
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
Menu.h
Go to the documentation of this file.
1#ifndef HEADER_CONSOLEINTERFACE_MENU
2#define HEADER_CONSOLEINTERFACE_MENU
3
8#include "Command.h"
9#include "../List/List.hpp"
10
17class Menu {
18 char title[256];
19 List<Command> menuOptions;
20
21 bool backExistsApp;
22 bool isSubMenu;
23
24public:
26 Menu();
28 Menu(const char* title, bool backExistsApp, bool isSubMenu);
30 Menu(const char* title, bool backExistsApp, bool isSubMenu, const Command* commands, unsigned commandCount);
31
33 void addCommand(const Command& command);
34
36 void registerError(const char* message) const;
38 void registerWarning(const char* message) const;
40 void registerSuccess(const char* message) const;
41
43 void navigate() const;
44};
45
46#endif
Stores the declaration of class Command.
Stores a 256 character name and a function pointer to be executed when calling run()
Definition: Command.h:12
Handles navigation between multiple commands.
Definition: Menu.h:17
void navigate() const
Lists commands and after user input executes an appropriate command run() function.
Definition: Menu.cpp:93
void addCommand(const Command &command)
Adds a command to the internal Command list.
Definition: Menu.cpp:32
void registerSuccess(const char *message) const
Tell Menu to show a success message next time it prints.
Definition: Menu.cpp:76
void registerWarning(const char *message) const
Tell Menu to show a warning message next time it prints.
Definition: Menu.cpp:64
void registerError(const char *message) const
Tell Menu to show an error message next time it prints.
Definition: Menu.cpp:52
Menu()
Sets name as "Menu", leaves all flags to false and creates an empty Command list.
Definition: Menu.cpp:5