Skip to content

Commit cc7e3d7

Browse files
authored
Merge pull request #2224 from frozar/parse_cli
[PARSE] Constness of the API
2 parents e157f3f + dca6eac commit cc7e3d7

File tree

2 files changed

+51
-51
lines changed

2 files changed

+51
-51
lines changed

common/include/pcl/console/parse.h

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace pcl
5656
* \note find_switch is simply returning find_argument != -1.
5757
*/
5858
PCL_EXPORTS bool
59-
find_switch (int argc, char** argv, const char* argument_name);
59+
find_switch (int argc, const char * const * argv, const char * argument_name);
6060

6161
/** \brief Finds the position of the argument with name "argument_name" in the argument list "argv"
6262
* \param[in] argc the number of command line arguments
@@ -65,7 +65,7 @@ namespace pcl
6565
* \return index of found argument or -1 if arguments do not appear in list
6666
*/
6767
PCL_EXPORTS int
68-
find_argument (int argc, char** argv, const char* argument_name);
68+
find_argument (int argc, const char * const * argv, const char * argument_name);
6969

7070
/** \brief Template version for parsing arguments. Template parameter needs to have input stream operator overloaded!
7171
* \param[in] argc the number of command line arguments
@@ -75,7 +75,7 @@ namespace pcl
7575
* \return index of found argument or -1 if arguments do not appear in list
7676
*/
7777
template<typename Type> int
78-
parse (int argc, char** argv, const char* argument_name, Type& value)
78+
parse (int argc, const char * const * argv, const char * argument_name, Type& value)
7979
{
8080
int index = find_argument (argc, argv, argument_name) + 1;
8181

@@ -98,7 +98,7 @@ namespace pcl
9898
* \return index of found argument or -1 if arguments do not appear in list
9999
*/
100100
PCL_EXPORTS int
101-
parse_argument (int argc, char** argv, const char* str, std::string &val);
101+
parse_argument (int argc, const char * const * argv, const char * str, std::string &val);
102102

103103
/** \brief Parse for a specific given command line argument.
104104
* \param[in] argc the number of command line arguments
@@ -108,7 +108,7 @@ namespace pcl
108108
* \return index of found argument or -1 if arguments do not appear in list
109109
*/
110110
PCL_EXPORTS int
111-
parse_argument (int argc, char** argv, const char* str, bool &val);
111+
parse_argument (int argc, const char * const * argv, const char * str, bool &val);
112112

113113
/** \brief Parse for a specific given command line argument.
114114
* \param[in] argc the number of command line arguments
@@ -118,7 +118,7 @@ namespace pcl
118118
* \return index of found argument or -1 if arguments do not appear in list
119119
*/
120120
PCL_EXPORTS int
121-
parse_argument (int argc, char** argv, const char* str, float &val);
121+
parse_argument (int argc, const char * const * argv, const char * str, float &val);
122122

123123
/** \brief Parse for a specific given command line argument.
124124
* \param[in] argc the number of command line arguments
@@ -128,7 +128,7 @@ namespace pcl
128128
* \return index of found argument or -1 if arguments do not appear in list
129129
*/
130130
PCL_EXPORTS int
131-
parse_argument (int argc, char** argv, const char* str, double &val);
131+
parse_argument (int argc, const char * const * argv, const char * str, double &val);
132132

133133
/** \brief Parse for a specific given command line argument.
134134
* \param[in] argc the number of command line arguments
@@ -138,7 +138,7 @@ namespace pcl
138138
* \return index of found argument or -1 if arguments do not appear in list
139139
*/
140140
PCL_EXPORTS int
141-
parse_argument (int argc, char** argv, const char* str, int &val);
141+
parse_argument (int argc, const char * const * argv, const char * str, int &val);
142142

143143
/** \brief Parse for a specific given command line argument.
144144
* \param[in] argc the number of command line arguments
@@ -148,7 +148,7 @@ namespace pcl
148148
* \return index of found argument or -1 if arguments do not appear in list
149149
*/
150150
PCL_EXPORTS int
151-
parse_argument (int argc, char** argv, const char* str, unsigned int &val);
151+
parse_argument (int argc, const char * const * argv, const char * str, unsigned int &val);
152152

153153
/** \brief Parse for a specific given command line argument.
154154
* \param[in] argc the number of command line arguments
@@ -158,7 +158,7 @@ namespace pcl
158158
* \return index of found argument or -1 if arguments do not appear in list
159159
*/
160160
PCL_EXPORTS int
161-
parse_argument (int argc, char** argv, const char* str, char &val);
161+
parse_argument (int argc, const char * const * argv, const char * str, char &val);
162162

163163
/** \brief Parse for specific given command line arguments (2x values comma
164164
* separated).
@@ -171,7 +171,7 @@ namespace pcl
171171
* \return index of found argument or -1 if arguments do not appear in list
172172
*/
173173
PCL_EXPORTS int
174-
parse_2x_arguments (int argc, char** argv, const char* str, float &f, float &s, bool debug = true);
174+
parse_2x_arguments (int argc, const char * const * argv, const char * str, float &f, float &s, bool debug = true);
175175

176176
/** \brief Parse for specific given command line arguments (2x values comma
177177
* separated).
@@ -184,7 +184,7 @@ namespace pcl
184184
* \return index of found argument or -1 if arguments do not appear in list
185185
*/
186186
PCL_EXPORTS int
187-
parse_2x_arguments (int argc, char** argv, const char* str, double &f, double &s, bool debug = true);
187+
parse_2x_arguments (int argc, const char * const * argv, const char * str, double &f, double &s, bool debug = true);
188188

189189
/** \brief Parse for specific given command line arguments (2x values comma
190190
* separated).
@@ -197,7 +197,7 @@ namespace pcl
197197
* \return index of found argument or -1 if arguments do not appear in list
198198
*/
199199
PCL_EXPORTS int
200-
parse_2x_arguments (int argc, char** argv, const char* str, int &f, int &s, bool debug = true);
200+
parse_2x_arguments (int argc, const char * const * argv, const char * str, int &f, int &s, bool debug = true);
201201

202202
/** \brief Parse for specific given command line arguments (3x values comma
203203
* separated).
@@ -211,7 +211,7 @@ namespace pcl
211211
* \return index of found argument or -1 if arguments do not appear in list
212212
*/
213213
PCL_EXPORTS int
214-
parse_3x_arguments (int argc, char** argv, const char* str, float &f, float &s, float &t, bool debug = true);
214+
parse_3x_arguments (int argc, const char * const * argv, const char * str, float &f, float &s, float &t, bool debug = true);
215215

216216
/** \brief Parse for specific given command line arguments (3x values comma
217217
* separated).
@@ -225,7 +225,7 @@ namespace pcl
225225
* \return index of found argument or -1 if arguments do not appear in list
226226
*/
227227
PCL_EXPORTS int
228-
parse_3x_arguments (int argc, char** argv, const char* str, double &f, double &s, double &t, bool debug = true);
228+
parse_3x_arguments (int argc, const char * const * argv, const char * str, double &f, double &s, double &t, bool debug = true);
229229

230230
/** \brief Parse for specific given command line arguments (3x values comma
231231
* separated).
@@ -239,7 +239,7 @@ namespace pcl
239239
* return index of found argument or -1 if arguments do not appear in list
240240
*/
241241
PCL_EXPORTS int
242-
parse_3x_arguments (int argc, char** argv, const char* str, int &f, int &s, int &t, bool debug = true);
242+
parse_3x_arguments (int argc, const char * const * argv, const char * str, int &f, int &s, int &t, bool debug = true);
243243

244244
/** \brief Parse for specific given command line arguments (3x values comma
245245
* separated).
@@ -250,7 +250,7 @@ namespace pcl
250250
* \return index of found argument or -1 if arguments do not appear in list
251251
*/
252252
PCL_EXPORTS int
253-
parse_x_arguments (int argc, char** argv, const char* str, std::vector<double>& v);
253+
parse_x_arguments (int argc, const char * const * argv, const char * str, std::vector<double>& v);
254254

255255
/** \brief Parse for specific given command line arguments (N values comma
256256
* separated).
@@ -261,7 +261,7 @@ namespace pcl
261261
* \return index of found argument or -1 if arguments do not appear in list
262262
*/
263263
PCL_EXPORTS int
264-
parse_x_arguments (int argc, char** argv, const char* str, std::vector<float>& v);
264+
parse_x_arguments (int argc, const char * const * argv, const char * str, std::vector<float>& v);
265265

266266
/** \brief Parse for specific given command line arguments (N values comma
267267
* separated).
@@ -272,7 +272,7 @@ namespace pcl
272272
* \return index of found argument or -1 if arguments do not appear in list
273273
*/
274274
PCL_EXPORTS int
275-
parse_x_arguments (int argc, char** argv, const char* str, std::vector<int>& v);
275+
parse_x_arguments (int argc, const char * const * argv, const char * str, std::vector<int>& v);
276276

277277
/** \brief Parse for specific given command line arguments (multiple occurrences
278278
* of the same command line parameter).
@@ -283,7 +283,7 @@ namespace pcl
283283
* \return index of found argument or -1 if arguments do not appear in list
284284
*/
285285
PCL_EXPORTS bool
286-
parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<int> &values);
286+
parse_multiple_arguments (int argc, const char * const * argv, const char * str, std::vector<int> &values);
287287

