本文整理汇总了C++中CFileItemList::GetCacheToDisc方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileItemList::GetCacheToDisc方法的具体用法?C++ CFileItemList::GetCacheToDisc怎么用?C++ CFileItemList::GetCacheToDisc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileItemList
的用法示例。
在下文中一共展示了CFileItemList::GetCacheToDisc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SortItems
// \brief Sorts Fileitems based on the sort method and sort oder provided by guiViewState
void CGUIMediaWindow::SortItems(CFileItemList &items)
{
auto_ptr<CGUIViewState> guiState(CGUIViewState::GetViewState(GetID(), items));
if (guiState.get())
{
items.Sort(guiState->GetSortMethod(), guiState->GetDisplaySortOrder());
// Should these items be saved to the hdd
if (items.GetCacheToDisc())
items.Save();
}
}
示例2: GetDirectory
/*!
\brief Overwrite to fill fileitems from a source
\param strDirectory Path to read
\param items Fill with items specified in \e strDirectory
*/
bool CGUIMediaWindow::GetDirectory(const CStdString &strDirectory, CFileItemList &items)
{
// cleanup items
if (items.Size())
items.Clear();
CStdString strParentPath=m_history.GetParentPath();
CLog::Log(LOGDEBUG,"CGUIMediaWindow::GetDirectory (%s)", strDirectory.c_str());
CLog::Log(LOGDEBUG," ParentPath = [%s]", strParentPath.c_str());
if (m_guiState.get() && !m_guiState->HideParentDirItems())
{
CFileItem *pItem = new CFileItem("..");
pItem->m_strPath = strParentPath;
pItem->m_bIsFolder = true;
pItem->m_bIsShareOrDrive = false;
items.Add(pItem);
}
// see if we can load a previously cached folder
CFileItemList cachedItems(strDirectory);
if (!strDirectory.IsEmpty() && cachedItems.Load())
{
items.AssignPointer(cachedItems, true); // true to keep any previous items (".." item)
cachedItems.ClearKeepPointer();
}
else
{
DWORD time = timeGetTime();
if (!m_rootDir.GetDirectory(strDirectory, items))
return false;
// took over a second, and not normally cached, so cache it
if (time + 1000 < timeGetTime() && !items.GetCacheToDisc())
items.Save();
// if these items should replace the current listing, then pop it off the top
if (items.GetReplaceListing())
m_history.RemoveParentPath();
}
return true;
}