Merge pull request #26148 from ksooo/fix-secondstotimestring-warning
[xbmc.git] / xbmc / addons / AddonEvents.h
blob8db032c78ceff939d764c3491615c251cb788593
1 /*
2 * Copyright (C) 2016-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/IAddon.h"
13 #include <string>
15 namespace ADDON
18 struct AddonEvent
20 std::string addonId;
21 AddonInstanceId instanceId{ADDON_SINGLETON_INSTANCE_ID};
23 explicit AddonEvent(std::string addonId) : addonId(std::move(addonId)) {}
24 AddonEvent(std::string addonId, AddonInstanceId instanceId)
25 : addonId(std::move(addonId)), instanceId(instanceId)
29 // Note: Do not remove the virtual dtor. There are types derived from AddonEvent (see below)
30 // and there are several places where 'typeid' is used to determine the runtime type of
31 // AddonEvent references. And 'typeid' only works for polymorphic objects.
32 virtual ~AddonEvent() = default;
35 namespace AddonEvents
38 /**
39 * Emitted after the add-on has been enabled.
41 struct Enabled : AddonEvent
43 explicit Enabled(std::string addonId) : AddonEvent(std::move(addonId)) {}
46 /**
47 * Emitted after the add-on has been disabled.
49 struct Disabled : AddonEvent
51 explicit Disabled(std::string addonId) : AddonEvent(std::move(addonId)) {}
54 /**
55 * Emitted after a new usable add-on instance was added.
57 struct InstanceAdded : AddonEvent
59 InstanceAdded(std::string addonId, AddonInstanceId instanceId)
60 : AddonEvent(std::move(addonId), instanceId)
65 /**
66 * Emitted after an add-on instance was removed.
68 struct InstanceRemoved : AddonEvent
70 InstanceRemoved(std::string addonId, AddonInstanceId instanceId)
71 : AddonEvent(std::move(addonId), instanceId)
76 /**
77 * Emitted after the add-on's metadata has been changed.
79 struct MetadataChanged : AddonEvent
81 explicit MetadataChanged(std::string addonId) : AddonEvent(std::move(addonId)) {}
84 /**
85 * Emitted when a different version of the add-on has been installed
86 * to the file system and should be reloaded.
88 struct ReInstalled : AddonEvent
90 explicit ReInstalled(std::string addonId) : AddonEvent(std::move(addonId)) {}
93 /**
94 * Emitted after the add-on has been uninstalled.
96 struct UnInstalled : AddonEvent
98 explicit UnInstalled(std::string addonId) : AddonEvent(std::move(addonId)) {}
102 * Emitted after the add-on has been loaded.
104 struct Load : AddonEvent
106 explicit Load(std::string addonId) : AddonEvent(std::move(addonId)) {}
110 * Emitted after the add-on has been unloaded.
112 struct Unload : AddonEvent
114 explicit Unload(std::string addonId) : AddonEvent(std::move(addonId)) {}
118 * Emitted after the auto-update state of the add-on has been changed.
120 struct AutoUpdateStateChanged : AddonEvent
122 explicit AutoUpdateStateChanged(std::string addonId) : AddonEvent(std::move(addonId)) {}
125 } // namespace AddonEvents
126 } // namespace ADDON