Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

MenuItemBase Class Reference

class hierarchy for items of a menu system. More...

#include <MenuItems.h>

Inheritance diagram for MenuItemBase::

HandleId MenuField MenuSub List of all members.

Public Methods

 MenuItemBase (const String &in_command, const String &in_description, char hot_key)
virtual ~MenuItemBase ()
bool addItem (MenuItemBase *item)
virtual bool ambigousCommand (const String &in_command, char inkey)
virtual MenuItemBase* getItemPtr (const String &in_command, char inkey='\0', bool sublevels=false)
virtual MenuItemBase* getItemPtr (const char *cl_arg, char cl_char='\0')
virtual void prompt (Is in)
virtual void promptQuestion ()=0
virtual void helpCommand (Os os)=0
virtual void printCommandList (Os out, bool sublevels=false)=0
virtual void print4awk (Os out)=0
virtual String get ()
virtual void set (const String &value)
virtual void setAnswer (const String &answer)
virtual void search4multipleAnswers (MenuAnswerTable &table)=0
virtual void issueCallback ()
virtual String getDefaultAnswer ()
virtual String getValidAnswer ()
String getName ()
String getDescription ()
MenuItemBase* getNextItem ()
 DEF_VIRTUAL_CAST (MenuSub)
 DEF_VIRTUAL_CAST (MenuField)
 COPY_CONSTRUCTOR (MenuItemBase)

Public Attributes

int no_disabled_by
 DpList(MenuDisableInfo)
DpListItemHandle disable_info
 CLASS_INFO

Protected Attributes

String command
String description
char hot_key
Handle(MenuItemBaseitemlist
bool last_before_prompt

Detailed Description

class hierarchy for items of a menu system.

NAME: MenuItemBase - class hierarchy for items of a menu system.

DESCRIPTION:

Class "MenuItemBase" is implemented with two subclasses, "MenuField" and "MenuSub". The class is implemented as a single linked list data structure managed by a "MenuLists" object. Class "MenuField" is used for user input of answer strings. Class "MenuSub" contains a pointer to a "MenuLists" object (or in other, words, a pointer to a submenu list of "MenuItemBases" objects) and represents submenus.

All operations on "MenuItemBase" class objects are performed through class "MenuLists" and class "MenuSystem". See class "MenuSystem" for further information.


Constructor & Destructor Documentation

MenuItemBase::MenuItemBase ( const String & in_command,
const String & in_description,
char hot_key )
 

The only constructor available takes two "String" arguments "in_command" and "in_description" and use them as the command (menu item name) and description text, repsectively. The "char" argument "hot_key" is the character value used as a shortcut access to the current item.

MenuItemBase::~MenuItemBase ( ) [virtual]
 


Member Function Documentation

MenuItemBase::COPY_CONSTRUCTOR ( MenuItemBase )
 

MenuItemBase::DEF_VIRTUAL_CAST ( MenuField )
 

MenuItemBase::DEF_VIRTUAL_CAST ( MenuSub )
 

bool MenuItemBase::addItem ( MenuItemBase * item )
 

attachs item to the end of the list.

bool MenuItemBase::ambigousCommand ( const String & in_command,
char inkey ) [virtual]
 

returns true if the command "inc_command" or its hotkey "inkey" is matched in already stored commands and hotkeys, i.e., the command is ambigious. Otherwise it returns false.

String MenuItemBase::get ( ) [virtual]
 

returns the value input by the user. (Must be implemented by derived class).

Reimplemented in MenuField.

String MenuItemBase::getDefaultAnswer ( ) [virtual]
 

returns the default answer for this menu item. (Must be implemented by derived class).

Reimplemented in MenuField.

String MenuItemBase::getDescription ( )
 

returns the description text as set by the constructor.

MenuItemBase * MenuItemBase::getItemPtr ( const char * cl_arg,
char cl_char = '\0' ) [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in MenuField, and MenuSub.

MenuItemBase * MenuItemBase::getItemPtr ( const String & in_command,
char inkey = '\0',
bool sublevels = false ) [virtual]
 

is an important function that searches for the "MenuItemBase" ("MenuField" or "MenuSub" object) that corresponds to the user''s command. There are overloaded versions of the function. One version takes the user given command as a "String" (or hotkey) and is aimed at interactive terminal window dialog. Another version takes command line arguments (+words, -hotkey) as input and is used for the interface where the user gives menu commands on the Unix command line.

Reimplemented in MenuField, and MenuSub.

String MenuItemBase::getName ( )
 

returns the command (menu item name) as set by the constructor.

MenuItemBase * MenuItemBase::getNextItem ( )
 

get next menu item in the list maintained in class "MenuItems".

String MenuItemBase::getValidAnswer ( ) [virtual]
 

returns the validity string for this menu item. (Must be implemented by derived class).

Reimplemented in MenuField.

void MenuItemBase::helpCommand ( Os os ) [pure virtual]
 

prints the help text for the current menu item. (Must be implemented by derived class).

Reimplemented in MenuField, and MenuSub.

void MenuItemBase::issueCallback ( ) [virtual]
 

performs a callback to a functor supplied by the application programmer, see class "MenuCallBack". (Must be implemented by derived class).

Reimplemented in MenuField.

void MenuItemBase::print4awk ( Os out ) [pure virtual]
 

prints all info about this menu item in a format that is suitable for generation of an input manual. The process is continued recursively. (Must be implemented by derived class).

Reimplemented in MenuField, and MenuSub.

void MenuItemBase::printCommandList ( Os out,
bool sublevels = false ) [pure virtual]
 

prints the command, default answer and validation string for this menu item. The process is continued recursively. (Must be implemented by derived class).

Reimplemented in MenuField, and MenuSub.

void MenuItemBase::prompt ( Is in ) [virtual]
 

presents a part of the menu (submenu) to the user. (Must be implemented by derived class).

Reimplemented in MenuField, and MenuSub.

void MenuItemBase::promptQuestion ( ) [pure virtual]
 

asks the user a question and reads an answer. In case of an empty answer, the default answer is used. Performs this task recursively. (Must be implemented by derived class).

Reimplemented in MenuField, and MenuSub.

void MenuItemBase::search4multipleAnswers ( MenuAnswerTable & table ) [pure virtual]
 

searches for multiple answers to the current menu item. (Must be implemented by derived class).

Reimplemented in MenuField, and MenuSub.

void MenuItemBase::set ( const String & value ) [virtual]
 

stores the user-supplied value for this menu item. (Must be implemented by derived class).

Reimplemented in MenuField.

void MenuItemBase::setAnswer ( const String & answer ) [virtual]
 

sets the current answer from user input if available, otherwise it sets it to the default answer. (Must be implemented by derived class).

Reimplemented in MenuField.


Friends And Related Function Documentation

class MenuLists [friend]
 

Reimplemented in MenuSub.

class MenuSystem [friend]
 

Reimplemented in MenuField.


Member Data Documentation

MenuItemBase::CLASS_INFO
 

Reimplemented in MenuSub.

MenuItemBase::DpList_MenuDisableInfo
 

String MenuItemBase::command [protected]
 

String MenuItemBase::description [protected]
 

DpListItemHandle MenuItemBase::disable_info
 

char MenuItemBase::hot_key [protected]
 

Handle(MenuItemBase) MenuItemBase::itemlist [protected]
 

bool MenuItemBase::last_before_prompt [protected]
 

int MenuItemBase::no_disabled_by
 


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.