00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MDWCOMMANDMANAGER_H
00021 #define MDWCOMMANDMANAGER_H
00022 #include <map>
00023 #include <vector>
00024 #include <string>
00025
00026 namespace mdw
00027 {
00028 class CommandHandler;
00029 class Stream;
00033 class CommandManager
00034 {
00035 public:
00036 static void initialise();
00037 static CommandManager &getInstance();
00038 CommandHandler *getHandler (const std::vector<std::string> &tokens, int &position);
00039 CommandHandler *getHandler (const std::string &firstLevel);
00040 void execute (const std::vector<std::string> &tokens, Stream &output);
00041 CommandHandler &createNode (const std::string &subHandler, CommandHandler *handler = 0);
00042 private:
00043 CommandManager();
00044 ~CommandManager();
00045 static CommandManager *_instance;
00046 void init();
00047
00048 std::map<std::string, CommandHandler*> _commandTree;
00049
00050 };
00051
00052 }
00053
00054 #endif