umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
|
#include <plugin.h>
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 () |
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 |
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.
|
virtual |
Destroy a plugin.
|
protected |
Construct a plugin
|
virtual |
Return the category descriptor string
KConfig * Plugin::config | ( | ) |
Return the configuration record for the plugin
|
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.
Implements Umbrello::Configurable.
|
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.
QByteArray Plugin::instanceName | ( | ) | const |
Return the instance name of the plugin
|
protectedvirtual |
Can be reimplemented to define plugin specific startup behavior
|
protectedvirtual |
Can be reimplemented to define plugin specific shutdown behavior
|
private |
Add to the reference count
|
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.
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.
|
friend |
|
protected |
Configuration record.
|
protected |
Instance name of the plugin.
|
protected |
Reference counter.