本文整理汇总了C++中FileList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ FileList::empty方法的具体用法?C++ FileList::empty怎么用?C++ FileList::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileList
的用法示例。
在下文中一共展示了FileList::empty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setFiles
void SubjectViewer::setFiles(const FileList &files)
{
currentIndex = 0;
this->files = files;
if (!files.empty()) {
info.setText(QString::number(currentIndex+1) + "/" + QString::number(files.size()));
viewer.setFile(this->files[currentIndex]);
} else {
info.setText("-");
viewer.setFile(File());
}
}
示例2: scanDirectory
void scanDirectory(const char* path, const char* ext, FileList& list)
{
fileListClear(list);
#ifdef WIN32
_finddata_t dir;
char pathWithExt[260];
intptr_t fh;
strcpy(pathWithExt, path);
strcat(pathWithExt, "/*");
strcat(pathWithExt, ext);
fh = _findfirst(pathWithExt, &dir);
if (fh == -1L)
return;
do
{
fileListAdd(list, std::string(dir.name));
}
while (_findnext(fh, &dir) == 0);
_findclose(fh);
#else
dirent* current = 0;
DIR* dp = opendir(path);
if (!dp)
return;
while ((current = readdir(dp)) != 0)
{
int len = strlen(current->d_name);
if (len > 4 && strncmp(current->d_name+len-4, ext, 4) == 0)
{
fileListAdd(list, current->d_name);
}
}
closedir(dp);
#endif
if (!list.empty())
std::sort(list.begin(), list.end());
}
示例3: PauseParsInGroups
void QueueEditor::PauseParsInGroups(ItemList* pItemList, bool bExtraParsOnly)
{
while (true)
{
FileList GroupFileList;
GroupFileList.clear();
FileInfo* pFirstFileInfo = NULL;
for (ItemList::iterator it = pItemList->begin(); it != pItemList->end(); )
{
EditItem* pItem = *it;
if (!pFirstFileInfo ||
(pFirstFileInfo->GetNZBInfo() == pItem->m_pFileInfo->GetNZBInfo()))
{
GroupFileList.push_back(pItem->m_pFileInfo);
if (!pFirstFileInfo)
{
pFirstFileInfo = pItem->m_pFileInfo;
}
delete pItem;
pItemList->erase(it);
it = pItemList->begin();
continue;
}
it++;
}
if (!GroupFileList.empty())
{
PausePars(&GroupFileList, bExtraParsOnly);
}
else
{
break;
}
}
}
示例4: main
int main( int argc, char **argv )
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use node masks to create stereo images.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
arguments.getApplicationUsage()->addCommandLineOption("-d <float>","Time delay in seconds between the display of successive image pairs when in auto advance mode.");
arguments.getApplicationUsage()->addCommandLineOption("-a","Enter auto advance of image pairs on start up.");
arguments.getApplicationUsage()->addCommandLineOption("-x <float>","Horizontal offset of left and right images.");
arguments.getApplicationUsage()->addCommandLineOption("-y <float>","Vertical offset of left and right images.");
arguments.getApplicationUsage()->addCommandLineOption("--disk","Keep images on disk");
arguments.getApplicationUsage()->addCommandLineOption("-files <filename>","Load filenames from a file");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--SingleThreaded","Select SingleThreaded threading model for viewer.");
arguments.getApplicationUsage()->addCommandLineOption("--CullDrawThreadPerContext","Select CullDrawThreadPerContext threading model for viewer.");
arguments.getApplicationUsage()->addCommandLineOption("--DrawThreadPerContext","Select DrawThreadPerContext threading model for viewer.");
arguments.getApplicationUsage()->addCommandLineOption("--CullThreadPerCameraDrawThreadPerContext","Select CullThreadPerCameraDrawThreadPerContext threading model for viewer.");
// construct the viewer.
osgViewer::Viewer viewer(arguments);
// register the handler to add keyboard and mouse handling.
SlideEventHandler* seh = new SlideEventHandler();
viewer.addEventHandler(seh);
// read any time delay argument.
float timeDelayBetweenSlides = 5.0f;
while (arguments.read("-d",timeDelayBetweenSlides)) {}
bool autoSteppingActive = false;
while (arguments.read("-a")) autoSteppingActive = true;
float offsetX=0.0f;
while (arguments.read("-x",offsetX)) {}
float offsetY=0.0f;
while (arguments.read("-y",offsetY)) {}
bool onDisk=false;
while (arguments.read("--disk")) {
onDisk=true;
}
std::string filename="";
FileList fileList;
// extract the filenames from the a file, one filename per line.
while (arguments.read("-files",filename)) {
osgDB::ifstream is(filename.c_str());
if (is) {
std::string line;
while (std::getline(is,line,'\n')) fileList.push_back(line);
is.close();
}
}
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
osgViewer::Viewer::ThreadingModel threading = osgViewer::Viewer::SingleThreaded;
while (arguments.read("--SingleThreaded")) threading = osgViewer::Viewer::SingleThreaded;
while (arguments.read("--CullDrawThreadPerContext")) threading = osgViewer::Viewer::CullDrawThreadPerContext;
while (arguments.read("--DrawThreadPerContext")) threading = osgViewer::Viewer::DrawThreadPerContext;
while (arguments.read("--CullThreadPerCameraDrawThreadPerContext")) threading = osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext;
viewer.setThreadingModel(threading);
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
// extract the filenames from the arguments list.
for(int pos=1; pos<arguments.argc(); ++pos)
{
if (arguments.isString(pos)) fileList.push_back(arguments[pos]);
}
if (fileList.empty())
{
fileList.push_back("Images/dog_left_eye.jpg");
fileList.push_back("Images/dog_right_eye.jpg");
}
else if (fileList.size()<2)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
//.........这里部分代码省略.........