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