106 public: |
106 public: |
107 |
107 |
108 ///\e |
108 ///\e |
109 ArgParser(int argc, char **argv); |
109 ArgParser(int argc, char **argv); |
110 |
110 |
|
111 ~ArgParser(); |
|
112 |
111 ///Add a new integer type option |
113 ///Add a new integer type option |
112 |
114 |
113 ///\param name The name of the option. The leading '-' must be omitted. |
115 ///\param name The name of the option. The leading '-' must be omitted. |
114 ///\param help A help string. |
116 ///\param help A help string. |
115 ///\retval value The value of the argument will be written to this variable. |
117 ///\retval value The value of the argument will be written to this variable. |
116 ///\param obl Indicate if the option is mandatory. |
118 ///\param obl Indicate if the option is mandatory. |
117 ArgParser &option(const std::string &name, |
119 ArgParser &intOption(const std::string &name, |
|
120 const std::string &help, |
|
121 int value=0, bool obl=false); |
|
122 |
|
123 ///Add a new floating type option |
|
124 |
|
125 ///\param name The name of the option. The leading '-' must be omitted. |
|
126 ///\param help A help string. |
|
127 ///\retval value The value of the argument will be written to this variable. |
|
128 ///\param obl Indicate if the option is mandatory. |
|
129 ArgParser &doubleOption(const std::string &name, |
|
130 const std::string &help, |
|
131 double value=0, bool obl=false); |
|
132 |
|
133 ///Add a new bool type option |
|
134 |
|
135 ///\param name The name of the option. The leading '-' must be omitted. |
|
136 ///\param help A help string. |
|
137 ///\retval value The value of the argument will be written to this variable. |
|
138 ///\param obl Indicate if the option is mandatory. |
|
139 ////\note A mandatory bool obtion is of very little use.) |
|
140 ArgParser &boolOption(const std::string &name, |
|
141 const std::string &help, |
|
142 bool value=false, bool obl=false); |
|
143 |
|
144 ///Add a new string type option |
|
145 |
|
146 ///\param name The name of the option. The leading '-' must be omitted. |
|
147 ///\param help A help string. |
|
148 ///\retval value The value of the argument will be written to this variable. |
|
149 ///\param obl Indicate if the option is mandatory. |
|
150 ArgParser &stringOption(const std::string &name, |
|
151 const std::string &help, |
|
152 std::string value="", bool obl=false); |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 ///Add a new integer type option |
|
158 |
|
159 ///\param name The name of the option. The leading '-' must be omitted. |
|
160 ///\param help A help string. |
|
161 ///\retval value The value of the argument will be written to this variable. |
|
162 ///\param obl Indicate if the option is mandatory. |
|
163 ArgParser &refOption(const std::string &name, |
118 const std::string &help, |
164 const std::string &help, |
119 int &value, bool obl=false); |
165 int &value, bool obl=false); |
120 |
166 |
121 ///Add a new floating type option |
167 ///Add a new floating type option |
122 |
168 |
123 ///\param name The name of the option. The leading '-' must be omitted. |
169 ///\param name The name of the option. The leading '-' must be omitted. |
124 ///\param help A help string. |
170 ///\param help A help string. |
125 ///\retval value The value of the argument will be written to this variable. |
171 ///\retval value The value of the argument will be written to this variable. |
126 ///\param obl Indicate if the option is mandatory. |
172 ///\param obl Indicate if the option is mandatory. |
127 ArgParser &option(const std::string &name, |
173 ArgParser &refOption(const std::string &name, |
128 const std::string &help, |
174 const std::string &help, |
129 double &value, bool obl=false); |
175 double &value, bool obl=false); |
130 |
176 |
131 ///Add a new bool type option |
177 ///Add a new bool type option |
132 |
178 |
133 ///\param name The name of the option. The leading '-' must be omitted. |
179 ///\param name The name of the option. The leading '-' must be omitted. |
134 ///\param help A help string. |
180 ///\param help A help string. |
135 ///\retval value The value of the argument will be written to this variable. |
181 ///\retval value The value of the argument will be written to this variable. |
136 ///\param obl Indicate if the option is mandatory. |
182 ///\param obl Indicate if the option is mandatory. |
137 ////\note A mandatory bool obtion is of very little use.) |
183 ////\note A mandatory bool obtion is of very little use.) |
138 ArgParser &option(const std::string &name, |
184 ArgParser &refOption(const std::string &name, |
139 const std::string &help, |
185 const std::string &help, |
140 bool &value, bool obl=false); |
186 bool &value, bool obl=false); |
141 |
187 |
142 ///Add a new string type option |
188 ///Add a new string type option |
143 |
189 |
144 ///\param name The name of the option. The leading '-' must be omitted. |
190 ///\param name The name of the option. The leading '-' must be omitted. |
145 ///\param help A help string. |
191 ///\param help A help string. |
146 ///\retval value The value of the argument will be written to this variable. |
192 ///\retval value The value of the argument will be written to this variable. |
147 ///\param obl Indicate if the option is mandatory. |
193 ///\param obl Indicate if the option is mandatory. |
148 ArgParser &option(const std::string &name, |
194 ArgParser &refOption(const std::string &name, |
149 const std::string &help, |
195 const std::string &help, |
150 std::string &value, bool obl=false); |
196 std::string &value, bool obl=false); |
151 |
197 |
152 ///Bind a function to an option. |
198 ///Bind a function to an option. |
153 |
199 |
154 ///\param name The name of the option. The leading '-' must be omitted. |
200 ///\param name The name of the option. The leading '-' must be omitted. |
155 ///\param help A help string. |
201 ///\param help A help string. |
156 ///\retval func The function to be called when the option is given. It |
202 ///\retval func The function to be called when the option is given. It |
157 /// must be of type "void f(void *)" |
203 /// must be of type "void f(void *)" |
158 ///\param data Data to be passed to \c func |
204 ///\param data Data to be passed to \c func |
159 ArgParser &option(const std::string &name, |
205 ArgParser &refOption(const std::string &name, |
160 const std::string &help, |
206 const std::string &help, |
161 void (*func)(void *),void *data); |
207 void (*func)(void *),void *data); |
162 |
208 |
163 ///Boundle some options into a group |
209 ///Boundle some options into a group |
164 |
210 |