kodi
AddonCallback.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 "AddonClass.h"
12 #include "CallbackFunction.h"
13 #include "CallbackHandler.h"
14 #include "LanguageHook.h"
15 
16 namespace XBMCAddon
17 {
18 
23  class AddonCallback : public AddonClass
24  {
25  protected:
27 
28  bool hasHandler() { return handler.isNotNull(); }
29 
30  inline AddonCallback() : handler(NULL)
31  {
32  // if there is a LanguageHook, it should be set already.
33  if (languageHook != NULL)
34  setHandler(languageHook->GetCallbackHandler());
35  }
36  public:
37 
38  ~AddonCallback() override;
39 
40  inline void setHandler(CallbackHandler* _handler) { handler = _handler; }
41  void invokeCallback(Callback* callback);
42  };
43 }
This class is a smart pointer for a Referenced class.
Definition: AddonClass.h:154
This is the abstraction representing different ways to handle the execution of callbacks.
Definition: CallbackHandler.h:21
Defining LOG_LIFECYCLE_EVENTS will log all instantiations, deletions and also reference countings (in...
Definition: Addon.cpp:25
virtual CallbackHandler * GetCallbackHandler()
For scripting languages that need a global callback handler, this method should be overloaded to supp...
Definition: LanguageHook.h:69
Definition: CallbackFunction.h:25
This class is the superclass for all reference counted classes in the api.
Definition: AddonClass.h:57
This class is the superclass for all API classes that are expected to be able to handle cross-languag...
Definition: AddonCallback.h:23