本文整理汇总了C++中wxFileSystemWatcherEvent类的典型用法代码示例。如果您正苦于以下问题:C++ wxFileSystemWatcherEvent类的具体用法?C++ wxFileSystemWatcherEvent怎么用?C++ wxFileSystemWatcherEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxFileSystemWatcherEvent类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: OnFileSystemEvent
virtual void OnFileSystemEvent(wxFileSystemWatcherEvent& evt)
{
wxLogDebug("--- %s ---", evt.ToString());
m_lastEvent = wxDynamicCast(evt.Clone(), wxFileSystemWatcherEvent);
m_events.Add(m_lastEvent);
// test finished
SendIdle();
tested = true;
}
开发者ID:hazeeq090576,项目名称:wxWidgets,代码行数:10,代码来源:fswatchertest.cpp
示例2: CheckResult
virtual void CheckResult()
{
CPPUNIT_ASSERT_MESSAGE( "No events received", !m_events.empty() );
const wxFileSystemWatcherEvent * const e = m_events.front();
// this is our "reference event"
const wxFileSystemWatcherEvent expected = ExpectedEvent();
CPPUNIT_ASSERT_EQUAL( expected.GetChangeType(), e->GetChangeType() );
CPPUNIT_ASSERT_EQUAL((int)wxEVT_FSWATCHER, e->GetEventType());
// XXX this needs change
CPPUNIT_ASSERT_EQUAL(wxEVT_CATEGORY_UNKNOWN, e->GetEventCategory());
CPPUNIT_ASSERT_EQUAL(expected.GetPath(), e->GetPath());
CPPUNIT_ASSERT_EQUAL(expected.GetNewPath(), e->GetNewPath());
// Under MSW extra modification events are sometimes reported after a
// rename and we just can't get rid of them, so ignore them in this
// test if they do happen.
if ( e->GetChangeType() == wxFSW_EVENT_RENAME &&
m_events.size() == 2 )
{
const wxFileSystemWatcherEvent* const e2 = m_events.back();
if ( e2->GetChangeType() == wxFSW_EVENT_MODIFY &&
e2->GetPath() == e->GetNewPath() )
{
// This is a modify event for the new file, ignore it.
return;
}
}
WX_ASSERT_EQUAL_MESSAGE
(
(
"Extra events received, last one is of type %x, path=\"%s\" "
"(the original event was for \"%s\" (\"%s\")",
m_events.back()->GetChangeType(),
m_events.back()->GetPath().GetFullPath(),
e->GetPath().GetFullPath(),
e->GetNewPath().GetFullPath()
),
1, m_events.size()
);
}
开发者ID:hazeeq090576,项目名称:wxWidgets,代码行数:48,代码来源:fswatchertest.cpp
示例3: OnChange
void SigUIFrame::OnChange(wxFileSystemWatcherEvent &event)
{
if (event.IsError()) {
wxLogVerbose("fswatcher error: %s", event.GetErrorDescription());
return;
}
wxLogVerbose("event on %s", event.GetPath().GetFullPath());
switch (event.GetChangeType()) {
default:
break;
case wxFSW_EVENT_CREATE:
case wxFSW_EVENT_MODIFY:
wxFileName filename = event.GetPath();
if (filename.GetName() != "lastupd")
return;
show_db(false);
break;
}
}
开发者ID:LZ-SecurityTeam,项目名称:clamav-devel,代码行数:19,代码来源:SigUIMain.cpp
示例4: wxFileSystemWatcher
void t4p::FileListingClass::OnFsWatcher(wxFileSystemWatcherEvent& event) {
wxFileName modFile = event.GetNewPath();
if (modFile.GetPathWithSep() != WorkingDir.GetPathWithSep()) {
// event from directory we are not showing
return;
}
if (event.GetChangeType() == wxFSW_EVENT_WARNING && event.GetWarningType() == wxFSW_WARNING_OVERFLOW) {
// restart the watch
delete Watcher;
Watcher = new wxFileSystemWatcher();
Watcher->SetOwner(this);
Watcher->Add(WorkingDir, wxFSW_EVENT_CREATE | wxFSW_EVENT_DELETE | wxFSW_EVENT_RENAME | wxFSW_EVENT_WARNING | wxFSW_EVENT_ERROR);
} else if (event.GetChangeType() == wxFSW_EVENT_ERROR) {
// restart the watch
delete Watcher;
Watcher = new wxFileSystemWatcher();
Watcher->SetOwner(this);
Watcher->Add(WorkingDir, wxFSW_EVENT_CREATE | wxFSW_EVENT_DELETE | wxFSW_EVENT_RENAME | wxFSW_EVENT_WARNING | wxFSW_EVENT_ERROR);
} else if (event.GetChangeType() == wxFSW_EVENT_CREATE
|| event.GetChangeType() == wxFSW_EVENT_DELETE
|| event.GetChangeType() == wxFSW_EVENT_RENAME) {
// naive implementation for now, just refresh the entire dir
// this is because we have labels to update, and the
// items must be kept sorted (first dirs, then files)
// each sorted, AND taking the filters into account
wxPostEvent(&Handler, event);
}
}
开发者ID:62BRAINS,项目名称:triumph4php,代码行数:28,代码来源:ExplorerFeatureClass.cpp
示例5: if
void t4p::FileWatcherFeatureClass::OnFsWatcher(wxFileSystemWatcherEvent& event) {
LastWatcherEventTime = wxDateTime::Now();
wxString path = event.GetPath().GetFullPath();
wxFileName fileName = event.GetPath();
if (wxFSW_EVENT_MODIFY == event.GetChangeType()) {
PathsExternallyModified[path] = 1;
} else if (wxFSW_EVENT_CREATE == event.GetChangeType()) {
PathsExternallyCreated[path] = 1;
} else if (wxFSW_EVENT_DELETE == event.GetChangeType()) {
PathsExternallyDeleted[path] = 1;
} else if (wxFSW_EVENT_RENAME == event.GetChangeType()) {
PathsExternallyRenamed[path] = event.GetNewPath().GetFullPath();
} else if (wxFSW_EVENT_WARNING == event.GetChangeType()) {
// too many files being added/removed
// this is probably a big directory being added / removed
// hopefully the root directory is caught
} else if (wxFSW_EVENT_ERROR == event.GetChangeType()) {
// in MSW, an error event could be due to the watched directoty being deleted / renamed.
// in this case, we need to restart the watch
IsWatchError = true;
wxASSERT_MSG(false, event.GetErrorDescription());
}
}
开发者ID:62BRAINS,项目名称:triumph4php,代码行数:23,代码来源:FileWatcherFeatureClass.cpp
示例6: SendEvent
void wxIOCPThread::SendEvent(wxFileSystemWatcherEvent& evt)
{
wxLogTrace(wxTRACE_FSWATCHER, "[iocp] EVT: %s", evt.ToString());
m_service->SendEvent(evt);
}
开发者ID:Richard-Ni,项目名称:wxWidgets,代码行数:5,代码来源:fswatcher.cpp
示例7: SendEvent
void SendEvent(wxFileSystemWatcherEvent& evt)
{
wxLogTrace(wxTRACE_FSWATCHER, evt.ToString());
m_watcher->GetOwner()->ProcessEvent(evt);
}
开发者ID:BloodRedd,项目名称:gamekit,代码行数:5,代码来源:fswatcher_inotify.cpp
示例8: OnFileSystemChange
void ReplayProvider::OnFileSystemChange(wxFileSystemWatcherEvent& event)
{
wxLogDebug(event.ToString());
if (!event.GetPath().GetExt().IsSameAs("replay", false))
return;
if (event.GetChangeType() & wxFSW_EVENT_CREATE)
{
Replay* existingReplay = FindReplay(event.GetPath().GetFullPath());
if (existingReplay) // Replay is already in list
return;
// Give rocket league some time to write the file
wxMilliSleep(500);
// Add new file
Replay::Ptr ri(new Replay(event.GetPath().GetFullPath()));
replay.push_back(ri);
if (wxConfig::Get()->ReadBool("AutoUpload", false))
{
TransferManager::Get().Upload(ri);
}
wxCommandEvent evt(wxEVT_REPLAY_ADDED);
evt.SetInt(replay.size() - 1);
evt.SetEventObject(this);
GetRoot()->ProcessEvent(evt);
}
else if (event.GetChangeType() & wxFSW_EVENT_DELETE)
{
// Find replay and remove it
size_t index = 0;
wxString changePath = event.GetPath().GetFullPath();
for (auto replayIT = replay.begin(); replayIT != replay.end(); ++replayIT, ++index)
{
if ((*replayIT)->GetFileName().IsSameAs(changePath, false))
{
replay.erase(replayIT);
break;
}
}
wxCommandEvent evt(wxEVT_REPLAY_REMOVED);
evt.SetInt(index);
evt.SetEventObject(this);
GetRoot()->ProcessEvent(evt);
}
else if (event.GetChangeType() & wxFSW_EVENT_RENAME)
{
wxString changePath = event.GetPath().GetFullPath();
// Find replay and update filename
for (auto replayIT = replay.begin(); replayIT != replay.end(); ++replayIT)
{
if ((*replayIT)->GetFileName().IsSameAs(changePath, false))
{
(*replayIT)->SetFileName(event.GetNewPath().GetFullPath());
break;
}
}
}
event.Skip();
}
开发者ID:TcT2k,项目名称:RLReplayManager,代码行数:66,代码来源:ReplayProvider.cpp
示例9: OnFileSystemEvent
void wxGxDiscConnection::OnFileSystemEvent(wxFileSystemWatcherEvent& event)
{
wxLogDebug(wxT("*** %s ***"), event.ToString().c_str());
switch(event.GetChangeType())
{
case wxFSW_EVENT_CREATE:
{
//get object parent
wxFileName oName = event.GetPath();
wxGxObjectContainer *parent = wxDynamicCast(FindGxObjectByPath(oName.GetPath()), wxGxObjectContainer);
if(!parent)
return;
//check doubles
if(parent->IsNameExist(event.GetPath().GetFullName()))
return;
CPLString szPath(event.GetPath().GetFullPath().mb_str(wxConvUTF8));
char **papszFileList = NULL;
papszFileList = CSLAddString( papszFileList, szPath );
if(m_pCatalog)
{
wxArrayLong ChildrenIds;
m_pCatalog->CreateChildren(parent, papszFileList, ChildrenIds);
for(size_t i = 0; i < ChildrenIds.GetCount(); ++i)
m_pCatalog->ObjectAdded(ChildrenIds[i]);
}
CSLDestroy( papszFileList );
}
break;
case wxFSW_EVENT_DELETE:
{
//search gxobject
wxGxObject *current = FindGxObjectByPath(event.GetPath().GetFullPath());
if(current)
{
current->Destroy();
return;
}
}
break;
case wxFSW_EVENT_RENAME:
{
wxGxObject *current = FindGxObjectByPath(event.GetPath().GetFullPath());
if(current)
{
current->SetName(event.GetNewPath().GetFullName());
current->SetPath( CPLString( event.GetNewPath().GetFullPath().mb_str(wxConvUTF8) ) );
wxGIS_GXCATALOG_EVENT_ID(ObjectChanged, current->GetId());
#ifdef __WXGTK__
m_pWatcher->Remove(event.GetPath());
if(!IsPathWatched(event.GetNewPath().GetFullPath()))
{
m_pWatcher->Add(event.GetNewPath());
}
#endif
return;
}
}
break;
case wxFSW_EVENT_MODIFY:
break;
default:
case wxFSW_EVENT_ACCESS:
case wxFSW_EVENT_WARNING:
case wxFSW_EVENT_ERROR:
break;
};
}
开发者ID:Mileslee,项目名称:wxgis,代码行数:70,代码来源:gxdiscconnection.cpp
注:本文中的wxFileSystemWatcherEvent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论