Plugin Class Reference

Class that manage a plugin. More...

#include <plugin.h>

Inheritance diagram for Plugin:

Admin Advertising AntiFlood BZRH CTCP DansTonChat Fedorafr FedoraProject GameServer Ignore Infos IpConverting Lamoule LogFactory Magic8Ball Moderation Module Ping PluginSample PostConnect Quotes RemoteControl Slapme Survey Tele Trad UsersInfos

List of all members.

Public Member Functions

 Plugin ()
 Constructor.
virtual ~Plugin ()
 Destructor.
vector< StructFunctionStoragegetFunctions ()
 Return plugin functions.
string getAuthor ()
 Return author.
string getDescription ()
 Return description.
string getVersion ()
 Return version.
string getName ()
 Return name.
bool checkMembers ()
 Check if all members are given.
void bindFunction (string, func_type, string, time_t, unsigned int)
 Register a plugin function.
void * getHandle ()
 Get plugin's handle.
void setHandle (void *)
 Set plugin's handle.
void addRequirement (string)
 Add a plugin that is required for the plugin.
vector< string > getRequirements ()
 Get requirements list.
bool requires (string)
 Tell if this plugin requires an other one.

Protected Attributes

string author
 Plugin author.
string description
 Plugin descritpion.
string version
 Plugin version.
string name
 Plugin name.
vector< StructFunctionStoragefuncs
 PLugins functions.
void * handle
 Stores plugin's handle.
vector< string > requirements
 stores plugins names that are required for the plugin


Detailed Description

Class that manage a plugin.

This class is a plugin head witch all the plugin class must derive. It contains function to get functions from the plugin, and check if all informations are given

Definition at line 83 of file plugin.h.


Constructor & Destructor Documentation

Plugin::Plugin (  ) 

Constructor.

Class constructor Initialize private attributes

Definition at line 35 of file plugin.cpp.

References author, description, funcs, handle, name, requirements, and version.

Plugin::~Plugin (  )  [virtual]

Destructor.

Class destructor

Definition at line 49 of file plugin.cpp.


Member Function Documentation

void Plugin::addRequirement ( string  plugin  ) 

Add a plugin that is required for the plugin.

Add a requirement for this plugin. It means that to load this plugin the requirement will have to be loaded before.

Parameters:
plugin Plugin that is required

Definition at line 163 of file plugin.cpp.

References requirements.

Referenced by Advertising::Advertising(), AntiFlood::AntiFlood(), FedoraProject::FedoraProject(), Ignore::Ignore(), Lamoule::Lamoule(), LogFactory::LogFactory(), Moderation::Moderation(), Module::Module(), Quotes::Quotes(), and Survey::Survey().

void Plugin::bindFunction ( string  highlightedWord,
func_type  type,
string  symbole,
time_t  lastExec,
unsigned int  timeout 
)

Register a plugin function.

Bind a plugin function. Called in plugin constructor, it initialise the function registration (before kernel). Used after plugin constructor has no effect (use kernel -> registerFunction instead)

Parameters:
highlightedWord Highlighted word (command), or time between two executions in seconds ( for IN_LOOP plugins )
type Function type
symbole function name to execute
lastExec last time plugin was executed
timeout Timeout for function (in seconds)

Definition at line 126 of file plugin.cpp.

References funcs, StructFunctionStorage::function, StructFunctionStorage::handle, StructFunctionStorage::highlightedWord, StructFunctionStorage::lastExec, StructFunctionStorage::object, StructFunctionStorage::symbole, StructFunctionStorage::timeout, and StructFunctionStorage::type.

Referenced by Admin::Admin(), Advertising::Advertising(), AntiFlood::AntiFlood(), BZRH::BZRH(), CTCP::CTCP(), DansTonChat::DansTonChat(), Fedorafr::Fedorafr(), FedoraProject::FedoraProject(), GameServer::GameServer(), Ignore::Ignore(), Infos::Infos(), IpConverting::IpConverting(), Lamoule::Lamoule(), LogFactory::LogFactory(), Magic8Ball::Magic8Ball(), Moderation::Moderation(), Module::Module(), Ping::Ping(), PluginSample::PluginSample(), PostConnect::PostConnect(), Quotes::Quotes(), RemoteControl::RemoteControl(), Slapme::Slapme(), Survey::Survey(), Tele::Tele(), Trad::Trad(), and UsersInfos::UsersInfos().

bool Plugin::checkMembers (  ) 

Check if all members are given.

Check if all attributes have benn completed

Returns:
True if ok, else false

Definition at line 102 of file plugin.cpp.

References funcs, getAuthor(), getDescription(), getName(), and getVersion().

Referenced by BotKernel::loadPlugin().

string Plugin::getAuthor (  ) 

Return author.

Get plugin author

Returns:
plugin author

Definition at line 57 of file plugin.cpp.

References author.

Referenced by checkMembers(), and moduleinfos().

string Plugin::getDescription (  ) 

Return description.

Get plugin description

Returns:
plugin description

Definition at line 66 of file plugin.cpp.

References description.

Referenced by checkMembers(), and moduleinfos().

vector< StructFunctionStorage > Plugin::getFunctions (  ) 

Return plugin functions.

Return shared functions

Returns:
Shared functions

Definition at line 93 of file plugin.cpp.

References funcs.

Referenced by BotKernel::loadPlugin().

void * Plugin::getHandle (  ) 

Get plugin's handle.

Get plugin's handle

Returns:
Plugin's handle

Definition at line 144 of file plugin.cpp.

References handle.

Referenced by BotKernel::addCountDown(), and BotKernel::registerFunction().

string Plugin::getName (  ) 

vector< string > Plugin::getRequirements (  ) 

Get requirements list.

Get requirements list.

Returns:
Requirements list (vector)

Definition at line 172 of file plugin.cpp.

References requirements.

Referenced by BotKernel::loadPlugin().

string Plugin::getVersion (  ) 

Return version.

Get plugin version

Returns:
plugin version

Definition at line 75 of file plugin.cpp.

References version.

Referenced by checkMembers(), and moduleinfos().

bool Plugin::requires ( string  plugin  ) 

Tell if this plugin requires an other one.

Tell if this plugin requires an other one.

Parameters:
plugin Plugin to test
Returns:
true is this plugin requires the given one, else false

Definition at line 182 of file plugin.cpp.

References Tools::isInVector(), and requirements.

void Plugin::setHandle ( void *  handle  ) 

Set plugin's handle.

Set plugin's handle

Parameters:
handle Plugin's handle

Definition at line 153 of file plugin.cpp.

Referenced by BotKernel::loadPlugin().


Member Data Documentation

string Plugin::author [protected]

string Plugin::description [protected]

vector<StructFunctionStorage> Plugin::funcs [protected]

PLugins functions.

Definition at line 94 of file plugin.h.

Referenced by bindFunction(), checkMembers(), getFunctions(), and Plugin().

void* Plugin::handle [protected]

Stores plugin's handle.

Definition at line 96 of file plugin.h.

Referenced by getHandle(), and Plugin().

string Plugin::name [protected]

vector<string> Plugin::requirements [protected]

stores plugins names that are required for the plugin

Definition at line 98 of file plugin.h.

Referenced by addRequirement(), getRequirements(), Plugin(), and requires().

string Plugin::version [protected]


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

Generated on Sun Aug 16 15:28:52 2009 for trustyRC by  doxygen 1.5.8