equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ESMRUI API extension definition |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef ESMRUTILSAPIEXT_H |
|
19 #define ESMRUTILSAPIEXT_H |
|
20 |
|
21 #include <CMRUtils.h> |
|
22 |
|
23 /** |
|
24 * Extension API query function. |
|
25 * |
|
26 * Usage: |
|
27 * Class providing extension: |
|
28 * |
|
29 * class CExtendable |
|
30 * { |
|
31 * public: |
|
32 * . |
|
33 * . |
|
34 * . |
|
35 * TAny* ExtensionL( TUid aExtUid ); |
|
36 * }; |
|
37 * |
|
38 * TAny* CExtendable::ExtensionL( TUid aExtUid ) |
|
39 * { |
|
40 * if (aExtUid == KOwnExtension) |
|
41 * { |
|
42 * return static_cast<ExtensionApiType*>( this ); |
|
43 * } |
|
44 * } |
|
45 * |
|
46 * Class using extension: |
|
47 * |
|
48 * |
|
49 * CMRUtils* utils = ...; |
|
50 * ExtensionApiType* ext = ExtensionApiL<ExtensionApiType>( iUtils ); |
|
51 * |
|
52 * @param aUtils |
|
53 * @return Pointer to the requested extension API |
|
54 */ |
|
55 template<class ExtensionApiType> |
|
56 ExtensionApiType* ExtensionApiL( CMRUtils& aUtils ) |
|
57 { |
|
58 TAny* extApi = aUtils.ExtensionL( ExtensionApiType::ExtensionUid() ); |
|
59 if ( extApi ) |
|
60 { |
|
61 return static_cast<ExtensionApiType*>( extApi ); |
|
62 } |
|
63 else |
|
64 { |
|
65 return NULL; |
|
66 } |
|
67 } |
|
68 |
|
69 #endif // ESMRUTILSAPIEXT_H |
|
70 |
|
71 // End of File |