本文整理汇总了C++中FileSet::end方法的典型用法代码示例。如果您正苦于以下问题:C++ FileSet::end方法的具体用法?C++ FileSet::end怎么用?C++ FileSet::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSet
的用法示例。
在下文中一共展示了FileSet::end方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindAll
void MFindDialog::FindAll(
const string& inWhat,
bool inIgnoreCase,
bool inRegex,
MMultiMethod inMethod,
fs::path inDirectory,
bool inRecursive,
bool inTextFilesOnly,
const string& inFileNameFilter)
{
mStopFindAll = false;
try
{
FileSet files;
auto_ptr<MMessageList> list(new MMessageList);
GetFilesForFindAll(inMethod, inDirectory,
inRecursive, inTextFilesOnly, inFileNameFilter, files);
for (FileSet::iterator file = files.begin(); file != files.end(); ++file)
{
if (mStopFindAll)
break;
SetStatusString(file->string());
MUrl url(*file);
bool searched = false;
gdk_threads_enter();
MTextDocument* doc = dynamic_cast<MTextDocument*>(MDocument::GetDocumentForURL(url));
if (doc != nil)
{
doc->FindAll(inWhat, inIgnoreCase, inRegex, false, *list.get());
searched = true;
}
gdk_threads_leave();
if (not searched)
MTextDocument::FindAll(*file, inWhat, inIgnoreCase, inRegex, false, *list.get());
}
mFindAllResult = list.release();
}
catch (exception& e)
{
mFindAllResult = new MMessageList; // flag failure... sucks.. I know
mFindAllResult->AddMessage(kMsgKindError, fs::path(), 0, 0, 0, "Error in find all, sorry");
mFindAllResult->AddMessage(kMsgKindError, fs::path(), 0, 0, 0, e.what());
}
catch (...)
{
mFindAllResult = new MMessageList; // flag failure... sucks.. I know
mFindAllResult->AddMessage(kMsgKindError, fs::path(), 0, 0, 0, "Error in find all, sorry");
}
}
示例2:
bool
PathHandler::_HasFile(const node_ref& nodeRef) const
{
FileEntry setEntry;
setEntry.ref.device = nodeRef.device;
setEntry.node = nodeRef.node;
// name does not need to be set, since it's not used for comparing
FileSet::const_iterator iterator = fFiles.find(setEntry);
return iterator != fFiles.end();
}
示例3: update
void
PathHandler::_NotifyTarget(BMessage* message, const node_ref& nodeRef) const
{
BMessage update(*message);
update.what = B_PATH_MONITOR;
TRACE("_NotifyTarget(): node ref %ld.%Ld\n", nodeRef.device, nodeRef.node);
WatchedDirectory directory;
directory.node = nodeRef;
DirectorySet::const_iterator iterator = fDirectories.find(directory);
if (iterator != fDirectories.end()) {
if (_WatchFilesOnly()) {
// stat or attr notification for a directory
return;
}
BDirectory nodeDirectory(&nodeRef);
BEntry entry;
if (nodeDirectory.GetEntry(&entry) == B_OK) {
BPath path(&entry);
update.AddString("path", path.Path());
}
} else {
if (_WatchFoldersOnly()) {
// this is bound to be a notification for a file
return;
}
FileEntry setEntry;
setEntry.ref.device = nodeRef.device;
setEntry.node = nodeRef.node;
// name does not need to be set, since it's not used for comparing
FileSet::const_iterator i = fFiles.find(setEntry);
if (i != fFiles.end()) {
BPath path(&(i->ref));
update.AddString("path", path.Path());
}
}
// This is in case the target is interested in figuring out which
// BPathMonitor::StartWatching() call the message is resulting from.
update.AddString("watched_path", fPath.Path());
fTarget.SendMessage(&update);
}
示例4: directoryChanged
void LocalProcess::directoryChanged(const QString &str)
{
FileSet fs = dirFiles(openstudio::toQString(m_outdir));
std::vector<FileSet::value_type> diff;
{
QMutexLocker l(&m_mutex);
std::set_symmetric_difference(fs.begin(), fs.end(),
m_outfiles.begin(), m_outfiles.end(),
std::back_inserter(diff));
m_outfiles = fs;
}
std::for_each(diff.begin(), diff.end(), boost::bind(&LocalProcess::emitUpdatedFileInfo, this, _1));
m_process.checkProcessStatus();
}
示例5: DoFindCommand
void MFindDialog::DoFindCommand(
uint32 inCommand)
{
// check regular expression first?
if (mMultiMode and IsChecked(kBatchCheckboxID) and mFindAllThread != nil)
{
PlaySound("warning");
return;
}
mInSelection = IsChecked(kInSelectionCheckboxID);
string what;
GetText(kFindComboboxID, what);
StoreComboText(kFindComboboxID, what, mFindStrings);
string with;
GetText(kReplaceComboboxID, with);
StoreComboText(kReplaceComboboxID, with, mReplaceStrings);
string where;
GetText(kStartDirComboboxID, where);
StoreComboText(kStartDirComboboxID, where, mStartDirectories);
MTextDocument* doc = MTextDocument::GetFirstTextDocument();
if (IsExpanded(kMultiFileExpanderID))
{
fs::path dir;
bool recursive, textFilesOnly;
string filter;
MMultiMethod method = eMMDirectory;
recursive = IsChecked(kRecursiveCheckboxID);
textFilesOnly = IsChecked(kTextFilesOnlyCheckboxID);
if (IsChecked(kEnableFilterCheckboxID))
GetText(kNameFilterEditboxID, filter);
switch (GetValue(kMethodPopupID))
{
case kMethodDirectory:
{
dir = where;
if (not exists(dir) or not is_directory(dir))
THROW(("Start directory does not exist or is not a directory"));
method = eMMDirectory;
break;
}
case kMethodIncludeFiles:
method = eMMIncludes;
break;
case kMethodOpenWindows:
method = eMMOpenWindows;
break;
}
if (IsChecked(kBatchCheckboxID))
{
mFindAllThread = new boost::thread(
boost::bind(&MFindDialog::FindAll, this, what,
IsChecked(kIgnoreCaseCheckboxID),
IsChecked(kRegexCheckboxID),
method, dir, recursive, textFilesOnly, filter));
}
else
{
mMultiFiles.clear();
FileSet files;
GetFilesForFindAll(method, dir,
recursive, textFilesOnly, filter, files);
copy(files.begin(), files.end(), back_inserter(mMultiFiles));
switch (inCommand)
{
case cmd_FindNext:
FindNext();
break;
case cmd_ReplaceAll:
switch (DisplayAlert("replace-all-alert"))
{
case kReplaceAll_Save:
ReplaceAll(true);
break;
case kReplaceAll_LeaveOpen:
ReplaceAll(false);
break;
}
break;
}
//.........这里部分代码省略.........
示例6: dirFiles
LocalProcess::FileSet LocalProcess::dirFiles(const QString &dir) const
{
QFileInfoList fil;
QDir subdirs(dir, "mergedjob-*", QDir::Name, QDir::Dirs);
QFileInfoList mergedjobdirs = subdirs.entryInfoList();
for (QFileInfoList::const_iterator itr = mergedjobdirs.begin();
itr != mergedjobdirs.end();
++itr)
{
QDir mergeddir(itr->absoluteFilePath(), "", QDir::Name, QDir::Files);
fil.append(mergeddir.entryInfoList());
}
QDir d(dir, "", QDir::Name, QDir::Files);
fil.append(d.entryInfoList());
QFileInfoList filtered;
// Filter out all files that are part of the set of input files. Everything remaining should be an outputfile
for (QFileInfoList::const_iterator itr = fil.begin();
itr != fil.end();
++itr)
{
bool partofinput = false;
for (std::vector<std::pair<openstudio::path, openstudio::path> >::const_iterator itr2 = m_requiredFiles.begin();
itr2 != m_requiredFiles.end();
++itr2)
{
QString fileName = itr->fileName();
QString fileName2 = toQString(itr2->second.filename());
if (fileName == fileName2)
{
partofinput = true;
break;
}
}
if (!partofinput)
{
filtered.push_back(*itr);
}
}
FileSet out;
typedef FileInfo (*filetransform)(QFileInfo);
try{
std::transform(filtered.begin(), filtered.end(), std::inserter(out, out.end()),
static_cast<filetransform>(&RunManager_Util::dirFile));
} catch(openstudio::Exception& e) {
LOG_AND_THROW("Exception caught " << e.what());
}
return out;
}