Merge pull request #4857 from t-nelson/Gotham_13.2_backports
[vuplus_xbmc] / xbmc / filesystem / AddonsDirectory.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 "addons/AddonManager.h"
24
25 class CURL;
26 typedef boost::shared_ptr<CFileItem> CFileItemPtr;
27
28 namespace XFILE 
29 {
30
31   /*!
32   \ingroup windows
33   \brief Get access to shares and it's directories.
34   */
35   class CAddonsDirectory : public IDirectory
36   {
37   public:
38     CAddonsDirectory(void);
39     virtual ~CAddonsDirectory(void);
40     virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
41     virtual bool Create(const char* strPath) { return true; }
42     virtual bool Exists(const char* strPath) { return true; }
43     virtual bool IsAllowed(const CStdString& strFile) const { return true; }
44
45     /*! \brief Fetch script and plugin addons of a given content type
46      \param content the content type to fetch
47      \param addons the list of addons to fill with scripts and plugin content
48      \return true if content is valid, false if it's invalid.
49      */
50     static bool GetScriptsAndPlugins(const CStdString &content, ADDON::VECADDONS &addons);
51
52     /*! \brief Fetch scripts and plugins of a given content type
53      \param content the content type to fetch
54      \param items the list to fill with scripts and content
55      \return true if more than one item is found, false otherwise.
56      */
57     static bool GetScriptsAndPlugins(const CStdString &content, CFileItemList &items);
58
59     /*! \brief return the "Get More..." link item for the current content type
60      \param content the content type for the link item
61      \return a CFileItemPtr to a new item for the link.
62      */
63     static CFileItemPtr GetMoreItem(const CStdString &content);
64
65     static void GenerateListing(CURL &path, ADDON::VECADDONS& addons, CFileItemList &items, bool reposAsFolders = true);
66     static CFileItemPtr FileItemFromAddon(const ADDON::AddonPtr &addon, const CStdString &basePath, bool folder = false);
67   };
68 }