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


C++ CDir::SetLastAccess方法代码示例

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


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

示例1: FileExists

bool CDirectoryCache::FileExists(const CStdString& strFile, bool& bInCache)
{
  CSingleLock lock (m_cs);
  bInCache = false;

  CStdString strPath;
  URIUtils::GetDirectory(strFile, strPath);
  URIUtils::RemoveSlashAtEnd(strPath);

  ciCache i = m_cache.find(strPath);
  if (i != m_cache.end())
  {
    bInCache = true;
    CDir *dir = i->second;
    dir->SetLastAccess(m_accessCounter);
#ifdef _DEBUG
    m_cacheHits++;
#endif
    return dir->m_Items->Contains(strFile);
  }
#ifdef _DEBUG
  m_cacheMisses++;
#endif
  return false;
}
开发者ID:A600,项目名称:xbmc,代码行数:25,代码来源:DirectoryCache.cpp

示例2: SetDirectory

void CDirectoryCache::SetDirectory(const CStdString& strPath, const CFileItemList &items, DIR_CACHE_TYPE cacheType)
{
  if (cacheType == DIR_CACHE_NEVER)
    return; // nothing to do

  // caches the given directory using a copy of the items, rather than the items
  // themselves.  The reason we do this is because there is often some further
  // processing on the items (stacking, transparent rars/zips for instance) that
  // alters the URL of the items.  If we shared the pointers, we'd have problems
  // as the URLs in the cache would have changed, so things such as
  // CDirectoryCache::FileExists() would fail for files that really do exist (just their
  // URL's have been altered).  This is called from CFile::Exists() which causes
  // all sorts of hassles.
  // IDEALLY, any further processing on the item would actually create a new item
  // instead of altering it, but we can't really enforce that in an easy way, so
  // this is the best solution for now.
  CSingleLock lock (m_cs);

  CStdString storedPath = URIUtils::SubstitutePath(strPath);
  URIUtils::RemoveSlashAtEnd(storedPath);

  ClearDirectory(storedPath);

  CheckIfFull();

  CDir* dir = new CDir(cacheType);
  dir->m_Items->Copy(items);
  dir->SetLastAccess(m_accessCounter);
  m_cache.insert(pair<CStdString, CDir*>(storedPath, dir));
}
开发者ID:A600,项目名称:xbmc,代码行数:30,代码来源:DirectoryCache.cpp

示例3: GetDirectory

bool CDirectoryCache::GetDirectory(const std::string& strPath, CFileItemList &items, bool retrieveAll)
{
  CSingleLock lock (m_cs);

  // Get rid of any URL options, else the compare may be wrong
  std::string storedPath = CURL(strPath).GetWithoutOptions();
  URIUtils::RemoveSlashAtEnd(storedPath);

  ciCache i = m_cache.find(storedPath);
  if (i != m_cache.end())
  {
    CDir* dir = i->second;
    if (dir->m_cacheType == XFILE::DIR_CACHE_ALWAYS ||
       (dir->m_cacheType == XFILE::DIR_CACHE_ONCE && retrieveAll))
    {
      items.Copy(*dir->m_Items);
      dir->SetLastAccess(m_accessCounter);
#ifdef _DEBUG
      m_cacheHits+=items.Size();
#endif
      return true;
    }
  }
  return false;
}
开发者ID:Arcko,项目名称:xbmc,代码行数:25,代码来源:DirectoryCache.cpp

示例4: FileExists

bool CDirectoryCache::FileExists(const std::string& strFile, bool& bInCache)
{
  CSingleLock lock (m_cs);
  bInCache = false;

  // Get rid of any URL options, else the compare may be wrong
  std::string strPath = CURL(strFile).GetWithoutOptions();
  URIUtils::RemoveSlashAtEnd(strPath);
  std::string storedPath = URIUtils::GetDirectory(strPath);
  URIUtils::RemoveSlashAtEnd(storedPath);

  ciCache i = m_cache.find(storedPath);
  if (i != m_cache.end())
  {
    bInCache = true;
    CDir *dir = i->second;
    dir->SetLastAccess(m_accessCounter);
#ifdef _DEBUG
    m_cacheHits++;
#endif
    return (URIUtils::PathEquals(strPath, storedPath) || dir->m_Items->Contains(strFile));
  }
#ifdef _DEBUG
  m_cacheMisses++;
#endif
  return false;
}
开发者ID:Arcko,项目名称:xbmc,代码行数:27,代码来源:DirectoryCache.cpp

示例5: AddFile

void CDirectoryCache::AddFile(const std::string& strFile)
{
  CSingleLock lock (m_cs);

  std::string strPath = URIUtils::GetDirectory(strFile);
  URIUtils::RemoveSlashAtEnd(strPath);

  ciCache i = m_cache.find(strPath);
  if (i != m_cache.end())
  {
    CDir *dir = i->second;
    CFileItemPtr item(new CFileItem(strFile, false));
    dir->m_Items->Add(item);
    dir->SetLastAccess(m_accessCounter);
  }
}
开发者ID:7orlum,项目名称:xbmc,代码行数:16,代码来源:DirectoryCache.cpp

示例6: AddFile

void CDirectoryCache::AddFile(const std::string& strFile)
{
  CSingleLock lock (m_cs);

  // Get rid of any URL options, else the compare may be wrong
  std::string strPath = URIUtils::GetDirectory(CURL(strFile).GetWithoutOptions());
  URIUtils::RemoveSlashAtEnd(strPath);

  ciCache i = m_cache.find(strPath);
  if (i != m_cache.end())
  {
    CDir *dir = i->second;
    CFileItemPtr item(new CFileItem(strFile, false));
    dir->m_Items->Add(item);
    dir->SetLastAccess(m_accessCounter);
  }
}
开发者ID:Arcko,项目名称:xbmc,代码行数:17,代码来源:DirectoryCache.cpp

示例7: GetDirectory

bool CDirectoryCache::GetDirectory(const CStdString& strPath, CFileItemList &items, bool retrieveAll)
{
  CSingleLock lock (m_cs);

  CStdString storedPath = URIUtils::SubstitutePath(strPath);
  URIUtils::RemoveSlashAtEnd(storedPath);

  ciCache i = m_cache.find(storedPath);
  if (i != m_cache.end())
  {
    CDir* dir = i->second;
    if (dir->m_cacheType == XFILE::DIR_CACHE_ALWAYS ||
       (dir->m_cacheType == XFILE::DIR_CACHE_ONCE && retrieveAll))
    {
      items.Copy(*dir->m_Items);
      dir->SetLastAccess(m_accessCounter);
#ifdef _DEBUG
      m_cacheHits+=items.Size();
#endif
      return true;
    }
  }
  return false;
}
开发者ID:A600,项目名称:xbmc,代码行数:24,代码来源:DirectoryCache.cpp


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