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

menuMgr.h

Go to the documentation of this file.
00001 // menuMgr.h: interface for the menuMgr class.
00002 //
00004 
00005 #if !defined(AFX_MENUMGR_H__FF53C340_17C5_4672_86AA_6CCA7BCBC8E4__INCLUDED_)
00006 #define AFX_MENUMGR_H__FF53C340_17C5_4672_86AA_6CCA7BCBC8E4__INCLUDED_
00007 
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011 
00012 #pragma warning( disable : 4786 )
00013 #include <vector>
00014 #include <string>
00015 #include <algorithm>
00016 using namespace std;
00017 
00018 #include "Singleton.h"
00019 typedef void(*func)();
00020 
00021 typedef vector<string> stringVector;
00022 
00023 class menuOption
00024 {
00025 public:
00026     string              m_menuHeader;
00027     stringVector        m_options;
00028     stringVector        m_messages;
00029     vector< func >      m_functions;
00030     stringVector        m_helpMenus;
00031 };
00032 
00033 class mapOption
00034 {
00035 public:
00036     mapOption()
00037     {
00038 
00039     }
00040 
00041     mapOption(string o, string n) : option(o), mappedTo(n)
00042     {
00043 
00044     }
00045 
00046     bool operator==(const mapOption& mpo)
00047     {
00048         return (option == mpo.option);
00049     }
00050 
00051     bool operator<(const mapOption& mpo)
00052     {
00053         return (option < mpo.option);
00054     }
00055 
00056     string ToString()
00057     {
00058         return mappedTo;
00059     }
00060 
00061     string option;
00062     string mappedTo;
00063 };
00064 
00065 class menuMgr : public Singleton<menuMgr>
00066 {
00067 public:
00069     void wait();
00071     void map(string option, string mappedTo);
00072     bool m_done;
00073     bool done();
00074     void show(int Menu);
00075     void add(int menu, string key, string message, func function);
00076     void add(int menu, string key, string message, int retMenu);
00077     void add(int menu, string help);
00078     string getMapped(string old);
00079     void menuMgr::addHeader(int menu, string header);   
00080     void setDone(bool b);
00081 
00082     menuMgr();
00083     virtual ~menuMgr();
00084 private:
00085     void chooseOption(int currMenu, string key);
00086     vector< menuOption >    m_menuOptions;
00087     vector<int>             m_numOptions;
00089     vector<mapOption>       m_mapOptions;
00090 };
00091 
00092 #endif // !defined(AFX_MENUMGR_H__FF53C340_17C5_4672_86AA_6CCA7BCBC8E4__INCLUDED_)

Generated on Mon Oct 22 20:18:45 2001 for University People Management System by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001