Classes | Public Types | Public Member Functions

Menu Class Reference

Class defining and handling one menu tree. More...

#include <menu.h>

Collaboration diagram for Menu:
Collaboration graph
[legend]

List of all members.

Classes

struct  arg
struct  command

Public Types

typedef int8_t(* func )(uint8_t argc, const struct arg *argv)
typedef bool(* preprompt )(void)

Public Member Functions

 Menu (const char *prompt, const struct command *commands, uint8_t entries, preprompt ppfunc=0)
void run (void)
 menu runner

Detailed Description

Class defining and handling one menu tree.

Definition at line 24 of file menu.h.


Member Typedef Documentation

typedef int8_t(* Menu::func)(uint8_t argc, const struct arg *argv)

menu command function

Functions called by menu array entries are expected to be of this type.

Parameters:
argc The number of valid arguments, including the name of the command in argv[0]. Will never be more than MENU_ARGS_MAX.
argv Pointer to an array of Menu::arg structures detailing any optional arguments given to the command. argv[0] is always the name of the command, so that the same function can be used to handle more than one command.

Definition at line 55 of file menu.h.

typedef bool(* Menu::preprompt)(void)

menu pre-prompt function

Called immediately before waiting for the user to type a command; can be used to display help text or status, for example.

If this function returns false, the menu exits.

Definition at line 64 of file menu.h.


Constructor & Destructor Documentation

Menu::Menu ( const char *  prompt,
const struct command commands,
uint8_t  entries,
preprompt  ppfunc = 0 
)

constructor

Note that you should normally not call the constructor directly. Use the MENU and MENU2 macros defined below.

Parameters:
prompt The prompt to be displayed with this menu.
commands An array of command structures in program memory (PROGMEM).
entries The number of entries in the menu.

Member Function Documentation

void Menu::run ( void   ) 

menu runner

Definition at line 31 of file menu.cpp.


The documentation for this class was generated from the following files: