InspIRCd  4.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 Cullable insp::uncopiable SimpleExtItem< std::string > SimpleExtItem< ChanData > BoolExtItem IntExtItem SimpleExtItem< T, Del > StringExtItem

Public Types

enum  ExtensibleType { EXT_USER , EXT_CHANNEL , EXT_MEMBERSHIP }
 

Public Member Functions

 ExtensionItem (Module *owner, const std::string &key, ExtensibleType exttype)
 
virtual void FromInternal (Extensible *container, const std::string &value) noexcept
 
virtual void FromNetwork (Extensible *container, const std::string &value) noexcept
 
virtual std::string ToHuman (const Extensible *container, void *item) const noexcept
 
virtual std::string ToInternal (const Extensible *container, void *item) const noexcept
 
virtual std::string ToNetwork (const Extensible *container, void *item) const noexcept
 
virtual void Delete (Extensible *container, void *item)=0
 
void RegisterService () override
 
- Public Member Functions inherited from ServiceProvider
 ServiceProvider (Module *Creator, const std::string &Name, ServiceType Type)
 
const char * GetTypeString () const
 
void DisableAutoRegister ()
 
- Public Member Functions inherited from Cullable
virtual ~Cullable ()
 
virtual Result Cull ()
 

Public Attributes

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

Protected Member Functions

void * GetRaw (const Extensible *container) const
 
void * SetRaw (Extensible *container, void *value)
 
void * UnsetRaw (Extensible *container)
 
void Sync (const Extensible *container, void *item)
 
- Protected Member Functions inherited from Cullable
 Cullable ()
 

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 ( Module owner,
const std::string &  key,
ExtensibleType  exttype 
)

Initializes an instance of the ExtensionItem class.

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

Member Function Documentation

◆ Delete()

virtual void ExtensionItem::Delete ( 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 BoolExtItem, IntExtItem, SimpleExtItem< T, Del >, SimpleExtItem< std::string >, and SimpleExtItem< ChanData >.

◆ FromInternal()

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

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 BoolExtItem, IntExtItem, and StringExtItem.

◆ FromNetwork()

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

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 BoolExtItem, IntExtItem, and StringExtItem.

◆ GetRaw()

void * ExtensionItem::GetRaw ( 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 ( )
overridevirtual

Registers this object with the ExtensionManager.

Reimplemented from ServiceProvider.

◆ SetRaw()

void * ExtensionItem::SetRaw ( 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.

◆ Sync()

void ExtensionItem::Sync ( const Extensible container,
void *  item 
)
protected

Syncs the value of this ExtensionItem across the network.

Parameters
containerThe container this ExtensionItem is set on.
itemThe value of this ExtensionItem.

◆ ToHuman()

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

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.

Reimplemented in BoolExtItem.

◆ ToInternal()

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

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 BoolExtItem, IntExtItem, and StringExtItem.

◆ ToNetwork()

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

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 BoolExtItem, IntExtItem, and StringExtItem.

◆ UnsetRaw()

void * ExtensionItem::UnsetRaw ( 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: