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
78d82111
Commit
78d82111
authored
May 30, 2011
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update CommandLineParser class: move method's definition from header to source
parent
0d1ec967
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
core.hpp
modules/core/include/opencv2/core/core.hpp
+15
-0
cmdparser.cpp
modules/core/src/cmdparser.cpp
+20
-0
No files found.
modules/core/include/opencv2/core/core.hpp
View file @
78d82111
...
...
@@ -4200,6 +4200,21 @@ class CV_EXPORTS CommandLineParser
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
string
>
>
data
;
std
::
string
getString
(
const
std
::
string
&
name
)
const
;
template
<
typename
_Tp
>
_Tp
analizeValue
(
const
std
::
string
&
str
);
template
<
typename
_Tp
>
static
_Tp
getData
(
const
std
::
string
&
str
)
{
_Tp
res
;
std
::
stringstream
s1
(
str
);
s1
>>
res
;
return
res
;
}
template
<
typename
_Tp
>
_Tp
fromStringNumber
(
const
std
::
string
&
str
);
//the default conversion function for numbers
template
<
typename
_Tp
>
_Tp
analyzeValue
(
const
std
::
string
&
str
);
};
...
...
modules/core/src/cmdparser.cpp
View file @
78d82111
...
...
@@ -134,6 +134,26 @@ std::string CommandLineParser::getString(const std::string& keys) const
return
data
.
find
(
names
[
found_index
])
->
second
[
0
];
}
template
<
typename
_Tp
>
_Tp
CommandLineParser
::
fromStringNumber
(
const
std
::
string
&
str
)
//the default conversion function for numbers
{
if
(
str
.
empty
())
CV_Error
(
CV_StsParseError
,
"Empty string cannot be converted to a number"
);
const
char
*
c_str
=
str
.
c_str
();
if
((
!
isdigit
(
c_str
[
0
]))
&&
(
(
c_str
[
0
]
!=
'-'
)
||
(
strlen
(
c_str
)
<=
1
)
||
(
!
isdigit
(
c_str
[
1
])
)
)
)
{
CV_Error
(
CV_StsParseError
,
"The string '"
+
str
+
"' cannot be converted to a number"
);
}
return
getData
<
_Tp
>
(
str
);
}
template
<
typename
_Tp
>
static
_Tp
getData
(
const
std
::
string
&
str
)
...
...
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