1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
\hypertarget{classMenu}{}\doxysection{Menu Class Reference}
\label{classMenu}\index{Menu@{Menu}}
Handles navigation between multiple commands.
{\ttfamily \#include $<$Menu.\+h$>$}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
\mbox{\Hypertarget{classMenu_ad466dd83355124a6ed958430450bfe94}\label{classMenu_ad466dd83355124a6ed958430450bfe94}}
{\bfseries Menu} ()
\begin{DoxyCompactList}\small\item\em Sets name as \char`\"{}\+Menu\char`\"{}, leaves all flags to false and creates an empty \mbox{\hyperlink{classCommand}{Command}} list. \end{DoxyCompactList}\item
\mbox{\hyperlink{classMenu_aeec919379638ad526df5167ed755a1f3}{Menu}} (const char $\ast$title, bool back\+Exists\+App, bool is\+Sub\+Menu)
\begin{DoxyCompactList}\small\item\em Copies title, saves flags and creates and empty \mbox{\hyperlink{classCommand}{Command}} list. \end{DoxyCompactList}\item
\mbox{\hyperlink{classMenu_a12057ad84f3a9d41bc7092cc2d86c87a}{Menu}} (const char $\ast$title, bool back\+Exists\+App, bool is\+Sub\+Menu, const \mbox{\hyperlink{classCommand}{Command}} $\ast$commands, unsigned command\+Count)
\begin{DoxyCompactList}\small\item\em Copies title, saves flags and copies commands. \end{DoxyCompactList}\item
\mbox{\Hypertarget{classMenu_a1f022cc8b705369073f8fd7b90b30c8d}\label{classMenu_a1f022cc8b705369073f8fd7b90b30c8d}}
void {\bfseries add\+Command} (const \mbox{\hyperlink{classCommand}{Command}} \&command)
\begin{DoxyCompactList}\small\item\em Adds a command to the internal \mbox{\hyperlink{classCommand}{Command}} list. \end{DoxyCompactList}\item
void \mbox{\hyperlink{classMenu_aad506cb9a7f35dea98c60484bb2d095c}{register\+Error}} (const char $\ast$message) const
\begin{DoxyCompactList}\small\item\em Tell \mbox{\hyperlink{classMenu}{Menu}} to show an error message next time it prints. \end{DoxyCompactList}\item
void \mbox{\hyperlink{classMenu_a5350b1addf9bf365351486cd161696ad}{register\+Warning}} (const char $\ast$message) const
\begin{DoxyCompactList}\small\item\em Tell \mbox{\hyperlink{classMenu}{Menu}} to show a warning message next time it prints. \end{DoxyCompactList}\item
void \mbox{\hyperlink{classMenu_a3504e28b5d05e1ad70dada190bbc3a9c}{register\+Success}} (const char $\ast$message) const
\begin{DoxyCompactList}\small\item\em Tell \mbox{\hyperlink{classMenu}{Menu}} to show a success message next time it prints. \end{DoxyCompactList}\item
void \mbox{\hyperlink{classMenu_a0400751da7f8583029b7a12d3003c36d}{navigate}} () const
\begin{DoxyCompactList}\small\item\em Lists commands and after user input executes an appropriate command run() function. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection{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\textquotesingle{}s run() function.
\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{classMenu_aeec919379638ad526df5167ed755a1f3}\label{classMenu_aeec919379638ad526df5167ed755a1f3}}
\index{Menu@{Menu}!Menu@{Menu}}
\index{Menu@{Menu}!Menu@{Menu}}
\doxysubsubsection{\texorpdfstring{Menu()}{Menu()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily Menu\+::\+Menu (\begin{DoxyParamCaption}\item[{const char $\ast$}]{title, }\item[{bool}]{back\+Exists\+App, }\item[{bool}]{is\+Sub\+Menu }\end{DoxyParamCaption})}
Copies title, saves flags and creates and empty \mbox{\hyperlink{classCommand}{Command}} list.
\begin{DoxyParams}{Parameters}
{\em title} & C-\/style string, class stores at most 255 characters (last character is always terminating zero) \\
\hline
{\em back\+Exists\+App} & Flag whether or not to list the 0-\/th option as \char`\"{}\+Exit\char`\"{}, rather than \char`\"{}\+Go Back\char`\"{} \\
\hline
{\em is\+Sub\+Menu} & Flag whether or not to show the title as a sub\+Title or not \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{classMenu_a12057ad84f3a9d41bc7092cc2d86c87a}\label{classMenu_a12057ad84f3a9d41bc7092cc2d86c87a}}
\index{Menu@{Menu}!Menu@{Menu}}
\index{Menu@{Menu}!Menu@{Menu}}
\doxysubsubsection{\texorpdfstring{Menu()}{Menu()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily Menu\+::\+Menu (\begin{DoxyParamCaption}\item[{const char $\ast$}]{title, }\item[{bool}]{back\+Exists\+App, }\item[{bool}]{is\+Sub\+Menu, }\item[{const \mbox{\hyperlink{classCommand}{Command}} $\ast$}]{commands, }\item[{unsigned}]{command\+Count }\end{DoxyParamCaption})}
Copies title, saves flags and copies commands.
\begin{DoxyParams}{Parameters}
{\em title} & C-\/style string, class stores at most 255 characters (last character is always terminating zero) \\
\hline
{\em back\+Exists\+App} & Flag whether or not to list the 0-\/th option as \char`\"{}\+Exit\char`\"{}, rather than \char`\"{}\+Go Back\char`\"{} \\
\hline
{\em is\+Sub\+Menu} & Flag whether or not to show the title as a sub\+Title or not \\
\hline
{\em commands} & Pointer to an array of \mbox{\hyperlink{classCommand}{Command}} instances \\
\hline
{\em command\+Count} & Number of elements that \char`\"{}commands\char`\"{} points to \\
\hline
\end{DoxyParams}
\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classMenu_a0400751da7f8583029b7a12d3003c36d}\label{classMenu_a0400751da7f8583029b7a12d3003c36d}}
\index{Menu@{Menu}!navigate@{navigate}}
\index{navigate@{navigate}!Menu@{Menu}}
\doxysubsubsection{\texorpdfstring{navigate()}{navigate()}}
{\footnotesize\ttfamily void Menu\+::navigate (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) 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\textquotesingle{}s run() function.
After the run() function exists, everything is reprinted. The 0 list index is always \char`\"{}\+Go Back\char`\"{}/\char`\"{}\+Exit\char`\"{} and it always stops the reprinting loop.
If there are no commands, prints \char`\"{}\+Menu is empty!\char`\"{}. If user input doesn\textquotesingle{}t correspond to any command, registers an error message and reprints. \mbox{\Hypertarget{classMenu_aad506cb9a7f35dea98c60484bb2d095c}\label{classMenu_aad506cb9a7f35dea98c60484bb2d095c}}
\index{Menu@{Menu}!registerError@{registerError}}
\index{registerError@{registerError}!Menu@{Menu}}
\doxysubsubsection{\texorpdfstring{registerError()}{registerError()}}
{\footnotesize\ttfamily void Menu\+::register\+Error (\begin{DoxyParamCaption}\item[{const char $\ast$}]{message }\end{DoxyParamCaption}) const}
Tell \mbox{\hyperlink{classMenu}{Menu}} to show an error message next time it prints.
\begin{DoxyParams}{Parameters}
{\em message} & C-\/style string, saves to pointer for later reuse when showing the message.\\
\hline
\end{DoxyParams}
Stores the message pointer in a global variable (in the cpp file) and sets it\textquotesingle{}s type as an Error in another global variable (in the cpp file).
The next time the whole \mbox{\hyperlink{classMenu}{Menu}} is shown, the message will appear below the title. \mbox{\Hypertarget{classMenu_a3504e28b5d05e1ad70dada190bbc3a9c}\label{classMenu_a3504e28b5d05e1ad70dada190bbc3a9c}}
\index{Menu@{Menu}!registerSuccess@{registerSuccess}}
\index{registerSuccess@{registerSuccess}!Menu@{Menu}}
\doxysubsubsection{\texorpdfstring{registerSuccess()}{registerSuccess()}}
{\footnotesize\ttfamily void Menu\+::register\+Success (\begin{DoxyParamCaption}\item[{const char $\ast$}]{message }\end{DoxyParamCaption}) const}
Tell \mbox{\hyperlink{classMenu}{Menu}} to show a success message next time it prints.
\begin{DoxyParams}{Parameters}
{\em message} & C-\/style string, saves to pointer for later reuse when showing the message.\\
\hline
\end{DoxyParams}
Stores the message pointer in a global variable (in the cpp file) and sets it\textquotesingle{}s type as Success in another global variable (in the cpp file).
The next time the whole \mbox{\hyperlink{classMenu}{Menu}} is shown, the message will appear below the title. \mbox{\Hypertarget{classMenu_a5350b1addf9bf365351486cd161696ad}\label{classMenu_a5350b1addf9bf365351486cd161696ad}}
\index{Menu@{Menu}!registerWarning@{registerWarning}}
\index{registerWarning@{registerWarning}!Menu@{Menu}}
\doxysubsubsection{\texorpdfstring{registerWarning()}{registerWarning()}}
{\footnotesize\ttfamily void Menu\+::register\+Warning (\begin{DoxyParamCaption}\item[{const char $\ast$}]{message }\end{DoxyParamCaption}) const}
Tell \mbox{\hyperlink{classMenu}{Menu}} to show a warning message next time it prints.
\begin{DoxyParams}{Parameters}
{\em message} & C-\/style string, saves to pointer for later reuse when showing the message.\\
\hline
\end{DoxyParams}
Stores the message pointer in a global variable (in the cpp file) and sets it\textquotesingle{}s type as a Warning in another global variable (in the cpp file).
The next time the whole \mbox{\hyperlink{classMenu}{Menu}} is shown, the message will appear below the title.
The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item
src/\+Generic/\+Console\+Interface/\mbox{\hyperlink{Menu_8h}{Menu.\+h}}\item
src/\+Generic/\+Console\+Interface/Menu.\+cpp\end{DoxyCompactItemize}
|