dependencies/uncategorized/cpluginvalidator.h
author kashif.sayed
Fri, 26 Mar 2010 04:17:01 +0530
branchv5backport
changeset 31 a3e98f9c292b
parent 25 1161e0025932
permissions -rw-r--r--
added missing files user: kashif.sayed added dependencies/AknTaskList.h added dependencies/DRMEvent.h added dependencies/DRMEventObserver.h added dependencies/DRMNotifier.h added dependencies/SchemeDefs.hrh added dependencies/SchemeHandler.h added dependencies/SchemeHandler.inl added dependencies/aiwcommon.hrh added dependencies/aiwdialdata.h added dependencies/drmrightsinfo.h added dependencies/drmutilitytypes.h added dependencies/javaattribute.h added dependencies/javadomainpskeys.h added dependencies/javaregistry.h added dependencies/javaregistryapplicationentry.h added dependencies/javaregistryentry.h added dependencies/javaregistryentrytype.h added dependencies/javaregistrypackageentry.h added dependencies/mjavaattribute.h added dependencies/swi/bld.inf added dependencies/swi/sispackagetrust.h added dependencies/swi/sisregistryentry.h added dependencies/swi/sisregistrylog.h added dependencies/swi/sisregistrysession.h changed .cproject changed dependencies/S3libs/bld.inf changed dependencies/bld.inf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25
Kashif.sayed
parents:
diff changeset
     1
/*
Kashif.sayed
parents:
diff changeset
     2
* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
Kashif.sayed
parents:
diff changeset
     3
* All rights reserved.
Kashif.sayed
parents:
diff changeset
     4
* This component and the accompanying materials are made available
Kashif.sayed
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
Kashif.sayed
parents:
diff changeset
     6
* which accompanies this distribution, and is available
Kashif.sayed
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
Kashif.sayed
parents:
diff changeset
     8
*
Kashif.sayed
parents:
diff changeset
     9
* Initial Contributors:
Kashif.sayed
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
Kashif.sayed
parents:
diff changeset
    11
*
Kashif.sayed
parents:
diff changeset
    12
* Contributors:
Kashif.sayed
parents:
diff changeset
    13
*
Kashif.sayed
parents:
diff changeset
    14
* Description:  
Kashif.sayed
parents:
diff changeset
    15
 *
Kashif.sayed
parents:
diff changeset
    16
*/
Kashif.sayed
parents:
diff changeset
    17
Kashif.sayed
parents:
diff changeset
    18
Kashif.sayed
parents:
diff changeset
    19
#ifndef CPLUGINVALIDATOR_H
Kashif.sayed
parents:
diff changeset
    20
#define CPLUGINVALIDATOR_H
Kashif.sayed
parents:
diff changeset
    21
Kashif.sayed
parents:
diff changeset
    22
// INCLUDES
Kashif.sayed
parents:
diff changeset
    23
#include <e32base.h>
Kashif.sayed
parents:
diff changeset
    24
#include <e32hashtab.h>
Kashif.sayed
parents:
diff changeset
    25
#include <ecom/implementationinformation.h>
Kashif.sayed
parents:
diff changeset
    26
Kashif.sayed
parents:
diff changeset
    27
// FORWARD DECLARATIONS
Kashif.sayed
parents:
diff changeset
    28
class REComSession;
Kashif.sayed
parents:
diff changeset
    29
Kashif.sayed
parents:
diff changeset
    30
/**
Kashif.sayed
parents:
diff changeset
    31
 *  Class containing information regarding a plugin
Kashif.sayed
parents:
diff changeset
    32
 *
Kashif.sayed
parents:
diff changeset
    33
 * 
Kashif.sayed
parents:
diff changeset
    34
 *  @lib cpclient.dll
Kashif.sayed
parents:
diff changeset
    35
 *  @since S60 v 5.0
Kashif.sayed
parents:
diff changeset
    36
 */
Kashif.sayed
parents:
diff changeset
    37
