*** empty log message ***
[h316.git] / pc-tools / ldc2 / src / configuration_manager.hh
1 #ifndef ARGUMENT_READER_H
2 #define ARGUMENT_READER_H
3
4 #include <vector>
5 #include <string>
6
7 using namespace std;
8
9 /*!
10 *\brief Hachti's wonderful commandline parser.
11 *
12 * This class is designed to do all the work with the parameters passed to
13 * the main() routine of a program.\n
14 * Usage:\n
15 * - Create an instance.
16 * - Add Parameters/switches with add_param().
17 * - Add Arguments with add_argument().
18 * - Call read_args() with your main routine's arguments.
19 * The vector returned by read_args() contains all error
20 * messages. When it's empty, everything is fine!
21 * - Call get_help() if you want nice formatted help output.
22 * (You want!!!)
23 * Sould be easy to use..... Enjoy.
24 */
25 class argument_reader{
26
27 public:
28 argument_reader(string name);
29
30 void add_param (string shortname,
31 string longname,
32 string description,
33 int *status,
34 string *target=NULL,
35 string placeholder=string("<string>")
36 );
37
38 vector<string> read_args(int argc, char ** args);
39
40 void get_help(vector<string> & target);
41 vector<string> get_help();
42
43 void add_argument(string placeholder, string description, int * status, string * target);
44
45 private:
46 /*!
47 *\brief Container for one command line option.
48 */
49 class opt_t{
50 public:
51 opt_t (string shortname, string longname,string description, int * status,
52 string * target=NULL, string placeholder=string("<string>"));
53 string shortname;
54 string longname;
55 int * status;
56 string * target;
57 string description;
58 string placeholder;
59 };
60
61 /*!
62 *\brief Container for one command line argument.
63 */
64 class arg_t{
65 public:
66 arg_t (string placeholder,string description,
67 int * status, string * target);
68 int * status;
69 string * target;
70 string description;
71 string placeholder;
72 };
73 vector<opt_t>opt_v;
74 vector<arg_t>arg_v;
75 string app_name;
76
77 }; // class argument_reader
78
79
80 #endif