Merge pull request #26293 from the-black-eagle/mka_read_more_tags
[xbmc.git] / xbmc / addons / addoninfo / AddonType.h
blobeae9c3f83df549e5797ac71f3623cd6c837b56a8
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "addons/addoninfo/AddonExtensions.h"
13 #include <set>
14 #include <string>
16 namespace ADDON
19 enum class AddonType
21 UNKNOWN = 0,
22 VISUALIZATION,
23 SKIN,
24 PVRDLL,
25 INPUTSTREAM,
26 GAMEDLL,
27 PERIPHERALDLL,
28 SCRIPT,
29 SCRIPT_WEATHER,
30 SUBTITLE_MODULE,
31 SCRIPT_LYRICS,
32 SCRAPER_ALBUMS,
33 SCRAPER_ARTISTS,
34 SCRAPER_MOVIES,
35 SCRAPER_MUSICVIDEOS,
36 SCRAPER_TVSHOWS,
37 SCREENSAVER,
38 PLUGIN,
39 REPOSITORY,
40 WEB_INTERFACE,
41 SERVICE,
42 AUDIOENCODER,
43 CONTEXTMENU_ITEM,
44 AUDIODECODER,
45 RESOURCE_IMAGES,
46 RESOURCE_LANGUAGE,
47 RESOURCE_UISOUNDS,
48 RESOURCE_GAMES,
49 RESOURCE_FONT,
50 VFS,
51 IMAGEDECODER,
52 SCRAPER_LIBRARY,
53 SCRIPT_LIBRARY,
54 SCRIPT_MODULE,
55 GAME_CONTROLLER,
56 VIDEOCODEC,
58 /**
59 * @brief virtual addon types
61 //@{
62 VIDEO,
63 AUDIO,
64 IMAGE,
65 EXECUTABLE,
66 GAME,
67 //@}
69 MAX_TYPES
72 class CAddonInfoBuilder;
73 class CAddonDatabaseSerializer;
75 class CAddonType : public CAddonExtensions
77 public:
78 CAddonType(AddonType type = AddonType::UNKNOWN) : m_type(type) {}
80 AddonType Type() const { return m_type; }
81 std::string LibPath() const;
82 const std::string& LibName() const { return m_libname; }
84 bool ProvidesSubContent(const AddonType& content) const
86 return content == AddonType::UNKNOWN
87 ? false
88 : m_type == content || m_providedSubContent.count(content) > 0;
91 bool ProvidesSeveralSubContents() const
93 return m_providedSubContent.size() > 1;
96 size_t ProvidedSubContents() const
98 return m_providedSubContent.size();
102 * @brief Indicates whether a given type is a dependency type (e.g. addons which the main type is
103 * a script.module)
105 * @param[in] type the provided type
106 * @return true if type is one of the dependency types
108 static bool IsDependencyType(AddonType type);
110 private:
111 friend class CAddonInfoBuilder;
112 friend class CAddonInfoBuilderFromDB;
113 friend class CAddonDatabaseSerializer;
115 void SetProvides(const std::string& content);
117 AddonType m_type;
118 std::string m_path;
119 std::string m_libname;
120 std::set<AddonType> m_providedSubContent;
123 } /* namespace ADDON */