Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

OptionAgent.h

Go to the documentation of this file.
00001 #ifndef HEADER_OPTIONAGENT_H
00002 #define HEADER_OPTIONAGENT_H
00003 
00004 class Environ;
00005 class OptionParams;
00006 
00007 #include "BaseAgent.h"
00008 #include "Name.h"
00009 
00010 #include <string>
00011 #include <map>
00012 
00013 /**
00014  * Game options.
00015  */
00016 class OptionAgent : public BaseAgent {
00017     AGENT(OptionAgent, Name::OPTION_NAME);
00018     private:
00019         static const char *CONFIG_FILE;
00020         Environ *m_environ;
00021     private:
00022         void prepareVersion();
00023         void prepareDataPaths();
00024         void prepareLang();
00025         void parseDashOpt(const std::string &arg,
00026                 const OptionParams &params);
00027         void parseParamOpt(const std::string &arg,
00028                 const OptionParams &params);
00029         bool splitOpt(const std::string &option,
00030                 std::string *out_name, std::string *out_value);
00031         std::string getHelpInfo(const OptionParams &params) const;
00032         std::string getVersionInfo() const;
00033         void readSystemConfig();
00034         void readUserConfig();
00035     protected:
00036         virtual void own_init();
00037         virtual void own_shutdown();
00038     public:
00039         void parseCmdOpt(int argc, char *argv[],
00040                 const OptionParams &params);
00041         void setParam(const std::string &name, const std::string &value);
00042         void setParam(const std::string &name, long value);
00043         void setPersistent(const std::string &name, const std::string &value);
00044         void setPersistent(const std::string &name, long value);
00045         void setDefault(const std::string &name, const std::string &value);
00046         void setDefault(const std::string &name, int value);
00047 
00048         std::string getParam(const std::string &name,
00049                 const std::string &implicit="") const;
00050         int getAsInt(const std::string &name,
00051                 int implicit=0) const;
00052         bool getAsBool(const std::string &name,
00053                 bool implicit=false) const;
00054 
00055         void addWatcher(const std::string &name, BaseMsg *msg);
00056         void removeWatchers(const std::string &listenerName);
00057         void receiveString(const StringMsg *msg);
00058 };
00059 
00060 #endif

Generated on Wed Jun 1 09:54:31 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2