本文整理汇总了C++中PathVector::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ PathVector::empty方法的具体用法?C++ PathVector::empty怎么用?C++ PathVector::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathVector
的用法示例。
在下文中一共展示了PathVector::empty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printable
std::string ContextGen::printable(const PathVector& val)
{
std::string res;
if(val.empty())
return "(empty vector)";
else
res = "(vector)";
Color col(getColorMode());
for(PathVector::const_iterator it = val.begin(); it != val.end(); ++it)
{
res.append(col.red("\n * "));
if(it->isNative()) res.append(col.yellow("[NATIVE] "));
else if(it->isForeign()) res.append(col.yellow("[FOREIGN] "));
else res.append(col.yellow("[NEITHER] ")); // is ok, if windows parity build and unix path with windows backend
res.append(it->get());
}
return res;
}
示例2: main
//.........这里部分代码省略.........
std::cout << " FaceLabel File: " << facelabelFile << std::endl;
std::cout << " Attribute File: " << attributeFile << std::endl;
std::cout << " Optional: clear SqlDB -> " << clearSqlDB << std::endl;
std::cout << " Base Path: " << basePath << std::endl;
std::cout << "-------------------------------------------------------" << std::endl;
//------------------ DELETE db entries from sql database
if (clearSqlDB.compare("true") == 0) {
cout << " \nCLEAR Sql Database " << endl;
DeleteSqlEntries dsde;
dsde.deleteAllSqlEntries(sqlDBFile);
return 0;
} else {
std::cout << " \nADD data to Sql Database" << std::endl;
std::string::size_type pos = sqlDBFile.find_last_of("\\/");
if (pos != std::string::npos) {
basePath = sqlDBFile.substr(0,pos+1);
}
}
//------------------ INSERT dbname INTO sql database
DeleteSqlEntries dnsf;
bool deleted = false;
deleted = dnsf.deleteDBName(sqlDBFile, imgDBName);
if (deleted == true) {
dnsf.insertDBName(sqlDBFile, imgDBName);
}
// get all *jpg files in img file folder
ImagesFromFolder iff;
PathVector paths = iff.getImagesFromFolder(imgFolder, ".JPG");
if (paths.empty()) {
std::cout << " FACETRACERIMPORTER -> Folderpath '" << imgFolder << "' is empty! " << std::endl;
} else {
iff.printFoundFiles(paths);
bool available = true;
for (unsigned int n = 0; n < paths.size(); ++n)
{
// extract faceId from path
int faceId = utils::convertToInt(paths.at(n).stem().string());
FaceTracerFileReader faceTracerFileReader;
std::string faceindexFileName = faceindexFile;
available = faceTracerFileReader.loadFaceindex(faceId, faceindexFileName, imgFolder);
std::string facestatsFileName = facestatsFile;
available = faceTracerFileReader.loadFacestats(faceId, facestatsFileName);
std::string facelabelFileName = facelabelFile;
available = faceTracerFileReader.loadFacelabel(faceId, facelabelFileName);
// faceTracerFileReader.printFaceTracerData();
// Draw landmarks to image.
//faceTracerFileReader.drawFacestats(faceId);
if (available == false) {
std::cout << "facetrace_import::main() data for faceId('" << faceId << "') missing." << std::endl;
break;
}
//------------------ INSERT INTO sql db
示例3: main
//.........这里部分代码省略.........
cout << " \nCLEAR Sql Database " << endl;
DeleteSqlEntries dsde;
dsde.deleteAllSqlEntries(sqlDBFile);
return 0;
} else {
std::cout << " \nADD data to Sql Database" << std::endl;
std::string::size_type pos = sqlDBFile.find_last_of("\\/");
if (pos != std::string::npos) {
basePath = sqlDBFile.substr(0,pos+1);
}
}
//------------------ INSERT dbname INTO sql database
DeleteSqlEntries dnsf;
bool deleted = false;
deleted = dnsf.deleteDBName(sqlDBFile, imgDBName);
if (deleted == true) {
dnsf.insertDBName(sqlDBFile, imgDBName);
}
// get all *jpg files from img file folder
ImagesFromFolder iff;
// PathVector paths = iff.getImagesFromFolder(imgDir + "\\0" + folderName, ".JPG");
// paths.clear();
PathVector pathImages = iff.getFilesFromFolderStruct(imgDir, ".JPG");
iff.clearPathVector();
PathVector pathLandmarks = iff.getFilesFromFolderStruct(landmarksDir, ".YML");
iff.clearPathVector();
if (pathImages.empty()) {
std::cout << " PUTIMPORTER -> Warning: NO Files in Folderpath '" << imgDir << "' found! " << std::endl;
} else if (pathLandmarks.empty()) {
std::cout << " PUTIMPORTER -> Warning: NO Files in Folderpath '" << landmarksDir << "' found! " << std::endl;
} else {
// iff.printFoundFiles(paths);
// iff.printFoundFiles(pathLandmarks);
PutFileReader putFileReader;
// first read all images
for (unsigned int n = 0; n < pathImages.size(); ++n)
{
std::string imgFileName = pathImages.at(n).string();
putFileReader.loadImage(imgFileName);
std::cout << " Insert '" << imgFileName << "' into putFileReader structure. " << std::endl;
}
// second add landmarks to images (if no images available ignore landmark)
for (unsigned int n = 0; n < pathLandmarks.size(); ++n)
{
std:
string landmarksFileName = pathLandmarks.at(n).string();
putFileReader.loadLandmarks(landmarksFileName);
std::cout << " Insert '" << landmarksFileName << "' into putFileReader structure. " << std::endl;
}
// insert all images into sql database
std::map<int, PutFileData>::iterator putIt = putFileReader.m_putDataMap.begin();
for (; putIt != putFileReader.m_putDataMap.end(); ++putIt)
{
//putFileReader.printPutData();