mirror of
https://github.com/opencv/opencv.git
synced 2025-01-19 06:53:50 +08:00
Merge pull request #25237 from YusukeKameda:4.x
doc: add note on handling of spaces in CommandLineParser #25237 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake Added note that this class will not work properly if tabs and other whitespace characters are included in the key. The support of whitespace characters by istringstream, etc. is on hold because the future of this class is not clear compared to implementations in Python and other languages.
This commit is contained in:
parent
fc34554475
commit
6e9dcb87c1
@ -773,7 +773,7 @@ The sample below demonstrates how to use CommandLineParser:
|
||||
The keys parameter is a string containing several blocks, each one is enclosed in curly braces and
|
||||
describes one argument. Each argument contains three parts separated by the `|` symbol:
|
||||
|
||||
-# argument names is a space-separated list of option synonyms (to mark argument as positional, prefix it with the `@` symbol)
|
||||
-# argument names is a list of option synonyms separated by standard space characters ' ' (to mark argument as positional, prefix it with the `@` symbol)
|
||||
-# default value will be used if the argument was not provided (can be empty)
|
||||
-# help message (can be empty)
|
||||
|
||||
@ -796,6 +796,8 @@ For example:
|
||||
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.
|
||||
Note that whitespace characters other than standard spaces are considered part of the string.
|
||||
Additionally, leading and trailing standard spaces around the help messages are ignored.
|
||||
|
||||
String keys like `get<String>("@image1")` return the empty string `""` by default - even with an empty default value.
|
||||
Use the special `<none>` default value to enforce that the returned string must not be empty. (like in `get<String>("@image2")`)
|
||||
|
Loading…
Reference in New Issue
Block a user