Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Plugin Class Reference

#include <elm/sys/Plugin.h>

Classes

class  make
 

Public Types

typedef Array< stringaliases_t
 
typedef List< Plugin * >::Iter DepIter
 

Public Member Functions

 Plugin (string name, const Version &plugger_version, CString hook="", const aliases_t &aliases=aliases_t::null)
 
 Plugin (const make &maker)
 
virtual ~Plugin (void)
 
string name (void) const
 
CString description (void) const
 
CString licence (void) const
 
const VersionpluginVersion (void) const
 
const VersionpluggerVersion (void) const
 
CString hook (void) const
 
const aliases_taliases (void) const
 
bool matches (const string &name) const
 
void unplug (void)
 
const Pathpath (void) const
 
DepIter dependencies (void) const
 

Static Public Attributes

static const t::uint32 MAGIC = 0xCAFEBABE
 

Protected Member Functions

virtual void startup (void)
 
virtual void cleanup (void)
 

Protected Attributes

CString _description
 
CString _licence
 
Version _plugin_version
 

Detailed Description

The class Plugin allows implementing plug-ins in OS-independent way. See Plugins for more details.

Member Typedef Documentation

◆ aliases_t

◆ DepIter

typedef List<Plugin *>::Iter DepIter

Constructor & Destructor Documentation

◆ Plugin() [1/2]

Plugin ( string  name,
const Version plugger_version,
CString  hook = "",
const aliases_t aliases = aliases_t::null 
)

Build a new plugin.

Parameters
namePlugin name.
plugger_versionPlugger version (used for checking compatibility between plugin and user application API).
hookHook of a matching plugger
aliasesName aliases for the plugin.

References Plugin::aliases(), and Plugin::hook().

◆ Plugin() [2/2]

Plugin ( const make maker)

New-style builder for plugin using Plugin::Maker.

Parameters
makerMaker for plugin.

References Vector< T, E, A >::addAll(), and Vector< T, E, A >::detach().

◆ ~Plugin()

~Plugin ( void  )
virtual

Member Function Documentation

◆ aliases()

const aliases_t & aliases ( void  ) const
inline

Get the table of aliases of the plugin.

Returns
Table of aliases.

Referenced by Plugin::Plugin().

◆ cleanup()

void cleanup ( void  )
protectedvirtual

This method is called just before the plugin removal from the user application. It may be overriden for performing specific clean up.

Referenced by Plugin::unplug().

◆ dependencies()

DepIter dependencies ( void  ) const
inline

◆ description()

String description ( void  ) const
inline

Get the plugin description.

Returns
Plugin description.

References Plugin::_description.

◆ hook()

String hook ( void  ) const
inline

Get the hook of the current plugin.

Returns
Plugin hook.

Referenced by Plugin::Plugin().

◆ licence()

String licence ( void  ) const
inline

Get the plugin licence.

Returns
Plugin licence.

References Plugin::_licence.

◆ matches()

bool matches ( const string name) const

Test if the current plugin matches the given name, that is, if the name or one of the aliases matches the name.

Parameters
nameName to test.
Returns
True if the name is matched, false else.

References Plugin::name().

◆ name()

string name ( void  ) const
inline

Get the plugin name.

Returns
Plugin name.

Referenced by Plugin::matches().

◆ path()

const Path& path ( void  ) const
inline

◆ pluggerVersion()

Version & pluggerVersion ( void  ) const
inline

Get the plugger version.

Returns
Plugger version.

Referenced by Plugger::plugFile().

◆ pluginVersion()

Version & pluginVersion ( void  ) const
inline

Get the plugin version.

Returns
Plugin version.

References Plugin::_plugin_version.

◆ startup()

void startup ( void  )
protectedvirtual

This method is called just after the plugin has been plugged into the user application. It may be overriden for performing specific initializations.

◆ unplug()

void unplug ( void  )

Call it when the plugin is no more used.

References Plugin::cleanup().

Member Data Documentation

◆ _description

CString _description
protected

Referenced by Plugin::description().

◆ _licence

CString _licence
protected

Referenced by Plugin::licence().

◆ _plugin_version

Version _plugin_version
protected

Referenced by Plugin::pluginVersion().

◆ MAGIC

const t::uint32 MAGIC = 0xCAFEBABE
static

Referenced by Plugger::plugFile().


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