The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Extensible Class Reference

class Extensible is the parent class of many classes such as User and Channel. More...

#include <base.h>

Inheritance diagram for Extensible:

Inheritance graph
[legend]
Collaboration diagram for Extensible:

Collaboration graph
[legend]
List of all members.

Public Member Functions

template<typename T>
bool Extend (const std::string &key, T *p)
 Extend an Extensible class.
bool Extend (const std::string &key)
 Extend an Extensible class.
bool Shrink (const std::string &key)
 Shrink an Extensible class.
template<typename T>
bool GetExt (const std::string &key, T *&p)
 Get an extension item.
bool GetExt (const std::string &key)
 Get an extension item.
void GetExtList (std::deque< std::string > &list)
 Get a list of all extension items names.

Private Attributes

ExtensibleStore Extension_Items
 Private data store.

Detailed Description

class Extensible is the parent class of many classes such as User and Channel.

class Extensible implements a system which allows modules to 'extend' the class by attaching data within a map associated with the object. In this way modules can store their own custom information within user objects, channel objects and server objects, without breaking other modules (this is more sensible than using a flags variable, and each module defining bits within the flag as 'theirs' as it is less prone to conflict and supports arbitary data storage).

Definition at line 54 of file base.h.


Member Function Documentation

bool Extensible::Extend const std::string key  )  [inline]
 

Extend an Extensible class.

Parameters:
key The key parameter is an arbitary string which identifies the extension data
You must provide a key to store the data as via the parameter 'key', this single-parameter version takes no 'data' parameter, this is used purely for boolean values. The key will be inserted into the map with a NULL 'data' pointer. If the key already exists then you may not insert it twice, Extensible::Extend will return false in this case.

Returns:
Returns true on success, false if otherwise

Definition at line 95 of file base.h.

template<typename T>
bool Extensible::Extend const std::string key,
T *  p
[inline]
 

Extend an Extensible class.

Parameters:
key The key parameter is an arbitary string which identifies the extension data
p This parameter is a pointer to any data you wish to associate with the object
You must provide a key to store the data as via the parameter 'key' and store the data in the templated parameter 'p'. The data will be inserted into the map. If the data already exists, you may not insert it twice, Extensible::Extend will return false in this case.

Returns:
Returns true on success, false if otherwise

Definition at line 75 of file base.h.

Referenced by CommandWatch::add_watch(), Shun::Apply(), ModuleSQLutils::AttachList(), BanRedirect::BeforeMode(), ModuleLDAPAuth::CheckCredentials(), ModuleCgiIRC::CheckIdent(), ModuleCgiIRC::CheckPass(), GenericCapHandler(), GetData(), CommandSwhois::Handle(), CommandSilence::Handle(), CommandNicklock::Handle(), CommandDccallow::Handle(), CommandTitle::Handle(), CommandWebirc::Handle(), CommandCAP::Handle(), FounderProtectBase::HandleChange(), ModuleSafeList::HandleList(), ModuleSSLOpenSSL::Handshake(), ModuleSSLGnuTLS::Handshake(), ModuleSQLOper::LookupOper(), ModuleSWhois::OnDecodeMetaData(), ModuleSSLOpenSSL::OnDecodeMetaData(), ModuleSSLGnuTLS::OnDecodeMetaData(), ModuleSSLDummy::OnDecodeMetaData(), ModuleServicesAccount::OnDecodeMetaData(), ModuleCustomTitle::OnDecodeMetaData(), ModuleCgiIRC::OnDecodeMetaData(), ModuleCallerID::OnDecodeMetaData(), ListModeBase::OnModeChange(), NickFlood::OnModeChange(), MsgFlood::OnModeChange(), JoinFlood::OnModeChange(), ModuleSWhois::OnPostCommand(), ModuleUHNames::OnPreCommand(), ModuleNamesX::OnPreCommand(), ModuleBlockAmsg::OnPreCommand(), ModuleSQLAuth::OnRequest(), ModuleCloaking::OnUserConnect(), ModuleDelayJoin::OnUserJoin(), ModuleKickNoRejoin::OnUserKick(), ModuleSQLAuth::OnUserRegister(), ModuleLDAPAuth::OnUserRegister(), ModuleIdent::OnUserRegister(), ModuleWaitPong::OnUserRegister(), ModuleAntiBear::OnUserRegister(), SaslAuthenticator::SaslAuthenticator(), SetupExt(), ModuleSSLOpenSSL::VerifyCertificate(), and ModuleSSLGnuTLS::VerifyCertificate().

