Merge pull request #4630 from Red-F/gotham-resume-pvr-lastplayedposition
[vuplus_xbmc] / xbmc / FileItem.h
1 /*!
2  \file FileItem.h
3  \brief
4  */
5 #pragma once
6
7 /*
8  *      Copyright (C) 2005-2013 Team XBMC
9  *      http://xbmc.org
10  *
11  *  This Program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2, or (at your option)
14  *  any later version.
15  *
16  *  This Program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with XBMC; see the file COPYING.  If not, see
23  *  <http://www.gnu.org/licenses/>.
24  *
25  */
26
27 #include "guilib/GUIListItem.h"
28 #include "utils/Archive.h"
29 #include "utils/ISerializable.h"
30 #include "utils/ISortable.h"
31 #include "XBDateTime.h"
32 #include "utils/SortUtils.h"
33 #include "utils/LabelFormatter.h"
34 #include "GUIPassword.h"
35 #include "threads/CriticalSection.h"
36
37 #include <vector>
38 #include "boost/shared_ptr.hpp"
39
40 namespace MUSIC_INFO
41 {
42   class CMusicInfoTag;
43 }
44 class CVideoInfoTag;
45 namespace EPG
46 {
47   class CEpgInfoTag;
48 }
49 namespace PVR
50 {
51   class CPVRChannel;
52   class CPVRRecording;
53   class CPVRTimerInfoTag;
54 }
55 class CPictureInfoTag;
56
57 class CAlbum;
58 class CArtist;
59 class CSong;
60 class CGenre;
61
62 class CURL;
63
64 /* special startoffset used to indicate that we wish to resume */
65 #define STARTOFFSET_RESUME (-1)
66
67 class CMediaSource;
68
69 enum EFileFolderType {
70   EFILEFOLDER_TYPE_ALWAYS     = 1<<0,
71   EFILEFOLDER_TYPE_ONCLICK    = 1<<1,
72   EFILEFOLDER_TYPE_ONBROWSE   = 1<<2,
73
74   EFILEFOLDER_MASK_ALL        = 0xff,
75   EFILEFOLDER_MASK_ONCLICK    = EFILEFOLDER_TYPE_ALWAYS
76                               | EFILEFOLDER_TYPE_ONCLICK,
77   EFILEFOLDER_MASK_ONBROWSE   = EFILEFOLDER_TYPE_ALWAYS
78                               | EFILEFOLDER_TYPE_ONCLICK
79                               | EFILEFOLDER_TYPE_ONBROWSE,
80 };
81
82 /*!
83   \brief Represents a file on a share
84   \sa CFileItemList
85   */
86 class CFileItem :
87   public CGUIListItem, public IArchivable, public ISerializable, public ISortable
88 {
89 public:
90   CFileItem(void);
91   CFileItem(const CFileItem& item);
92   CFileItem(const CGUIListItem& item);
93   CFileItem(const CStdString& strLabel);
94   CFileItem(const CStdString& strPath, bool bIsFolder);
95   CFileItem(const CSong& song);
96   CFileItem(const CStdString &path, const CAlbum& album);
97   CFileItem(const CArtist& artist);
98   CFileItem(const CGenre& genre);
99   CFileItem(const MUSIC_INFO::CMusicInfoTag& music);
100   CFileItem(const CVideoInfoTag& movie);
101   CFileItem(const EPG::CEpgInfoTag& tag);
102   CFileItem(const PVR::CPVRChannel& channel);
103   CFileItem(const PVR::CPVRRecording& record);
104   CFileItem(const PVR::CPVRTimerInfoTag& timer);
105   CFileItem(const CMediaSource& share);
106   virtual ~CFileItem(void);
107   virtual CGUIListItem *Clone() const { return new CFileItem(*this); };
108
109   const CStdString &GetPath() const { return m_strPath; };
110   void SetPath(const CStdString &path) { m_strPath = path; };
111
112   void Reset();
113   const CFileItem& operator=(const CFileItem& item);
114   virtual void Archive(CArchive& ar);
115   virtual void Serialize(CVariant& value) const;
116   virtual void ToSortable(SortItem &sortable, Field field) const;
117   void ToSortable(SortItem &sortable, const Fields &fields) const;
118   virtual bool IsFileItem() const { return true; };
119
120   bool Exists(bool bUseCache = true) const;
121   
122   /*!
123    \brief Check whether an item is an optical media folder or its parent. 
124     This will return the non-empty path to the playable entry point of the media
125     one or two levels down (VIDEO_TS.IFO for DVDs or index.bdmv for BDs). 
126     The returned path will be empty if folder does not meet this criterion.
127    \return non-empty string if item is optical media folder, empty otherwise. 
128    */
129   std::string GetOpticalMediaPath() const;
130   /*!
131    \brief Check whether an item is a video item. Note that this returns true for
132     anything with a video info tag, so that may include eg. folders.
133    \return true if item is video, false otherwise. 
134    */
135   bool IsVideo() const;
136
137   bool IsDiscStub() const;
138
139   /*!
140    \brief Check whether an item is a picture item. Note that this returns true for
141     anything with a picture info tag, so that may include eg. folders.
142    \return true if item is picture, false otherwise. 
143    */
144   bool IsPicture() const;
145   bool IsLyrics() const;
146
147   /*!
148    \brief Check whether an item is an audio item. Note that this returns true for
149     anything with a music info tag, so that may include eg. folders.
150    \return true if item is audio, false otherwise. 
151    */
152   bool IsAudio() const;
153
154   bool IsKaraoke() const;
155   bool IsCUESheet() const;
156   bool IsInternetStream(const bool bStrictCheck = false) const;
157   bool IsPlayList() const;
158   bool IsSmartPlayList() const;
159   bool IsLibraryFolder() const;
160   bool IsPythonScript() const;
161   bool IsPlugin() const;
162   bool IsScript() const;
163   bool IsAddonsPath() const;
164   bool IsSourcesPath() const;
165   bool IsNFO() const;
166   bool IsDVDImage() const;
167   bool IsOpticalMediaFile() const;
168   bool IsDVDFile(bool bVobs = true, bool bIfos = true) const;
169   bool IsBDFile() const;
170   bool IsRAR() const;
171   bool IsAPK() const;
172   bool IsZIP() const;
173   bool IsCBZ() const;
174   bool IsCBR() const;
175   bool IsISO9660() const;
176   bool IsCDDA() const;
177   bool IsDVD() const;
178   bool IsOnDVD() const;
179   bool IsOnLAN() const;
180   bool IsHD() const;
181   bool IsNfs() const;  
182   bool IsAfp() const;    
183   bool IsRemote() const;
184   bool IsSmb() const;
185   bool IsURL() const;
186   bool IsDAAP() const;
187   bool IsStack() const;
188   bool IsMultiPath() const;
189   bool IsMusicDb() const;
190   bool IsVideoDb() const;
191   bool IsEPG() const;
192   bool IsPVRChannel() const;
193   bool IsPVRRecording() const;
194   bool IsPVRTimer() const;
195   bool IsType(const char *ext) const;
196   bool IsVirtualDirectoryRoot() const;
197   bool IsReadOnly() const;
198   bool CanQueue() const;
199   void SetCanQueue(bool bYesNo);
200   bool IsParentFolder() const;
201   bool IsFileFolder(EFileFolderType types = EFILEFOLDER_MASK_ALL) const;
202   bool IsRemovable() const;
203   bool IsTuxBox() const;
204   bool IsMythTV() const;
205   bool IsHDHomeRun() const;
206   bool IsSlingbox() const;
207   bool IsVTP() const;
208   bool IsPVR() const;
209   bool IsLiveTV() const;
210   bool IsRSS() const;
211   bool IsAndroidApp() const;
212
213   void RemoveExtension();
214   void CleanString();
215   void FillInDefaultIcon();
216   void SetFileSizeLabel();
217   virtual void SetLabel(const CStdString &strLabel);
218   CURL GetAsUrl() const;
219   int GetVideoContentType() const; /* return VIDEODB_CONTENT_TYPE, but don't want to include videodb in this header */
220   bool IsLabelPreformated() const { return m_bLabelPreformated; }
221   void SetLabelPreformated(bool bYesNo) { m_bLabelPreformated=bYesNo; }
222   bool SortsOnTop() const { return m_specialSort == SortSpecialOnTop; }
223   bool SortsOnBottom() const { return m_specialSort == SortSpecialOnBottom; }
224   void SetSpecialSort(SortSpecial sort) { m_specialSort = sort; }
225
226   inline bool HasMusicInfoTag() const
227   {
228     return m_musicInfoTag != NULL;
229   }
230
231   MUSIC_INFO::CMusicInfoTag* GetMusicInfoTag();
232
233   inline const MUSIC_INFO::CMusicInfoTag* GetMusicInfoTag() const
234   {
235     return m_musicInfoTag;
236   }
237
238   inline bool HasVideoInfoTag() const
239   {
240     return m_videoInfoTag != NULL;
241   }
242
243   CVideoInfoTag* GetVideoInfoTag();
244
245   inline const CVideoInfoTag* GetVideoInfoTag() const
246   {
247     return m_videoInfoTag;
248   }
249
250   inline bool HasEPGInfoTag() const
251   {
252     return m_epgInfoTag != NULL;
253   }
254
255   EPG::CEpgInfoTag* GetEPGInfoTag();
256
257   inline const EPG::CEpgInfoTag* GetEPGInfoTag() const
258   {
259     return m_epgInfoTag;
260   }
261
262   inline bool HasPVRChannelInfoTag() const
263   {
264     return m_pvrChannelInfoTag != NULL;
265   }
266
267   PVR::CPVRChannel* GetPVRChannelInfoTag();
268
269   inline const PVR::CPVRChannel* GetPVRChannelInfoTag() const
270   {
271     return m_pvrChannelInfoTag;
272   }
273
274   inline bool HasPVRRecordingInfoTag() const
275   {
276     return m_pvrRecordingInfoTag != NULL;
277   }
278
279   PVR::CPVRRecording* GetPVRRecordingInfoTag();
280
281   inline const PVR::CPVRRecording* GetPVRRecordingInfoTag() const
282   {
283     return m_pvrRecordingInfoTag;
284   }
285
286   inline bool HasPVRTimerInfoTag() const
287   {
288     return m_pvrTimerInfoTag != NULL;
289   }
290
291   PVR::CPVRTimerInfoTag* GetPVRTimerInfoTag();
292
293   inline const PVR::CPVRTimerInfoTag* GetPVRTimerInfoTag() const
294   {
295     return m_pvrTimerInfoTag;
296   }
297
298   /*!
299    \brief Test if this item has a valid resume point set.
300    \return True if this item has a resume point and it is set, false otherwise.
301    */
302   bool IsResumePointSet() const;
303
304   /*!
305    \brief Return the current resume time.
306    \return The time in seconds from the start to resume playing from.
307    */
308   double GetCurrentResumeTime() const;
309
310   inline bool HasPictureInfoTag() const
311   {
312     return m_pictureInfoTag != NULL;
313   }
314
315   inline const CPictureInfoTag* GetPictureInfoTag() const
316   {
317     return m_pictureInfoTag;
318   }
319
320   CPictureInfoTag* GetPictureInfoTag();
321
322   /*!
323    \brief Get the local fanart for this item if it exists
324    \return path to the local fanart for this item, or empty if none exists
325    \sa GetFolderThumb, GetTBNFile
326    */
327   CStdString GetLocalFanart() const;
328
329   /*! \brief Assemble the filename of a particular piece of local artwork for an item.
330              No file existence check is typically performed.
331    \param artFile the art file to search for.
332    \param useFolder whether to look in the folder for the art file. Defaults to false.
333    \return the path to the local artwork.
334    \sa FindLocalArt
335    */
336   CStdString GetLocalArt(const std::string &artFile, bool useFolder = false) const;
337
338   /*! \brief Assemble the filename of a particular piece of local artwork for an item,
339              and check for file existence.
340    \param artFile the art file to search for.
341    \param useFolder whether to look in the folder for the art file. Defaults to false.
342    \return the path to the local artwork if it exists, empty otherwise.
343    \sa GetLocalArt
344    */
345   CStdString FindLocalArt(const std::string &artFile, bool useFolder) const;
346
347   /*! \brief Whether or not to skip searching for local art.
348    \return true if local art should be skipped for this item, false otherwise.
349    \sa GetLocalArt, FindLocalArt
350    */
351   bool SkipLocalArt() const;
352
353   // Gets the .tbn file associated with this item
354   CStdString GetTBNFile() const;
355   // Gets the folder image associated with this item (defaults to folder.jpg)
356   CStdString GetFolderThumb(const CStdString &folderJPG = "folder.jpg") const;
357   // Gets the correct movie title
358   CStdString GetMovieName(bool bUseFolderNames = false) const;
359
360   /*! \brief Find the base movie path (i.e. the item the user expects us to use to lookup the movie)
361    For folder items, with "use foldernames for lookups" it returns the folder.
362    Regardless of settings, for VIDEO_TS/BDMV it returns the parent of the VIDEO_TS/BDMV folder (if present)
363
364    \param useFolderNames whether we're using foldernames for lookups
365    \return the base movie folder
366    */
367   CStdString GetBaseMoviePath(bool useFolderNames) const;
368
369   // Gets the user thumb, if it exists
370   CStdString GetUserMusicThumb(bool alwaysCheckRemote = false, bool fallbackToFolder = false) const;
371
372   /*! \brief Get the path where we expect local metadata to reside.
373    For a folder, this is just the existing path (eg tvshow folder)
374    For a file, this is the parent path, with exceptions made for VIDEO_TS and BDMV files
375
376    Three cases are handled:
377
378      /foo/bar/movie_name/file_name          -> /foo/bar/movie_name/
379      /foo/bar/movie_name/VIDEO_TS/file_name -> /foo/bar/movie_name/
380      /foo/bar/movie_name/BDMV/file_name     -> /foo/bar/movie_name/
381
382      \sa URIUtils::GetParentPath
383    */
384   CStdString GetLocalMetadataPath() const;
385
386   // finds a matching local trailer file
387   CStdString FindTrailer() const;
388
389   virtual bool LoadMusicTag();
390
391   /* Returns the content type of this item if known */
392   const CStdString& GetMimeType() const { return m_mimetype; }
393
394   /* sets the mime-type if known beforehand */
395   void SetMimeType(const CStdString& mimetype) { m_mimetype = mimetype; } ;
396
397   /*! \brief Resolve the MIME type based on file extension or a web lookup
398    If m_mimetype is already set (non-empty), this function has no effect. For
399    http:// and shout:// streams, this will query the stream (blocking operation).
400    Set lookup=false to skip any internet lookups and always return immediately.
401    */
402   void FillInMimeType(bool lookup = true);
403
404   /* general extra info about the contents of the item, not for display */
405   void SetExtraInfo(const CStdString& info) { m_extrainfo = info; };
406   const CStdString& GetExtraInfo() const { return m_extrainfo; };
407
408   /*! \brief Update an item with information from another item
409    We take metadata information from the given item and supplement the current item
410    with that info.  If tags exist in the new item we use the entire tag information.
411    Properties are appended, and labels, thumbnail and icon are updated if non-empty
412    in the given item.
413    \param item the item used to supplement information
414    \param replaceLabels whether to replace labels (defaults to true)
415    */
416   void UpdateInfo(const CFileItem &item, bool replaceLabels = true);
417
418   bool IsSamePath(const CFileItem *item) const;
419
420   bool IsAlbum() const;
421
422   /*! \brief Sets details using the information from the CVideoInfoTag object
423    Sets the videoinfotag and uses its information to set the label and path.
424    \param video video details to use and set
425    */
426   void SetFromVideoInfoTag(const CVideoInfoTag &video);
427   /*! \brief Sets details using the information from the CAlbum object
428    Sets the album in the music info tag and uses its information to set the
429    label and album-specific properties.
430    \param album album details to use and set
431    */
432   void SetFromAlbum(const CAlbum &album);
433   /*! \brief Sets details using the information from the CSong object
434    Sets the song in the music info tag and uses its information to set the
435    label, path, song-specific properties and artwork.
436    \param song song details to use and set
437    */
438   void SetFromSong(const CSong &song);
439
440   bool m_bIsShareOrDrive;    ///< is this a root share/drive
441   int m_iDriveType;     ///< If \e m_bIsShareOrDrive is \e true, use to get the share type. Types see: CMediaSource::m_iDriveType
442   CDateTime m_dateTime;             ///< file creation date & time
443   int64_t m_dwSize;             ///< file size (0 for folders)
444   CStdString m_strDVDLabel;
445   CStdString m_strTitle;
446   int m_iprogramCount;
447   int m_idepth;
448   int m_lStartOffset;
449   int m_lStartPartNumber;
450   int m_lEndOffset;
451   LockType m_iLockMode;
452   CStdString m_strLockCode;
453   int m_iHasLock; // 0 - no lock 1 - lock, but unlocked 2 - locked
454   int m_iBadPwdCount;
455
456 private:
457   CStdString m_strPath;            ///< complete path to item
458
459   SortSpecial m_specialSort;
460   bool m_bIsParentFolder;
461   bool m_bCanQueue;
462   bool m_bLabelPreformated;
463   CStdString m_mimetype;
464   CStdString m_extrainfo;
465   MUSIC_INFO::CMusicInfoTag* m_musicInfoTag;
466   CVideoInfoTag* m_videoInfoTag;
467   EPG::CEpgInfoTag* m_epgInfoTag;
468   PVR::CPVRChannel* m_pvrChannelInfoTag;
469   PVR::CPVRRecording* m_pvrRecordingInfoTag;
470   PVR::CPVRTimerInfoTag * m_pvrTimerInfoTag;
471   CPictureInfoTag* m_pictureInfoTag;
472   bool m_bIsAlbum;
473 };
474
475 /*!
476   \brief A shared pointer to CFileItem
477   \sa CFileItem
478   */
479 typedef boost::shared_ptr<CFileItem> CFileItemPtr;
480
481 /*!
482   \brief A vector of pointer to CFileItem
483   \sa CFileItem
484   */
485 typedef std::vector< CFileItemPtr > VECFILEITEMS;
486
487 /*!
488   \brief Iterator for VECFILEITEMS
489   \sa CFileItemList
490   */
491 typedef std::vector< CFileItemPtr >::iterator IVECFILEITEMS;
492
493 /*!
494   \brief A map of pointers to CFileItem
495   \sa CFileItem
496   */
497 typedef std::map<CStdString, CFileItemPtr > MAPFILEITEMS;
498
499 /*!
500   \brief Iterator for MAPFILEITEMS
501   \sa MAPFILEITEMS
502   */
503 typedef std::map<CStdString, CFileItemPtr >::iterator IMAPFILEITEMS;
504
505 /*!
506   \brief Pair for MAPFILEITEMS
507   \sa MAPFILEITEMS
508   */
509 typedef std::pair<CStdString, CFileItemPtr > MAPFILEITEMSPAIR;
510
511 typedef bool (*FILEITEMLISTCOMPARISONFUNC) (const CFileItemPtr &pItem1, const CFileItemPtr &pItem2);
512 typedef void (*FILEITEMFILLFUNC) (CFileItemPtr &item);
513
514 /*!
515   \brief Represents a list of files
516   \sa CFileItemList, CFileItem
517   */
518 class CFileItemList : public CFileItem
519 {
520 public:
521   enum CACHE_TYPE { CACHE_NEVER = 0, CACHE_IF_SLOW, CACHE_ALWAYS };
522
523   CFileItemList();
524   CFileItemList(const CStdString& strPath);
525   virtual ~CFileItemList();
526   virtual void Archive(CArchive& ar);
527   CFileItemPtr operator[] (int iItem);
528   const CFileItemPtr operator[] (int iItem) const;
529   CFileItemPtr operator[] (const CStdString& strPath);
530   const CFileItemPtr operator[] (const CStdString& strPath) const;
531   void Clear();
532   void ClearItems();
533   void Add(const CFileItemPtr &pItem);
534   void AddFront(const CFileItemPtr &pItem, int itemPosition);
535   void Remove(CFileItem* pItem);
536   void Remove(int iItem);
537   CFileItemPtr Get(int iItem);
538   const CFileItemPtr Get(int iItem) const;
539   const VECFILEITEMS GetList() const { return m_items; }
540   CFileItemPtr Get(const CStdString& strPath);
541   const CFileItemPtr Get(const CStdString& strPath) const;
542   int Size() const;
543   bool IsEmpty() const;
544   void Append(const CFileItemList& itemlist);
545   void Assign(const CFileItemList& itemlist, bool append = false);
546   bool Copy  (const CFileItemList& item, bool copyItems = true);
547   void Reserve(int iCount);
548   void Sort(SortBy sortBy, SortOrder sortOrder, SortAttribute sortAttributes = SortAttributeNone);
549   /* \brief Sorts the items based on the given sorting options
550
551   In contrast to Sort (see above) this does not change the internal
552   state by storing the sorting method and order used and therefore
553   will always execute the sorting even if the list of items has
554   already been sorted with the same options before.
555   */
556   void Sort(SortDescription sortDescription);
557   void Randomize();
558   void FillInDefaultIcons();
559   int GetFolderCount() const;
560   int GetFileCount() const;
561   int GetSelectedCount() const;
562   int GetObjectCount() const;
563   void FilterCueItems();
564   void RemoveExtensions();
565   void SetFastLookup(bool fastLookup);
566   bool Contains(const CStdString& fileName) const;
567   bool GetFastLookup() const { return m_fastLookup; };
568
569   /*! \brief stack a CFileItemList
570    By default we stack all items (files and folders) in a CFileItemList
571    \param stackFiles whether to stack all items or just collapse folders (defaults to true)
572    \sa StackFiles,StackFolders
573    */
574   void Stack(bool stackFiles = true);
575
576   SortOrder GetSortOrder() const { return m_sortDescription.sortOrder; }
577   SortBy GetSortMethod() const { return m_sortDescription.sortBy; }
578   /*! \brief load a CFileItemList out of the cache
579
580    The file list may be cached based on which window we're viewing in, as different
581    windows will be listing different portions of the same URL (eg viewing music files
582    versus viewing video files)
583    
584    \param windowID id of the window that's loading this list (defaults to 0)
585    \return true if we loaded from the cache, false otherwise.
586    \sa Save,RemoveDiscCache
587    */
588   bool Load(int windowID = 0);
589
590   /*! \brief save a CFileItemList to the cache
591    
592    The file list may be cached based on which window we're viewing in, as different
593    windows will be listing different portions of the same URL (eg viewing music files
594    versus viewing video files)
595    
596    \param windowID id of the window that's saving this list (defaults to 0)
597    \return true if successful, false otherwise.
598    \sa Load,RemoveDiscCache
599    */
600   bool Save(int windowID = 0);
601   void SetCacheToDisc(CACHE_TYPE cacheToDisc) { m_cacheToDisc = cacheToDisc; }
602   bool CacheToDiscAlways() const { return m_cacheToDisc == CACHE_ALWAYS; }
603   bool CacheToDiscIfSlow() const { return m_cacheToDisc == CACHE_IF_SLOW; }
604   /*! \brief remove a previously cached CFileItemList from the cache
605    
606    The file list may be cached based on which window we're viewing in, as different
607    windows will be listing different portions of the same URL (eg viewing music files
608    versus viewing video files)
609    
610    \param windowID id of the window whose cache we which to remove (defaults to 0)
611    \sa Save,Load
612    */
613   void RemoveDiscCache(int windowID = 0) const;
614   bool AlwaysCache() const;
615
616   void Swap(unsigned int item1, unsigned int item2);
617
618   /*! \brief Update an item in the item list
619    \param item the new item, which we match based on path to an existing item in the list
620    \return true if the item exists in the list (and was thus updated), false otherwise.
621    */
622   bool UpdateItem(const CFileItem *item);
623
624   void AddSortMethod(SortBy sortBy, int buttonLabel, const LABEL_MASKS &labelMasks, SortAttribute sortAttributes = SortAttributeNone);
625   void AddSortMethod(SortBy sortBy, SortAttribute sortAttributes, int buttonLabel, const LABEL_MASKS &labelMasks);
626   void AddSortMethod(SortDescription sortDescription, int buttonLabel, const LABEL_MASKS &labelMasks);
627   bool HasSortDetails() const { return m_sortDetails.size() != 0; };
628   const std::vector<SORT_METHOD_DETAILS> &GetSortDetails() const { return m_sortDetails; };
629
630   /*! \brief Specify whether this list should be sorted with folders separate from files
631    By default we sort with folders listed (and sorted separately) except for those sort modes
632    which should be explicitly sorted with folders interleaved with files (eg SORT_METHOD_FILES).
633    With this set the folder state will be ignored, allowing folders and files to sort interleaved.
634    \param sort whether to ignore the folder state.
635    */
636   void SetSortIgnoreFolders(bool sort) { m_sortIgnoreFolders = sort; };
637   bool GetReplaceListing() const { return m_replaceListing; };
638   void SetReplaceListing(bool replace);
639   void SetContent(const CStdString &content) { m_content = content; };
640   const CStdString &GetContent() const { return m_content; };
641
642   void ClearSortState();
643 private:
644   void Sort(FILEITEMLISTCOMPARISONFUNC func);
645   void FillSortFields(FILEITEMFILLFUNC func);
646   CStdString GetDiscFileCache(int windowID) const;
647
648   /*!
649    \brief stack files in a CFileItemList
650    \sa Stack
651    */
652   void StackFiles();
653
654   /*!
655    \brief stack folders in a CFileItemList
656    \sa Stack
657    */
658   void StackFolders();
659
660   VECFILEITEMS m_items;
661   MAPFILEITEMS m_map;
662   bool m_fastLookup;
663   SortDescription m_sortDescription;
664   bool m_sortIgnoreFolders;
665   CACHE_TYPE m_cacheToDisc;
666   bool m_replaceListing;
667   CStdString m_content;
668
669   std::vector<SORT_METHOD_DETAILS> m_sortDetails;
670
671   CCriticalSection m_lock;
672 };