• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messageviewer

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
PluginLoader< T, T_config > Class Template Reference

#include <pluginloader.h>

Inheritance diagram for PluginLoader< T, T_config >:
Inheritance graph
[legend]

Public Member Functions

virtual ~PluginLoader ()
 
virtual T * createForName (const QString &type) const
 
virtual void scan ()
 
- Public Member Functions inherited from PluginLoaderBase
const PluginMetaData * infoForName (const QString &type) const
 
QStringList types () const
 

Static Public Member Functions

static PluginLoader< T,
T_config > * 
instance ()
 

Protected Member Functions

 PluginLoader ()
 
- Protected Member Functions inherited from PluginLoaderBase
 PluginLoaderBase ()
 
virtual ~PluginLoaderBase ()
 
void doScan (const char *path)
 
KLibrary::void_function_ptr mainFunc (const QString &type, const char *main_func) const
 

Detailed Description

template<typename T, typename T_config>
class PluginLoader< T, T_config >

A generic plugin loader for when KPart::Plugin is overkill.

Author
Marc Mutz mutz@.nosp@m.kde..nosp@m.org based on KABC's FormatFactory

This is a generic plugin loader / factory for small plugins that don't want to be QObjects.

Usage

A PluginLoader takes two template arguments, T and T_config:

T
The type of object to return
T_config::mainfunc
The suffix of the factory function to call in the library to obtain a new object of type T. The string passed to KLibrary::symbol() is libName_mainfunc.
T_config::path
The search pattern for .desktop files containing the plugin descriptions. This is the string passed as the filter argument to KStandardDirs::findAllResources.

The last two parameters being strings, they are passed via an encapsulating class, of which mainfunc and path are public static members:

struct MyObjectPluginLoaderConfig {
  static const char * const mainfunc;
  static const char * const path;
};
const char * const MyObjectPluginLoaderConfig::mainfunc = "myapp_create_myobject";
const char * const MyObjectPluginLoaderConfig::path = "myapp/plugins/ *.desktop";

You would then use a typedef to create a less unwieldy name for your plugin loader:

typedef PluginLoader< MyObject, MyObjectPluginLoaderConfig > MyObjectPluginLoader;

All of this is what the DEFINE_PLUGIN_LOADER(pluginloadername,type,mainfunc,path) macro achieves.

Definition at line 78 of file pluginloader.h.

Constructor & Destructor Documentation

template<typename T, typename T_config>
PluginLoader< T, T_config >::PluginLoader ( )
inlineprotected

Definition at line 80 of file pluginloader.h.

template<typename T, typename T_config>
virtual PluginLoader< T, T_config >::~PluginLoader ( )
inlinevirtual

Definition at line 86 of file pluginloader.h.

Member Function Documentation

template<typename T, typename T_config>
virtual T* PluginLoader< T, T_config >::createForName ( const QString &  type) const
inlinevirtual

Returns a pointer to a plugin object (of type T) or a null pointer if the type wasn't found.

You can extend this method for when you want to handle builtin types

Definition at line 107 of file pluginloader.h.

template<typename T, typename T_config>
static PluginLoader<T,T_config>* PluginLoader< T, T_config >::instance ( )
inlinestatic

Returns the single instance of this loader.

Definition at line 89 of file pluginloader.h.

template<typename T, typename T_config>
virtual void PluginLoader< T, T_config >::scan ( )
inlinevirtual

Rescans the plugin directory to find any newly installed plugins.

Implements PluginLoaderBase.

Definition at line 100 of file pluginloader.h.


The documentation for this class was generated from the following file:
  • pluginloader.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messageviewer

Skip menu "messageviewer"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal