Debian Codegraph @

src/gengine/OptionParams.h

raw
1 #ifndef HEADER_OPTIONPARAMS_H
2 #define HEADER_OPTIONPARAMS_H
3
4 class Environ;
5
6 #include "NoCopy.h"
7
8 #include <map>
9 #include <string>
10
11 /**
12 * Describe command line params.
13 */
14 class OptionParams : public NoCopy {
15 public:
16 enum eType {
17 TYPE_NUMBER,
18 TYPE_BOOLEAN,
19 TYPE_STRING,
20 TYPE_PATH
21 };
22 private:
23 struct Param {
24 eType type;
25 std::string help;
26 Param(eType aType, const std::string &aHelp)
27 : type(aType), help(aHelp) {}
28 };
29 typedef std::map<std::string,Param> t_params;
30 t_params m_params;
31 int m_maxSize;
32 private:
33 std::string getType(eType type) const;
34 public:
35 OptionParams() { m_maxSize = 0; }
36 void addParam(const std::string &name, eType type,
37 const std::string &help);
38
39 std::string getHelp(const Environ *options) const;
40 std::string getConfig(const Environ *options) const;
41 void checkValidity(const std::string &name, const std::string &value) const;
42 };
43
44
45
46 #endif