epoc32/include/http/cecomfilter.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/http/cecomfilter.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/http/cecomfilter.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,120 @@
     1.4 -cecomfilter.h
     1.5 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file CEComFilter.h
    1.24 + @warning : This file contains Rose Model ID comments - please do not delete
    1.25 +*/
    1.26 +
    1.27 +#ifndef	__CECOMFILTER_H__
    1.28 +#define	__CECOMFILTER_H__
    1.29 +
    1.30 +// System includes
    1.31 +#include <e32base.h>
    1.32 +#include <ecom/ecom.h>
    1.33 +#include <http/rhttpsession.h>
    1.34 +
    1.35 +/**
    1.36 +The ECom filter interface UID
    1.37 +@publishedAll
    1.38 +@released
    1.39 +*/
    1.40 +const TUid KUidFilterPluginInterface = {0x101F446D}; 
    1.41 +
    1.42 +
    1.43 +//##ModelId=3C4C0F400280
    1.44 +class CEComFilter : public CBase
    1.45 +/**
    1.46 +This class serves as the base class for ECom filter plugins. It provides minimal functionality
    1.47 +to simply install and destroy filters specified by their UID or data type. The RHTTPSession
    1.48 +passed in is passed onto the filter as a TAny* pointer and therefore must be casted back to
    1.49 +an RHTTPSession pointer by the filter.
    1.50 +@publishedAll
    1.51 +@released
    1.52 +*/
    1.53 +	{
    1.54 +public: // Methods
    1.55 +	/**
    1.56 +	@fn				InstallFilterL(RHTTPSession aSession, const TUid aEComFilterUid)
    1.57 +	Intended Usage:	This method is used to install filters to the filter queue. The implementation
    1.58 +					UID of the filter plugin is passed to identify the plugin that is required.
    1.59 +					The returned pointer is not owned as the filters must be self-destroying when
    1.60 +					they are unloaded.
    1.61 +	@param			aSession A handle to the transport session
    1.62 +	@param			aEComFilterUid The implementation UID of the plugin
    1.63 +	@return			Pointer to the newly installed plugin
    1.64 +	@pre 			The session had already been setup
    1.65 +	@post			The filter(s) have been installed
    1.66 +	*/
    1.67 +	//##ModelId=3C4C0F4002A8
    1.68 +	inline static CEComFilter* InstallFilterL(RHTTPSession aSession, const TUid aEComFilterUid);
    1.69 +
    1.70 +	/**
    1.71 +	@fn				InstallFilterL(RHTTPSession aSession, const TDesC8& aEComFilterDataType)
    1.72 +	Intended Usage:	This method is used to install filters to the filter queue. The implementation
    1.73 +					UID of the filter plugin is passed to identify the plugin that is required.
    1.74 +					The returned pointer is not owned as the filters must be self-destroying when
    1.75 +					they are unloaded.
    1.76 +	@param			aSession A handle to the transport session
    1.77 +	@param			aEComFilterDataType A descriptor containing the datatype of the filter to load
    1.78 +	@return			Pointer to the newly installed plugin
    1.79 +	@pre 			The session had already been setup
    1.80 +	@post			The filter(s) have been installed
    1.81 +	*/
    1.82 +	//##ModelId=3C4C0F4002AB
    1.83 +	inline static CEComFilter* InstallFilterL(RHTTPSession aSession, const TDesC8& aEComFilterDataType);
    1.84 +
    1.85 +	/**
    1.86 +	@fn				~CEComFilter()
    1.87 +	Intended Usage:	Virtual destructor
    1.88 +	@pre 			The object identified by the destructor key in iEcomDtorID exists
    1.89 +	@post			The object is destroyed
    1.90 +	*/
    1.91 +	//##ModelId=3C4C0F40029E
    1.92 +	inline ~CEComFilter();
    1.93 +
    1.94 +private: // Attributes
    1.95 +	/// The ECom destructor key identifier
    1.96 +	//##ModelId=3C4C0F400297
    1.97 +	TUid iEcomDtorID;
    1.98 +	};
    1.99 +
   1.100 +//----------------------------------------------------------------------------------------
   1.101 +
   1.102 +inline CEComFilter* CEComFilter::InstallFilterL(RHTTPSession aSession, const TUid aEComFilterUid)
   1.103 +	{
   1.104 +	TAny* filterPlugin = REComSession::CreateImplementationL(aEComFilterUid, _FOFF(CEComFilter,iEcomDtorID), &aSession);
   1.105 +	return REINTERPRET_CAST(CEComFilter*, filterPlugin);
   1.106 +	}
   1.107 +
   1.108 +inline CEComFilter* CEComFilter::InstallFilterL(RHTTPSession aSession,const TDesC8& aEComFilterDataType)
   1.109 +	{
   1.110 +	TEComResolverParams resolverParams;
   1.111 +	resolverParams.SetDataType(aEComFilterDataType);
   1.112 +	// This will leave if the plugin is not found
   1.113 +	TAny* filterPlugin = REComSession::CreateImplementationL(KUidFilterPluginInterface, 
   1.114 +											_FOFF(CEComFilter,iEcomDtorID), 
   1.115 +											&aSession, resolverParams);
   1.116 +	return REINTERPRET_CAST(CEComFilter*, filterPlugin);
   1.117 +	}
   1.118 +
   1.119 +inline CEComFilter::~CEComFilter()
   1.120 +	{
   1.121 +	REComSession::DestroyedImplementation(iEcomDtorID);
   1.122 +	}
   1.123 +
   1.124 +#endif // __CECOMFILTER_H__