InspIRCd  3.0
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
ExtensionItem Class Referenceabstract

#include <extensible.h>

Inheritance diagram for ExtensionItem:
ServiceProvider usecountbase classbase LocalIntExt SimpleExtItem< T, Del > SimpleExtItem< ChanData > SimpleExtItem< std::string > StringExtItem LocalStringExt

Public Types

enum  ExtensibleType { EXT_USER, EXT_CHANNEL, EXT_MEMBERSHIP }
 

Public Member Functions

 ExtensionItem (const std::string &key, ExtensibleType exttype, Module *owner)
 
virtual ~ExtensionItem ()
 
virtual void FromInternal (Extensible *container, const std::string &value)
 
virtual void FromNetwork (Extensible *container, const std::string &value)
 
virtual std::string ToHuman (const Extensible *container, void *item) const
 
virtual std::string ToInternal (const Extensible *container, void *item) const
 
virtual std::string ToNetwork (const Extensible *container, void *item) const
 
virtual void free (Extensible *container, void *item)=0
 
void RegisterService () CXX11_OVERRIDE
 
 DEPRECATED_METHOD (virtual std::string serialize(SerializeFormat format, const Extensible *container, void *item) const)
 
 DEPRECATED_METHOD (virtual void unserialize(SerializeFormat format, Extensible *container, const std::string &value))
 
- Public Member Functions inherited from ServiceProvider
 ServiceProvider (Module *Creator, const std::string &Name, ServiceType Type)
 
void DisableAutoRegister ()
 
- Public Member Functions inherited from classbase
virtual CullResult cull ()
 
- Public Member Functions inherited from usecountbase
unsigned int GetUseCount () const
 
void refcount_inc () const
 
bool refcount_dec () const
 

Public Attributes

const ExtensibleType type
 
- Public Attributes inherited from ServiceProvider
ModuleRef creator
 
const std::string name
 
const ServiceType service
 

Protected Member Functions

void * get_raw (const Extensible *container) const
 
void * set_raw (Extensible *container, void *value)
 
void * unset_raw (Extensible *container)
 

Detailed Description

Base class for logic that extends an Extensible object.

Member Enumeration Documentation

◆ ExtensibleType

Types of Extensible that an ExtensionItem can apply to.

Enumerator
EXT_USER 

The ExtensionItem applies to a User object.

EXT_CHANNEL 

The ExtensionItem applies to a Channel object.

EXT_MEMBERSHIP 

The ExtensionItem applies to a Membership object.

Constructor & Destructor Documentation

◆ ExtensionItem()

ExtensionItem::ExtensionItem ( const std::string &  key,
ExtensibleType  exttype,
Module owner 
)

Initializes an instance of the ExtensionItem class.

Parameters
keyThe name of the extension item (e.g. ssl_cert).
exttypeThe type of Extensible that this ExtensionItem applies to.
ownerThe module which created this ExtensionItem

◆ ~ExtensionItem()

ExtensionItem::~ExtensionItem ( )
virtual

Destroys an instance of the ExtensionItem class.

Member Function Documentation

◆ DEPRECATED_METHOD() [1/2]

ExtensionItem::DEPRECATED_METHOD ( virtual std::string serialize(SerializeFormat format, const Extensible *container, void *item) const  )

DEPRECATED: use To{Human,Internal,Network} instead.

◆ DEPRECATED_METHOD() [2/2]

ExtensionItem::DEPRECATED_METHOD ( virtual void   unserializeSerializeFormat format, Extensible *container, const std::string &value)

DEPRECATED: use From{Internal,Network} instead.

◆ free()

virtual void ExtensionItem::free ( Extensible container,
void *  item 
)
pure virtual

Deallocates the specified ExtensionItem value.

Parameters
containerThe container that the ExtensionItem is set on.
itemThe item to deallocate.

Implemented in StringExtItem, LocalIntExt, SimpleExtItem< T, Del >, SimpleExtItem< std::string >, and SimpleExtItem< ChanData >.

◆ FromInternal()

void ExtensionItem::FromInternal ( Extensible container,
const std::string &  value 
)
virtual

Sets an ExtensionItem using a value in the internal format.

Parameters
containerA container the ExtensionItem should be set on.
valueA value in the internal format.

Reimplemented in LocalIntExt, and LocalStringExt.

◆ FromNetwork()

void ExtensionItem::FromNetwork ( Extensible container,
const std::string &  value 
)
virtual

Sets an ExtensionItem using a value in the network format.

Parameters
containerA container the ExtensionItem should be set on.
valueA value in the network format.

Reimplemented in StringExtItem.

◆ get_raw()

void * ExtensionItem::get_raw ( const Extensible container) const
protected

Retrieves the value for this ExtensionItem from the internal map.

Parameters
containerThe container that the ExtensionItem is set on.
Returns
Either the value of this ExtensionItem or NULL if it is not set.

◆ RegisterService()

void ExtensionItem::RegisterService ( )
virtual

Registers this object with the ExtensionManager.

Reimplemented from ServiceProvider.

◆ set_raw()

void * ExtensionItem::set_raw ( Extensible container,
void *  value 
)
protected

Stores a value for this ExtensionItem in the internal map and returns the old value if one was set.

Parameters
containerA container the ExtensionItem should be set on.
valueThe value to set on the specified container.
Returns
Either the old value or NULL if one is not set.

◆ ToHuman()

std::string ExtensionItem::ToHuman ( const Extensible container,
void *  item 
) const
virtual

Gets an ExtensionItem's value in a human-readable format.

Parameters
containerThe container the ExtensionItem is set on.
itemThe value to convert to a human-readable format.
Returns
The value specified in item in a human readable format.

◆ ToInternal()

std::string ExtensionItem::ToInternal ( const Extensible container,
void *  item 
) const
virtual

Gets an ExtensionItem's value in the internal format.

Parameters
containerThe container the ExtensionItem is set on.
itemThe value to convert to the internal format.
Returns
The value specified in item in the internal format.

Reimplemented in LocalIntExt, and LocalStringExt.

◆ ToNetwork()

std::string ExtensionItem::ToNetwork ( const Extensible container,
void *  item 
) const
virtual

Gets an ExtensionItem's value in the network format.

Parameters
containerThe container the ExtensionItem is set on.
itemThe value to convert to the network format.
Returns
The value specified in item in the network format.

Reimplemented in StringExtItem.

◆ unset_raw()

void * ExtensionItem::unset_raw ( Extensible container)
protected

Removes the value for this ExtensionItem from the internal map and returns it.

Parameters
containerA container the ExtensionItem should be removed from.
Returns
Either the old value or NULL if one is not set.

Member Data Documentation

◆ type

const ExtensibleType ExtensionItem::type

The type of Extensible that this ExtensionItem applies to.


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