xbmc
PluginSource.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "addons/Addon.h"
12 
13 #include <set>
14 
15 namespace ADDON
16 {
17 
18 typedef std::map<std::string, std::vector<std::string>> ContentPathMap;
19 
20 class CPluginSource : public CAddon
21 {
22 public:
23 
24  enum Content { UNKNOWN, AUDIO, IMAGE, EXECUTABLE, VIDEO, GAME };
25 
26  explicit CPluginSource(const AddonInfoPtr& addonInfo, AddonType addonType);
27 
28  bool HasType(AddonType type) const override;
29  bool Provides(const Content& content) const
30  {
31  return content == UNKNOWN ? false : m_providedContent.count(content) > 0;
32  }
33 
34  bool ProvidesSeveral() const
35  {
36  return m_providedContent.size() > 1;
37  }
38 
39  const ContentPathMap& MediaLibraryScanPaths() const
40  {
41  return m_mediaLibraryScanPaths;
42  }
43 
44  static Content Translate(const std::string &content);
45 private:
50  void SetProvides(const std::string &content);
51  std::set<Content> m_providedContent;
52  ContentPathMap m_mediaLibraryScanPaths;
53 };
54 
55 } /*namespace ADDON*/
Definition: Application.h:74
Definition: PluginSource.h:20
bool HasType(AddonType type) const override
To check complete addon (not only this) contains a type.
Definition: PluginSource.cpp:76
Definition: Addon.cpp:39
Definition: Addon.h:34