All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions
Qtilities::Plugins::Template::PluginTemplate Class Reference

A template which can is a starting point to creating plugins to be used with the Qtilities extension system. More...

#include <PluginTemplate.h>

Inheritance diagram for Qtilities::Plugins::Template::PluginTemplate:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void finalize ()
 This function is called before a plugin is unloaded in the system.
bool initialize (const QStringList &arguments, QStringList *error_strings)
 This function is called when the plugin is loaded.
bool initializeDependencies (QStringList *error_strings)
 This function is called when all the plugins in the system were loaded and initialized.
QObject * objectBase ()
 Returns the QObject* base of the interface.
const QObject * objectBase () const
 Returns a const QObject* base of the interface.
QtilitiesCategory pluginCategory () const
 The category of the plugin.
QString pluginCopyright () const
 The copyright information of the plugin.
QString pluginDescription () const
 A description for the plugin.
QString pluginLicense () const
 The licensing details of the plugin.
QString pluginName () const
 The name of the plugin.
QString pluginPublisher () const
 The name of the plugin's publisher.
QString pluginPublisherContact () const
 The contact details (in the form of an email address) of the plugin's publisher.
QString pluginPublisherWebsite () const
 The website of the plugin's publisher.
VersionInformation pluginVersionInformation () const
 The version information of the plugin.
- Public Member Functions inherited from Qtilities::ExtensionSystem::Interfaces::IPlugin
void addErrorMessage (const QString &error_string)
 Adds a error message to list of error associated with the plugin.
void addErrorMessages (const QStringList &error_strings)
 Adds error messages to list of error associated with the plugin.
void addPluginState (PluginState state)
 Adds a PluginState the PluginStateFlags of the plugin.
QStringList errorMessages () const
 Gets the error messages associated with the plugin.
bool hasErrors () const
 Indicates if there are errors messages associated with this plugin.
QString pluginFileName () const
 Gets the plugin file name.
PluginStateFlags pluginState () const
 Gets the plugin state.
QString pluginStateString () const
 Function which returns a string associated with a the plugin's state.
void setPluginFileName (const QString &file_name)
 Sets the plugin file name.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IObjectBase
QString objectOriginID () const
 Allows interfaces to provide some sort of source identification.
void setObjectOriginID (const QString &object_origin_id)
 Allows setting of the object source ID of this interface implementation.

Additional Inherited Members

- Public Types inherited from Qtilities::ExtensionSystem::Interfaces::IPlugin
enum  PluginState { Functional = 0, IncompatibleState = 1, ErrorState = 2, InActive = 4 }
 The possible states in which a plugin can be. More...

Detailed Description

A template which can is a starting point to creating plugins to be used with the Qtilities extension system.

This plugin provides a template which can be used to create plugins based on the Qtilities extension system. This class is the entry point into the plugin and is an implementation of the Qtilities::ExtensionSystem::Interfaces::IPlugin interface.


Member Function Documentation

void Qtilities::Plugins::Template::PluginTemplate::finalize ( )
virtual

This function is called before a plugin is unloaded in the system.

If your plugin needs to do something before it is unloaded (save settings for example), do it in here.

Reimplemented from Qtilities::ExtensionSystem::Interfaces::IPlugin.

bool Qtilities::Plugins::Template::PluginTemplate::initialize ( const QStringList &  arguments,
QStringList *  error_strings 
)
virtual

This function is called when the plugin is loaded.

Use this implementation to register objects in the global object pool. Typically one plugin will look for objects in other plugins which implements a specific interface. These objects, the ones implementing the interfaces, must be added to the global object pool in this function.

Parameters:
argumentsA list of possible arguments to be sent to the plugin during initialization.
error_stringsPlugins can add error/warning strings to this list when they detect errors.
Returns:
True if the plugin was successfully initialized, false otherwise.

Implements Qtilities::ExtensionSystem::Interfaces::IPlugin.

bool Qtilities::Plugins::Template::PluginTemplate::initializeDependencies ( QStringList *  error_strings)
virtual

This function is called when all the plugins in the system were loaded and initialized.

If you have an object which looks for specific interfaces in the global object pool, do the search here.

Parameters:
error_stringsPlugins can add error/warning strings to this list when they detect errors.
Returns:
True if dependancies were successfully initialized, false otherwise.

Implements Qtilities::ExtensionSystem::Interfaces::IPlugin.

const QObject* Qtilities::Plugins::Template::PluginTemplate::objectBase ( ) const
inlinevirtual

Returns a const QObject* base of the interface.

This function can be used in const methods, but make sure that you don't modify things that should stay const. An example where this is used is when we want to get a property on an object in a const method. This is a const operation.

Implements Qtilities::Core::Interfaces::IObjectBase.

Qtilities::Core::VersionInformation Qtilities::Plugins::Template::PluginTemplate::pluginVersionInformation ( ) const
virtual

The version information of the plugin.

If your plugin does not depend on the application it is used in, you can return an empty list of supported versions (this is the default) to let the extension system know not to check the compatibility of your plugin.

Here is an example implementation of this function:

// Create a version information object with the version of the plugin:
VersionInformation version_info(1,0,1);
// Next add a compatible application version:
VersionNumber compatible_version(1,0,0);
// Add it as a compatible version to our version information for this plugin:
version_info << compatible_version;
// Return the version information object:
return version_info;

Implements Qtilities::ExtensionSystem::Interfaces::IPlugin.



Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé