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