umbrello API Documentation

Umbrello::Plugin Class Reference
[class class Umbrello2 API]

#include <plugin.h>

Inheritance diagram for Umbrello::Plugin:

Umbrello::Configurable List of all members.

Public Member Functions

virtual ~Plugin ()
 Destroy a plugin.
QCString instanceName () const
 Return the instance name of the plugin.
KConfig * config ()
 Return the configuration record for the plugin.
virtual QString category ()
 Return the category descriptor string.
void unload ()
 Unload the plugin.

Protected Member Functions

 Plugin (QObject *parent, const char *name, const QStringList &args)
 Construct a plugin.
virtual bool onInit ()
 Can be reimplemented to define plugin specific startup behavior.
virtual bool onShutdown ()
 Can be reimplemented to define plugin specific shutdown behavior.

Protected Attributes

uint _ref
 Reference counter.
QCString _instanceName
 Instance name of the plugin.
KConfig * _config
 Configuration record.

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 dependant 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 KInstance object corresponding to the shared library. Because the KInstance 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.

Definition at line 87 of file plugin.h.


Constructor & Destructor Documentation

Plugin::~Plugin  )  [virtual]
 

Destroy a plugin.

Definition at line 42 of file plugin.cpp.

Plugin::Plugin QObject *  parent,
const char *  name,
const QStringList &  args
[protected]
 

Construct a plugin.

Definition at line 31 of file plugin.cpp.


Member Function Documentation

QCString Plugin::instanceName  )  const
 

Return the instance name of the plugin.

Definition at line 110 of file plugin.cpp.

References _instanceName.

KConfig * Plugin::config  ) 
 

Return the configuration record for the plugin.

Definition at line 116 of file plugin.cpp.

References _config.

QString Plugin::category  )  [virtual]
 

Return the category descriptor string.

Definition at line 162 of file plugin.cpp.

Referenced by Umbrello::PluginLoader::loadPlugin().

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.

Definition at line 53 of file plugin.cpp.

References _instanceName, _ref, Umbrello::PluginLoader::instance(), and Umbrello::PluginLoader::unloadPlugin().

Referenced by Umbrello::Configurable::unloadPlugins().

bool Plugin::onInit  )  [protected, virtual]
 

Can be reimplemented to define plugin specific startup behavior.

Definition at line 122 of file plugin.cpp.

bool Plugin::onShutdown  )  [protected, virtual]
 

Can be reimplemented to define plugin specific shutdown behavior.

Definition at line 128 of file plugin.cpp.


Member Data Documentation

uint Umbrello::Plugin::_ref [protected]
 

Reference counter.

Definition at line 157 of file plugin.h.

Referenced by unload().

QCString Umbrello::Plugin::_instanceName [protected]
 

Instance name of the plugin.

Definition at line 158 of file plugin.h.

Referenced by instanceName(), and unload().

KConfig* Umbrello::Plugin::_config [protected]
 

Configuration record.

Definition at line 159 of file plugin.h.

Referenced by config().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:09 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003