101 }; |
101 }; |
102 |
102 |
103 std::vector<OtherArg> _others_help; |
103 std::vector<OtherArg> _others_help; |
104 std::vector<std::string> _file_args; |
104 std::vector<std::string> _file_args; |
105 std::string _command_name; |
105 std::string _command_name; |
|
106 |
|
107 |
|
108 private: |
|
109 //Bind a function to an option. |
|
110 |
|
111 //\param name The name of the option. The leading '-' must be omitted. |
|
112 //\param help A help string. |
|
113 //\retval func The function to be called when the option is given. It |
|
114 // must be of type "void f(void *)" |
|
115 //\param data Data to be passed to \c func |
|
116 ArgParser &funcOption(const std::string &name, |
|
117 const std::string &help, |
|
118 void (*func)(void *),void *data); |
106 |
119 |
107 public: |
120 public: |
108 |
121 |
109 ///\e |
122 ///\e |
110 ArgParser(int argc, const char **argv); |
123 ArgParser(int argc, const char **argv); |
149 ///\retval value The value of the argument will be written to this variable. |
162 ///\retval value The value of the argument will be written to this variable. |
150 ///\param obl Indicate if the option is mandatory. |
163 ///\param obl Indicate if the option is mandatory. |
151 ArgParser &stringOption(const std::string &name, |
164 ArgParser &stringOption(const std::string &name, |
152 const std::string &help, |
165 const std::string &help, |
153 std::string value="", bool obl=false); |
166 std::string value="", bool obl=false); |
154 |
|
155 ///Bind a function to an option. |
|
156 |
|
157 ///\param name The name of the option. The leading '-' must be omitted. |
|
158 ///\param help A help string. |
|
159 ///\retval func The function to be called when the option is given. It |
|
160 /// must be of type "void f(void *)" |
|
161 ///\param data Data to be passed to \c func |
|
162 ArgParser &funcOption(const std::string &name, |
|
163 const std::string &help, |
|
164 void (*func)(void *),void *data); |
|
165 |
167 |
166 ///\name Options with an external strorage. |
168 ///\name Options with an external strorage. |
167 ///Using this functions, the value of the option will be directly written |
169 ///Using this functions, the value of the option will be directly written |
168 ///into a variable once the option appears in the command line. |
170 ///into a variable once the option appears in the command line. |
169 |
171 |