Merge pull request #5039 from CEikermann/patch-1
[vuplus_xbmc] / xbmc / addons / PluginSource.h
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20 #pragma once
21
22 #include "Addon.h"
23
24 namespace ADDON
25 {
26
27 class CPluginSource : public CAddon
28 {
29 public:
30
31   enum Content { UNKNOWN, AUDIO, IMAGE, EXECUTABLE, VIDEO };
32
33   CPluginSource(const cp_extension_t *ext);
34   CPluginSource(const AddonProps &props);
35   virtual ~CPluginSource() {}
36   virtual AddonPtr Clone() const;
37   virtual bool IsType(TYPE type) const;
38   bool Provides(const Content& content) const
39   {
40     return content == UNKNOWN ? false : m_providedContent.count(content) > 0;
41   }
42
43   bool ProvidesSeveral() const
44   {
45     return m_providedContent.size() > 1;
46   }
47
48   static Content Translate(const CStdString &content);
49 private:
50   /*! \brief Set the provided content for this plugin
51    If no valid content types are passed in, we set the EXECUTABLE type
52    \param content a space-separated list of content types
53    */
54   void SetProvides(const CStdString &content);
55   std::set<Content> m_providedContent;
56 };
57
58 } /*namespace ADDON*/