bool Extensible::GetExt const std::string key  )  [inline]
 

Get an extension item.

Parameters:
key The key parameter is an arbitary string which identifies the extension data
Returns:
Returns true if the item was found and false if it was not.
This single-parameter version only checks if the key exists, it does nothing with the 'data' field and is probably only useful in conjunction with the single-parameter version of Extend().

Definition at line 144 of file base.h.

template<typename T>
bool Extensible::GetExt const std::string key,
T *&  p
[inline]
 

Get an extension item.

Parameters:
key The key parameter is an arbitary string which identifies the extension data
p If you provide a non-existent key, this value will be NULL. Otherwise a pointer to the item you requested will be placed in this templated parameter.
Returns:
Returns true if the item was found and false if it was nor, regardless of wether 'p' is NULL. This allows you to store NULL values in Extensible.

Definition at line 120 of file base.h.

Referenced by CommandWatch::add_watch(), Shun::Apply(), ModuleSQLutils::AttachList(), BanRedirect::BeforeMode(), FounderProtectBase::CanRemoveOthers(), ModuleOperPrefixMode::CleanUser(), CommandDccallow::DisplayDCCAllowList(), ListModeBase::DisplayList(), ListModeBase::DoChannelDelete(), ListModeBase::DoOnRequest(), ListModeBase::DoSyncChannel(), ModuleDCCAllow::Expire(), GenericCapHandler(), GetData(), CommandWatch::Handle(), CommandSwhois::Handle(), cmd_sslinfo::Handle(), cmd_fingerprint::Handle(), CommandSilence::Handle(), CommandAuthenticate::Handle(), RemoveBase::Handle(), CommandNicklock::Handle(), CommandDccallow::Handle(), CommandTitle::Handle(), FounderProtectBase::HandleChange(), ModuleSafeList::HandleList(), ModuleSSLOpenSSL::Handshake(), ModuleSSLGnuTLS::Handshake(), ModuleSilence::MatchPattern(), ListModeBase::ModeSet(), OperPrefixMode::ModeSet(), NickFlood::ModeSet(), MsgFlood::ModeSet(), JoinFlood::ModeSet(), FounderProtectBase::ModeSet(), ModuleChanProtect::OnAccessCheck(), ModuleSSLOpenSSL::OnBufferFlushed(), ModuleSSLGnuTLS::OnBufferFlushed(), ModuleSafeList::OnBufferFlushed(), ModuleSQLutils::OnChannelDelete(), ModuleNickFlood::OnChannelDelete(), ModuleMsgFlood::OnChannelDelete(), ModuleKickNoRejoin::OnChannelDelete(), ModuleJoinFlood::OnChannelDelete(), ModuleCloaking::OnCheckBan(), ModuleBanException::OnCheckBan(), ModuleBanException::OnCheckExtBan(), ModuleInviteException::OnCheckInvite(), ModuleSQLAuth::OnCheckReady(), ModuleLDAPAuth::OnCheckReady(), ModuleIdent::OnCheckReady(), ModuleWaitPong::OnCheckReady(), ModuleCAP::OnCheckReady(), ModuleBanException::OnCheckStringExtBan(), Modulewatch::OnCleanup(), ModuleSWhois::OnCleanup(), ModuleSSLOpenSSL::OnCleanup(), ModuleSSLGnuTLS::OnCleanup(), ModuleServicesAccount::OnCleanup(), ModuleSafeList::OnCleanup(), ModuleCustomTitle::OnCleanup(), ModuleWaitPong::OnCleanup(), ModuleCgiIRC::OnCleanup(), ModuleBlockAmsg::OnCleanup(), ModuleBanRedirect::OnCleanup(), ModuleSWhois::OnDecodeMetaData(), ModuleSSLOpenSSL::OnDecodeMetaData(), ModuleSSLGnuTLS::OnDecodeMetaData(), ModuleSSLDummy::OnDecodeMetaData(), ModuleServicesAccount::OnDecodeMetaData(), ModuleCustomTitle::OnDecodeMetaData(), ModuleCgiIRC::OnDecodeMetaData(), ModuleSASL::OnEvent(), ModuleDelayJoin::OnHostCycle(), ListModeBase::OnModeChange(), NickFlood::OnModeChange(), MsgFlood::OnModeChange(), KickRejoin::OnModeChange(), JoinFlood::OnModeChange(), CloakUser::OnModeChange(), ModuleUHNames::OnNamesListItem(), ModuleNamesX::OnNamesListItem(), ModuleDelayJoin::OnNamesListItem(), ModuleSWhois::OnPostCommand(), ModuleSSLOpenSSL::OnPostConnect(), ModuleSSLGnuTLS::OnPostConnect(), ModuleSASL::OnPostConnect(), ModuleOperSSLCert::OnPreCommand(), ModuleShun::OnPreCommand(), ModuleWaitPong::OnPreCommand(), ModuleBlockAmsg::OnPreCommand(), ModuleAntiBear::OnPreCommand(), ModuleSSLOpenSSL::OnRawSocketClose(), ModuleSSLGnuTLS::OnRawSocketClose(), ModuleSQLOper::OnRequest(), ModuleSQLAuth::OnRequest(), ModuleSWhois::OnSyncUserMetaData(), ModuleSSLOpenSSL::OnSyncUserMetaData(), ModuleSSLGnuTLS::OnSyncUserMetaData(), ModuleSSLDummy::OnSyncUserMetaData(), ModuleServicesAccount::OnSyncUserMetaData(), ModuleCustomTitle::OnSyncUserMetaData(), ModuleCloaking::OnSyncUserMetaData(), ModuleCgiIRC::OnSyncUserMetaData(), ModuleDelayJoin::OnText(), ModuleCloaking::OnUserConnect(), ModuleCgiIRC::OnUserConnect(), ModuleSQLutils::OnUserDisconnect(), ModuleSASL::OnUserDisconnect(), ModuleIdent::OnUserDisconnect(), ModuleWaitPong::OnUserDisconnect(), ModuleCloaking::OnUserDisconnect(), ModuleJoinFlood::OnUserJoin(), ModuleDelayJoin::OnUserJoin(), ModuleKickNoRejoin::OnUserKick(), ModuleDelayJoin::OnUserKick(), ModuleDelayJoin::OnUserPart(), ModuleSSLModes::OnUserPreJoin(), ModuleServicesAccount::OnUserPreJoin(), ModuleRegOnlyCreate::OnUserPreJoin(), ModuleKickNoRejoin::OnUserPreJoin(), ModuleJoinFlood::OnUserPreJoin(), ModuleBanRedirect::OnUserPreJoin(), ModuleServicesAccount::OnUserPreMessage(), ModuleNickLock::OnUserPreNick(), ModuleNickFlood::OnUserPreNick(), ModuleDCCAllow::OnUserPreNotice(), Modulewatch::OnUserQuit(), ModuleSWhois::OnUserQuit(), ModuleSilence::OnUserQuit(), ModuleServicesAccount::OnUserQuit(), ModuleDelayJoin::OnUserQuit(), ModuleDCCAllow::OnUserQuit(), ModuleCustomTitle::OnUserQuit(), ModuleSASL::OnUserRegister(), ModuleSSLOpenSSL::OnWhois(), ModuleSSLGnuTLS::OnWhois(), ModuleSSLDummy::OnWhois(), ModuleServicesAccount::OnWhois(), ModuleSWhois::OnWhoisLine(), ModuleCustomTitle::OnWhoisLine(), ModuleMsgFlood::ProcessMessages(), ModuleChanFilter::ProcessMessages(), CommandWatch::remove_watch(), RemoveData(), ModuleSQLutils::RemoveFromList(), ListModeBase::RemoveMode(), ModuleDCCAllow::RemoveNick(), and SetupExt().

