- Albatross's Rapid Numeric Menu Development Header Documentation.
- All the classes are in the namespace nmenu.
- The base class for all the other classes in this work. Declares a few simple functions which all the derived classes need to have for this library to work gracefully, namely:
- exec(): Meant to store the "meat" of the item. This is called whenever the item needs to actually do its job.
- set_name(): The name the item will use as displayed by a MenuList.
- set_return(): Takes a pointer to another MenuBase derivative as an argument, which will be called after exec() is finished. Alternatively, nullptr may be supplied as an argument, in which case the user will leave the menu under certain circumstances.
- Stores and removes a list of pointers to other MenuBase derivatives. When exec() is called, the descriptions of the pointed-to items are printed, and the user is allowed to choose one of them, at which point the exec() of that item will be called. If a description is empty, three question marks are printed instead.
- The constructor can take a string describing this menu that will be printed if the object ever becomes the item of another MenuList, which is an empty string by default. The second argument is passed to set_return(), and is nullptr by default.
- A pointer can be added to the internal list by passing it as an argument to the member function connect(). This will add it to the end of the list. To remove a pointer, the member function disconnect() may be called with the index of the option to be removed. If the last item needs to be removed, then a convenience member function disconnect_last() may be called. If the whole list needs to be cleared, the member function disconnect_all() may also be used.
- A single item on the menu. This is a templated derivative of MenuBase, which expects a few arguments to its constructor. The first is its description that the MenuList will print. The second is expected to be a pointer to a function, a function object, a pointer to a function object, or a pointer to a lambda that can be called without passing any arguments to it. The third argument is passed to set_return(), and is nullptr by default.
- This is a convenience class that when called will make the program leave the menu. It will not necessarily terminate the program if there is code after the exec() call that makes the program enter the menu.
- It can take two arguments in its constructor. The first is the usual description. The second is a message that will be printed if this option is selected.
a guest Oct 2nd, 2012 73 Never
RAW Paste Data