head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.37; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.53; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.54.00; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.21.55; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# commands.hxx

Go to the documentation of this file.

    00001
    00010 #ifndef __COMMANDS_HXX
    00011 #define __COMMANDS_HXX
    00012
    00013
    00014 #include <simgear/compiler.h>
    00015
    00016 #include STL_STRING
    00017 #include <map>
    00018 #include <vector>
    00019
    00020 #include "props.hxx"
    00021
    00022 SG_USING_STD(string);
    00023 SG_USING_STD(map);
    00024 SG_USING_STD(vector);
    00025
    00026
    00048 class SGCommandState
    00049 {
    00050 public:
    00051   SGCommandState ();
    00052   SGCommandState (const SGPropertyNode * args);
    00053   virtual ~SGCommandState ();
    00054   virtual void setArgs (const SGPropertyNode * args);
    00055   virtual const SGPropertyNode * getArgs () const { return _args; }
    00056 private:
    00057   SGPropertyNode * _args;
    00058 };
    00059
    00060
    00082 class SGCommandMgr
    00083 {
    00084 public:
    00085
    00089   typedef bool (*command_t) (const SGPropertyNode * arg,
    00090                              SGCommandState ** state);
    00091
    00092
    00096   SGCommandMgr ();
    00097
    00098
    00102   virtual ~SGCommandMgr ();
    00103
    00104
    00114   virtual void addCommand (const string &name, command_t command);
    00115
    00116
    00124   virtual command_t getCommand (const string &name) const;
    00125
    00126
    00133   virtual vector<string> getCommandNames () const;
    00134
    00135
    00149   virtual bool execute (const string &name,
    00150                         const SGPropertyNode * arg,
    00151                         SGCommandState ** state) const;
    00152
    00153 private:
    00154
    00155   typedef map<string,command_t> command_map;
    00156   command_map _commands;
    00157
    00158 };
    00159
    00160 #endif // __COMMANDS_HXX
    00161
    00162 // end of commands.hxx

@ 1.3 log @Oops, try again. @ text @d77 1 a77 1