has() should only test for the presence of the argument

and not consider its value. treat arguments with a set default value as
present.
pull/5329/head
Pavel Rojtberg 9 years ago
parent 08dd126f08
commit 96cc618410
  1. 4
      modules/core/include/opencv2/core/utility.hpp
  2. 4
      modules/core/src/command_line_parser.cpp

@ -607,6 +607,10 @@ For example:
} }
@endcode @endcode
Note that there are no default values for `help` and `timestamp` so we can check their presence using the `has()` method.
Arguments with default values are considered to be always present. Use the `get()` method in these cases to check their
actual value instead.
### Usage ### Usage
For the described keys: For the described keys:

@ -334,9 +334,9 @@ bool CommandLineParser::has(const String& name) const
{ {
for (size_t j = 0; j < impl->data[i].keys.size(); j++) for (size_t j = 0; j < impl->data[i].keys.size(); j++)
{ {
if (name.compare(impl->data[i].keys[j]) == 0 && String("true").compare(impl->data[i].def_value) == 0) if (name == impl->data[i].keys[j])
{ {
return true; return !impl->cat_string(impl->data[i].def_value).empty();
} }
} }
} }

Loading…
Cancel
Save