Debian Codegraph @

src/gengine/OptionAgent.h

raw
1 #ifndef HEADER_OPTIONAGENT_H
2 #define HEADER_OPTIONAGENT_H
3
4 class Environ;
5 class OptionParams;
6
7 #include "BaseAgent.h"
8 #include "Name.h"
9
10 #include <string>
11 #include <map>
12
13 /**
14 * Game options.
15 */
16 class OptionAgent : public BaseAgent {
17 AGENT(OptionAgent, Name::OPTION_NAME);
18 private:
19 static const char *CONFIG_FILE;
20 Environ *m_environ;
21 private:
22 void prepareVersion();
23 void prepareDataPaths();
24 void prepareLang();
25 void parseDashOpt(const std::string &arg,
26 const OptionParams &params);
27 void parseParamOpt(const std::string &arg,
28 const OptionParams &params);
29 bool splitOpt(const std::string &option,
30 std::string *out_name, std::string *out_value);
31 std::string getHelpInfo(const OptionParams &params) const;
32 std::string getVersionInfo() const;
33 void readSystemConfig();
34 void readUserConfig();
35 protected:
36 virtual void own_init();
37 virtual void own_shutdown();
38 public:
39 void parseCmdOpt(int argc, char *argv[],
40 const OptionParams &params);
41 void setParam(const std::string &name, const std::string &value);
42 void setParam(const std::string &name, long value);
43 void setPersistent(const std::string &name, const std::string &value);
44 void setPersistent(const std::string &name, long value);
45 void setDefault(const std::string &name, const std::string &value);
46 void setDefault(const std::string &name, int value);
47
48 std::string getParam(const std::string &name,
49 const std::string &implicit="") const;
50 int getAsInt(const std::string &name,
51 int implicit=0) const;
52 bool getAsBool(const std::string &name,
53 bool implicit=false) const;
54
55 void addWatcher(const std::string &name, BaseMsg *msg);
56 void removeWatchers(const std::string &listenerName);
57 void receiveString(const StringMsg *msg);
58 };
59
60 #endif