Changed CommandLineParser to make it less verbose
authorLeonid Beynenson <Leonid.Beynenson@itseez.com>
Thu, 20 Sep 2012 13:58:44 +0000 (17:58 +0400)
committerLeonid Beynenson <Leonid.Beynenson@itseez.com>
Thu, 20 Sep 2012 14:01:24 +0000 (18:01 +0400)
when it is unrequired.

modules/core/src/command_line_parser.cpp

index 3dbb1ac..8f998ab 100644 (file)
@@ -72,14 +72,14 @@ static void from_str(const string& str, int type, void* dst)
     else if( type == Param::STRING )\r
         ss >> *(string*)dst;\r
     else\r
-        CV_Error(CV_StsBadArg, "unknown/unsupported parameter type");\r
+        throw cv::Exception(CV_StsBadArg, "unknown/unsupported parameter type", __func__, __FILE__, __LINE__);\r
     \r
     if (ss.fail())\r
     {\r
         string err_msg = "can not convert: [" + str +\r
         + "] to [" + get_type_name(type) + "]";\r
         \r
-        CV_Error(CV_StsBadArg, err_msg);\r
+        throw cv::Exception(CV_StsBadArg, err_msg, __func__, __FILE__, __LINE__);\r
     }\r
 }\r
 \r
@@ -417,14 +417,15 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
         {\r
             if (begin == true)\r
             {\r
-                CV_Error(CV_StsParseError,\r
+                throw cv::Exception(CV_StsParseError,\r
                          string("error in split_range_string(")\r
                          + str\r
                          + string(", ")\r
                          + string(1, fs)\r
                          + string(", ")\r
                          + string(1, ss)\r
-                         + string(")")\r
+                         + string(")"),\r
+                         __func__, __FILE__, __LINE__\r
                          );\r
             }\r
             begin = true;\r
@@ -436,14 +437,15 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
         {\r
             if (begin == false)\r
             {\r
-                CV_Error(CV_StsParseError,\r
+                throw cv::Exception(CV_StsParseError,\r
                          string("error in split_range_string(")\r
                          + str\r
                          + string(", ")\r
                          + string(1, fs)\r
                          + string(", ")\r
                          + string(1, ss)\r
-                         + string(")")\r
+                         + string(")"),\r
+                         __func__, __FILE__, __LINE__\r
                          );\r
             }\r
             begin = false;\r
@@ -459,15 +461,16 @@ vector<string> CommandLineParser::Impl::split_range_string(const string& _str, c
 \r
     if (begin == true)\r
     {\r
-        CV_Error(CV_StsParseError,\r
+        throw cv::Exception(CV_StsParseError,\r
                  string("error in split_range_string(")\r
                  + str\r
                  + string(", ")\r
                  + string(1, fs)\r
                  + string(", ")\r
                  + string(1, ss)\r
-                 + string(")")\r
-                 );\r
+                 + string(")"),\r
+                 __func__, __FILE__, __LINE__\r
+                );\r
     }\r
 \r
     return vec;\r