VMime
serviceFactory Class Reference

Classes

class  registeredService
 

Public Member Functions

void registerService (shared_ptr< registeredService > reg)
 
shared_ptr< servicecreate (shared_ptr< session > sess, const string &protocol, shared_ptr< security::authenticator > auth=null)
 
shared_ptr< servicecreate (shared_ptr< session > sess, const utility::url &u, shared_ptr< security::authenticator > auth=null)
 
shared_ptr< const
registeredService
getServiceByProtocol (const string &protocol) const
 
size_t getServiceCount () const
 
shared_ptr< const
registeredService
getServiceAt (const size_t pos) const
 
const std::vector< shared_ptr
< const registeredService > > 
getServiceList () const
 

Static Public Member Functions

static shared_ptr< serviceFactorygetInstance ()
 

Detailed Description

A factory to create 'service' objects for a specified protocol.

Member Function Documentation

shared_ptr< service > create ( shared_ptr< session sess,
const string protocol,
shared_ptr< security::authenticator auth = null 
)

Create a new service instance from a protocol name.

Parameters
sesssession
protocolprotocol name (eg. "pop3")
authauthenticator used to provide credentials (can be NULL if not used)
Returns
a new service instance for the specified protocol, or NULL if no service is registered for this protocol
shared_ptr< service > create ( shared_ptr< session sess,
const utility::url u,
shared_ptr< security::authenticator auth = null 
)

Create a new service instance from a URL.

Parameters
sesssession
ufull URL with at least protocol and server (you can also specify port, username and password)
authauthenticator used to provide credentials (can be NULL if not used)
Returns
a new service instance for the specified protocol or NULL if no service is registered for this protocol

References url::getHost(), url::getPassword(), url::getPath(), url::getPort(), url::getProtocol(), url::getUsername(), and url::UNSPECIFIED_PORT.

shared_ptr< serviceFactory > getInstance ( )
static
shared_ptr< const serviceFactory::registeredService > getServiceAt ( const size_t  pos) const

Return the registered service at the specified position.

Parameters
posposition of the registered service to return
Returns
registered service at the specified position
shared_ptr< const serviceFactory::registeredService > getServiceByProtocol ( const string protocol) const

Return information about a registered protocol.

Parameters
protocolprotocol name
Returns
information about this protocol, or NULL if no service is registered for this protocol

References stringUtils::toLower().

size_t getServiceCount ( ) const

Return the number of registered services.

Returns
number of registered services
const std::vector< shared_ptr< const serviceFactory::registeredService > > getServiceList ( ) const

Return a list of all registered services.

Returns
list of registered services
void registerService ( shared_ptr< registeredService reg)

Register a new service by its protocol name.

Parameters
regservice registration infos

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