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