Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

CFileItem: extend Copy() with an optional "copyItems" parameter (true…

… by default) to be able to only copy the properties of a list without the items
  • Loading branch information...
commit 60592607838c528cdb1e574dd4d10258bcb4ce72 1 parent 9e7255f
Sascha Montellese Montellese authored
Showing with 9 additions and 6 deletions.
  1. +8 −5 xbmc/FileItem.cpp
  2. +1 −1  xbmc/FileItem.h
13 xbmc/FileItem.cpp
View
@@ -1721,7 +1721,7 @@ void CFileItemList::Assign(const CFileItemList& itemlist, bool append)
m_cacheToDisc = itemlist.m_cacheToDisc;
}
-bool CFileItemList::Copy(const CFileItemList& items)
+bool CFileItemList::Copy(const CFileItemList& items, bool copyItems /* = true */)
{
// assign all CFileItem parts
*(CFileItem*)this = *(CFileItem*)&items;
@@ -1736,11 +1736,14 @@ bool CFileItemList::Copy(const CFileItemList& items)
m_sortOrder = items.m_sortOrder;
m_sortIgnoreFolders = items.m_sortIgnoreFolders;
- // make a copy of each item
- for (int i = 0; i < items.Size(); i++)
+ if (copyItems)
{
- CFileItemPtr newItem(new CFileItem(*items[i]));
- Add(newItem);
+ // make a copy of each item
+ for (int i = 0; i < items.Size(); i++)
+ {
+ CFileItemPtr newItem(new CFileItem(*items[i]));
+ Add(newItem);
+ }
}
return true;
2  xbmc/FileItem.h
View
@@ -475,7 +475,7 @@ class CFileItemList : public CFileItem
bool IsEmpty() const;
void Append(const CFileItemList& itemlist);
void Assign(const CFileItemList& itemlist, bool append = false);
- bool Copy (const CFileItemList& item);
+ bool Copy (const CFileItemList& item, bool copyItems = true);
void Reserve(int iCount);
void Sort(SORT_METHOD sortMethod, SortOrder sortOrder);
/* \brief Sorts the items based on the given sorting options
Please sign in to comment.
Something went wrong with that request. Please try again.