void Extensible::GetExtList std::deque< std::string > &  list  ) 
 

Get a list of all extension items names.

Parameters:
list A deque of strings to receive the list
Returns:
This function writes a list of all extension items stored in this object by name into the given deque and returns void.

Definition at line 38 of file base.cpp.

References Extension_Items.

Referenced by CommandTaxonomy::Handle().

bool Extensible::Shrink const std::string key  ) 
 

Shrink an Extensible class.

Parameters:
key The key parameter is an arbitary string which identifies the extension data
You must provide a key name. The given key name will be removed from the classes data. If you provide a nonexistent key (case is important) then the function will return false.
Returns:
Returns true on success.

Definition at line 29 of file base.cpp.

References Extension_Items.

Referenced by BanRedirect::BeforeMode(), ModuleOperPrefixMode::CleanUser(), ListModeBase::DoChannelDelete(), GenericCapHandler(), CommandWatch::Handle(), CommandSwhois::Handle(), CommandSilence::Handle(), CommandNickunlock::Handle(), CommandDccallow::Handle(), CommandTitle::Handle(), CommandCAP::Handle(), FounderProtectBase::HandleChange(), ModuleSafeList::HandleList(), ModuleSafeList::OnBufferFlushed(), ModuleSQLutils::OnChannelDelete(), ModuleNickFlood::OnChannelDelete(), ModuleMsgFlood::OnChannelDelete(), ModuleKickNoRejoin::OnChannelDelete(), ModuleJoinFlood::OnChannelDelete(), Modulewatch::OnCleanup(), ModuleSWhois::OnCleanup(), ModuleSSLOpenSSL::OnCleanup(), ModuleSSLGnuTLS::OnCleanup(), ModuleServicesAccount::OnCleanup(), ModuleSafeList::OnCleanup(), ModuleNickLock::OnCleanup(), ModuleCustomTitle::OnCleanup(), ModuleWaitPong::OnCleanup(), ModuleCgiIRC::OnCleanup(), ModuleBlockAmsg::OnCleanup(), ModuleBanRedirect::OnCleanup(), ModuleSWhois::OnDecodeMetaData(), ModuleServicesAccount::OnDecodeMetaData(), ModuleSASL::OnEvent(), ListModeBase::OnModeChange(), NickFlood::OnModeChange(), MsgFlood::OnModeChange(), KickRejoin::OnModeChange(), JoinFlood::OnModeChange(), ModuleSWhois::OnPostCommand(), ModuleShun::OnPreCommand(), ModuleWaitPong::OnPreCommand(), ModuleAntiBear::OnPreCommand(), ModuleSSLOpenSSL::OnRawSocketClose(), ModuleSSLGnuTLS::OnRawSocketClose(), ModuleDelayJoin::OnText(), ModuleCgiIRC::OnUserConnect(), ModuleSQLutils::OnUserDisconnect(), ModuleSQLAuth::OnUserDisconnect(), ModuleSASL::OnUserDisconnect(), ModuleLDAPAuth::OnUserDisconnect(), ModuleIdent::OnUserDisconnect(), ModuleWaitPong::OnUserDisconnect(), ModuleCloaking::OnUserDisconnect(), ModuleChanProtect::OnUserKick(), ModuleChanProtect::OnUserPart(), ModuleKickNoRejoin::OnUserPreJoin(), Modulewatch::OnUserQuit(), ModuleSWhois::OnUserQuit(), ModuleSilence::OnUserQuit(), ModuleServicesAccount::OnUserQuit(), ModuleNickLock::OnUserQuit(), ModuleDCCAllow::OnUserQuit(), ModuleCustomTitle::OnUserQuit(), ModuleSASL::OnUserRegister(), CommandWatch::remove_watch(), RemoveData(), ModuleSQLutils::RemoveFromList(), and SaslAuthenticator::~SaslAuthenticator().


Member Data Documentation

ExtensibleStore Extensible::Extension_Items [private]
 

Private data store.

Holds all extensible metadata for the class.

Definition at line 59 of file base.h.

Referenced by GetExtList(), and Shrink().


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