Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
d57a7008
Commit
d57a7008
authored
Oct 09, 2013
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed cmd parser when arg is like -+
parent
6b69a66c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
cmdparser.cpp
modules/core/src/cmdparser.cpp
+23
-7
No files found.
modules/core/src/cmdparser.cpp
View file @
d57a7008
...
...
@@ -92,6 +92,22 @@ string del_space(string name)
}
//namespace
static
bool
keyIsNumber
(
const
std
::
string
&
option
,
size_t
start
)
{
bool
isNumber
=
true
;
size_t
end
=
option
.
find_first_of
(
'='
,
start
);
end
=
option
.
npos
==
end
?
option
.
length
()
:
end
;
for
(
;
start
<
end
;
++
start
)
if
(
!
isdigit
(
option
[
start
]))
{
isNumber
=
false
;
break
;
}
return
isNumber
;
}
CommandLineParser
::
CommandLineParser
(
int
argc
,
const
char
*
const
argv
[],
const
char
*
keys
)
{
std
::
string
keys_buffer
;
...
...
@@ -144,13 +160,13 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const c
if
(
!
argv
[
i
])
break
;
curName
=
argv
[
i
];
if
(
curName
.
find
(
'-'
)
==
0
&&
((
curName
[
1
]
<
'0'
)
||
(
curName
[
1
]
>
'9'
)))
{
while
(
curName
.
find
(
'-'
)
==
0
)
curName
.
erase
(
curName
.
begin
(),
(
curName
.
begin
()
+
1
))
;
}
else
withNoKey
=
true
;
size_t
nondash
=
curName
.
find_first_not_of
(
"-"
);
if
(
nondash
==
0
||
nondash
==
curName
.
npos
||
keyIsNumber
(
curName
,
nondash
)
)
withNoKey
=
true
;
else
curName
.
erase
(
0
,
nondash
);
if
(
curName
.
find
(
'='
)
!=
curName
.
npos
)
{
hasValueThroughEq
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment