Want more features on Pastebin? Sign Up, it's FREE!

ARNMDH Documentation

By: a guest on Oct 2nd, 2012  |  syntax: None  |  size: 2.56 KB  |  views: 71  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Albatross's Rapid Numeric Menu Development Header Documentation.
  2. All the classes are in the namespace nmenu.
  4. Classes:
  5.         MenuBase
  6.                 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:
  7.                 exec(): Meant to store the "meat" of the item. This is called whenever the item needs to actually do its job.
  8.                 set_name(): The name the item will use as displayed by a MenuList.
  9.                 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.
  10.         MenuList
  11.                 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.
  12.                 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.
  13.                 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.
  14.         MenuItem
  15.                 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.
  16.         MenuExit
  17.                 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.
  18.                 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.
clone this paste RAW Paste Data