|
1 /* |
|
2 * Copyright (c) 2007-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef FEATMGR_H |
|
22 #define FEATMGR_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32std.h> |
|
26 #include <e32svr.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CFeatMgrTlsData; |
|
30 |
|
31 // DEFINES |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 // CONSTANTS |
|
36 |
|
37 /** |
|
38 Feature manager API. |
|
39 Feature manager API offers the following functionality: |
|
40 - Inquire whether a certain static feature is supported. |
|
41 For usage, see example code at the end of the header file. |
|
42 |
|
43 @publishedPartner |
|
44 @deprecated Use the class CFeatureDiscovery for basic feature queries, or the |
|
45 class RFeatureControl for advanced feature queries and control. |
|
46 */ |
|
47 class FeatureManager |
|
48 { |
|
49 public: |
|
50 |
|
51 /** |
|
52 This must be called in the scope of the thread before calling |
|
53 any other methods. It sets up TLS. Uninitialization is done |
|
54 by calling the UnInitializeLib() function. |
|
55 |
|
56 @leave KErrNoMemory Memory allocation failure. |
|
57 |
|
58 @deprecated Use the class CFeatureDiscovery for basic feature queries, or the |
|
59 class RFeatureControl for advanced feature queries and control. |
|
60 */ |
|
61 IMPORT_C static void InitializeLibL(); |
|
62 |
|
63 /** |
|
64 This must be called in the scope of the thread after calling |
|
65 InitializeLibL(). It frees the allocated TLS. Do not call UnInitializeLib() |
|
66 if InitalizeLibL() leaves. |
|
67 |
|
68 @deprecated Use the class CFeatureDiscovery for basic feature queries, or the |
|
69 class RFeatureControl for advanced feature queries and control. |
|
70 */ |
|
71 IMPORT_C static void UnInitializeLib(); |
|
72 |
|
73 /** |
|
74 Fetches information whether a certain feature is supported. |
|
75 |
|
76 @param aFeature feature id. |
|
77 @return feature support status. |
|
78 |
|
79 @deprecated Use the class CFeatureDiscovery for basic feature queries, or the |
|
80 class RFeatureControl for advanced feature queries and control. |
|
81 */ |
|
82 IMPORT_C static TBool FeatureSupported(TInt aFeature); |
|
83 |
|
84 private: |
|
85 |
|
86 /** |
|
87 Get TlsData pointer. |
|
88 |
|
89 @return object stored in TLS |
|
90 */ |
|
91 static CFeatMgrTlsData* TlsData(); |
|
92 |
|
93 private: |
|
94 |
|
95 /** |
|
96 C++ default constructor. |
|
97 Prohibits instantiation of this class. |
|
98 */ |
|
99 FeatureManager(); |
|
100 |
|
101 |
|
102 }; |
|
103 |
|
104 /** |
|
105 Example usage: |
|
106 |
|
107 @code |
|
108 // replace <featureUID> with a real UID |
|
109 |
|
110 #include <featmgr/featmgr.h> |
|
111 #include <bldvariant.hrh> // for feature definitions |
|
112 |
|
113 CMyClass::ConstructL() |
|
114 { |
|
115 // Sets up TLS, must be done before FeatureManager is used. |
|
116 FeatureManager::InitializeLibL(); |
|
117 // Used in destructor. |
|
118 iFeatMgrInitialized = ETrue; |
|
119 } |
|
120 |
|
121 CMyClass::ShowMenuL() |
|
122 { |
|
123 if ( FeatureManager::FeatureSupported( <featureUID> ) ) |
|
124 { |
|
125 // Feature supported, show menu item associated with it. |
|
126 } |
|
127 } |
|
128 |
|
129 CMyClass::~CMyClass() |
|
130 { |
|
131 // Do not call UnInitializeLib() if InitalizeLib() leaves. |
|
132 if ( iFeatMgrInitialized ) |
|
133 { |
|
134 // Frees the TLS. Must be done after FeatureManager is used. |
|
135 FeatureManager::UnInitializeLib(); |
|
136 } |
|
137 } |
|
138 @endcode |
|
139 |
|
140 */ |
|
141 #endif // FEATMGR_H |
|
142 |
|
143 // End of File |