-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for multiple extensions in parse_file_extension_argument ()
.
#2347
Conversation
Let's try to avoid copy/pasted code. The "old" parse function can now be implemented by simply running the new one: Also, please improve the docstring. |
Ok, I did another proposition in the last commit. |
common/include/pcl/console/parse.h
Outdated
/** \brief Parse command line arguments for file names with given extension | ||
* \param[in] argc the number of command line arguments | ||
* \param[in] argv the command line arguments | ||
* \param[in] ext the extension to search for | ||
* \return a vector with file names indices | ||
*/ | ||
PCL_EXPORTS std::vector<int> | ||
parse_file_extension_argument (int argc, const char * const * argv, const std::string &ext); | ||
parse_file_extension_argument (int argc, const char * const * argv, const std::string ext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference got lost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my bad.
common/src/parse.cpp
Outdated
{ | ||
std::vector<int> indices; | ||
for (int i = 1; i < argc; ++i) | ||
{ | ||
std::string fname = std::string (argv[i]); | ||
std::string ext = extension; | ||
bool found = false; | ||
for (int j = 0; j < extension.size (); ++j) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: comparison of integers of different signs: 'int' and 'std::vector::size_type' (aka 'unsigned long') [-Wsign-compare]
Please use size_t
common/src/parse.cpp
Outdated
// Additional check: we want to be able to differentiate between .p and .png | ||
if ((ext.size () - (fname.size () - it)) == 0) | ||
indices.push_back (i); | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what you are trying to achieve here. continue
in the end of the iteration does not do anything, it will "continue" anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, it was a pretty bad joke (but makes me laugth a lot).
For an unobvious reason, the compilation of the app
Locally, I also see that the compilation of other apps fail too. If a have any suggest to fix it, don't hesitate! |
If a function is defined directly in header you should inline it. However, I'd prefer if you move implementation (even though it's a three-liner) to the "cpp" file. |
Amazing suggestion 🙂
Le jeu. 21 juin 2018 14:23, Sergey Alexandrov <notifications@github.com> a
écrit :
… If a function is defined directly in header you should inline it. However,
I'd prefer if you move implementation (even though it's a three-liner) to
the "cpp" file.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2347 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-k3JJyjqu9FNT0RY6KgoJCVXuTfDJ4ks5t-5BdgaJpZM4Uu6jx>
.
|
common/src/parse.cpp
Outdated
pcl::console::parse_file_extension_argument (int argc, const char * const * argv, | ||
const std::string &ext) | ||
{ | ||
std::vector<std::string> extensions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix indentation.
…several extensions.
parse_file_extension_argument ()
in console parsing tools.
parse_file_extension_argument ()
in console parsing tools.parse_file_extension_argument ()
.
Add another
parse_file_extension_argument ()
which deals with several extensions given as argument.