本文整理汇总了C++中CDirectoryCache::Lookup方法的典型用法代码示例。如果您正苦于以下问题:C++ CDirectoryCache::Lookup方法的具体用法?C++ CDirectoryCache::Lookup怎么用?C++ CDirectoryCache::Lookup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDirectoryCache
的用法示例。
在下文中一共展示了CDirectoryCache::Lookup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: List
int CFileZillaEnginePrivate::List(const CListCommand &command)
{
if (!IsConnected())
return FZ_REPLY_NOTCONNECTED;
if (command.GetPath().IsEmpty() && command.GetSubDir() != _T(""))
return FZ_REPLY_SYNTAXERROR;
if (command.GetFlags() & LIST_FLAG_LINK && command.GetSubDir() == _T(""))
return FZ_REPLY_SYNTAXERROR;
bool refresh = (command.GetFlags() & LIST_FLAG_REFRESH) != 0;
bool avoid = (command.GetFlags() & LIST_FLAG_AVOID) != 0;
if (refresh && avoid)
return FZ_REPLY_SYNTAXERROR;
if (!refresh && !command.GetPath().IsEmpty())
{
const CServer* pServer = m_pControlSocket->GetCurrentServer();
if (pServer)
{
CServerPath path(CPathCache::Lookup(*pServer, command.GetPath(), command.GetSubDir()));
if (path.IsEmpty() && command.GetSubDir().IsEmpty())
path = command.GetPath();
if (!path.IsEmpty())
{
CDirectoryListing *pListing = new CDirectoryListing;
CDirectoryCache cache;
bool is_outdated = false;
bool found = cache.Lookup(*pListing, *pServer, path, true, is_outdated);
if (found && !is_outdated)
{
if (pListing->m_hasUnsureEntries)
refresh = true;
else
{
if (!avoid)
{
m_lastListDir = pListing->path;
m_lastListTime = wxDateTime::Now();
CDirectoryListingNotification *pNotification = new CDirectoryListingNotification(pListing->path);
AddNotification(pNotification);
}
delete pListing;
return FZ_REPLY_OK;
}
}
if (is_outdated)
refresh = true;
delete pListing;
}
}
}
if (IsBusy())
return FZ_REPLY_BUSY;
m_pCurrentCommand = command.Clone();
return m_pControlSocket->List(command.GetPath(), command.GetSubDir(), command.GetFlags());
}
示例2: CacheLookup
int CFileZillaEngine::CacheLookup(const CServerPath& path, CDirectoryListing& listing)
{
if (!IsConnected())
return FZ_REPLY_ERROR;
wxASSERT(m_pControlSocket->GetCurrentServer());
CDirectoryCache cache;
bool is_outdated = false;
if (!cache.Lookup(listing, *m_pControlSocket->GetCurrentServer(), path, true, is_outdated))
return FZ_REPLY_ERROR;
return FZ_REPLY_OK;
}
示例3: List
int CFileZillaApi::List(const CServerPath& parent, CString dirname, int nListMode /*=FZ_LIST_USECACHE*/)
{
//Check if call allowed
if (!m_bInitialized)
return FZ_REPLY_NOTINITIALIZED;
if (IsConnected()==FZ_REPLY_NOTCONNECTED)
return FZ_REPLY_NOTCONNECTED;
#ifndef MPEXT_NO_CACHE
if ( (nListMode&(FZ_LIST_FORCECACHE|FZ_LIST_REALCHANGE))==(FZ_LIST_FORCECACHE|FZ_LIST_REALCHANGE) )
return FZ_REPLY_INVALIDPARAM;
if (nListMode&FZ_LIST_FORCECACHE)
nListMode|=FZ_LIST_USECACHE;
#endif
if (dirname==_MPT("") || parent.IsEmpty())
return FZ_REPLY_INVALIDPARAM;
#ifndef MPEXT_NO_CACHE
//Check if current dir is cached
if (nListMode&FZ_LIST_USECACHE && !(nListMode&FZ_LIST_REALCHANGE))
{
t_server server;
BOOL res=m_pMainThread->GetCurrentServer(server);
if (res)
{
t_directory *directory=new t_directory;
CDirectoryCache cache;
res=cache.Lookup(parent,dirname,server,*directory);
if (res)
{
BOOL bExact=TRUE;
if (nListMode & FZ_LIST_EXACT)
for (int i=0;i<directory->num;i++)
if (directory->direntry[i].bUnsure || (directory->direntry[i].size==-1 && !directory->direntry[i].dir))
{
bExact=FALSE;
break;
}
if (bExact)
{
m_pMainThread->SetWorkingDir(directory);
delete directory;
return FZ_REPLY_OK;
}
}
delete directory;
}
}
#endif
if (m_pMainThread->IsBusy())
return FZ_REPLY_BUSY;
#ifndef MPEXT_NO_CACHE
if (nListMode&FZ_LIST_FORCECACHE)
return FZ_REPLY_ERROR;
#endif
t_command command;
command.id=FZ_COMMAND_LIST;
command.path=parent;
command.param1=dirname;
command.param4=nListMode;
m_pMainThread->Command(command);
if (m_hOwnerWnd)
return FZ_REPLY_WOULDBLOCK;
else
return m_pMainThread->LastOperationSuccessful()?FZ_REPLY_OK:FZ_REPLY_ERROR;
}