288288
/** \brief Parse for specific given command line arguments (multiple occurrences
289289
* of the same command line parameter).
@@ -294,7 +294,7 @@ namespace pcl
294294
* \return true if found, false otherwise
295295
*/
296296
PCL_EXPORTS bool
297-
parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<float> &values);
297+
parse_multiple_arguments (int argc, const char * const * argv, const char * str, std::vector<float> &values);
298298

299299
/** \brief Parse for specific given command line arguments (multiple occurrences
300300
* of the same command line parameter).
@@ -305,7 +305,7 @@ namespace pcl
305305
* \return true if found, false otherwise
306306
*/
307307
PCL_EXPORTS bool
308-
parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<double> &values);
308+
parse_multiple_arguments (int argc, const char * const * argv, const char * str, std::vector<double> &values);
309309

310310
/** \brief Parse for a specific given command line argument (multiple occurrences
311311
* of the same command line parameter).
@@ -316,7 +316,7 @@ namespace pcl
316316
* \return true if found, false otherwise
317317
*/
318318
PCL_EXPORTS bool
319-
parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<std::string> &values);
319+
parse_multiple_arguments (int argc, const char * const * argv, const char * str, std::vector<std::string> &values);
320320

321321
/** \brief Parse command line arguments for file names with given extension (multiple occurrences
322322
* of 2x argument groups, separated by commas).
@@ -328,7 +328,7 @@ namespace pcl
328328
* \return true if found, false otherwise
329329
*/
330330
PCL_EXPORTS bool
331-
parse_multiple_2x_arguments (int argc, char** argv, const char* str,
331+
parse_multiple_2x_arguments (int argc, const char * const * argv, const char * str,
332332
std::vector<double> &values_f,
333333
std::vector<double> &values_s);
334334

@@ -343,7 +343,7 @@ namespace pcl
343343
* \return true if found, false otherwise
344344
*/
345345
PCL_EXPORTS bool
346-
parse_multiple_3x_arguments (int argc, char** argv, const char* str,
346+
parse_multiple_3x_arguments (int argc, const char * const * argv, const char * str,
347347
std::vector<double> &values_f,
348348
std::vector<double> &values_s,
349349
std::vector<double> &values_t);
@@ -355,7 +355,7 @@ namespace pcl
355355
* \return a vector with file names indices
356356
*/
357357
PCL_EXPORTS std::vector<int>
358-
parse_file_extension_argument (int argc, char** argv, const std::string &ext);
358+
parse_file_extension_argument (int argc, const char * const * argv, const std::string &ext);
359359
}
360360
}
361361

0 commit comments

Comments
 (0)