umbrello: Umbrello::Plugin Class Reference

umbrello 2.32.3 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Umbrello::Plugin Class Reference
Umbrello2 API

`#include <plugin.h>`

Inheritance diagram for Umbrello::Plugin:

## Public Member Functions
virtual | ~Plugin ()
QByteArray | instanceName () const
KConfig * | config ()
virtual QString | category ()
void | unload ()
Public Member Functions inherited from Umbrello::Configurable
| Configurable ()
virtual | ~Configurable ()
virtual bool | configure ()=0

## Protected Member Functions
| Plugin (QObject *parent, const char *name, const QStringList &args)
virtual bool | onInit ()
virtual bool | onShutdown ()
Protected Member Functions inherited from Umbrello::Configurable
bool | loadPlugins (KConfig *config, const QString &group, const QString &key)
bool | unloadPlugins ()

## Protected Attributes
uint | _ref
| Reference counter. More...
QByteArray | _instanceName
| Instance name of the plugin. More...
KConfig * | _config
| Configuration record. More...

## Private Member Functions
bool | init ()
bool | shutdown ()
virtual bool | configure ()
void | ref ()

## Friends
class | PluginLoader

## Detailed Description

The Plugin class is the base class for all modular functionality in the core Umbrello library. Because Umbrello is a plugin architecture, this class is derived from many times. Plugins are created via the KLibFactory of the encapsulating shared library and created from some other functional object (application, tool or plugin). After the plugin has been created, the init method is called. Before unloading, the shutdown method is called. Derived plugins can implement specific startup/shutdown behavior by overloading the onInit and onShutdown methods respectively.

By default, plugins use a configuration group called [LoadActions] in the config file. Entries in this group define any dependent or on-demand plugins that should be loaded in conjunction with this plugin. Known entries (actions) are "Load" and "LoadGUI". Because plugins can be used by both GUI and command line tools, they must be selective about some functionality. Specifically, during configuration, a plugin for a tool must not load GUI plugins.

In order to provide application-like functionality, this class offers support for accessing the configuration records of the KComponentData object corresponding to the shared library. Because the KComponentData object is only available within the scope of the shared library, the configuration records must be set in the constructor of the derived plugin class. However, because the construction name is passed to this constructor (as are the parent object and args), we can simply capture the name when the object is constructed.

## Constructor & Destructor Documentation

## ◆ ~Plugin()

Plugin::~Plugin | ( |  | ) |
| virtual

Destroy a plugin.

## ◆ Plugin()

Plugin::Plugin | ( | QObject * | parent,
|  | const char * | name,
|  | const QStringList & | args
| ) |  |
| protected

Construct a plugin

## Member Function Documentation

## ◆ category()

QString Plugin::category | ( |  | ) |
| virtual

Return the category descriptor string

## ◆ config()

KConfig * Plugin::config | ( |  | ) |

Return the configuration record for the plugin

## ◆ configure()

bool Plugin::configure | ( |  | ) |
| privatevirtual

The configure method is called by init to parse the configuration file and load any plugins. Note that the libraries loaded depends on the GUI state of the application. If the application is type Qt::Tty, then we don't use the "loadGUI" action.

Returns
  True on success, false on failure.

Implements Umbrello::Configurable.

## ◆ init()

bool Plugin::init | ( |  | ) |
| private

This method is called by the loader to initialize and configure the plugin. During initialization, any configured plugins are loaded. Before loading plugins, onInit is called to perform plugin specific initialization. This allows dependencies in the plugin chain.

Returns
  True on success, false on failure.

## ◆ instanceName()

QByteArray Plugin::instanceName | ( |  | ) | const

Return the instance name of the plugin

## ◆ onInit()

bool Plugin::onInit | ( |  | ) |
| protectedvirtual

Can be reimplemented to define plugin specific startup behavior

## ◆ onShutdown()

bool Plugin::onShutdown | ( |  | ) |
| protectedvirtual

Can be reimplemented to define plugin specific shutdown behavior

## ◆ ref()

void Plugin::ref | ( |  | ) |
| private

Add to the reference count

## ◆ shutdown()

bool Plugin::shutdown | ( |  | ) |
| private

This method is called by the loader to shutdown the plugin. During shutdown, any configured plugins are unloaded this occurs before plugin specific shutdown so as to reduce dependency errors.

Returns
  True on success, false on failure.

## ◆ unload()

void Plugin::unload | ( |  | ) |

Unload the plugin. This method actually only decrements the reference count. When the refcount is 0, the object calls shutdown and deletes itself.

## Friends And Related Function Documentation

## ◆ PluginLoader

friend class PluginLoader
| friend

## Member Data Documentation

## ◆ _config

KConfig* Umbrello::Plugin::_config
| protected

Configuration record.

## ◆ _instanceName

QByteArray Umbrello::Plugin::_instanceName
| protected

Instance name of the plugin.

## ◆ _ref

uint Umbrello::Plugin::_ref
| protected

Reference counter.

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

- umbrello/_unused/plugin.h
- umbrello/_unused/plugin.cpp