1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
  
     | 
    
      /*
 *  Copyright (C) 2016-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */
#pragma once
#include "addons/IAddon.h"
#include <string>
namespace ADDON
{
struct AddonEvent
{
  std::string addonId;
  AddonInstanceId instanceId{ADDON_SINGLETON_INSTANCE_ID};
  explicit AddonEvent(std::string addonId) : addonId(std::move(addonId)) {}
  AddonEvent(std::string addonId, AddonInstanceId instanceId)
    : addonId(std::move(addonId)), instanceId(instanceId)
  {
  }
  // Note: Do not remove the virtual dtor. There are types derived from AddonEvent (see below)
  //       and there are several places where 'typeid' is used to determine the runtime type of
  //       AddonEvent references. And 'typeid' only works for polymorphic objects.
  virtual ~AddonEvent() = default;
};
namespace AddonEvents
{
/**
 * Emitted after the add-on has been enabled.
 */
struct Enabled : AddonEvent
{
  explicit Enabled(std::string addonId) : AddonEvent(std::move(addonId)) {}
};
/**
 * Emitted after the add-on has been disabled.
 */
struct Disabled : AddonEvent
{
  explicit Disabled(std::string addonId) : AddonEvent(std::move(addonId)) {}
};
/**
 * Emitted after a new usable add-on instance was added.
 */
struct InstanceAdded : AddonEvent
{
  InstanceAdded(std::string addonId, AddonInstanceId instanceId)
    : AddonEvent(std::move(addonId), instanceId)
  {
  }
};
/**
 * Emitted after an add-on instance was removed.
 */
struct InstanceRemoved : AddonEvent
{
  InstanceRemoved(std::string addonId, AddonInstanceId instanceId)
    : AddonEvent(std::move(addonId), instanceId)
  {
  }
};
/**
 * Emitted after the add-on's metadata has been changed.
 */
struct MetadataChanged : AddonEvent
{
  explicit MetadataChanged(std::string addonId) : AddonEvent(std::move(addonId)) {}
};
/**
 * Emitted when a different version of the add-on has been installed
 * to the file system and should be reloaded.
 */
struct ReInstalled : AddonEvent
{
  explicit ReInstalled(std::string addonId) : AddonEvent(std::move(addonId)) {}
};
/**
 * Emitted after the add-on has been uninstalled.
 */
struct UnInstalled : AddonEvent
{
  explicit UnInstalled(std::string addonId) : AddonEvent(std::move(addonId)) {}
};
/**
 * Emitted after the add-on has been loaded.
 */
struct Load : AddonEvent
{
  explicit Load(std::string addonId) : AddonEvent(std::move(addonId)) {}
};
/**
 * Emitted after the add-on has been unloaded.
 */
struct Unload : AddonEvent
{
  explicit Unload(std::string addonId) : AddonEvent(std::move(addonId)) {}
};
/**
 * Emitted after the auto-update state of the add-on has been changed.
 */
struct AutoUpdateStateChanged : AddonEvent
{
  explicit AutoUpdateStateChanged(std::string addonId) : AddonEvent(std::move(addonId)) {}
};
} // namespace AddonEvents
} // namespace ADDON
 
     |