当前位置: 首页>>代码示例>>C++>>正文


C++ FileList::begin方法代码示例

本文整理汇总了C++中FileList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ FileList::begin方法的具体用法?C++ FileList::begin怎么用?C++ FileList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileList的用法示例。


在下文中一共展示了FileList::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: archivefs_readdir

int archivefs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
                      off_t offset, struct fuse_file_info *info) {
  (void)offset;
  (void)path;

  FusePrivate* fuse_data = PRIVATE_DATA;
  FileHandle* fh = NULL;
  int ret;

  /* Stejná logika jako u archivefs_read.
   */
  if (fuse_data->mode == FusePrivate::ARCHIVE_MOUNTED) {
    fh = reinterpret_cast<FileHandle*>(info->fh);
  } else {
    char fpath[PATH_MAX];
    fullpath(fpath, path);
    struct stat dir_info;
    if (stat(fpath, &dir_info) == 0 && S_ISDIR(dir_info.st_mode)) {
      DIR* dir = reinterpret_cast<DIR*>(info->fh);
      struct dirent* file;

      // Every directory contains at least two entries: . and ..  If my
      // first call to the system readdir() returns NULL I've got an
      // error; near as I can tell, that's the only condition under
      // which I can get an error from readdir()
      file = readdir(dir);
      if (file == NULL) {
        ret = errno;
        print_err("READDIR", path, ret);
        return -ret;
      } else {
        do {
          if (filler(buf, file->d_name, NULL, 0) != 0) {
            return -ENOMEM;
          }

        } while ((file = readdir(dir)) != NULL);

        return 0;
      }
    } else {
      fh = reinterpret_cast<FileHandle*>(info->fh);
    }
  }

  filler(buf, ".", NULL, 0);
  filler(buf, "..", NULL, 0);

  FileList* files = fh->first->readDir(fh->second);
  for (FileList::const_iterator it = files->begin();
       it != files->end(); ++it) {
    if (filler(buf, (*it)->name_ptr, NULL, 0) != 0) {
      print_err("READDIR", path, ENOMEM);
      return -ENOMEM;
    }
  }

  return 0;
}
开发者ID:samekmichal,项目名称:archivefs,代码行数:59,代码来源:archivefs.cpp

示例2: run

void MaterialScriptChecker::run()
{
	string currentPath = FileSystem::getCurrentPath();
	FileList fileList;
	FileSystem::getAllFileInPath(fileList, currentPath, "material", FILE_ATTRIBUTE_ARCHIVE);
	for (FileIterator i = fileList.begin(); i != fileList.end(); i++)
	{
		checkFile(i->fileName);
	}
}
开发者ID:Alex-Chang,项目名称:FileAnlayzer,代码行数:10,代码来源:MaterialScriptChecker.cpp

示例3: scan

 void DirectoryScanner::scan(db::Watchfolder folder,std::string indir/*, std::string outdir, db::Preset preset, FileFilter & filter*/) {
   LOGDEBUG("Scanning Directory:" << indir);
   MyFileFilter filter=MyFileFilter(folder.extensionfilter);
   FileList list = File(indir).listFiles(filter);
   FileList::iterator it = list.begin();
   for (; it != list.end(); it++) {
     if ((*it)->isDirectory())
       scan(folder,(*it)->getPath());
     else
       computeFile(folder,*it->get());
   }
 }
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:12,代码来源:DirectoryScanner.cpp

示例4: output

void output(const FileList& flist)
{
	for (BOOST_AUTO(iter, flist.begin()); iter != flist.end(); ++iter)
	{
		BOOST_AUTO(&fmeta, iter->second);
		std::vector<char> buffer;
		std::cout << "name  : "  << GetFileName(fmeta.mName, buffer) << "\n, "
					<< "meta  : {" << fmeta.mMeta     << "}, \n"
					<< "offset: "  << fmeta.mOffset   << ", \n"
					<< "fsize : "  << fmeta.mFileSize << ", \n"
					<< "wbsize: "  << fmeta.mWriteBSize << "\n"
					<< std::endl;
	}
}
开发者ID:wenxq,项目名称:cpp,代码行数:14,代码来源:main.cpp

