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
3d3efe7c
Commit
3d3efe7c
authored
Sep 30, 2011
by
Andrey Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed sub algorithm in CommandLineParser
parent
5e831f7f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
cmdparser.cpp
modules/core/src/cmdparser.cpp
+16
-15
No files found.
modules/core/src/cmdparser.cpp
View file @
3d3efe7c
...
...
@@ -51,30 +51,33 @@ void helpParser()
vector
<
string
>
split_string
(
const
string
&
str
,
const
string
&
delimiters
)
{
vector
<
string
>
res
;
string
::
size_type
lastPos
=
str
.
find_first_not_of
(
delimiters
,
0
);
string
::
size_type
pos
=
str
.
find_first_of
(
delimiters
,
lastPos
);
while
(
string
::
npos
!=
pos
||
string
::
npos
!=
lastPos
)
{
res
.
push_back
(
str
.
substr
(
lastPos
,
pos
-
lastPos
));
lastPos
=
str
.
find_first_not_of
(
delimiters
,
pos
);
if
(
str
[
pos
+
1
]
==
'|'
&&
str
[
pos
]
==
'|'
)
string
split_str
=
str
;
int
pos_delim
=
split_str
.
find
(
delimiters
);
while
(
pos_delim
!=
string
::
npos
)
{
if
(
pos_delim
==
0
)
{
res
.
push_back
(
""
);
if
(
str
[
pos
+
2
]
==
'|'
)
res
.
push_back
(
""
);
split_str
.
erase
(
0
,
1
);
}
if
(
str
[
pos
+
1
]
==
'\0'
)
res
.
push_back
(
""
);
pos
=
str
.
find_first_of
(
delimiters
,
lastPos
);
else
{
res
.
push_back
(
split_str
.
substr
(
0
,
pos_delim
));
split_str
.
erase
(
0
,
pos_delim
+
1
);
}
pos_delim
=
split_str
.
find
(
delimiters
);
}
res
.
push_back
(
split_str
);
return
res
;
}
CommandLineParser
::
CommandLineParser
(
int
argc
,
const
char
*
const
argv
[],
const
char
*
keys
)
{
std
::
string
keys_buffer
;
std
::
string
values_buffer
;
std
::
string
buffer
;
...
...
@@ -188,8 +191,6 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const c
printf
(
"The current parameter is not defined: %s
\n
"
,
curName
.
c_str
());
isFound
=
false
;
}
}
bool
CommandLineParser
::
has
(
const
std
::
string
&
keys
)
...
...
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