williamr@2: /*
williamr@2: * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2: * All rights reserved.
williamr@2: * This component and the accompanying materials are made available
williamr@2: * under the terms of the License "Eclipse Public License v1.0"
williamr@2: * which accompanies this distribution, and is available
williamr@2: * at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2: *
williamr@2: * Initial Contributors:
williamr@2: * Nokia Corporation - initial contribution.
williamr@2: *
williamr@2: * Contributors:
williamr@2: *
williamr@2: * Description: 
williamr@2: * CERTIFICATEAPPS.H
williamr@2: * CCertificateAppInfoManager class implementation
williamr@2: *
williamr@2: */
williamr@2: 
williamr@2: 
williamr@2: 
williamr@2: 
williamr@2: /**
williamr@2:  @file 
williamr@2:  @publishedAll
williamr@2:  @released 
williamr@2: */
williamr@2:  
williamr@2: #ifndef __CERTIFICATEAPPS_H__
williamr@2: #define __CERTIFICATEAPPS_H__
williamr@2: 
williamr@2: #include <f32file.h>
williamr@2: #include <s32file.h>
williamr@2: #include <mctcertapps.h>
williamr@2: 
williamr@2: /**
williamr@2:  * This class is used to access a persistent store which contains the available
williamr@2:  * applications on a device.  It provides an interface to add and retrieve
williamr@2:  * applications.
williamr@2:  * 
williamr@2:  * @publishedAll
williamr@2:  * @released
williamr@2:  */
williamr@2: class CCertificateAppInfoManager : public CBase
williamr@2: 	{
williamr@2: public:
williamr@2: 	/**
williamr@2: 	* Creates a new instance of the app info manager and puts a pointer to it onto the cleanup stack.
williamr@2: 	*
williamr@2: 	* @return	A new CCertificateAppInfoManager object.
williamr@2: 	*/
williamr@2: 	IMPORT_C static CCertificateAppInfoManager* NewLC();
williamr@2: 	
williamr@2: 	/**
williamr@2: 	* Creates a new instance of the app info manager.
williamr@2: 	* 
williamr@2: 	* @return	A new CCertificateAppInfoManager object.
williamr@2: 	*/
williamr@2: 	IMPORT_C static CCertificateAppInfoManager* NewL();
williamr@2: 
williamr@2: 	/**
williamr@2: 	 * Creates a new instance of the app info manager.
williamr@2: 	 * 
williamr@2: 	 * @deprecated	Clients should use the no-argument version.
williamr@2: 	 */
williamr@2: 	IMPORT_C static CCertificateAppInfoManager* NewLC(RFs& aFs, TBool aOpenedForWrite);
williamr@2: 	
williamr@2: 	/**
williamr@2: 	 * Creates a new instance of the app info manager.
williamr@2: 	 * 
williamr@2: 	 * @deprecated	Clients should use the no-argument version.
williamr@2: 	 */
williamr@2: 	IMPORT_C static CCertificateAppInfoManager* NewL(RFs& aFs, TBool aOpenedForWrite);
williamr@2: 
williamr@2: 	/** Virtual destructor. Frees all resources owned by the object, prior to its destruction.
williamr@2:   	*/
williamr@2: 	IMPORT_C virtual ~CCertificateAppInfoManager();
williamr@2: 
williamr@2: private:
williamr@2: 	CCertificateAppInfoManager();
williamr@2: 	void ConstructL();
williamr@2: 
williamr@2: public:
williamr@2: 	/**
williamr@2: 	 * Adds a new application.
williamr@2: 	 * 
williamr@2: 	 * @param aClient				The new application to add.
williamr@2: 	 * @capability WriteDeviceData	The caller requires the WriteDeviceData capability.
williamr@2: 	 * @leave KErrPermissionDenied	If the caller does not have the required capability.
williamr@2: 	 */
williamr@2: 	IMPORT_C void AddL(const TCertificateAppInfo& aClient);
williamr@2: 	
williamr@2: 	/**
williamr@2: 	 * Removes an existing application.
williamr@2: 	 * 
williamr@2: 	 * @param aUid					The UID of the application to remove.
williamr@2: 	 * @capability WriteDeviceData	The caller requires the WriteDeviceData capability.
williamr@2: 	 * @leave KErrPermissionDenied	If the caller does not have the required capability.
williamr@2: 	 * @leave KErrNotFound			If there is no application matching the specified UID.
williamr@2: 	 */
williamr@2: 	IMPORT_C void RemoveL(const TUid& aUid);
williamr@2: 
williamr@2: 	/**
williamr@2: 	 * Gets an application by UID.
williamr@2: 	 *
williamr@2: 	 * @param aUid			The UID of the application.
williamr@2: 	 * @param aIndex		On return, the index of the application in the store.
williamr@2: 	 * @return				Information about the application if it is present.
williamr@2: 	 * @leave KErrNotFound	If there is no application matching the specified UID.
williamr@2: 	 */
williamr@2: 	IMPORT_C const TCertificateAppInfo& ApplicationL(const TUid& aUid, TInt& aIndex) const;
williamr@2: 
williamr@2: 	/**
williamr@2: 	 * Gets a list of all applications in the store.
williamr@2: 	 *
williamr@2: 	 * @return	An array containing all applications in the store.
williamr@2: 	 */
williamr@2: 	IMPORT_C const RArray<TCertificateAppInfo>& Applications() const;
williamr@2: 
williamr@2: private:
williamr@2: 	MCTCertApps* iCertAppsIf;
williamr@2: 	/// A cache of the contents of the store 
williamr@2: 	RArray<TCertificateAppInfo> iClients;
williamr@2: 	};
williamr@2: 
williamr@2: #endif