本文整理汇总了C++中FileManager::copyFile方法的典型用法代码示例。如果您正苦于以下问题:C++ FileManager::copyFile方法的具体用法?C++ FileManager::copyFile怎么用?C++ FileManager::copyFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::copyFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyFile
bool LnkProperties::copyFile( DocLnk &newdoc )
{
const char *linkExtn = ".desktop";
QString fileExtn;
int extnPos = lnk->file().findRev( '.' );
if ( extnPos > 0 )
fileExtn = lnk->file().mid( extnPos );
QString safename = newdoc.name();
safename.replace(QRegExp("/"),"_");
QString fn = locations[ d->locationCombo->currentItem() ]
+ "/Documents/" + newdoc.type();
if (!createMimedir(locations[ d->locationCombo->currentItem() ],newdoc.type())) {
return FALSE;
}
fn+="/"+safename;
if ( QFile::exists(fn + fileExtn) || QFile::exists(fn + linkExtn) ) {
int n=1;
QString nn = fn + "_" + QString::number(n);
while ( QFile::exists(nn+fileExtn) || QFile::exists(nn+linkExtn) ) {
n++;
nn = fn + "_" + QString::number(n);
}
fn = nn;
}
newdoc.setFile( fn + fileExtn );
newdoc.setLinkFile( fn + linkExtn );
// Copy file
FileManager fm;
if ( !fm.copyFile( *lnk, newdoc ) )
return FALSE;
return TRUE;
}
示例2: copy
/* fast cpy */
void OtherHandler::copy(const QString& src, const QString& file) {
FileManager *fm;
if(!fm->copyFile(src,file))
owarn << "Copy failed" << oendl;
}
示例3: clusterImageBasedonTopicDist
/*!
\fn clusterImageBasedonTopicDist
Params:
@param1: string thetaFilename
return:
cv::Mat center
center topic distribution
cluster all image topic distribution into 20 groups by kmeans, the center topic distribution is returned
*/
cv::Mat WordModel::clusterImageBasedonTopicDist(string thetaFilename, string imgfolder)
{
cv::Mat thetaMat;
FileManager fm;
ImageManager im;
fm.ThetaDataReader(thetaFilename, &thetaMat);
//fm.ReadMatFromDisk<float>(thetaFilename, &thetaMat);
CV_Assert(thetaMat.data != 0);
cv::Mat labels, centers;
cv::kmeans(thetaMat, 32, labels, cv::TermCriteria(), 5, 0, centers);
//fm.SaveMat2Disk<float>(centers, "model\\flann\\center.theta");
vector<vector<int>> v_groups(32);
for (int i=0; i<thetaMat.rows; i++)
{
int idx = labels.at<int>(i, 0);
v_groups[idx].push_back(i);
}
cv::Mat gps_mat;
fm.ReadMatFromDisk<double>("model\\gps.dat", &gps_mat);
CubeMat cm = fm.CubeMatSampling(imgfolder, 5);
//organize sampled images into one vector, only double side views will be inserted
vector<string> imglist;
for (int i=0; i<cm.size(); i++)
{
imglist.push_back(cm[i][1]);
imglist.push_back(cm[i][3]);
}
#if 0
for (int i=0; i<v_groups.size(); i++)
{
vector<int> _v = v_groups[i];
cv::Mat sift_features, gps_features;
for (int j=0; j < _v.size(); j++)
{
int idx = _v[j];
double lat = gps_mat.at<double>(idx, 0);
double lng = gps_mat.at<double>(idx, 1);
cv::Mat gps_row(1,2, CV_64F);
gps_row.at<double>(0,0) = lat;
gps_row.at<double>(0,1) = lng;
string imgname = imglist[idx];
cv::Mat imat = cv::imread(imgname);
imat = im.ImageClipper(imat);
cv::Mat descriptor;
descriptor = im.ImgSiftCollector(imat, false, 0.9);
sift_features.push_back(descriptor);
for (int k=0; k<descriptor.rows; k++)
{
gps_features.push_back(gps_row);
}
}
char buffer[256];
sprintf(buffer, "model\\flann\\%d.sift", i);
fm.SaveMat2Disk<float>(sift_features, static_cast<string>(buffer));
sprintf(buffer, "model\\flann\\%d.gps", i);
fm.SaveMat2Disk<double>(gps_features, static_cast<string>(buffer));
}
#else
string trainingimgclusterfolder = "imgs\\pitts";
for (int i=0; i<v_groups.size(); i++)
{
vector<int> _v=v_groups[i];
for (int j=0; j<_v.size(); j++)
{
int idx = _v[j];
string imgname = imglist[idx];
char buffer[256];
sprintf(buffer, "%s\\%d\\", trainingimgclusterfolder.c_str(), i);
string dstfolder = fm.DirectoryBuilder(static_cast<string>(buffer));
vector<string> _v;
fm.file_name_splitter(imgname, &_v, "\\");
dstfolder = dstfolder + _v[_v.size() - 1];
fm.copyFile(imgname, dstfolder);
}
}
#endif
/*
cv::flann::Index index(centers, cv::flann::KMeansIndexParams());
cv::Mat thetaMat_test, indices, distance;
//.........这里部分代码省略.........