本文整理汇总了C++中FileList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ FileList::end方法的具体用法?C++ FileList::end怎么用?C++ FileList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileList
的用法示例。
在下文中一共展示了FileList::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
}
示例4: 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());
}
}
示例5: 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;
}
}
示例6: 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());
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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());
}
示例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 );
}
示例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;
}
示例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;
}
示例14: main
int main( int argc, char *argv[] ) {
bool bHelp = false;
bool bError = false;
bool bDouble = false;
std::string RefName, OutName;
File *RefFile = 0;
FileList files;
uint64_t n;
//double dValue;
//! Parse command line arguments (flags).
for (;;) {
int c, option_index=0;
static struct option long_options[] = {
{ "help", 0, 0, OPT_HELP },
{ "reference", 1, 0, OPT_REFERENCE },
{ "output", 1, 0, OPT_OUTPUT },
{ "double", 0, 0, OPT_DOUBLE },
{ 0, 0, 0, 0 }
};
c = getopt_long( argc, argv, "hr:o:d",
long_options, &option_index );
if ( c == -1 ) break;
switch (c) {
case OPT_HELP:
bHelp = true;
break;
case OPT_REFERENCE:
assert(optarg !=NULL);
RefName = optarg;
break;
case OPT_OUTPUT:
assert(optarg !=NULL);
OutName = optarg;
break;
case OPT_DOUBLE:
bDouble = true;
break;
default:
bError = true;
}
}
if ( bError ) return 1;
if ( !RefName.empty() ) {
std::cout << "Opening " << RefName << std::endl;
RefFile = new File( RefName, H5F_ACC_RDONLY );
RefFile->readClasses();
}
// Open all MDL I/O files
files.reserve( argc-optind );
while ( optind < argc ) {
std::cout << "Opening " << argv[optind] << std::endl;
files.push_back(
new File(argv[optind++],
RefName.empty() ? H5F_ACC_RDONLY : H5F_ACC_RDWR));
}
// Put the files in iOrder order.
std::for_each(files.begin(), files.end(), File::doReadClasses());
std::sort(files.begin(),files.end(), File::compStart());
// Check that there are no gaps and determine the totals
std::for_each(files.begin(), files.end(), File::doAddStart(n));
std::cout << "We have a total of " << n << " dark particles" << std::endl;
// Now fix the tables if we have a reference file
if ( RefFile ) {
std::for_each(files.begin(), files.end(), File::doFixClasses(RefFile));
std::for_each(files.begin(), files.end(), File::doWriteClasses());
}
if ( !OutName.empty() ) {
std::cout << "Creating " << OutName << std::endl;
File OutFile( OutName, H5F_ACC_TRUNC );
OutFile.create(n,false);
OutFile.copyAttributes(files.front());
std::for_each(files.begin(), files.end(), File::doMergeClasses(OutFile));
OutFile.writeClasses();
std::for_each(files.begin(), files.end(), File::doCopyData(OutFile));
}
}
示例15: end
gcc_pure
const_iterator end() const {
return files.end();
}