示例5: presetdir

      PresetList::PresetList() : Wt::Ext::TableView() {
        File presetdir(org::esb::config::Config::get("preset.path"));
        if (presetdir.exists()) {
          FileList files = presetdir.listFiles();
          std::list<std::list<std::string> > data;
          FileList::iterator file_it = files.begin();
          for (; file_it != files.end(); file_it++) {
            org::esb::hive::PresetReader reader((*file_it)->getPath());
            LOGDEBUG((*file_it)->getPath());
            std::list<std::string> line;
            line.push_back((*file_it)->getFileName());
            line.push_back(reader.getPreset()["name"]);
            //line.push_back(reader.getPreset()["id"]);
            data.push_back(line);
          }
          setModel(new PresetListTableModel(data));
          setAlternatingRowColors(true);
          resizeColumnsToContents(true);
          setColumnHidden(0, true);
          setHighlightMouseOver(true);
          setSelectionBehavior(Wt::SelectRows);
          setSelectionMode(Wt::SingleSelection);
          setColumnWidth(0, 50);
          setAutoExpandColumn(1);

          itemSelectionChanged().connect(SLOT(this, PresetList::selectionChanged));


          setTopToolBar(new Wt::Ext::ToolBar());
          create_button = topToolBar()->addButton("Create a new Preset");
          create_button->setIcon("icons/add-icon.png");
          topToolBar()->addSeparator();
          edit_button = topToolBar()->addButton("Edit selected Preset");
          edit_button->setIcon("icons/edit-icon.png");
          //topToolBar()->addSeparator();
          //delete_button = topToolBar()->addButton("Delete selected Preset");
          //delete_button->setIcon("icons/encoding-project-remove-icon.png");

          create_button->setEnabled(true);
          edit_button->setEnabled(false);
          //delete_button->setEnabled(false);

          create_button->clicked().connect(SLOT(this, PresetList::createPreset));
          edit_button->clicked().connect(SLOT(this, PresetList::editPreset));
          //delete_button->clicked().connect(SLOT(this, PresetList::deletePreset));

        } else {
          LOGERROR("Preset Directory does not exist! " << presetdir.getPath());
        }
      }
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:50,代码来源:PresetList.cpp

示例6: take

bool FileSystem::take(FileNode* node) {
  pthread_mutex_lock(&fmap_mux);
    int ret = file_map.erase(node->pathname);
  pthread_mutex_unlock(&fmap_mux);

  if (ret == 0) return false;

  FileList* files = &(node->parent->children);
  FileList::iterator it = ::find(files->begin(), files->end(), node);

  if (it != files->end()) {
    files->erase(it);
    return true;
  }
  return false;
}
开发者ID:samekmichal,项目名称:archivefs,代码行数:16,代码来源:filesystem.cpp

示例7: refresh

 void PresetList::refresh() {
   File presetdir(org::esb::config::Config::get("preset.path"));
   if (presetdir.exists()) {
     FileList files = presetdir.listFiles();
     std::list<std::list<std::string> > data;
     FileList::iterator file_it = files.begin();
     for (; file_it != files.end(); file_it++) {
       org::esb::hive::PresetReader reader((*file_it)->getPath());
       LOGDEBUG((*file_it)->getPath());
       std::list<std::string> line;
       line.push_back((*file_it)->getFileName());
       line.push_back(reader.getPreset()["name"]);
       data.push_back(line);
     }
    static_cast<PresetListTableModel*>(model())->setModelData(data);
   }
 }
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:17,代码来源:PresetList.cpp

示例8: remove_recursive

bool FileSystem::remove_recursive(const String &filename)
{
	assert(!filename.empty());

	if (filename.empty())
		return false;
	if (is_file(filename))
		return file_remove(filename);
	if (is_directory(filename))
	{
		FileList files;
		directory_scan(filename, files);
		bool success = true;
		for(FileList::const_iterator i = files.begin(); i != files.end(); ++i)
			if (!remove_recursive(filename + ETL_DIRECTORY_SEPARATOR + *i))
				success = false;
		return success;
	}
	return true;
}
开发者ID:blackwarthog,项目名称:synfig,代码行数:20,代码来源:filesystem.cpp

示例9: GenCheckCodes

void GenCheckCodes( const string& path )
{
	string cur_file;
	string res_path = path.substr(0, path.find("sound"));

	FileList::iterator it	= g_file_list.begin();
	FileList::iterator eit	= g_file_list.end();
	for ( ; it != eit; ++it )
	{	
		cur_file = res_path + *it;
		uint32 file_id = FileName2Id((*it).c_str());
		uint32 crc = 0;
		CCrc32::GetInst()->InitCrc32(crc);

		FILE* fp = 0;
		if ( fopen_s(&fp, cur_file.c_str(), "rb") != 0 )
		{
			cerr << "open " << cur_file << "failed." << endl;
			return;
		}

		fseek(fp, 0, SEEK_END);
		size_t size = ftell(fp);
		fseek(fp, 0, SEEK_SET);
		char* date_buf = new char[size];
		if ( !date_buf )
		{
			cerr << "alloc data buf failed." << endl;
			return;
		}
		fread_s(date_buf, size, size, 1, fp);
		
		CCrc32::GetInst()->MakeCrc32Sub(crc, (uint8*)date_buf, (uint32)size);
		CCrc32::GetInst()->MakeCrc32End(crc);
		g_check_map.insert(make_pair(file_id, crc));

		delete[] date_buf;
		fclose(fp);
	}
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:40,代码来源:GenAudioCheckFile.cpp

示例10: 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());
}
开发者ID:Zedron,项目名称:recastnavigation,代码行数:40,代码来源:Filelist.cpp

示例11: fillItemList

void QuickOpenFunctionDialog::fillItemList() {
    m_items.clear();
    m_functionDefList.clear();
    FileList fileList = m_part->codeModel()->fileList();

    // for each one file, get all functions
    FileDom fileDom;
    for( FileList::Iterator it = fileList.begin() ; it!=fileList.end() ; ++it ){
            fileDom = *it;
            FunctionDefinitionList defs = CodeModelUtils::allFunctionDefinitionsDetailed( fileDom ).functionList;
            if( defs.isEmpty() ) {
              m_functionDefList += CodeModelUtils::allFunctionsDetailed( fileDom ).functionList;
            } else {
              for( FunctionDefinitionList::iterator it = defs.begin(); it != defs.end(); ++it )
                (m_functionDefList).append( (*it).data() );
            }
    }

    for( FunctionList::const_iterator it = m_functionDefList.begin(); it != m_functionDefList.end(); ++it )
      m_items << (*it)->name();
    QStringList_unique( m_items );
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:22,代码来源:quickopenfunctiondialog.cpp

示例12: copy_recursive

bool FileSystem::copy_recursive(Handle from_file_system, const String &from_filename, Handle to_file_system, const String &to_filename)
{
	if (!from_file_system || !to_file_system) return false;
	if (from_file_system->is_file(from_filename))
		return copy(from_file_system, from_filename, to_file_system, to_filename);
	if (from_file_system->is_directory(from_filename))
	{
		if (!to_file_system->directory_create(to_filename))
			return false;
		FileList files;
		bool success = from_file_system->directory_scan(from_filename, files);
		for(FileList::const_iterator i = files.begin(); i != files.end(); ++i)
			if (!copy_recursive(
					from_file_system,
					from_filename + ETL_DIRECTORY_SEPARATOR + *i,
					to_file_system,
					to_filename + ETL_DIRECTORY_SEPARATOR + *i ))
				success = false;
		return success;
	}
	return false;
}
开发者ID:blackwarthog,项目名称:synfig,代码行数:22,代码来源:filesystem.cpp

示例13: CreateFileList

/// Create list of all files in provided folder ending with same postfix
static FileList CreateFileList(std::string folder , std::string postfix)
{
  itk::Directory::Pointer dir = itk::Directory::New();
  FileList fileList;

  if( dir->Load(folder.c_str() ) )
  {
    int n = dir->GetNumberOfFiles();
    for(int r=0;r<n;r++)
    {
      std::string filename = dir->GetFile( r );
      if (filename == "." || filename == "..")
        continue;
      filename = folder + filename;
      if (!itksys::SystemTools::FileExists( filename.c_str()))
        continue;

      if (postfix.compare(filename.substr(filename.length() -postfix.length() )) == 0)
        fileList.push_back(filename);
    }
  }
  std::sort (fileList.begin(), fileList.end());
  return fileList;
}
开发者ID:151706061,项目名称:MITK,代码行数:25,代码来源:TumorProgressionMapping.cpp

示例14: Reset

 Result_t Reset()
 {
   m_FramesRead = 0;
   m_CurrentFile = m_FileList.begin();
   return RESULT_OK;
 }
开发者ID:SeanFarinha,项目名称:opendcp,代码行数:6,代码来源:DCData_Sequence_Parser.cpp

示例15: begin

 gcc_pure
 const_iterator begin() const {
   return files.begin();
 }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:4,代码来源:FileRepository.hpp


注:本文中的FileList::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。