epoc32/include/caf/agentfactory.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2003 - 2007 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: 
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
williamr@2
    20
/** 
williamr@2
    21
@file 
williamr@2
    22
williamr@2
    23
@publishedPartner
williamr@2
    24
@released
williamr@2
    25
*/
williamr@2
    26
williamr@2
    27
#ifndef __AGENTFACTORY_H__
williamr@2
    28
#define __AGENTFACTORY_H__
williamr@2
    29
williamr@2
    30
#include <e32base.h>
williamr@2
    31
#include <ecom/ecom.h>
williamr@2
    32
#include <caf/caftypes.h>
williamr@2
    33
williamr@2
    34
namespace ContentAccess
williamr@2
    35
{
williamr@2
    36
	// Products
williamr@2
    37
	 class CAgentContent;
williamr@2
    38
	 class CAgentData;
williamr@2
    39
	 class CAgentImportFile;
williamr@2
    40
	 class CAgentManager;
williamr@2
    41
	 class CAgentRightsManager;
williamr@2
    42
williamr@2
    43
	// Other CAF classes
williamr@2
    44
	class CMetaData;
williamr@2
    45
	class CMetaDataArray;
williamr@2
    46
	class TVirtualPathPtr;
williamr@2
    47
williamr@2
    48
williamr@2
    49
	/** The CAF 2.0 agent interface UID */
williamr@2
    50
	const TUid KCAAgentInterfaceUid = {0x10204740};
williamr@2
    51
williamr@2
    52
	/**
williamr@2
    53
	 Abstract interface handed out by an ECOM agent
williamr@2
    54
	 implementation by REComSession::CreateImplementationL().
williamr@2
    55
williamr@2
    56
	 CAgentFactory defines an abstract factory that is responsible for
williamr@2
    57
	 creating the abstract products: 
williamr@2
    58
	 @li ContentAccess::CAgentContent
williamr@2
    59
	 @li ContentAccess::CAgentData
williamr@2
    60
	 @li ContentAccess::CAgentImportFile
williamr@2
    61
	 @li ContentAccess::CAgentManager
williamr@2
    62
	 @li ContentAccess::CAgentRightsManager
williamr@2
    63
	 
williamr@2
    64
	 Derived classes will hand out concrete product implementations which are 
williamr@2
    65
	 specific for that particular agent.
williamr@2
    66
williamr@2
    67
	 Derived classes effectively represent the ECOM session handle
williamr@2
    68
	 used by CAF classes
williamr@2
    69
	  
williamr@2
    70
	 @see ContentAccess::CF32AgentFactory. This implements 
williamr@2
    71
	 ContentAccess::CAgentFactory to handle unrestricted content.
williamr@2
    72
	 
williamr@2
    73
 	 @publishedPartner
williamr@2
    74
	 @released
williamr@2
    75
	 */
williamr@2
    76
	class CAgentFactory : public CBase
williamr@2
    77
		{
williamr@2
    78
	public:
williamr@2
    79
		/** Create a new instance of a particular agent using its DLL implementation Uid
williamr@2
    80
		@param aUid The Uid of the agent to create an instance of its CAgentFactory
williamr@2
    81
		@return a new CAgentFactory
williamr@2
    82
williamr@2
    83
		@internalComponent
williamr@2
    84
		@released
williamr@2
    85
		*/
williamr@2
    86
		static CAgentFactory* NewL(TUid aUid);
williamr@2
    87
	
williamr@2
    88
	/** Destructor, calls REComSession::DestroyedImplementation(); to destroy 
williamr@2
    89
		the ECOM implementation. When all implementations are destroyed
williamr@2
    90
		ECOM will unload the agent DLL
williamr@2
    91
		*/
williamr@2
    92
		IMPORT_C virtual ~CAgentFactory(); 
williamr@2
    93
williamr@2
    94
		/**
williamr@2
    95
		Factory function creates a CAgentContent object for browsing
williamr@2
    96
		the contents of a file belonging to this agent.
williamr@2
    97
		 
williamr@2
    98
		@param aURI	The location of the file.
williamr@2
    99
		@param aShareMode The share mode used for opening this content
williamr@2
   100
		@return A pointer to the CAgentContent object.
williamr@2
   101
		*/
williamr@2
   102
		virtual CAgentContent* CreateContentBrowserL(const TDesC& aURI, TContentShareMode aShareMode)  = 0;
williamr@2
   103
williamr@2
   104
		/**
williamr@2
   105
		Creates a CAgentContent object for browsing the contents of a file 
williamr@2
   106
		belonging to this agent
williamr@2
   107
williamr@2
   108
		@param aFile An open file handle for reading from the file, the agent must make its own duplicate of the file handle.
williamr@2
   109
		@return A pointer to the CAgentContent object.
williamr@2
   110
		*/
williamr@2
   111
		virtual CAgentContent* CreateContentBrowserL(RFile& aFile) = 0;
williamr@2
   112
williamr@2
   113
		/**
williamr@2
   114
		 Factory function creates a CAgentData object for reading 
williamr@2
   115
		 from a content object
williamr@2
   116
		 
williamr@2
   117
		 @param aVirtualPath The content object to read from
williamr@2
   118
		 @param aShareMode The share mode for opening the file containing the content object
williamr@2
   119
		 @return A pointer to the CAgentData object.
williamr@2
   120
		 */
williamr@2
   121
		virtual CAgentData* CreateDataConsumerL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)  = 0;
williamr@2
   122
williamr@2
   123
		/**
williamr@2
   124
		 Factory function creates a CAgentData object for reading 
williamr@2
   125
		 from a content object.
williamr@2
   126
		 
williamr@2
   127
		 @param aFile An open file handle used by the agent to read from the file. The agent MUST make its own duplicate of this file handle, either in the same process or a server process
williamr@2
   128
		 @param aUniqueId The agent specific unique ID of object within the file to read.
williamr@2
   129
		 @return A pointer to the CAgentData object.
williamr@2
   130
		 */
williamr@2
   131
		virtual CAgentData* CreateDataConsumerL(RFile& aFile, const TDesC& aUniqueId)  = 0;
williamr@2
   132
williamr@2
   133
		/** 
williamr@2
   134
		 Factory function creates an object for performing management 
williamr@2
   135
		 functions with this particular agent
williamr@2
   136
williamr@2
   137
		 CAgentManager objects are stateless so they require no 
williamr@2
   138
		 construction parameters.
williamr@2
   139
		 
williamr@2
   140
		 @return A pointer to a CAgentManager object.
williamr@2
   141
		 */
williamr@2
   142
		virtual CAgentManager*  CreateManagerL()   = 0;
williamr@2
   143
		
williamr@2
   144
		/** 
williamr@2
   145
		 Factory function creates an object that allows the agent to import 
williamr@2
   146
		 or transform content. The agent will supply output files where necessary
williamr@2
   147
		 
williamr@2
   148
		 @param aMimeType The mime type of the file to be imported
williamr@2
   149
		 @param aMetaDataArray Array of metadata associated with the file to import
williamr@2
   150
		 @param aOutputDirectory Preferred directory to store output files
williamr@2
   151
		 @param aSuggestedFileName Suggested filename for the output file(s)
williamr@2
   152
		 @return A pointer to a ContentAccess::CAgentImportFile object.
williamr@2
   153
		 @leave KErrCANotSupported If the agent does not support importing or transforming content
williamr@2
   154
		 */
williamr@2
   155
		virtual CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName) = 0;
