Merge pull request #4857 from t-nelson/Gotham_13.2_backports
[vuplus_xbmc] / xbmc / filesystem / VirtualDirectory.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2013 Team XBMC
4  *      http://xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include "IDirectory.h"
23 #include "MediaSource.h"
24
25 namespace XFILE
26 {
27
28   /*!
29   \ingroup windows
30   \brief Get access to shares and it's directories.
31   */
32   class CVirtualDirectory : public IDirectory
33   {
34   public:
35     CVirtualDirectory(void);
36     virtual ~CVirtualDirectory(void);
37     virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
38     virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items, bool bUseFileDirectories);
39     void SetSources(const VECSOURCES& vecSources);
40     inline unsigned int GetNumberOfSources() 
41     {
42       return m_vecSources.size();
43     }
44
45     bool IsSource(const CStdString& strPath, VECSOURCES *sources = NULL, CStdString *name = NULL) const;
46     bool IsInSource(const CStdString& strPath) const;
47
48     inline const CMediaSource& operator [](const int index) const
49     {
50       return m_vecSources[index];
51     }
52
53     inline CMediaSource& operator[](const int index)
54     {
55       return m_vecSources[index];
56     }
57
58     void GetSources(VECSOURCES &sources) const;
59
60     void AllowNonLocalSources(bool allow) { m_allowNonLocalSources = allow; };
61
62     /*! \brief Set whether we allow threaded loading of directories.
63      The default is to allow threading, so this can be used to disable it.
64      \param allowThreads if true we allow threads, if false we don't.
65      */
66     void SetAllowThreads(bool allowThreads) { m_allowThreads = allowThreads; };
67   protected:
68     void CacheThumbs(CFileItemList &items);
69
70     VECSOURCES m_vecSources;
71     bool       m_allowNonLocalSources;
72     bool       m_allowThreads;
73   };
74 }