Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

Extensible Class Reference

class Extensible is the parent class of many classes such as userrec and chanrec. More...

#include <base.h>

Inherits classbase.

Inherited by chanrec, command_t, connection, and ircd_connector.

List of all members.

Public Member Functions

bool Extend (std::string key, char *p)
 Extend an Extensible class.

bool Shrink (std::string key)
 Shrink an Extensible class.

char * GetExt (std::string key)
 Get an extension item.


Private Attributes

std::map< std::string, char * > Extension_Items
 Private data store.


Detailed Description

class Extensible is the parent class of many classes such as userrec and chanrec.

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 50 of file base.h.


Member Function Documentation

bool Extensible::Extend std::string  key,
char *  p
 

Extend an Extensible class.

You must provide a key to store the data as, and a void* to the data (typedef VoidPointer) 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. On successful extension, Extend returns true.

char* Extensible::GetExt std::string  key  ) 
 

Get an extension item.

You must provide a key name, which is case sensitive. If you provide a non-existent key name, the function returns NULL, otherwise a pointer to the item referenced by the key is returned.

bool Extensible::Shrink std::string  key  ) 
 

Shrink an Extensible class.

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 true on success.


Member Data Documentation

std::map<std::string,char*> Extensible::Extension_Items [private]
 

Private data store.

Definition at line 54 of file base.h.


The documentation for this class was generated from the following file:
Generated on Sat May 7 15:34:25 2005 for InspIRCd by doxygen 1.3.3