LeechCraft  0.6.70-3565-g2d86529
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LeechCraft::Util::BaseHookInterconnector Class Reference

Base class for signal-slot relays in plugin APIs. More...

#include "basehookinterconnector.h"

+ Inheritance diagram for LeechCraft::Util::BaseHookInterconnector:
+ Collaboration diagram for LeechCraft::Util::BaseHookInterconnector:

Public Member Functions

 BaseHookInterconnector (QObject *parent=0)
 Creates the interconnector with the given parent. More...
 
virtual ~BaseHookInterconnector ()
 Virtual destructor. More...
 
virtual void AddPlugin (QObject *plugin)
 Adds a subplugin to this interconnector. More...
 
void RegisterHookable (QObject *hookable)
 Adds a hookable object from the root plugin. More...
 

Protected Attributes

QList< QObject * > Plugins_
 

Detailed Description

Base class for signal-slot relays in plugin APIs.

This class is typically used by plugins that support other plugins to relay signals from the internals of the root plugin to the subplugins.

The interconnector automatically connects its signals with the matching slots (that is, with the same name and parameters) of subplugins added to it via AddPlugin(), and connects signals of the objects added via RegisterHookable() to its own matching signals.

The usage is as follows:

  1. One subclasses from this class and lists all the signals that should ever be relayed to plugins in the signals section of the subclass. First parameter of the signals should always be LeechCraft::IHookProxy_ptr.
  2. One adds the instance objects of the subplugins to the interconnector via the AddPlugin() method.
  3. One registers the objects emitting signals that need to be relayed to plugins via the RegisterHookable() method.
  4. Everything works.

Please note that second and third steps can be done in arbitrary order and even be interleaved.

Definition at line 66 of file basehookinterconnector.h.

Constructor & Destructor Documentation

LeechCraft::Util::BaseHookInterconnector::BaseHookInterconnector ( QObject *  parent = 0)

Creates the interconnector with the given parent.

Parameters
[in]parentThe parent object of this interconnector.

Definition at line 38 of file basehookinterconnector.cpp.

LeechCraft::Util::BaseHookInterconnector::~BaseHookInterconnector ( )
virtual

Virtual destructor.

Definition at line 43 of file basehookinterconnector.cpp.

Member Function Documentation

void LeechCraft::Util::BaseHookInterconnector::AddPlugin ( QObject *  plugin)
virtual

Adds a subplugin to this interconnector.

This function is used to add a subplugin whose slots should be connected to the signals of this plugin.

Every signal of this object with the name and parameters list matching a slot of plugin will be automatically connected to it.

Parameters
[in]pluginThe subplugin to add to this interconnector.
See Also
RegisterHookable()

Definition at line 104 of file basehookinterconnector.cpp.

References Plugins_.

void LeechCraft::Util::BaseHookInterconnector::RegisterHookable ( QObject *  hookable)

Adds a hookable object from the root plugin.

This function is used to add an object whose signals need to be exposed to subplugins.

Every signal of hookable with the name and parameters list matching a signal of this object will be automatically connected to it.

Parameters
[in]hookableThe hookable object from the root plugin to add.
See Also
AddPlugin()

Definition at line 111 of file basehookinterconnector.cpp.

Member Data Documentation

QList<QObject*> LeechCraft::Util::BaseHookInterconnector::Plugins_
protected

Definition at line 70 of file basehookinterconnector.h.

Referenced by AddPlugin().


The documentation for this class was generated from the following files: