os/persistentdata/featuremgmt/featuremgr/src/clientdll/featmgr.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 
    17 
    18 // INCLUDE FILES
    19 #include <featmgr/featmgr.h>
    20 #include "featmgrtlsdata.h"
    21 #include <featmgr/featurecontrol.h>
    22 #include "featmgrdebug.h"
    23 #include <e32std.h>
    24 
    25 // LOCAL CONSTANTS AND MACROS
    26 _LIT( KPanicCategory, "FeatMgr" );
    27 
    28 
    29 // ============================= LOCAL FUNCTIONS ===============================
    30 
    31 // ============================ MEMBER FUNCTIONS ===============================
    32 
    33 // -----------------------------------------------------------------------------
    34 // FeatureManager::InitializeLibL()
    35 // -----------------------------------------------------------------------------
    36 //
    37 EXPORT_C void FeatureManager::InitializeLibL()
    38     {
    39 	FUNC_LOG
    40 
    41     if ( !Dll::Tls() )
    42         {
    43         Dll::SetTls( CFeatMgrTlsData::NewL() );
    44         }
    45 
    46 	// Increase the client count (self)
    47 	TlsData()->IncreaseClientCount();
    48 	}
    49 
    50 // -----------------------------------------------------------------------------
    51 // FeatureManager::UnInitializeLibL()
    52 // -----------------------------------------------------------------------------
    53 //
    54 EXPORT_C void FeatureManager::UnInitializeLib()
    55     {
    56 	FUNC_LOG
    57 
    58     if ( Dll::Tls() )
    59 		{
    60 		CFeatMgrTlsData::DeleteClient();
    61         }
    62     }
    63 
    64 // -----------------------------------------------------------------------------
    65 // FeatureManager::FeatureSupported()
    66 // -----------------------------------------------------------------------------
    67 //
    68 EXPORT_C TBool FeatureManager::FeatureSupported( TInt aFeature )
    69     {
    70     TFeatureEntry feature( TUid::Uid(aFeature) );
    71     TInt err( TlsData()->FeatureSupported( feature ) );
    72 
    73     return (( err > 0 ) ? ETrue : EFalse );
    74     }
    75 
    76 // -----------------------------------------------------------------------------
    77 // FeatureManager::TlsData()
    78 // -----------------------------------------------------------------------------
    79 //
    80 CFeatMgrTlsData* FeatureManager::TlsData()
    81     {
    82     CFeatMgrTlsData* tlsData = STATIC_CAST( CFeatMgrTlsData*, Dll::Tls() );
    83 
    84     __ASSERT_ALWAYS( tlsData, User::Panic( KPanicCategory, ELibNotInitialized ) );
    85 
    86     return tlsData;
    87     }
    88     
    89 //  End of File