NONSHARABLE_CLASS( TPluginInfo )
Kashif.sayed
parents:
diff changeset
    38
	{
Kashif.sayed
parents:
diff changeset
    39
public:
Kashif.sayed
parents:
diff changeset
    40
	TAny* iPlugin; // not own
Kashif.sayed
parents:
diff changeset
    41
	TUid iImplementationUid;
Kashif.sayed
parents:
diff changeset
    42
	TInt iVersion;
Kashif.sayed
parents:
diff changeset
    43
	TUid iDtor_ID_Key;
Kashif.sayed
parents:
diff changeset
    44
	};
Kashif.sayed
parents:
diff changeset
    45
Kashif.sayed
parents:
diff changeset
    46
/**
Kashif.sayed
parents:
diff changeset
    47
 *  Class used to maintain required ECOM plugins implementations
Kashif.sayed
parents:
diff changeset
    48
 *
Kashif.sayed
parents:
diff changeset
    49
 * 
Kashif.sayed
parents:
diff changeset
    50
 *  @lib cpclient.dll
Kashif.sayed
parents:
diff changeset
    51
 *  @since S60 v 5.0
Kashif.sayed
parents:
diff changeset
    52
 */
Kashif.sayed
parents:
diff changeset
    53
NONSHARABLE_CLASS( CPluginValidator ): public CActive
Kashif.sayed
parents:
diff changeset
    54
    {
Kashif.sayed
parents:
diff changeset
    55
public:
Kashif.sayed
parents:
diff changeset
    56
Kashif.sayed
parents:
diff changeset
    57
    /**
Kashif.sayed
parents:
diff changeset
    58
     * Two-phased constructor.
Kashif.sayed
parents:
diff changeset
    59
     * 
Kashif.sayed
parents:
diff changeset
    60
     */     
Kashif.sayed
parents:
diff changeset
    61
    IMPORT_C static CPluginValidator* NewL( TUid aUid, 
Kashif.sayed
parents:
diff changeset
    62
                                            TAny *aParameter = NULL );
Kashif.sayed
parents:
diff changeset
    63
Kashif.sayed
parents:
diff changeset
    64
    /**
Kashif.sayed
parents:
diff changeset
    65
     * Two-phased constructor.
Kashif.sayed
parents:
diff changeset
    66
     * 
Kashif.sayed
parents:
diff changeset
    67
     */     
Kashif.sayed
parents:
diff changeset
    68
    IMPORT_C static CPluginValidator* NewLC( TUid aUid,
Kashif.sayed
parents:
diff changeset
    69
                                             TAny *aParameter = NULL );
Kashif.sayed
parents:
diff changeset
    70
Kashif.sayed
parents:
diff changeset
    71
    /**
Kashif.sayed
parents:
diff changeset
    72
     * Gets plugin with provided UID
Kashif.sayed
parents:
diff changeset
    73
     *
Kashif.sayed
parents:
diff changeset
    74
     * @param aUid required plugin
Kashif.sayed
parents:
diff changeset
    75
     * @return pointer to plugin implementation
Kashif.sayed
parents:
diff changeset
    76
     */   
Kashif.sayed
parents:
diff changeset
    77
    IMPORT_C TAny* GetImplementation( TUid aUid );
Kashif.sayed
parents:
diff changeset
    78
Kashif.sayed
parents:
diff changeset
    79
    /**
Kashif.sayed
parents:
diff changeset
    80
     * Gets plugin with provided index
Kashif.sayed
parents:
diff changeset
    81
     *
Kashif.sayed
parents:
diff changeset
    82
     * @param aIndex index of plugin
Kashif.sayed
parents:
diff changeset
    83
     * @return pointer to plugin implementation
Kashif.sayed
parents:
diff changeset
    84
     */   
Kashif.sayed
parents:
diff changeset
    85
    IMPORT_C TAny* GetImplementation( TInt aIndex );
Kashif.sayed
parents:
diff changeset
    86
    
Kashif.sayed
parents:
diff changeset
    87
    /**
Kashif.sayed
parents:
diff changeset
    88
     * Gets number of plugins
Kashif.sayed
parents:
diff changeset
    89
     *
Kashif.sayed
parents:
diff changeset
    90
     * @return number of plugins
Kashif.sayed
parents:
diff changeset
    91
     */    
Kashif.sayed
parents:
diff changeset
    92
    IMPORT_C TInt GetCount();
Kashif.sayed
parents:
diff changeset
    93
    
Kashif.sayed
parents:
diff changeset
    94
    /**
Kashif.sayed
parents:
diff changeset
    95
     * Desctructor.
Kashif.sayed
parents:
diff changeset
    96
     */     
Kashif.sayed
parents:
diff changeset
    97
    virtual ~CPluginValidator();
Kashif.sayed
parents:
diff changeset
    98
Kashif.sayed
parents:
diff changeset
    99
protected:
Kashif.sayed
parents:
diff changeset
   100
Kashif.sayed
parents:
diff changeset
   101
    /**
Kashif.sayed
parents:
diff changeset
   102
     * From CActive, RunL.
Kashif.sayed
parents:
diff changeset
   103
     * Handles the active object’s request completion event
Kashif.sayed
parents:
diff changeset
   104
     */
Kashif.sayed
parents:
diff changeset
   105
    void RunL();
Kashif.sayed
parents:
diff changeset
   106
Kashif.sayed
parents:
diff changeset
   107
    /**
Kashif.sayed
parents:
diff changeset
   108
     * From CActive, DoCancel.
Kashif.sayed
parents:
diff changeset
   109
     * Implements cancellation of an outstanding request.
Kashif.sayed
parents:
diff changeset
   110
     */
Kashif.sayed
parents:
diff changeset
   111
    void DoCancel();
Kashif.sayed
parents:
diff changeset
   112
Kashif.sayed
parents:
diff changeset
   113
    /**
Kashif.sayed
parents:
diff changeset
   114
     * From CActive, RunError.
Kashif.sayed
parents:
diff changeset
   115
     * Method called when leave occured in RunL
Kashif.sayed
parents:
diff changeset
   116
     */
Kashif.sayed
parents:
diff changeset
   117
    TInt RunError( TInt aError );
Kashif.sayed
parents:
diff changeset
   118
Kashif.sayed
parents:
diff changeset
   119
protected:
Kashif.sayed
parents:
diff changeset
   120
Kashif.sayed
parents:
diff changeset
   121
    /**
Kashif.sayed
parents:
diff changeset
   122
     * C++ default constructor.
Kashif.sayed
parents:
diff changeset
   123
     */    
Kashif.sayed
parents:
diff changeset
   124
    CPluginValidator( TUid aUid, TAny *aParameter );
Kashif.sayed
parents:
diff changeset
   125
Kashif.sayed
parents:
diff changeset
   126
    /**
Kashif.sayed
parents:
diff changeset
   127
     * Perform the second phase construction of a CPluginValidator object.
Kashif.sayed
parents:
diff changeset
   128
     */    
Kashif.sayed
parents:
diff changeset
   129
    void ConstructL();
Kashif.sayed
parents:
diff changeset
   130
    
Kashif.sayed
parents:
diff changeset
   131
    /*
Kashif.sayed
parents:
diff changeset
   132
     * Checks if plugin is present in an array
Kashif.sayed
parents:
diff changeset
   133
     */
Kashif.sayed
parents:
diff changeset
   134
    TBool PresentInArrayL( TPluginInfo aPluginInfo, 
Kashif.sayed
parents:
diff changeset
   135
    		const RImplInfoPtrArray& aInfoArray );
Kashif.sayed
parents:
diff changeset
   136
Kashif.sayed
parents:
diff changeset
   137
    /*
Kashif.sayed
parents:
diff changeset
   138
     * 
Kashif.sayed
parents:
diff changeset
   139
     */
Kashif.sayed
parents:
diff changeset
   140
    void DestroyPlugin( TInt aIndex );    
Kashif.sayed
parents:
diff changeset
   141
    
Kashif.sayed
parents:
diff changeset
   142
    /**
Kashif.sayed
parents:
diff changeset
   143
     * Cleans plugins table;
Kashif.sayed
parents:
diff changeset
   144
     */    
Kashif.sayed
parents:
diff changeset
   145
    void CleanPluginsTable();
Kashif.sayed
parents:
diff changeset
   146
    
Kashif.sayed
parents:
diff changeset
   147
    /**
Kashif.sayed
parents:
diff changeset
   148
     * Loads or destroys plugins
Kashif.sayed
parents:
diff changeset
   149
     */    
Kashif.sayed
parents:
diff changeset
   150
    virtual void ManagePluginsL();    
Kashif.sayed
parents:
diff changeset
   151
Kashif.sayed
parents:
diff changeset
   152
    /**
Kashif.sayed
parents:
diff changeset
   153
     * Loads ECOM plugins
Kashif.sayed
parents:
diff changeset
   154
     */    
Kashif.sayed
parents:
diff changeset
   155
    virtual void LoadPluginL( TPluginInfo& aPluginInfo );    
Kashif.sayed
parents:
diff changeset
   156
    
Kashif.sayed
parents:
diff changeset
   157
protected:
Kashif.sayed
parents:
diff changeset
   158
    
Kashif.sayed
parents:
diff changeset
   159
    /**
Kashif.sayed
parents:
diff changeset
   160
     * ECOM handler
Kashif.sayed
parents:
diff changeset
   161
     * Own.
Kashif.sayed
parents:
diff changeset
   162
     */
Kashif.sayed
parents:
diff changeset
   163
    REComSession* iSession;
Kashif.sayed
parents:
diff changeset
   164
    
Kashif.sayed
parents:
diff changeset
   165
    /**
Kashif.sayed
parents:
diff changeset
   166
     * Array containing plugins
Kashif.sayed
parents:
diff changeset
   167
     * Own.
Kashif.sayed
parents:
diff changeset
   168
     */
Kashif.sayed
parents:
diff changeset
   169
    RArray<TPluginInfo> iPluginArray;
Kashif.sayed
parents:
diff changeset
   170
    
Kashif.sayed
parents:
diff changeset
   171
    /**
Kashif.sayed
parents:
diff changeset
   172
     * UID of the interface
Kashif.sayed
parents:
diff changeset
   173
     */
Kashif.sayed
parents:
diff changeset
   174
    const TUid iUid;
Kashif.sayed
parents:
diff changeset
   175
        
Kashif.sayed
parents:
diff changeset
   176
    /**
Kashif.sayed
parents:
diff changeset
   177
     * Parameter to pass to the object creation method.
Kashif.sayed
parents:
diff changeset
   178
     */
Kashif.sayed
parents:
diff changeset
   179
    TAny* iParameter;
Kashif.sayed
parents:
diff changeset
   180
     };
Kashif.sayed
parents:
diff changeset
   181
Kashif.sayed
parents:
diff changeset
   182
// ==================== LOCAL FUNCTIONS ====================
Kashif.sayed
parents:
diff changeset
   183
Kashif.sayed
parents:
diff changeset
   184
/**
Kashif.sayed
parents:
diff changeset
   185
* Identity function to search in an array of TPluginInfo.
Kashif.sayed
parents:
diff changeset
   186
* @param aLeft Search term.
Kashif.sayed
parents:
diff changeset
   187
* @param aRight Array item.
Kashif.sayed
parents:
diff changeset
   188
* @return ETrue if ID-s match.
Kashif.sayed
parents:
diff changeset
   189
*/
Kashif.sayed
parents:
diff changeset
   190
LOCAL_C TBool UidMatch( const TPluginInfo& aLeft, const TPluginInfo& aRight )
Kashif.sayed
parents:
diff changeset
   191
    {
Kashif.sayed
parents:
diff changeset
   192
    return aLeft.iImplementationUid == aRight.iImplementationUid;
Kashif.sayed
parents:
diff changeset
   193
    }
Kashif.sayed
parents:
diff changeset
   194
Kashif.sayed
parents:
diff changeset
   195
#endif // CPLUGINVALIDATOR_H