First public contribution.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef EXTENSIONCONTAINER_H_
17 #define EXTENSIONCONTAINER_H_
19 class CExtensionContainer:public CBase
22 /** Get Extension Interface.
23 * Implemented using the CBase::Extension_() mechanism
24 * Note that the pointer returned is only good for the lifetime of the called CBase derived object.
25 * @param aExtensionId The GUID/ Well-known ID of the interface
26 * @return pointer to the interface or NULL if not available
28 inline TAny* GetInterface(TUint aExtensionId);
29 /** Get Extension Interface - templated helper.
30 * Resolves the ID and returned pointer based on the class name.
31 * Note that the pointer returned is only good for the lifetime of the called CBase derived object.
32 * Class name should support ETypeId intergral value, else use non-template version.
33 * @param MClass The class of the interface with embedded GUID / Well known ID
34 * @return pointer to the interface or NULL if not available
36 template <class MClass> MClass* GetInterface()
38 return static_cast<MClass*>(GetInterface(MClass::ETypeId));
42 inline TAny* CExtensionContainer::GetInterface(TUint aExtensionId)
45 //Note that extension is intentionally not overloaded in CExtensionContainer
46 if (this->Extension_(aExtensionId,retVal,NULL)<KErrNone)
56 #endif /* EXTENSIONCONTAINER_H_ */