os/persistentdata/featuremgmt/featuremgr/inc/featmgr.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/featuremgmt/featuremgr/inc/featmgr.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,143 @@
     1.4 +/*
     1.5 +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +
    1.24 +#ifndef FEATMGR_H 
    1.25 +#define FEATMGR_H 
    1.26 +
    1.27 +//  INCLUDES
    1.28 +#include <e32std.h>
    1.29 +#include <e32svr.h>
    1.30 +
    1.31 +// FORWARD DECLARATIONS
    1.32 +class CFeatMgrTlsData;
    1.33 +
    1.34 +// DEFINES
    1.35 +
    1.36 +// CLASS DECLARATION
    1.37 +
    1.38 +// CONSTANTS
    1.39 +
    1.40 +/**
    1.41 + Feature manager API.
    1.42 + Feature manager API offers the following functionality:
    1.43 + - Inquire whether a certain static feature is supported.
    1.44 + For usage, see example code at the end of the header file.
    1.45 +
    1.46 +@publishedPartner
    1.47 +@deprecated Use the class CFeatureDiscovery for basic feature queries, or the 
    1.48 +             class RFeatureControl for advanced feature queries and control.
    1.49 +*/
    1.50 +class FeatureManager
    1.51 +    {
    1.52 +    public: 
    1.53 +
    1.54 +        /**
    1.55 +         This must be called in the scope of the thread before calling
    1.56 +         any other methods. It sets up TLS. Uninitialization is done
    1.57 +         by calling the UnInitializeLib() function.
    1.58 +        
    1.59 +         @leave KErrNoMemory Memory allocation failure. 
    1.60 +        
    1.61 +         @deprecated Use the class CFeatureDiscovery for basic feature queries, or the 
    1.62 +                     class RFeatureControl for advanced feature queries and control.
    1.63 +        */
    1.64 +        IMPORT_C static void InitializeLibL();
    1.65 +
    1.66 +        /**
    1.67 +         This must be called in the scope of the thread after calling
    1.68 +         InitializeLibL(). It frees the allocated TLS. Do not call UnInitializeLib() 
    1.69 +         if InitalizeLibL() leaves.
    1.70 +        
    1.71 +         @deprecated Use the class CFeatureDiscovery for basic feature queries, or the 
    1.72 +                     class RFeatureControl for advanced feature queries and control.
    1.73 +        */
    1.74 +        IMPORT_C static void UnInitializeLib();
    1.75 +        
    1.76 +		/**
    1.77 +         Fetches information whether a certain feature is supported.
    1.78 +        
    1.79 +         @param aFeature feature id.
    1.80 +         @return feature support status.
    1.81 +        
    1.82 +         @deprecated Use the class CFeatureDiscovery for basic feature queries, or the 
    1.83 +                     class RFeatureControl for advanced feature queries and control.
    1.84 +        */		
    1.85 +        IMPORT_C static TBool FeatureSupported(TInt aFeature);
    1.86 +
    1.87 +	private: 
    1.88 +
    1.89 +        /**
    1.90 +         Get TlsData pointer.
    1.91 +        
    1.92 +         @return object stored in TLS
    1.93 +        */
    1.94 +        static CFeatMgrTlsData* TlsData();
    1.95 +
    1.96 +    private:
    1.97 +
    1.98 +        /**
    1.99 +         C++ default constructor.
   1.100 +         Prohibits instantiation of this class.
   1.101 +        */
   1.102 +        FeatureManager();
   1.103 +        
   1.104 +      
   1.105 +    };
   1.106 +
   1.107 +/**
   1.108 + Example usage:
   1.109 +
   1.110 + @code
   1.111 + // replace <featureUID> with a real UID 
   1.112 +
   1.113 + #include <featmgr/featmgr.h>
   1.114 + #include <bldvariant.hrh> // for feature definitions
   1.115 +
   1.116 + CMyClass::ConstructL()
   1.117 +     {
   1.118 +     // Sets up TLS, must be done before FeatureManager is used.
   1.119 +     FeatureManager::InitializeLibL();
   1.120 +     // Used in destructor. 
   1.121 +     iFeatMgrInitialized = ETrue;
   1.122 +     }
   1.123 +
   1.124 + CMyClass::ShowMenuL()
   1.125 +     {
   1.126 +     if ( FeatureManager::FeatureSupported( <featureUID> ) )
   1.127 +         {
   1.128 +         // Feature supported, show menu item associated with it.
   1.129 +         }
   1.130 +     }
   1.131 +
   1.132 + CMyClass::~CMyClass()
   1.133 +     {
   1.134 +     // Do not call UnInitializeLib() if InitalizeLib() leaves.
   1.135 +     if ( iFeatMgrInitialized )
   1.136 +         {
   1.137 +	      // Frees the TLS. Must be done after FeatureManager is used.
   1.138 +         FeatureManager::UnInitializeLib();  
   1.139 +         }
   1.140 +     }
   1.141 + @endcode
   1.142 +
   1.143 +*/
   1.144 +#endif      // FEATMGR_H 
   1.145 +            
   1.146 +// End of File