Commit 0bde00a8 authored by Leonid Beynenson's avatar Leonid Beynenson

Changed CommandLineParser to make it less verbose

when it is unrequired.
parent 858f4371
...@@ -72,14 +72,14 @@ static void from_str(const string& str, int type, void* dst) ...@@ -72,14 +72,14 @@ static void from_str(const string& str, int type, void* dst)
else if( type == Param::STRING ) else if( type == Param::STRING )
ss >> *(string*)dst; ss >> *(string*)dst;
else else
CV_Error(CV_StsBadArg, "unknown/unsupported parameter type"); throw cv::Exception(CV_StsBadArg, "unknown/unsupported parameter type", __func__, __FILE__, __LINE__);
if (ss.fail()) if (ss.fail())
{ {
string err_msg = "can not convert: [" + str + string err_msg = "can not convert: [" + str +
+ "] to [" + get_type_name(type) + "]"; + "] to [" + get_type_name(type) + "]";
CV_Error(CV_StsBadArg, err_msg); throw cv::Exception(CV_StsBadArg, err_msg, __func__, __FILE__, __LINE__);
} }
} }
...@@ -417,14 +417,15 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c ...@@ -417,14 +417,15 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
{ {
if (begin == true) if (begin == true)
{ {
CV_Error(CV_StsParseError, throw cv::Exception(CV_StsParseError,
string("error in split_range_string(") string("error in split_range_string(")
+ str + str
+ string(", ") + string(", ")
+ string(1, fs) + string(1, fs)
+ string(", ") + string(", ")
+ string(1, ss) + string(1, ss)
+ string(")") + string(")"),
__func__, __FILE__, __LINE__
); );
} }
begin = true; begin = true;
...@@ -436,14 +437,15 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c ...@@ -436,14 +437,15 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
{ {
if (begin == false) if (begin == false)
{ {
CV_Error(CV_StsParseError, throw cv::Exception(CV_StsParseError,
string("error in split_range_string(") string("error in split_range_string(")
+ str + str
+ string(", ") + string(", ")
+ string(1, fs) + string(1, fs)
+ string(", ") + string(", ")
+ string(1, ss) + string(1, ss)
+ string(")") + string(")"),
__func__, __FILE__, __LINE__
); );
} }
begin = false; begin = false;
...@@ -459,14 +461,15 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c ...@@ -459,14 +461,15 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
if (begin == true) if (begin == true)
{ {
CV_Error(CV_StsParseError, throw cv::Exception(CV_StsParseError,
string("error in split_range_string(") string("error in split_range_string(")
+ str + str
+ string(", ") + string(", ")
+ string(1, fs) + string(1, fs)
+ string(", ") + string(", ")
+ string(1, ss) + string(1, ss)
+ string(")") + string(")"),
__func__, __FILE__, __LINE__
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment