Drop cv:: prefix from cv::String used inside the cv namespace
This commit is contained in:
@@ -96,7 +96,7 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
|
||||
};
|
||||
|
||||
|
||||
template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<cv::String, _ValueTp>& vec,
|
||||
template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<String, _ValueTp>& vec,
|
||||
const char* key)
|
||||
{
|
||||
if( !key )
|
||||
@@ -130,7 +130,7 @@ Param::Param()
|
||||
|
||||
Param::Param(int _type, bool _readonly, int _offset,
|
||||
Algorithm::Getter _getter, Algorithm::Setter _setter,
|
||||
const cv::String& _help)
|
||||
const String& _help)
|
||||
{
|
||||
type = _type;
|
||||
readonly = _readonly;
|
||||
@@ -142,23 +142,23 @@ Param::Param(int _type, bool _readonly, int _offset,
|
||||
|
||||
struct CV_EXPORTS AlgorithmInfoData
|
||||
{
|
||||
sorted_vector<cv::String, Param> params;
|
||||
cv::String _name;
|
||||
sorted_vector<String, Param> params;
|
||||
String _name;
|
||||
};
|
||||
|
||||
|
||||
static sorted_vector<cv::String, Algorithm::Constructor>& alglist()
|
||||
static sorted_vector<String, Algorithm::Constructor>& alglist()
|
||||
{
|
||||
static sorted_vector<cv::String, Algorithm::Constructor> alglist_var;
|
||||
static sorted_vector<String, Algorithm::Constructor> alglist_var;
|
||||
return alglist_var;
|
||||
}
|
||||
|
||||
void Algorithm::getList(std::vector<cv::String>& algorithms)
|
||||
void Algorithm::getList(std::vector<String>& algorithms)
|
||||
{
|
||||
alglist().get_keys(algorithms);
|
||||
}
|
||||
|
||||
Ptr<Algorithm> Algorithm::_create(const cv::String& name)
|
||||
Ptr<Algorithm> Algorithm::_create(const String& name)
|
||||
{
|
||||
Algorithm::Constructor c = 0;
|
||||
if( !alglist().find(name, c) )
|
||||
@@ -174,42 +174,42 @@ Algorithm::~Algorithm()
|
||||
{
|
||||
}
|
||||
|
||||
cv::String Algorithm::name() const
|
||||
String Algorithm::name() const
|
||||
{
|
||||
return info()->name();
|
||||
}
|
||||
|
||||
void Algorithm::set(const cv::String& parameter, int value)
|
||||
void Algorithm::set(const String& parameter, int value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const cv::String& parameter, double value)
|
||||
void Algorithm::set(const String& parameter, double value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<double>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const cv::String& parameter, bool value)
|
||||
void Algorithm::set(const String& parameter, bool value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<bool>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const cv::String& parameter, const cv::String& value)
|
||||
void Algorithm::set(const String& parameter, const String& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<cv::String>::type, &value);
|
||||
info()->set(this, parameter.c_str(), ParamType<String>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const cv::String& parameter, const Mat& value)
|
||||
void Algorithm::set(const String& parameter, const Mat& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const cv::String& parameter, const std::vector<Mat>& value)
|
||||
void Algorithm::set(const String& parameter, const std::vector<Mat>& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<std::vector<Mat> >::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const cv::String& parameter, const Ptr<Algorithm>& value)
|
||||
void Algorithm::set(const String& parameter, const Ptr<Algorithm>& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value);
|
||||
}
|
||||
@@ -229,9 +229,9 @@ void Algorithm::set(const char* parameter, bool value)
|
||||
info()->set(this, parameter, ParamType<bool>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const char* parameter, const cv::String& value)
|
||||
void Algorithm::set(const char* parameter, const String& value)
|
||||
{
|
||||
info()->set(this, parameter, ParamType<cv::String>::type, &value);
|
||||
info()->set(this, parameter, ParamType<String>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::set(const char* parameter, const Mat& value)
|
||||
@@ -250,37 +250,37 @@ void Algorithm::set(const char* parameter, const Ptr<Algorithm>& value)
|
||||
}
|
||||
|
||||
|
||||
void Algorithm::setInt(const cv::String& parameter, int value)
|
||||
void Algorithm::setInt(const String& parameter, int value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setDouble(const cv::String& parameter, double value)
|
||||
void Algorithm::setDouble(const String& parameter, double value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<double>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setBool(const cv::String& parameter, bool value)
|
||||
void Algorithm::setBool(const String& parameter, bool value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<bool>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setString(const cv::String& parameter, const cv::String& value)
|
||||
void Algorithm::setString(const String& parameter, const String& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<cv::String>::type, &value);
|
||||
info()->set(this, parameter.c_str(), ParamType<String>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setMat(const cv::String& parameter, const Mat& value)
|
||||
void Algorithm::setMat(const String& parameter, const Mat& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setMatVector(const cv::String& parameter, const std::vector<Mat>& value)
|
||||
void Algorithm::setMatVector(const String& parameter, const std::vector<Mat>& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<std::vector<Mat> >::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setAlgorithm(const cv::String& parameter, const Ptr<Algorithm>& value)
|
||||
void Algorithm::setAlgorithm(const String& parameter, const Ptr<Algorithm>& value)
|
||||
{
|
||||
info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value);
|
||||
}
|
||||
@@ -300,9 +300,9 @@ void Algorithm::setBool(const char* parameter, bool value)
|
||||
info()->set(this, parameter, ParamType<bool>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setString(const char* parameter, const cv::String& value)
|
||||
void Algorithm::setString(const char* parameter, const String& value)
|
||||
{
|
||||
info()->set(this, parameter, ParamType<cv::String>::type, &value);
|
||||
info()->set(this, parameter, ParamType<String>::type, &value);
|
||||
}
|
||||
|
||||
void Algorithm::setMat(const char* parameter, const Mat& value)
|
||||
@@ -322,47 +322,47 @@ void Algorithm::setAlgorithm(const char* parameter, const Ptr<Algorithm>& value)
|
||||
|
||||
|
||||
|
||||
int Algorithm::getInt(const cv::String& parameter) const
|
||||
int Algorithm::getInt(const String& parameter) const
|
||||
{
|
||||
return get<int>(parameter);
|
||||
}
|
||||
|
||||
double Algorithm::getDouble(const cv::String& parameter) const
|
||||
double Algorithm::getDouble(const String& parameter) const
|
||||
{
|
||||
return get<double>(parameter);
|
||||
}
|
||||
|
||||
bool Algorithm::getBool(const cv::String& parameter) const
|
||||
bool Algorithm::getBool(const String& parameter) const
|
||||
{
|
||||
return get<bool>(parameter);
|
||||
}
|
||||
|
||||
cv::String Algorithm::getString(const cv::String& parameter) const
|
||||
String Algorithm::getString(const String& parameter) const
|
||||
{
|
||||
return get<cv::String>(parameter);
|
||||
return get<String>(parameter);
|
||||
}
|
||||
|
||||
Mat Algorithm::getMat(const cv::String& parameter) const
|
||||
Mat Algorithm::getMat(const String& parameter) const
|
||||
{
|
||||
return get<Mat>(parameter);
|
||||
}
|
||||
|
||||
std::vector<Mat> Algorithm::getMatVector(const cv::String& parameter) const
|
||||
std::vector<Mat> Algorithm::getMatVector(const String& parameter) const
|
||||
{
|
||||
return get<std::vector<Mat> >(parameter);
|
||||
}
|
||||
|
||||
Ptr<Algorithm> Algorithm::getAlgorithm(const cv::String& parameter) const
|
||||
Ptr<Algorithm> Algorithm::getAlgorithm(const String& parameter) const
|
||||
{
|
||||
return get<Algorithm>(parameter);
|
||||
}
|
||||
|
||||
cv::String Algorithm::paramHelp(const cv::String& parameter) const
|
||||
String Algorithm::paramHelp(const String& parameter) const
|
||||
{
|
||||
return info()->paramHelp(parameter.c_str());
|
||||
}
|
||||
|
||||
int Algorithm::paramType(const cv::String& parameter) const
|
||||
int Algorithm::paramType(const String& parameter) const
|
||||
{
|
||||
return info()->paramType(parameter.c_str());
|
||||
}
|
||||
@@ -372,7 +372,7 @@ int Algorithm::paramType(const char* parameter) const
|
||||
return info()->paramType(parameter);
|
||||
}
|
||||
|
||||
void Algorithm::getParams(std::vector<cv::String>& names) const
|
||||
void Algorithm::getParams(std::vector<String>& names) const
|
||||
{
|
||||
info()->getParams(names);
|
||||
}
|
||||
@@ -388,7 +388,7 @@ void Algorithm::read(const FileNode& fn)
|
||||
}
|
||||
|
||||
|
||||
AlgorithmInfo::AlgorithmInfo(const cv::String& _name, Algorithm::Constructor create)
|
||||
AlgorithmInfo::AlgorithmInfo(const String& _name, Algorithm::Constructor create)
|
||||
{
|
||||
data = new AlgorithmInfoData;
|
||||
data->_name = _name;
|
||||
@@ -408,7 +408,7 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
|
||||
for( i = 0; i < nparams; i++ )
|
||||
{
|
||||
const Param& p = data->params.vec[i].second;
|
||||
const cv::String& pname = data->params.vec[i].first;
|
||||
const String& pname = data->params.vec[i].first;
|
||||
if( p.type == Param::INT )
|
||||
cv::write(fs, pname, algo->get<int>(pname));
|
||||
else if( p.type == Param::BOOLEAN )
|
||||
@@ -416,7 +416,7 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
|
||||
else if( p.type == Param::REAL )
|
||||
cv::write(fs, pname, algo->get<double>(pname));
|
||||
else if( p.type == Param::STRING )
|
||||
cv::write(fs, pname, algo->get<cv::String>(pname));
|
||||
cv::write(fs, pname, algo->get<String>(pname));
|
||||
else if( p.type == Param::MAT )
|
||||
cv::write(fs, pname, algo->get<Mat>(pname));
|
||||
else if( p.type == Param::MAT_VECTOR )
|
||||
@@ -437,7 +437,7 @@ void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
|
||||
cv::write(fs, pname, algo->getInt(pname));
|
||||
else
|
||||
{
|
||||
cv::String msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
|
||||
String msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
|
||||
CV_Error( CV_StsUnsupportedFormat, msg.c_str());
|
||||
}
|
||||
}
|
||||
@@ -451,7 +451,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
|
||||
for( i = 0; i < nparams; i++ )
|
||||
{
|
||||
const Param& p = data->params.vec[i].second;
|
||||
const cv::String& pname = data->params.vec[i].first;
|
||||
const String& pname = data->params.vec[i].first;
|
||||
const FileNode n = fn[pname];
|
||||
if( n.empty() )
|
||||
continue;
|
||||
@@ -472,7 +472,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
|
||||
}
|
||||
else if( p.type == Param::STRING )
|
||||
{
|
||||
cv::String val = (cv::String)n;
|
||||
String val = (String)n;
|
||||
info->set(algo, pname.c_str(), p.type, &val, true);
|
||||
}
|
||||
else if( p.type == Param::MAT )
|
||||
@@ -489,7 +489,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
|
||||
}
|
||||
else if( p.type == Param::ALGORITHM )
|
||||
{
|
||||
Ptr<Algorithm> nestedAlgo = Algorithm::_create((cv::String)n["name"]);
|
||||
Ptr<Algorithm> nestedAlgo = Algorithm::_create((String)n["name"]);
|
||||
CV_Assert( !nestedAlgo.empty() );
|
||||
nestedAlgo->read(n);
|
||||
info->set(algo, pname.c_str(), p.type, &nestedAlgo, true);
|
||||
@@ -516,13 +516,13 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
|
||||
}
|
||||
else
|
||||
{
|
||||
cv::String msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
|
||||
String msg = format("unknown/unsupported type of '%s' parameter == %d", pname.c_str(), p.type);
|
||||
CV_Error( CV_StsUnsupportedFormat, msg.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cv::String AlgorithmInfo::name() const
|
||||
String AlgorithmInfo::name() const
|
||||
{
|
||||
return data->_name;
|
||||
}
|
||||
@@ -532,7 +532,7 @@ union GetSetParam
|
||||
int (Algorithm::*get_int)() const;
|
||||
bool (Algorithm::*get_bool)() const;
|
||||
double (Algorithm::*get_double)() const;
|
||||
cv::String (Algorithm::*get_string)() const;
|
||||
String (Algorithm::*get_string)() const;
|
||||
Mat (Algorithm::*get_mat)() const;
|
||||
std::vector<Mat> (Algorithm::*get_mat_vector)() const;
|
||||
Ptr<Algorithm> (Algorithm::*get_algo)() const;
|
||||
@@ -544,7 +544,7 @@ union GetSetParam
|
||||
void (Algorithm::*set_int)(int);
|
||||
void (Algorithm::*set_bool)(bool);
|
||||
void (Algorithm::*set_double)(double);
|
||||
void (Algorithm::*set_string)(const cv::String&);
|
||||
void (Algorithm::*set_string)(const String&);
|
||||
void (Algorithm::*set_mat)(const Mat&);
|
||||
void (Algorithm::*set_mat_vector)(const std::vector<Mat>&);
|
||||
void (Algorithm::*set_algo)(const Ptr<Algorithm>&);
|
||||
@@ -554,9 +554,9 @@ union GetSetParam
|
||||
void (Algorithm::*set_uchar)(uchar);
|
||||
};
|
||||
|
||||
static cv::String getNameOfType(int argType);
|
||||
static String getNameOfType(int argType);
|
||||
|
||||
static cv::String getNameOfType(int argType)
|
||||
static String getNameOfType(int argType)
|
||||
{
|
||||
switch(argType)
|
||||
{
|
||||
@@ -576,9 +576,9 @@ static cv::String getNameOfType(int argType)
|
||||
return "";
|
||||
}
|
||||
|
||||
static cv::String getErrorMessageForWrongArgumentInSetter(cv::String algoName, cv::String paramName, int paramType, int argType)
|
||||
static String getErrorMessageForWrongArgumentInSetter(String algoName, String paramName, int paramType, int argType)
|
||||
{
|
||||
cv::String message = cv::String("Argument error: the setter")
|
||||
String message = String("Argument error: the setter")
|
||||
+ " method was called for the parameter '" + paramName + "' of the algorithm '" + algoName
|
||||
+"', the parameter has " + getNameOfType(paramType) + " type, ";
|
||||
|
||||
@@ -592,9 +592,9 @@ static cv::String getErrorMessageForWrongArgumentInSetter(cv::String algoName, c
|
||||
return message;
|
||||
}
|
||||
|
||||
static cv::String getErrorMessageForWrongArgumentInGetter(cv::String algoName, cv::String paramName, int paramType, int argType)
|
||||
static String getErrorMessageForWrongArgumentInGetter(String algoName, String paramName, int paramType, int argType)
|
||||
{
|
||||
cv::String message = cv::String("Argument error: the getter")
|
||||
String message = String("Argument error: the getter")
|
||||
+ " method was called for the parameter '" + paramName + "' of the algorithm '" + algoName
|
||||
+"', the parameter has " + getNameOfType(paramType) + " type, ";
|
||||
|
||||
@@ -630,7 +630,7 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
|
||||
if ( !( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN
|
||||
|| p->type == Param::UNSIGNED_INT || p->type == Param::UINT64 || p->type == Param::FLOAT || argType == Param::UCHAR) )
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -790,21 +790,21 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
|
||||
{
|
||||
if( p->type != Param::STRING )
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
const cv::String& val = *(const cv::String*)value;
|
||||
const String& val = *(const String*)value;
|
||||
if( p->setter )
|
||||
(algo->*f.set_string)(val);
|
||||
else
|
||||
*(cv::String*)((uchar*)algo + p->offset) = val;
|
||||
*(String*)((uchar*)algo + p->offset) = val;
|
||||
}
|
||||
else if( argType == Param::MAT )
|
||||
{
|
||||
if( p->type != Param::MAT )
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -818,7 +818,7 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
|
||||
{
|
||||
if( p->type != Param::MAT_VECTOR )
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -832,7 +832,7 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
|
||||
{
|
||||
if( p->type != Param::ALGORITHM )
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInSetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -862,7 +862,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
int val = p->getter ? (algo->*f.get_int)() : *(int*)((uchar*)algo + p->offset);
|
||||
@@ -887,7 +887,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if (!( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
bool val = p->getter ? (algo->*f.get_bool)() : *(bool*)((uchar*)algo + p->offset);
|
||||
@@ -913,7 +913,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if(!( argType == Param::REAL || argType == Param::FLOAT))
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
double val = p->getter ? (algo->*f.get_double)() : *(double*)((uchar*)algo + p->offset);
|
||||
@@ -929,7 +929,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if(!( argType == Param::REAL || argType == Param::FLOAT))
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
float val = p->getter ? (algo->*f.get_float)() : *(float*)((uchar*)algo + p->offset);
|
||||
@@ -945,7 +945,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
unsigned int val = p->getter ? (algo->*f.get_uint)() : *(unsigned int*)((uchar*)algo + p->offset);
|
||||
@@ -969,7 +969,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
uint64 val = p->getter ? (algo->*f.get_uint64)() : *(uint64*)((uchar*)algo + p->offset);
|
||||
@@ -993,7 +993,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if (!( argType == Param::INT || argType == Param::REAL || argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64 || argType == Param::UCHAR))
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
uchar val = p->getter ? (algo->*f.get_uchar)() : *(uchar*)((uchar*)algo + p->offset);
|
||||
@@ -1021,18 +1021,18 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if( p->type != Param::STRING )
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
*(cv::String*)value = p->getter ? (algo->*f.get_string)() :
|
||||
*(cv::String*)((uchar*)algo + p->offset);
|
||||
*(String*)value = p->getter ? (algo->*f.get_string)() :
|
||||
*(String*)((uchar*)algo + p->offset);
|
||||
}
|
||||
else if( argType == Param::MAT )
|
||||
{
|
||||
if( p->type != Param::MAT )
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -1043,7 +1043,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if( p->type != Param::MAT_VECTOR )
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -1054,7 +1054,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
{
|
||||
if( p->type != Param::ALGORITHM )
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
|
||||
@@ -1063,7 +1063,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
|
||||
}
|
||||
else
|
||||
{
|
||||
cv::String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
String message = getErrorMessageForWrongArgumentInGetter(algo->name(), parameter, p->type, argType);
|
||||
CV_Error(CV_StsBadArg, message);
|
||||
}
|
||||
}
|
||||
@@ -1078,7 +1078,7 @@ int AlgorithmInfo::paramType(const char* parameter) const
|
||||
}
|
||||
|
||||
|
||||
cv::String AlgorithmInfo::paramHelp(const char* parameter) const
|
||||
String AlgorithmInfo::paramHelp(const char* parameter) const
|
||||
{
|
||||
const Param* p = findstr(data->params, parameter);
|
||||
if( !p )
|
||||
@@ -1087,7 +1087,7 @@ cv::String AlgorithmInfo::paramHelp(const char* parameter) const
|
||||
}
|
||||
|
||||
|
||||
void AlgorithmInfo::getParams(std::vector<cv::String>& names) const
|
||||
void AlgorithmInfo::getParams(std::vector<String>& names) const
|
||||
{
|
||||
data->params.get_keys(names);
|
||||
}
|
||||
@@ -1096,7 +1096,7 @@ void AlgorithmInfo::getParams(std::vector<cv::String>& names) const
|
||||
void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argType,
|
||||
void* value, bool readOnly,
|
||||
Algorithm::Getter getter, Algorithm::Setter setter,
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
CV_Assert( argType == Param::INT || argType == Param::BOOLEAN ||
|
||||
argType == Param::REAL || argType == Param::STRING ||
|
||||
@@ -1104,7 +1104,7 @@ void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argTyp
|
||||
argType == Param::ALGORITHM
|
||||
|| argType == Param::FLOAT || argType == Param::UNSIGNED_INT || argType == Param::UINT64
|
||||
|| argType == Param::UCHAR);
|
||||
data->params.add(cv::String(parameter), Param(argType, readOnly,
|
||||
data->params.add(String(parameter), Param(argType, readOnly,
|
||||
(int)((size_t)value - (size_t)(void*)&algo),
|
||||
getter, setter, help));
|
||||
}
|
||||
@@ -1114,7 +1114,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
int& value, bool readOnly,
|
||||
int (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(int),
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<int>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
@@ -1124,7 +1124,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
bool& value, bool readOnly,
|
||||
int (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(int),
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<bool>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
@@ -1134,19 +1134,19 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
double& value, bool readOnly,
|
||||
double (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(double),
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<double>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
}
|
||||
|
||||
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
cv::String& value, bool readOnly,
|
||||
cv::String (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const cv::String&),
|
||||
const cv::String& help)
|
||||
String& value, bool readOnly,
|
||||
String (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const String&),
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<cv::String>::type, &value, readOnly,
|
||||
addParam_(algo, parameter, ParamType<String>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
}
|
||||
|
||||
@@ -1154,7 +1154,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
Mat& value, bool readOnly,
|
||||
Mat (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const Mat&),
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<Mat>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
@@ -1164,7 +1164,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
std::vector<Mat>& value, bool readOnly,
|
||||
std::vector<Mat> (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const std::vector<Mat>&),
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<std::vector<Mat> >::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
@@ -1174,7 +1174,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
Ptr<Algorithm>& value, bool readOnly,
|
||||
Ptr<Algorithm> (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(const Ptr<Algorithm>&),
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
@@ -1184,7 +1184,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
float& value, bool readOnly,
|
||||
float (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(float),
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<float>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
@@ -1194,7 +1194,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
unsigned int& value, bool readOnly,
|
||||
unsigned int (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(unsigned int),
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<unsigned int>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
@@ -1204,7 +1204,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
uint64& value, bool readOnly,
|
||||
uint64 (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(uint64),
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<uint64>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
@@ -1214,7 +1214,7 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
||||
uchar& value, bool readOnly,
|
||||
uchar (Algorithm::*getter)(),
|
||||
void (Algorithm::*setter)(uchar),
|
||||
const cv::String& help)
|
||||
const String& help)
|
||||
{
|
||||
addParam_(algo, parameter, ParamType<uchar>::type, &value, readOnly,
|
||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||
|
@@ -6,9 +6,9 @@ namespace cv
|
||||
struct CommandLineParserParams
|
||||
{
|
||||
public:
|
||||
cv::String help_message;
|
||||
cv::String def_value;
|
||||
std::vector<cv::String> keys;
|
||||
String help_message;
|
||||
String def_value;
|
||||
std::vector<String> keys;
|
||||
int number;
|
||||
};
|
||||
|
||||
@@ -16,27 +16,27 @@ public:
|
||||
struct CommandLineParser::Impl
|
||||
{
|
||||
bool error;
|
||||
cv::String error_message;
|
||||
cv::String about_message;
|
||||
String error_message;
|
||||
String about_message;
|
||||
|
||||
cv::String path_to_app;
|
||||
cv::String app_name;
|
||||
String path_to_app;
|
||||
String app_name;
|
||||
|
||||
std::vector<CommandLineParserParams> data;
|
||||
|
||||
std::vector<cv::String> split_range_string(const cv::String& str, char fs, char ss) const;
|
||||
std::vector<cv::String> split_string(const cv::String& str, char symbol = ' ', bool create_empty_item = false) const;
|
||||
cv::String cat_string(const cv::String& str) const;
|
||||
std::vector<String> split_range_string(const String& str, char fs, char ss) const;
|
||||
std::vector<String> split_string(const String& str, char symbol = ' ', bool create_empty_item = false) const;
|
||||
String cat_string(const String& str) const;
|
||||
|
||||
void apply_params(const cv::String& key, const cv::String& value);
|
||||
void apply_params(int i, cv::String value);
|
||||
void apply_params(const String& key, const String& value);
|
||||
void apply_params(int i, String value);
|
||||
|
||||
void sort_params();
|
||||
int refcount;
|
||||
};
|
||||
|
||||
|
||||
static cv::String get_type_name(int type)
|
||||
static String get_type_name(int type)
|
||||
{
|
||||
if( type == Param::INT )
|
||||
return "int";
|
||||
@@ -53,7 +53,7 @@ static cv::String get_type_name(int type)
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
static void from_str(const cv::String& str, int type, void* dst)
|
||||
static void from_str(const String& str, int type, void* dst)
|
||||
{
|
||||
std::stringstream ss(str.c_str());
|
||||
if( type == Param::INT )
|
||||
@@ -67,20 +67,20 @@ static void from_str(const cv::String& str, int type, void* dst)
|
||||
else if( type == Param::REAL )
|
||||
ss >> *(double*)dst;
|
||||
else if( type == Param::STRING )
|
||||
*(cv::String*)dst = str;
|
||||
*(String*)dst = str;
|
||||
else
|
||||
throw cv::Exception(CV_StsBadArg, "unknown/unsupported parameter type", "", __FILE__, __LINE__);
|
||||
|
||||
if (ss.fail())
|
||||
{
|
||||
cv::String err_msg = "can not convert: [" + str +
|
||||
String err_msg = "can not convert: [" + str +
|
||||
+ "] to [" + get_type_name(type) + "]";
|
||||
|
||||
throw cv::Exception(CV_StsBadArg, err_msg, "", __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandLineParser::getByName(const cv::String& name, bool space_delete, int type, void* dst) const
|
||||
void CommandLineParser::getByName(const String& name, bool space_delete, int type, void* dst) const
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -90,7 +90,7 @@ void CommandLineParser::getByName(const cv::String& name, bool space_delete, int
|
||||
{
|
||||
if (name.compare(impl->data[i].keys[j]) == 0)
|
||||
{
|
||||
cv::String v = impl->data[i].def_value;
|
||||
String v = impl->data[i].def_value;
|
||||
if (space_delete)
|
||||
v = impl->cat_string(v);
|
||||
from_str(v, type, dst);
|
||||
@@ -104,7 +104,7 @@ void CommandLineParser::getByName(const cv::String& name, bool space_delete, int
|
||||
catch (std::exception& e)
|
||||
{
|
||||
impl->error = true;
|
||||
impl->error_message = impl->error_message + "Exception: " + cv::String(e.what()) + "\n";
|
||||
impl->error_message = impl->error_message + "Exception: " + String(e.what()) + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*
|
||||
{
|
||||
if (impl->data[i].number == index)
|
||||
{
|
||||
cv::String v = impl->data[i].def_value;
|
||||
String v = impl->data[i].def_value;
|
||||
if (space_delete == true) v = impl->cat_string(v);
|
||||
from_str(v, type, dst);
|
||||
return;
|
||||
@@ -129,7 +129,7 @@ void CommandLineParser::getByIndex(int index, bool space_delete, int type, void*
|
||||
catch(std::exception & e)
|
||||
{
|
||||
impl->error = true;
|
||||
impl->error_message = impl->error_message + "Exception: " + cv::String(e.what()) + "\n";
|
||||
impl->error_message = impl->error_message + "Exception: " + String(e.what()) + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,34 +149,34 @@ static bool cmp_params(const CommandLineParserParams & p1, const CommandLinePars
|
||||
return true;
|
||||
}
|
||||
|
||||
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const cv::String& keys)
|
||||
CommandLineParser::CommandLineParser(int argc, const char* const argv[], const String& keys)
|
||||
{
|
||||
impl = new Impl;
|
||||
impl->refcount = 1;
|
||||
|
||||
// path to application
|
||||
size_t pos_s = cv::String(argv[0]).find_last_of("/\\");
|
||||
if (pos_s == cv::String::npos)
|
||||
size_t pos_s = String(argv[0]).find_last_of("/\\");
|
||||
if (pos_s == String::npos)
|
||||
{
|
||||
impl->path_to_app = "";
|
||||
impl->app_name = cv::String(argv[0]);
|
||||
impl->app_name = String(argv[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
impl->path_to_app = cv::String(argv[0]).substr(0, pos_s);
|
||||
impl->app_name = cv::String(argv[0]).substr(pos_s + 1, cv::String(argv[0]).length() - pos_s);
|
||||
impl->path_to_app = String(argv[0]).substr(0, pos_s);
|
||||
impl->app_name = String(argv[0]).substr(pos_s + 1, String(argv[0]).length() - pos_s);
|
||||
}
|
||||
|
||||
impl->error = false;
|
||||
impl->error_message = "";
|
||||
|
||||
// parse keys
|
||||
std::vector<cv::String> k = impl->split_range_string(keys, '{', '}');
|
||||
std::vector<String> k = impl->split_range_string(keys, '{', '}');
|
||||
|
||||
int jj = 0;
|
||||
for (size_t i = 0; i < k.size(); i++)
|
||||
{
|
||||
std::vector<cv::String> l = impl->split_string(k[i], '|', true);
|
||||
std::vector<String> l = impl->split_string(k[i], '|', true);
|
||||
CommandLineParserParams p;
|
||||
p.keys = impl->split_string(l[0]);
|
||||
p.def_value = l[1];
|
||||
@@ -203,11 +203,11 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const c
|
||||
jj = 0;
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
cv::String s = cv::String(argv[i]);
|
||||
String s = String(argv[i]);
|
||||
|
||||
if (s.find('=') != cv::String::npos && s.find('=') < s.length())
|
||||
if (s.find('=') != String::npos && s.find('=') < s.length())
|
||||
{
|
||||
std::vector<cv::String> k_v = impl->split_string(s, '=', true);
|
||||
std::vector<String> k_v = impl->split_string(s, '=', true);
|
||||
for (int h = 0; h < 2; h++)
|
||||
{
|
||||
if (k_v[0][0] == '-')
|
||||
@@ -253,12 +253,12 @@ CommandLineParser& CommandLineParser::operator = (const CommandLineParser& parse
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CommandLineParser::about(const cv::String& message)
|
||||
void CommandLineParser::about(const String& message)
|
||||
{
|
||||
impl->about_message = message;
|
||||
}
|
||||
|
||||
void CommandLineParser::Impl::apply_params(const cv::String& key, const cv::String& value)
|
||||
void CommandLineParser::Impl::apply_params(const String& key, const String& value)
|
||||
{
|
||||
for (size_t i = 0; i < data.size(); i++)
|
||||
{
|
||||
@@ -273,7 +273,7 @@ void CommandLineParser::Impl::apply_params(const cv::String& key, const cv::Stri
|
||||
}
|
||||
}
|
||||
|
||||
void CommandLineParser::Impl::apply_params(int i, cv::String value)
|
||||
void CommandLineParser::Impl::apply_params(int i, String value)
|
||||
{
|
||||
for (size_t j = 0; j < data.size(); j++)
|
||||
{
|
||||
@@ -295,28 +295,28 @@ void CommandLineParser::Impl::sort_params()
|
||||
std::sort (data.begin(), data.end(), cmp_params);
|
||||
}
|
||||
|
||||
cv::String CommandLineParser::Impl::cat_string(const cv::String& str) const
|
||||
String CommandLineParser::Impl::cat_string(const String& str) const
|
||||
{
|
||||
int left = 0, right = (int)str.length();
|
||||
while( left <= right && str[left] == ' ' )
|
||||
left++;
|
||||
while( right > left && str[right-1] == ' ' )
|
||||
right--;
|
||||
return left >= right ? cv::String("") : str.substr(left, right-left);
|
||||
return left >= right ? String("") : str.substr(left, right-left);
|
||||
}
|
||||
|
||||
cv::String CommandLineParser::getPathToApplication() const
|
||||
String CommandLineParser::getPathToApplication() const
|
||||
{
|
||||
return impl->path_to_app;
|
||||
}
|
||||
|
||||
bool CommandLineParser::has(const cv::String& name) const
|
||||
bool CommandLineParser::has(const String& name) const
|
||||
{
|
||||
for (size_t i = 0; i < impl->data.size(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < impl->data[i].keys.size(); j++)
|
||||
{
|
||||
if (name.compare(impl->data[i].keys[j]) == 0 && cv::String("true").compare(impl->data[i].def_value) == 0)
|
||||
if (name.compare(impl->data[i].keys[j]) == 0 && String("true").compare(impl->data[i].def_value) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -350,7 +350,7 @@ void CommandLineParser::printMessage() const
|
||||
{
|
||||
if (impl->data[i].number > -1)
|
||||
{
|
||||
cv::String name = impl->data[i].keys[0].substr(1, impl->data[i].keys[0].length() - 1);
|
||||
String name = impl->data[i].keys[0].substr(1, impl->data[i].keys[0].length() - 1);
|
||||
printf("%s ", name.c_str());
|
||||
}
|
||||
}
|
||||
@@ -364,7 +364,7 @@ void CommandLineParser::printMessage() const
|
||||
printf("\t");
|
||||
for (size_t j = 0; j < impl->data[i].keys.size(); j++)
|
||||
{
|
||||
cv::String k = impl->data[i].keys[j];
|
||||
String k = impl->data[i].keys[j];
|
||||
if (k.length() > 1)
|
||||
{
|
||||
printf("--");
|
||||
@@ -380,7 +380,7 @@ void CommandLineParser::printMessage() const
|
||||
printf(", ");
|
||||
}
|
||||
}
|
||||
cv::String dv = impl->cat_string(impl->data[i].def_value);
|
||||
String dv = impl->cat_string(impl->data[i].def_value);
|
||||
if (dv.compare("") != 0)
|
||||
{
|
||||
printf(" (value:%s)", dv.c_str());
|
||||
@@ -395,12 +395,12 @@ void CommandLineParser::printMessage() const
|
||||
if (impl->data[i].number != -1)
|
||||
{
|
||||
printf("\t");
|
||||
cv::String k = impl->data[i].keys[0];
|
||||
String k = impl->data[i].keys[0];
|
||||
k = k.substr(1, k.length() - 1);
|
||||
|
||||
printf("%s", k.c_str());
|
||||
|
||||
cv::String dv = impl->cat_string(impl->data[i].def_value);
|
||||
String dv = impl->cat_string(impl->data[i].def_value);
|
||||
if (dv.compare("") != 0)
|
||||
{
|
||||
printf(" (value:%s)", dv.c_str());
|
||||
@@ -410,11 +410,11 @@ void CommandLineParser::printMessage() const
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<cv::String> CommandLineParser::Impl::split_range_string(const cv::String& _str, char fs, char ss) const
|
||||
std::vector<String> CommandLineParser::Impl::split_range_string(const String& _str, char fs, char ss) const
|
||||
{
|
||||
cv::String str = _str;
|
||||
std::vector<cv::String> vec;
|
||||
cv::String word = "";
|
||||
String str = _str;
|
||||
std::vector<String> vec;
|
||||
String word = "";
|
||||
bool begin = false;
|
||||
|
||||
while (!str.empty())
|
||||
@@ -424,13 +424,13 @@ std::vector<cv::String> CommandLineParser::Impl::split_range_string(const cv::St
|
||||
if (begin == true)
|
||||
{
|
||||
throw cv::Exception(CV_StsParseError,
|
||||
cv::String("error in split_range_string(")
|
||||
String("error in split_range_string(")
|
||||
+ str
|
||||
+ cv::String(", ")
|
||||
+ cv::String(1, fs)
|
||||
+ cv::String(", ")
|
||||
+ cv::String(1, ss)
|
||||
+ cv::String(")"),
|
||||
+ String(", ")
|
||||
+ String(1, fs)
|
||||
+ String(", ")
|
||||
+ String(1, ss)
|
||||
+ String(")"),
|
||||
"", __FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
@@ -444,13 +444,13 @@ std::vector<cv::String> CommandLineParser::Impl::split_range_string(const cv::St
|
||||
if (begin == false)
|
||||
{
|
||||
throw cv::Exception(CV_StsParseError,
|
||||
cv::String("error in split_range_string(")
|
||||
String("error in split_range_string(")
|
||||
+ str
|
||||
+ cv::String(", ")
|
||||
+ cv::String(1, fs)
|
||||
+ cv::String(", ")
|
||||
+ cv::String(1, ss)
|
||||
+ cv::String(")"),
|
||||
+ String(", ")
|
||||
+ String(1, fs)
|
||||
+ String(", ")
|
||||
+ String(1, ss)
|
||||
+ String(")"),
|
||||
"", __FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
@@ -468,13 +468,13 @@ std::vector<cv::String> CommandLineParser::Impl::split_range_string(const cv::St
|
||||
if (begin == true)
|
||||
{
|
||||
throw cv::Exception(CV_StsParseError,
|
||||
cv::String("error in split_range_string(")
|
||||
String("error in split_range_string(")
|
||||
+ str
|
||||
+ cv::String(", ")
|
||||
+ cv::String(1, fs)
|
||||
+ cv::String(", ")
|
||||
+ cv::String(1, ss)
|
||||
+ cv::String(")"),
|
||||
+ String(", ")
|
||||
+ String(1, fs)
|
||||
+ String(", ")
|
||||
+ String(1, ss)
|
||||
+ String(")"),
|
||||
"", __FILE__, __LINE__
|
||||
);
|
||||
}
|
||||
@@ -482,11 +482,11 @@ std::vector<cv::String> CommandLineParser::Impl::split_range_string(const cv::St
|
||||
return vec;
|
||||
}
|
||||
|
||||
std::vector<cv::String> CommandLineParser::Impl::split_string(const cv::String& _str, char symbol, bool create_empty_item) const
|
||||
std::vector<String> CommandLineParser::Impl::split_string(const String& _str, char symbol, bool create_empty_item) const
|
||||
{
|
||||
cv::String str = _str;
|
||||
std::vector<cv::String> vec;
|
||||
cv::String word = "";
|
||||
String str = _str;
|
||||
std::vector<String> vec;
|
||||
String word = "";
|
||||
|
||||
while (!str.empty())
|
||||
{
|
||||
|
@@ -1916,7 +1916,7 @@ static const int* getFontData(int fontFace)
|
||||
}
|
||||
|
||||
|
||||
void putText( Mat& img, const cv::String& text, Point org,
|
||||
void putText( Mat& img, const String& text, Point org,
|
||||
int fontFace, double fontScale, Scalar color,
|
||||
int thickness, int line_type, bool bottomLeftOrigin )
|
||||
|
||||
@@ -1978,7 +1978,7 @@ void putText( Mat& img, const cv::String& text, Point org,
|
||||
}
|
||||
}
|
||||
|
||||
Size getTextSize( const cv::String& text, int fontFace, double fontScale, int thickness, int* _base_line)
|
||||
Size getTextSize( const String& text, int fontFace, double fontScale, int thickness, int* _base_line)
|
||||
{
|
||||
Size size;
|
||||
double view_x = 0;
|
||||
|
@@ -15,8 +15,8 @@
|
||||
image = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", NSADDIMAGE_OPTION_RETURN_ON_ERROR);
|
||||
|
||||
// prepend a '_' for the Unix C symbol mangling convention
|
||||
cv::String symbolName = "_";
|
||||
symbolName += cv::String(name);
|
||||
String symbolName = "_";
|
||||
symbolName += String(name);
|
||||
|
||||
NSSymbol symbol = image ? NSLookupSymbolInImage(image, &symbolName[0], NSLOOKUPSYMBOLINIMAGE_OPTION_BIND | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR) : 0;
|
||||
|
||||
|
@@ -208,10 +208,10 @@ static void glob_rec(const cv::String& directory, const cv::String& wildchart, s
|
||||
else CV_Error(CV_StsObjectNotFound, cv::format("could not open directory: %s", directory.c_str()));
|
||||
}
|
||||
|
||||
void cv::glob(cv::String pattern, std::vector<cv::String>& result, bool recursive)
|
||||
void cv::glob(String pattern, std::vector<String>& result, bool recursive)
|
||||
{
|
||||
result.clear();
|
||||
cv::String path, wildchart;
|
||||
String path, wildchart;
|
||||
|
||||
if (isDir(pattern, 0))
|
||||
{
|
||||
@@ -227,7 +227,7 @@ void cv::glob(cv::String pattern, std::vector<cv::String>& result, bool recursiv
|
||||
else
|
||||
{
|
||||
size_t pos = pattern.find_last_of(dir_separators);
|
||||
if (pos == cv::String::npos)
|
||||
if (pos == String::npos)
|
||||
{
|
||||
wildchart = pattern;
|
||||
path = ".";
|
||||
|
@@ -172,7 +172,7 @@ namespace
|
||||
bool hasEqualOrGreaterBin(int major, int minor) const;
|
||||
|
||||
private:
|
||||
static void fromStr(const cv::String& set_as_str, std::vector<int>& arr);
|
||||
static void fromStr(const String& set_as_str, std::vector<int>& arr);
|
||||
|
||||
std::vector<int> bin;
|
||||
std::vector<int> ptx;
|
||||
@@ -218,9 +218,9 @@ namespace
|
||||
return !bin.empty() && (bin.back() >= major * 10 + minor);
|
||||
}
|
||||
|
||||
void CudaArch::fromStr(const cv::String& set_as_str, std::vector<int>& arr)
|
||||
void CudaArch::fromStr(const String& set_as_str, std::vector<int>& arr)
|
||||
{
|
||||
if (set_as_str.find_first_not_of(" ") == cv::String::npos)
|
||||
if (set_as_str.find_first_not_of(" ") == String::npos)
|
||||
return;
|
||||
|
||||
std::istringstream stream(set_as_str);
|
||||
|
@@ -152,7 +152,7 @@ cv::String cv::FileStorage::getDefaultObjectName(const cv::String& _filename)
|
||||
name = name_buf;
|
||||
if( strcmp( name, "_" ) == 0 )
|
||||
strcpy( name, stubname );
|
||||
return cv::String(name);
|
||||
return String(name);
|
||||
}
|
||||
|
||||
typedef struct CvGenericHash
|
||||
@@ -5104,7 +5104,7 @@ stop_search:
|
||||
namespace cv
|
||||
{
|
||||
|
||||
static void getElemSize( const cv::String& fmt, size_t& elemSize, size_t& cn )
|
||||
static void getElemSize( const String& fmt, size_t& elemSize, size_t& cn )
|
||||
{
|
||||
const char* dt = fmt.c_str();
|
||||
cn = 1;
|
||||
@@ -5124,7 +5124,7 @@ FileStorage::FileStorage()
|
||||
state = UNDEFINED;
|
||||
}
|
||||
|
||||
FileStorage::FileStorage(const cv::String& filename, int flags, const cv::String& encoding)
|
||||
FileStorage::FileStorage(const String& filename, int flags, const String& encoding)
|
||||
{
|
||||
state = UNDEFINED;
|
||||
open( filename, flags, encoding );
|
||||
@@ -5145,7 +5145,7 @@ FileStorage::~FileStorage()
|
||||
}
|
||||
}
|
||||
|
||||
bool FileStorage::open(const cv::String& filename, int flags, const cv::String& encoding)
|
||||
bool FileStorage::open(const String& filename, int flags, const String& encoding)
|
||||
{
|
||||
release();
|
||||
fs = Ptr<CvFileStorage>(cvOpenFileStorage( filename.c_str(), 0, flags,
|
||||
@@ -5167,9 +5167,9 @@ void FileStorage::release()
|
||||
state = UNDEFINED;
|
||||
}
|
||||
|
||||
cv::String FileStorage::releaseAndGetString()
|
||||
String FileStorage::releaseAndGetString()
|
||||
{
|
||||
cv::String buf;
|
||||
String buf;
|
||||
if( fs.obj && fs.obj->outbuf )
|
||||
icvClose(fs.obj, &buf);
|
||||
|
||||
@@ -5182,7 +5182,7 @@ FileNode FileStorage::root(int streamidx) const
|
||||
return isOpened() ? FileNode(fs, cvGetRootFileNode(fs, streamidx)) : FileNode();
|
||||
}
|
||||
|
||||
FileStorage& operator << (FileStorage& fs, const cv::String& str)
|
||||
FileStorage& operator << (FileStorage& fs, const String& str)
|
||||
{
|
||||
enum { NAME_EXPECTED = FileStorage::NAME_EXPECTED,
|
||||
VALUE_EXPECTED = FileStorage::VALUE_EXPECTED,
|
||||
@@ -5201,7 +5201,7 @@ FileStorage& operator << (FileStorage& fs, const cv::String& str)
|
||||
fs.state = fs.structs.empty() || fs.structs.back() == '{' ?
|
||||
INSIDE_MAP + NAME_EXPECTED : VALUE_EXPECTED;
|
||||
cvEndWriteStruct( *fs );
|
||||
fs.elname = cv::String();
|
||||
fs.elname = String();
|
||||
}
|
||||
else if( fs.state == NAME_EXPECTED + INSIDE_MAP )
|
||||
{
|
||||
@@ -5225,12 +5225,12 @@ FileStorage& operator << (FileStorage& fs, const cv::String& str)
|
||||
}
|
||||
cvStartWriteStruct( *fs, fs.elname.size() > 0 ? fs.elname.c_str() : 0,
|
||||
flags, *_str ? _str : 0 );
|
||||
fs.elname = cv::String();
|
||||
fs.elname = String();
|
||||
}
|
||||
else
|
||||
{
|
||||
write( fs, fs.elname, (_str[0] == '\\' && (_str[1] == '{' || _str[1] == '}' ||
|
||||
_str[1] == '[' || _str[1] == ']')) ? cv::String(_str+1) : str );
|
||||
_str[1] == '[' || _str[1] == ']')) ? String(_str+1) : str );
|
||||
if( fs.state == INSIDE_MAP + VALUE_EXPECTED )
|
||||
fs.state = INSIDE_MAP + NAME_EXPECTED;
|
||||
}
|
||||
@@ -5241,7 +5241,7 @@ FileStorage& operator << (FileStorage& fs, const cv::String& str)
|
||||
}
|
||||
|
||||
|
||||
void FileStorage::writeRaw( const cv::String& fmt, const uchar* vec, size_t len )
|
||||
void FileStorage::writeRaw( const String& fmt, const uchar* vec, size_t len )
|
||||
{
|
||||
if( !isOpened() )
|
||||
return;
|
||||
@@ -5252,7 +5252,7 @@ void FileStorage::writeRaw( const cv::String& fmt, const uchar* vec, size_t len
|
||||
}
|
||||
|
||||
|
||||
void FileStorage::writeObj( const cv::String& name, const void* obj )
|
||||
void FileStorage::writeObj( const String& name, const void* obj )
|
||||
{
|
||||
if( !isOpened() )
|
||||
return;
|
||||
@@ -5260,7 +5260,7 @@ void FileStorage::writeObj( const cv::String& name, const void* obj )
|
||||
}
|
||||
|
||||
|
||||
FileNode FileStorage::operator[](const cv::String& nodename) const
|
||||
FileNode FileStorage::operator[](const String& nodename) const
|
||||
{
|
||||
return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename.c_str()));
|
||||
}
|
||||
@@ -5270,7 +5270,7 @@ FileNode FileStorage::operator[](const char* nodename) const
|
||||
return FileNode(fs, cvGetFileNodeByName(fs, 0, nodename));
|
||||
}
|
||||
|
||||
FileNode FileNode::operator[](const cv::String& nodename) const
|
||||
FileNode FileNode::operator[](const String& nodename) const
|
||||
{
|
||||
return FileNode(fs, cvGetFileNodeByName(fs, node, nodename.c_str()));
|
||||
}
|
||||
@@ -5286,10 +5286,10 @@ FileNode FileNode::operator[](int i) const
|
||||
i == 0 ? *this : FileNode();
|
||||
}
|
||||
|
||||
cv::String FileNode::name() const
|
||||
String FileNode::name() const
|
||||
{
|
||||
const char* str;
|
||||
return !node || (str = cvGetFileNodeName(node)) == 0 ? cv::String() : cv::String(str);
|
||||
return !node || (str = cvGetFileNodeName(node)) == 0 ? String() : String(str);
|
||||
}
|
||||
|
||||
void* FileNode::readObj() const
|
||||
@@ -5404,7 +5404,7 @@ FileNodeIterator& FileNodeIterator::operator -= (int ofs)
|
||||
}
|
||||
|
||||
|
||||
FileNodeIterator& FileNodeIterator::readRaw( const cv::String& fmt, uchar* vec, size_t maxCount )
|
||||
FileNodeIterator& FileNodeIterator::readRaw( const String& fmt, uchar* vec, size_t maxCount )
|
||||
{
|
||||
if( fs && container && remaining > 0 )
|
||||
{
|
||||
@@ -5428,16 +5428,16 @@ FileNodeIterator& FileNodeIterator::readRaw( const cv::String& fmt, uchar* vec,
|
||||
}
|
||||
|
||||
|
||||
void write( FileStorage& fs, const cv::String& name, int value )
|
||||
void write( FileStorage& fs, const String& name, int value )
|
||||
{ cvWriteInt( *fs, name.size() ? name.c_str() : 0, value ); }
|
||||
|
||||
void write( FileStorage& fs, const cv::String& name, float value )
|
||||
void write( FileStorage& fs, const String& name, float value )
|
||||
{ cvWriteReal( *fs, name.size() ? name.c_str() : 0, value ); }
|
||||
|
||||
void write( FileStorage& fs, const cv::String& name, double value )
|
||||
void write( FileStorage& fs, const String& name, double value )
|
||||
{ cvWriteReal( *fs, name.size() ? name.c_str() : 0, value ); }
|
||||
|
||||
void write( FileStorage& fs, const cv::String& name, const cv::String& value )
|
||||
void write( FileStorage& fs, const String& name, const String& value )
|
||||
{ cvWriteString( *fs, name.size() ? name.c_str() : 0, value.c_str() ); }
|
||||
|
||||
void writeScalar(FileStorage& fs, int value )
|
||||
@@ -5449,11 +5449,11 @@ void writeScalar(FileStorage& fs, float value )
|
||||
void writeScalar(FileStorage& fs, double value )
|
||||
{ cvWriteReal( *fs, 0, value ); }
|
||||
|
||||
void writeScalar(FileStorage& fs, const cv::String& value )
|
||||
void writeScalar(FileStorage& fs, const String& value )
|
||||
{ cvWriteString( *fs, 0, value.c_str() ); }
|
||||
|
||||
|
||||
void write( FileStorage& fs, const cv::String& name, const Mat& value )
|
||||
void write( FileStorage& fs, const String& name, const Mat& value )
|
||||
{
|
||||
if( value.dims <= 2 )
|
||||
{
|
||||
@@ -5468,15 +5468,15 @@ void write( FileStorage& fs, const cv::String& name, const Mat& value )
|
||||
}
|
||||
|
||||
// TODO: the 4 functions below need to be implemented more efficiently
|
||||
void write( FileStorage& fs, const cv::String& name, const SparseMat& value )
|
||||
void write( FileStorage& fs, const String& name, const SparseMat& value )
|
||||
{
|
||||
Ptr<CvSparseMat> mat = (CvSparseMat*)value;
|
||||
cvWrite( *fs, name.size() ? name.c_str() : 0, mat );
|
||||
}
|
||||
|
||||
|
||||
WriteStructContext::WriteStructContext(FileStorage& _fs, const cv::String& name,
|
||||
int flags, const cv::String& typeName) : fs(&_fs)
|
||||
WriteStructContext::WriteStructContext(FileStorage& _fs, const String& name,
|
||||
int flags, const String& typeName) : fs(&_fs)
|
||||
{
|
||||
cvStartWriteStruct(**fs, !name.empty() ? name.c_str() : 0, flags,
|
||||
!typeName.empty() ? typeName.c_str() : 0);
|
||||
|
@@ -113,7 +113,7 @@ namespace cv
|
||||
|
||||
Exception::Exception() { code = 0; line = 0; }
|
||||
|
||||
Exception::Exception(int _code, const cv::String& _err, const cv::String& _func, const cv::String& _file, int _line)
|
||||
Exception::Exception(int _code, const String& _err, const String& _func, const String& _file, int _line)
|
||||
: code(_code), err(_err), func(_func), file(_file), line(_line)
|
||||
{
|
||||
formatMessage();
|
||||
@@ -340,27 +340,27 @@ int64 getCPUTickCount(void)
|
||||
|
||||
#endif
|
||||
|
||||
const cv::String& getBuildInformation()
|
||||
const String& getBuildInformation()
|
||||
{
|
||||
static cv::String build_info =
|
||||
static String build_info =
|
||||
#include "version_string.inc"
|
||||
;
|
||||
return build_info;
|
||||
}
|
||||
|
||||
cv::String format( const char* fmt, ... )
|
||||
String format( const char* fmt, ... )
|
||||
{
|
||||
char buf[1 << 16];
|
||||
va_list args;
|
||||
va_start( args, fmt );
|
||||
vsprintf( buf, fmt, args );
|
||||
return cv::String(buf);
|
||||
return String(buf);
|
||||
}
|
||||
|
||||
cv::String tempfile( const char* suffix )
|
||||
String tempfile( const char* suffix )
|
||||
{
|
||||
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
|
||||
cv::String fname;
|
||||
String fname;
|
||||
|
||||
#if defined WIN32 || defined _WIN32
|
||||
char temp_dir2[MAX_PATH + 1] = { 0 };
|
||||
@@ -372,7 +372,7 @@ cv::String tempfile( const char* suffix )
|
||||
temp_dir = temp_dir2;
|
||||
}
|
||||
if(0 == ::GetTempFileNameA(temp_dir, "ocv", 0, temp_file))
|
||||
return cv::String();
|
||||
return String();
|
||||
|
||||
DeleteFileA(temp_file);
|
||||
|
||||
@@ -397,7 +397,7 @@ cv::String tempfile( const char* suffix )
|
||||
}
|
||||
|
||||
const int fd = mkstemp((char*)fname.c_str());
|
||||
if (fd == -1) return cv::String();
|
||||
if (fd == -1) return String();
|
||||
|
||||
close(fd);
|
||||
remove(fname.c_str());
|
||||
|
Reference in New Issue
Block a user