LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
LC::Util::BaseHookInterconnector Class Reference

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

#include "basehookinterconnector.h"

+ Inheritance diagram for LC::Util::BaseHookInterconnector:
+ Collaboration diagram for LC::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 LC::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 57 of file basehookinterconnector.h.

Constructor & Destructor Documentation

◆ BaseHookInterconnector()

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

Creates the interconnector with the given parent.

Parameters
[in]parentThe parent object of this interconnector.

Definition at line 29 of file basehookinterconnector.cpp.

◆ ~BaseHookInterconnector()

LC::Util::BaseHookInterconnector::~BaseHookInterconnector ( )
virtual

Virtual destructor.

Definition at line 34 of file basehookinterconnector.cpp.

Member Function Documentation

◆ AddPlugin()

void LC::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 170 of file basehookinterconnector.cpp.

◆ RegisterHookable()

void LC::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 177 of file basehookinterconnector.cpp.

Member Data Documentation

◆ Plugins_

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

Definition at line 67 of file basehookinterconnector.h.


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