williamr@2
   156
williamr@2
   157
		/** 
williamr@2
   158
		 Factory function creates an object that allows the agent to import 
williamr@2
   159
		 or transform content. The caller will supply output files where necessary
williamr@2
   160
		 
williamr@2
   161
		 @param aMimeType The mime type of the file to be imported
williamr@2
   162
		 @param aMetaDataArray Array of metadata associated with the file to import
williamr@2
   163
		 @return A pointer to a ContentAccess::CAgentImportFile object.
williamr@2
   164
		 @leave KErrCANotSupported If the agent does not support importing or transforming content
williamr@2
   165
		 */
williamr@2
   166
		virtual CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray) = 0;
williamr@2
   167
		
williamr@2
   168
		/** 
williamr@2
   169
		Factory function that creates an rights manager object for this agent
williamr@2
   170
williamr@2
   171
		@return A pointer to a ContentAccess::CAgentRightsManager object.
williamr@2
   172
		@leave KErrCANotSupported If the agent does not provide any rights management functions
williamr@2
   173
		*/
williamr@2
   174
		virtual CAgentRightsManager* CreateRightsManagerL() = 0;
williamr@2
   175
williamr@2
   176
	private:
williamr@2
   177
		// ECOM session key. This is set by 
williamr@2
   178
		// REComSession::CreateImplementationL() during construction
williamr@2
   179
		TUid iEcomKey;
williamr@2
   180
		};
williamr@2
   181
williamr@2
   182
	} // namespace ContentAccess
williamr@2
   183
#endif // __AGENTFACTORY_H__