From 24bdf39e6c21ab846f6c86803761d78a094e05c0 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 26 May 2022 20:31:26 +0300 Subject: Added files from project 1 (mirror) --- .../Project 1/docs/html/classMenu.html | 330 +++++++++++++++++++++ 1 file changed, 330 insertions(+) create mode 100644 Year 1/Object-oriented Programming/Project 1/docs/html/classMenu.html (limited to 'Year 1/Object-oriented Programming/Project 1/docs/html/classMenu.html') diff --git a/Year 1/Object-oriented Programming/Project 1/docs/html/classMenu.html b/Year 1/Object-oriented Programming/Project 1/docs/html/classMenu.html new file mode 100644 index 0000000..15580eb --- /dev/null +++ b/Year 1/Object-oriented Programming/Project 1/docs/html/classMenu.html @@ -0,0 +1,330 @@ + + + + + + + +FMI Ticket System: Menu Class Reference + + + + + + + + + +
+
+ + + + + + +
+
FMI Ticket System +
+
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+ +
Menu Class Reference
+
+
+ +

Handles navigation between multiple commands. + More...

+ +

#include <Menu.h>

+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

+ Menu ()
 Sets name as "Menu", leaves all flags to false and creates an empty Command list.
 
 Menu (const char *title, bool backExistsApp, bool isSubMenu)
 Copies title, saves flags and creates and empty Command list. More...
 
 Menu (const char *title, bool backExistsApp, bool isSubMenu, const Command *commands, unsigned commandCount)
 Copies title, saves flags and copies commands. More...
 
+void addCommand (const Command &command)
 Adds a command to the internal Command list.
 
void registerError (const char *message) const
 Tell Menu to show an error message next time it prints. More...
 
void registerWarning (const char *message) const
 Tell Menu to show a warning message next time it prints. More...
 
void registerSuccess (const char *message) const
 Tell Menu to show a success message next time it prints. More...
 
void navigate () const
 Lists commands and after user input executes an appropriate command run() function. More...
 
+

Detailed Description

+

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.

+

Constructor & Destructor Documentation

+ +

◆ Menu() [1/2]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Menu::Menu (const char * title,
bool backExistsApp,
bool isSubMenu 
)
+
+ +

Copies title, saves flags and creates and empty Command list.

+
Parameters
+ + + + +
titleC-style string, class stores at most 255 characters (last character is always terminating zero)
backExistsAppFlag whether or not to list the 0-th option as "Exit", rather than "Go Back"
isSubMenuFlag whether or not to show the title as a subTitle or not
+
+
+ +
+
+ +

◆ Menu() [2/2]

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Menu::Menu (const char * title,
bool backExistsApp,
bool isSubMenu,
const Command * commands,
unsigned commandCount 
)
+
+ +

Copies title, saves flags and copies commands.

+
Parameters
+ + + + + + +
titleC-style string, class stores at most 255 characters (last character is always terminating zero)
backExistsAppFlag whether or not to list the 0-th option as "Exit", rather than "Go Back"
isSubMenuFlag whether or not to show the title as a subTitle or not
commandsPointer to an array of Command instances
commandCountNumber of elements that "commands" points to
+
+
+ +
+
+

Member Function Documentation

+ +

◆ navigate()

+ +
+
+ + + + + + + +
void Menu::navigate () const
+
+ +

Lists commands and after user input executes an appropriate command run() function.

+

Prints the title, then an Error/Warning/Sucess message (if set), prints all command names as an ordered list (starting from 1), waits for user input to select one of those commands (by list number) and finally executes the appropriate command's run() function.

+

After the run() function exists, everything is reprinted. The 0 list index is always "Go Back"/"Exit" and it always stops the reprinting loop.

+

If there are no commands, prints "Menu is empty!". If user input doesn't correspond to any command, registers an error message and reprints.

+ +
+
+ +

◆ registerError()

+ +
+
+ + + + + + + + +
void Menu::registerError (const char * message) const
+
+ +

Tell Menu to show an error message next time it prints.

+
Parameters
+ + +
messageC-style string, saves to pointer for later reuse when showing the message.
+
+
+

Stores the message pointer in a global variable (in the cpp file) and sets it's type as an Error in another global variable (in the cpp file).

+

The next time the whole Menu is shown, the message will appear below the title.

+ +
+
+ +

◆ registerSuccess()

+ +
+
+ + + + + + + + +
void Menu::registerSuccess (const char * message) const
+
+ +

Tell Menu to show a success message next time it prints.

+
Parameters
+ + +
messageC-style string, saves to pointer for later reuse when showing the message.
+
+
+

Stores the message pointer in a global variable (in the cpp file) and sets it's type as Success in another global variable (in the cpp file).

+

The next time the whole Menu is shown, the message will appear below the title.

+ +
+
+ +

◆ registerWarning()

+ +
+
+ + + + + + + + +
void Menu::registerWarning (const char * message) const
+
+ +

Tell Menu to show a warning message next time it prints.

+
Parameters
+ + +
messageC-style string, saves to pointer for later reuse when showing the message.
+
+
+

Stores the message pointer in a global variable (in the cpp file) and sets it's type as a Warning in another global variable (in the cpp file).

+

The next time the whole Menu is shown, the message will appear below the title.

+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + -- cgit v1.3.1-23-gd82d