os/security/contentmgmt/contentaccessfwfordrm/inc/content.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
/** 
sl@0
    20
@file
sl@0
    21
sl@0
    22
@publishedAll
sl@0
    23
@released
sl@0
    24
*/
sl@0
    25
sl@0
    26
sl@0
    27
#ifndef __CONTENT_H__
sl@0
    28
#define __CONTENT_H__
sl@0
    29
sl@0
    30
#include <e32base.h>
sl@0
    31
#include <f32file.h>
sl@0
    32
sl@0
    33
#include <caf/caftypes.h>
sl@0
    34
#include <caf/agent.h>
sl@0
    35
#include <caf/streamableptrarray.h>
sl@0
    36
#include <caf/virtualpathptr.h>
sl@0
    37
sl@0
    38
namespace ContentAccess
sl@0
    39
	{
sl@0
    40
	class CAgentResolver;
sl@0
    41
	class CAgentFactory;
sl@0
    42
	class CAgentContent;
sl@0
    43
	class CData;
sl@0
    44
	class CEmbeddedObject;
sl@0
    45
	class RAttributeSet;
sl@0
    46
	class RStringAttributeSet;
sl@0
    47
sl@0
    48
	
sl@0
    49
sl@0
    50
#ifndef REMOVE_CAF1
sl@0
    51
	class CAttribute;
sl@0
    52
#endif
sl@0
    53
	
sl@0
    54
sl@0
    55
/**
sl@0
    56
   CContent allows applications to browse the content objects contained within a 
sl@0
    57
   single file and construct a CData object for reading that content.
sl@0
    58
 
sl@0
    59
  Applications will use an object of this type rather than the traditional 
sl@0
    60
  RFile mechanisms. They will, however, be  required to indicate 
sl@0
    61
  <i>DRM Intent</i> - something that determines whether (and how) access to
sl@0
    62
  the content should be permitted by a Content-Access agent.
sl@0
    63
 
sl@0
    64
  CContent allows direct access to meta-data such as the attributes of 
sl@0
    65
  the content and indirect access to the plaintext data itself through 
sl@0
    66
  the CData class. 
sl@0
    67
  
sl@0
    68
  Applications can use CContent to browse the hierarchy of content objects 
sl@0
    69
  within a file containing several content objects.
sl@0
    70
   
sl@0
    71
  During construction CContent loads the correct CAF Agent plugin to handle 
sl@0
    72
  the file specified by the URI.
sl@0
    73
 */
sl@0
    74
	class CContent :  public CBase
sl@0
    75
		{
sl@0
    76
	public:
sl@0
    77
sl@0
    78
		/**
sl@0
    79
		 Constructs a new CContent object with a given URI. The URI can be in the same format as a virtual path for more information see CVirtualPath and TVirtualPathPtr
sl@0
    80
sl@0
    81
		 @param aURI	The filename, URI or virtual path of the DRM file.
sl@0
    82
		 @return a new CContent object.
sl@0
    83
		 @leave KErrNotFound If the file at the given URI does not exist or if an invalid URI or virtual path have been supplied.
sl@0
    84
		 @leave KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
sl@0
    85
		 @leave ...		One of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
    86
						other system-wide error codes for any other errors.
sl@0
    87
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
    88
		 */
sl@0
    89
		IMPORT_C static CContent* NewLC(const TDesC& aURI);
sl@0
    90
sl@0
    91
		/**
sl@0
    92
		 Constructs a new CContent object with a given URI. The URI can be in the same format as a virtual path for more information see CVirtualPath and TVirtualPathPtr
sl@0
    93
sl@0
    94
		 @param aURI	The filename, URI or virtual path of the DRM file.
sl@0
    95
		 @return a new CContent object.
sl@0
    96
		 @leave KErrNotFound If the file at the given URI does not exist or if an invalid URI or virtual path have been supplied.
sl@0
    97
		 @leave KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
sl@0
    98
		 @leave ...			One of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
    99
							other system-wide error codes for any other errors.
sl@0
   100
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   101
		 */
sl@0
   102
		IMPORT_C static CContent* NewL(const TDesC& aURI);
sl@0
   103
		
sl@0
   104
		/**
sl@0
   105
		 Constructs a new CContent object with a given URI. The URI can be in the same format as a virtual path for more information see CVirtualPath and TVirtualPathPtr
sl@0
   106
sl@0
   107
		 @param aURI	The filename, URI or virtual path of the DRM file.
sl@0
   108
		 @param aShareMode The sharing mode used when accessing the content.
sl@0
   109
		 @return a new CContent object.
sl@0
   110
		 @leave KErrNotFound If the file at the given URI does not exist or if an invalid URI or virtual path have been supplied.
sl@0
   111
		 @leave KErrAccessDenied If the file is already open with a different share mode.
sl@0
   112
		 @leave KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
sl@0
   113
		 @leave ...			One of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   114
							other system-wide error codes for any other errors.
sl@0
   115
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   116
		 */
sl@0
   117
		IMPORT_C static CContent* NewLC(const TDesC& aURI, TContentShareMode aShareMode);
sl@0
   118
		
sl@0
   119
		/** 
sl@0
   120
		Constructs a new CContent object with a given URI. The URI can be in the same format as a virtual path for more information see CVirtualPath and TVirtualPathPtr
sl@0
   121
sl@0
   122
		@param aURI	The filename, URI or virtual path of the DRM file.
sl@0
   123
		@param aShareMode The sharing mode used when accessing the content.
sl@0
   124
		@return a new CContent object.
sl@0
   125
		@leave KErrNotFound If the file at the given URI does not exist or if an invalid URI or virtual path have been supplied.
sl@0
   126
		@leave KErrAccessDenied If the file is already open with a different share mode.
sl@0
   127
		@leave KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
sl@0
   128
		@leave ...			One of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   129
							other system-wide error codes for any other errors.
sl@0
   130
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   131
		*/
sl@0
   132
		IMPORT_C static CContent* NewL(const TDesC& aURI, TContentShareMode aShareMode);
sl@0
   133
sl@0
   134
		/**
sl@0
   135
		 Constructs a new CContent object with an open file handle.
sl@0
   136
sl@0
   137
  		 CContent will use a duplicate of this file handle, the client is 
sl@0
   138
		 free to close its file handle any time after creating the CContent 
sl@0
   139
		 object.
sl@0
   140
sl@0
   141
		 @param aFile The file handle. The file must already be open before calling NewLC. 
sl@0
   142
		 The underlying RFs session should be shared for transfer to other processes using RFs::ShareProtected(), since the agent may use transfer this handle to its own or one of the system servers.
sl@0
   143
		 @return a new CContent object.
sl@0
   144
		 @leave KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
sl@0
   145
		 @leave ...			One of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   146
							other system-wide error codes for any other errors.
sl@0
   147
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   148
		 */
sl@0
   149
		IMPORT_C static CContent* NewLC(RFile& aFile);
sl@0
   150
		
sl@0
   151
		/** 
sl@0
   152
		 Constructs a new CContent object with an open file handle.
sl@0
   153
sl@0
   154
  		 CContent will use a duplicate of this file handle, the client is 
sl@0
   155
		 free to close its file handle any time after creating the CContent 
sl@0
   156
		 object.
sl@0
   157
sl@0
   158
		 @param aFile The file handle. The file must already be open before calling this method. 
sl@0
   159
		 The underlying RFs session should be shared for transfer to other processes using RFs::ShareProtected(), since the agent may use transfer this handle to its own or one of the system servers.
sl@0
   160
		 @return a new CContent object.
sl@0
   161
		 @leave KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.	 
sl@0
   162
		 @leave ...			One of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   163
							other system-wide error codes for any other errors.
sl@0
   164
		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   165
		*/
sl@0
   166
		IMPORT_C static CContent* NewL(RFile& aFile);
sl@0
   167
sl@0
   168
#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT		
sl@0
   169
		/** 
sl@0
   170
		 Constructs a new CContent object.
sl@0
   171
sl@0
   172
  		 @param aHeaderData	Header data of WMDRM file/stream content. 
sl@0
   173
		 @return 			CContent object.
sl@0
   174
		 @leave 			KErrMissingHeaderData if the header data is NULL or one of the CAF error codes defined in caferr.h  
sl@0
   175
		 					or one of the system-wide error codes for any other errors.
sl@0
   176
		 @capability DRM 	Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   177
	 	 */
sl@0
   178
		IMPORT_C static CContent* NewL(const TDesC8& aHeaderData);
sl@0
   179
		
sl@0
   180
		/** 
sl@0
   181
		 Constructs a new CContent object.
sl@0
   182
  		 
sl@0
   183
  		 @param aHeaderData	Header data of WMDRM file/stream content.  
sl@0
   184
		 @return 			CContent object.
sl@0
   185
		 @leave 			KErrMissingHeaderData if the header data is NULL or one of the CAF error codes defined in caferr.h  or one of the 
sl@0
   186
							system-wide error codes for any other errors.
sl@0
   187
		 @capability DRM 	Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   188
		 */
sl@0
   189
		IMPORT_C static CContent* NewLC(const TDesC8& aHeaderData);
sl@0
   190
		
sl@0
   191
#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
sl@0
   192
sl@0
   193
		/** destructor */
sl@0
   194
		virtual ~CContent();
sl@0
   195
sl@0
   196
 		/** Open a Container object within the file.
sl@0
   197
 		
sl@0
   198
 		Allows an application to access the content objects and 
sl@0
   199
 		any nested container objects within the specified container.
sl@0
   200
  		
sl@0
   201
 		@param aUniqueId The container object's unique ID.
sl@0
   202
		@return Whether the container was opened.
sl@0
   203
 		@return KErrNone if the container was opened successfully.
sl@0
   204
 		@return KErrNotFound if the container does not exist.
sl@0
   205
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.		 
sl@0
   206
		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   207
				other system-wide error codes for any other errors.
sl@0
   208
 		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   209
 		*/
sl@0
   210
 		IMPORT_C TInt OpenContainer(const TDesC& aUniqueId);
sl@0
   211
sl@0
   212
 		/** Close the current container object and go back to previous enclosing
sl@0
   213
 		container within the file.
sl@0
   214
 		
sl@0
   215
 		Allows an application to access the content objects and 
sl@0
   216
 		any nested container objects within parent container.
sl@0
   217
  		
sl@0
   218
		@return Whether the container was closed.
sl@0
   219
  		@return KErrNone if the container was closed.
sl@0
   220
  		@return KErrNotFound if there is no enclosing container.
sl@0
   221
  		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.		 		
sl@0
   222
  		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   223
 		*/
sl@0
   224
		IMPORT_C TInt CloseContainer();
sl@0
   225
sl@0
   226
		/** List all the embedded container objects and content objects within the 
sl@0
   227
		current container
sl@0
   228
 		 		
sl@0
   229
		The UniqueId() member of CEmbeddedObject can be used to refer directly to 
sl@0
   230
		a particular object within the file.
sl@0
   231
		
sl@0
   232
		@code
sl@0
   233
		// Create a ccontent object for the file of interest
sl@0
   234
		CContent* content = CContent::NewLC(uri);
sl@0
   235
		
sl@0
   236
		// Define an array to store the results
sl@0
   237
		RStreamablePtrArray <CEmbeddedObject> array;
sl@0
   238
		CleanupClosePushL(array);
sl@0
   239
		
sl@0
   240
		// Find all the content and container objects within the current container
sl@0
   241
		content->GetEmbeddedObjectsL(array);
sl@0
   242
		
sl@0
   243
		// Do something with the array
sl@0
   244
		....
sl@0
   245
		
sl@0
   246
		// Finished
sl@0
   247
		CleanupStack::PopAndDestroy(2);
sl@0
   248
		@endcode
sl@0
   249
		
sl@0
   250
		@param aArray The array to be populated with the embedded objects. 
sl@0
   251
		@leave KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.		 
sl@0
   252
		@leave ...			One of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   253
							other system-wide error codes for any other errors.
sl@0
   254
  		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   255
 		*/
sl@0
   256
		IMPORT_C void GetEmbeddedObjectsL(RStreamablePtrArray<CEmbeddedObject>& aArray) const;
sl@0
   257
sl@0
   258
		/** List all the embedded objects within the current container that
sl@0
   259
		are of the specified type
sl@0
   260
sl@0
   261
		@code
sl@0
   262
		// Create a ccontent object for the file of interest
sl@0
   263
		CContent* content = CContent::NewLC(uri);
sl@0
   264
		
sl@0
   265
		// Define an array to store the results
sl@0
   266
		RStreamablePtrArray <CEmbeddedObject> array;
sl@0
   267
		CleanupClosePushL(array);
sl@0
   268
		
sl@0
   269
		// Find all the content objects within the current container
sl@0
   270
		content->GetEmbeddedObjectsL(array, EContentObject);
sl@0
   271
		
sl@0
   272
		// Do something with the array
sl@0
   273
		....
sl@0
   274
		
sl@0
   275
		// Finished
sl@0
   276
		CleanupStack::PopAndDestroy(2);
sl@0
   277
		@endcode
sl@0
   278
 		 		
sl@0
   279
		@param aArray The array to be populated with the embedded objects. 
sl@0
   280
		@param aType The type of objects to list.
sl@0
   281
		@leave KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.		 
sl@0
   282
		@leave ...			One of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   283
							other system-wide error codes for any other errors.
sl@0
   284
  		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   285
 		*/
sl@0
   286
		IMPORT_C void GetEmbeddedObjectsL(RStreamablePtrArray<CEmbeddedObject>& aArray, TEmbeddedType aType) const;
sl@0
   287
		
sl@0
   288
		/** Search the current container for content objects with a particular mime type
sl@0
   289
sl@0
   290
		@code
sl@0
   291
		_LIT8(KTextPlainMimeType, "text/plain");
sl@0
   292
		
sl@0
   293
		// Create a ccontent object for the file of interest
sl@0
   294
		CContent* content = CContent::NewLC(uri);
sl@0
   295
		
sl@0
   296
		// Define an array to store the results
sl@0
   297
		RStreamablePtrArray <CEmbeddedObject> array;
sl@0
   298
		CleanupClosePushL(array);
sl@0
   299
		
sl@0
   300
		// Recursively search for all the content objects with the 
sl@0
   301
		// specified mime type
sl@0
   302
		User::LeaveIfError(content->Search(array, KTextPlainMimeType(), ETrue));
sl@0
   303
		
sl@0
   304
		// Do something with the array
sl@0
   305
		....
sl@0
   306
		
sl@0
   307
		// Finished
sl@0
   308
		CleanupStack::PopAndDestroy(2);
sl@0
   309
		@endcode
sl@0
   310
sl@0
   311
  		@param aArray The array to store the results of the search. The agent will add CEmbeddedObject objects to the supplied array.
sl@0
   312
		@param aMimeType The mime type to search for.
sl@0
   313
		@param aRecursive ETrue to search inside containers embedded within the current container, EFalse to search only the current container.
sl@0
   314
		@return The result of the search.
sl@0
   315
		@return KErrNone if the search was successful, even if no content objects were found.
sl@0
   316
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.		 
sl@0
   317
		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   318
				other system-wide error codes for any other errors.
sl@0
   319
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   320
		*/
sl@0
   321
		IMPORT_C TInt Search(RStreamablePtrArray<CEmbeddedObject>& aArray, const TDesC8& aMimeType, TBool aRecursive);
sl@0
   322
sl@0
   323
sl@0
   324
		/**  Get an attribute for the default content object within the file
sl@0
   325
sl@0
   326
  		@see ContentAccess::TAttribute
sl@0
   327
sl@0
   328
		@code
sl@0
   329
		TInt value = 0;
sl@0
   330
		CContent* c = CContent::NewL(uri);
sl@0
   331
		TInt err =c->GetAttribute(EIsProtected, value);
sl@0
   332
		if(err == KErrNone && value)
sl@0
   333
			{
sl@0
   334
			DisplayPadLock();
sl@0
   335
			}
sl@0
   336
		@endcode
sl@0
   337
sl@0
   338
		@param aAttribute The attribute to query, from ContentAccess::TAttribute.
sl@0
   339
		@param aValue Used to return the attribute value.
sl@0
   340
		@return Whether the attribute value was updated.
sl@0
   341
		@return KErrNone if the value of the attribute was updated.
sl@0
   342
		@return KErrNotFound if the object with the given UniqueId was not found.
sl@0
   343
		@return KErrCANotSupported if the requested attribute does not exist.
sl@0
   344
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.	 
sl@0
   345
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the 
sl@0
   346
				other system-wide error codes for any other errors.
sl@0
   347
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   348
		*/
sl@0
   349
		IMPORT_C TInt GetAttribute(TInt aAttribute, TInt& aValue) const;		
sl@0
   350
sl@0
   351
		/**  Get an attribute for an object within the file
sl@0
   352
sl@0
   353
		@see ContentAccess::TAttribute
sl@0
   354
sl@0
   355
		@code
sl@0
   356
		TInt value = 0;
sl@0
   357
		CContent* c = CContent::NewL(uri);
sl@0
   358
		TInt err =c->GetAttribute(EIsProtected, value, uniqueId);
sl@0
   359
		if(err == KErrNone && value)
sl@0
   360
			{
sl@0
   361
			DisplayPadLock();
sl@0
   362
			}
sl@0
   363
		@endcode
sl@0
   364
sl@0
   365
		@param aAttribute The attribute to query, from ContentAccess::TAttribute.
sl@0
   366
		@param aValue Used to return the attribute value.
sl@0
   367
		@param aUniqueId The UniqueId of the object within the file.
sl@0
   368
		@return Whether the attribute value was updated.
sl@0
   369
		@return KErrNone if the value of the attribute was updated.
sl@0
   370
		@return KErrNotFound if the object with the given UniqueId was not found.
sl@0
   371
		@return KErrCANotSupported if the requested attribute does not exist.
sl@0
   372
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.	 
sl@0
   373
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the 
sl@0
   374
				other system-wide error codes for any other errors.
sl@0
   375
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   376
		*/
sl@0
   377
		IMPORT_C TInt GetAttribute(TInt aAttribute, TInt& aValue, const TDesC& aUniqueId) const;
sl@0
   378
		
sl@0
   379
sl@0
   380
		/** Get a set of attributes for the default content object within the file
sl@0
   381
sl@0
   382
		@see ContentAccess::TAttribute
sl@0
   383
sl@0
   384
		The following example determines whether the default content object 
sl@0
   385
		is protected and has rights that will enable it to be viewed by the 
sl@0
   386
		user
sl@0
   387
sl@0
   388
		@code
sl@0
   389
		CContent* content = CContent::NewLC(uri);
sl@0
   390
				
sl@0
   391
		RAttributeSet attributeSet;
sl@0
   392
		CleanupClosePushL(attributeSet);
sl@0
   393
		attributeSet->AddL(EProtected);
sl@0
   394
		attributeSet->AddL(ECanView);
sl@0
   395
sl@0
   396
		User::LeaveIfError(content->GetAttributeSet(attributeSet);
sl@0
   397
sl@0
   398
		TInt err = attributeSet.GetValue(EProtected, value);
sl@0
   399
		if(err == KErrNone && value)
sl@0
   400
				{
sl@0
   401
				// file is DRM protected
sl@0
   402
				}
sl@0
   403
sl@0
   404
		err = attributeSet.GetValue(ECanView, value);
sl@0
   405
		if(err == KErrNone && value)
sl@0
   406
				{
sl@0
   407
				// File has rights that allow it to be displayed on screen
sl@0
   408
				}
sl@0
   409
		
sl@0
   410
		// Finished
sl@0
   411
		CleanupStack::PopAndDestroy(2); // content, attributeSet.Close()
sl@0
   412
		@endcode
sl@0
   413
sl@0
   414
sl@0
   415
		@param aAttributeSet The set of attributes to query and update.
sl@0
   416
		@return Whether the attribute set was updated.
sl@0
   417
		@return KErrNone if the attributes were retrieved successfully.
sl@0
   418
		@return KErrNotFound if the default content object was not found.
sl@0
   419
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.		 
sl@0
   420
		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   421
				other system-wide error codes for any other errors.
sl@0
   422
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   423
		*/
sl@0
   424
		IMPORT_C TInt GetAttributeSet(RAttributeSet& aAttributeSet) const;		
sl@0
   425
		
sl@0
   426
		/** Get a set of attributes from an object within the file
sl@0
   427
sl@0
   428
		@see ContentAccess::TAttribute
sl@0
   429
sl@0
   430
		The following example determines whether the default content object 
sl@0
   431
		is protected and has rights that will enable it to be viewed by the 
sl@0
   432
		user
sl@0
   433
sl@0
   434
		@code
sl@0
   435
		CContent* content = CContent::NewLC(uri);
sl@0
   436
				
sl@0
   437
		RAttributeSet attributeSet;
sl@0
   438
		CleanupClosePushL(attributeSet);
sl@0
   439
		attributeSet->AddL(EProtected);
sl@0
   440
		attributeSet->AddL(ECanView);
sl@0
   441
sl@0
   442
		User::LeaveIfError(content->GetAttributeSet(attributeSet, uniqueId);
sl@0
   443
sl@0
   444
		TInt err = attributeSet.GetValue(EProtected, value);
sl@0
   445
		if(err == KErrNone && value)
sl@0
   446
				{
sl@0
   447
				// file is DRM protected
sl@0
   448
				}
sl@0
   449
sl@0
   450
		err = attributeSet.GetValue(ECanView, value);
sl@0
   451
		if(err == KErrNone && value)
sl@0
   452
				{
sl@0
   453
				// File has rights that allow it to be displayed on screen
sl@0
   454
				}
sl@0
   455
		
sl@0
   456
		// Finished
sl@0
   457
		CleanupStack::PopAndDestroy(2); // content, attributeSet.Close()
sl@0
   458
		@endcode
sl@0
   459
sl@0
   460
sl@0
   461
		@param aAttributeSet The set of attributes to query and update.
sl@0
   462
		@param aUniqueId The unique ID of the object within the file.
sl@0
   463
		@return Whether that attribute set was updated.
sl@0
   464
		@return KErrNone if the attributes were retrieved successfully.
sl@0
   465
		@return KErrNotFound if the default content object was not found.
sl@0
   466
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.		 
sl@0
   467
		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   468
				other system-wide error codes for any other errors.
sl@0
   469
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   470
		*/
sl@0
   471
		IMPORT_C TInt GetAttributeSet(RAttributeSet& aAttributeSet, const TDesC& aUniqueId) const;
sl@0
   472
		
sl@0
   473
		/**  Get text string attributes or meta-data for the default content object within the file
sl@0
   474
	
sl@0
   475
		@see ContentAccess::TStringAttribute
sl@0
   476
sl@0
   477
		@code
sl@0
   478
		TInt err = KErrNone;
sl@0
   479
		
sl@0
   480
		CContent* c = CContent::NewL(uri);
sl@0
   481
		TBuf <MAX_PATH> previewUri;
sl@0
   482
		err = c->GetStringAttribute(EPreviewURI, previewUri);
sl@0
   483
		if(err == KErrNone)
sl@0
   484
			{
sl@0
   485
			DisplayPreview(previewUri);
sl@0
   486
			}
sl@0
   487
		@endcode
sl@0
   488
sl@0
   489
		@param aAttribute The attribute to query, from ContentAccess::TStringAttribute.
sl@0
   490
		@param aValue Returns the value of the attribute.
sl@0
   491
		@return Whether the attribute value was updated.
sl@0
   492
		@return KErrNone if the attribute was retrieved.
sl@0
   493
		@return KErrNotFound if the default content object was not found.
sl@0
   494
		@return KErrOverflow if the buffer was not large enough to return the result.
sl@0
   495
		@return KErrCANotSupported if the requested attribute does not exist.
sl@0
   496
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.		 
sl@0
   497
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the 
sl@0
   498
				other system-wide error codes for any other errors.
sl@0
   499
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   500
		*/
sl@0
   501
		IMPORT_C TInt GetStringAttribute(TInt aAttribute, TDes& aValue) const;
sl@0
   502
		
sl@0
   503
		/** Get text string attributes or meta-data for an object within the file
sl@0
   504
sl@0
   505
		@see ContentAccess::TStringAttribute
sl@0
   506
sl@0
   507
		@code
sl@0
   508
		TInt err = KErrNone;
sl@0
   509
		
sl@0
   510
		CContent* c = CContent::NewL(uri);
sl@0
   511
		TBuf <MAX_PATH> previewUri;
sl@0
   512
		err = c->GetStringAttribute(EPreviewURI, previewUri, uniqueId);
sl@0
   513
		if(err == KErrNone)
sl@0
   514
			{
sl@0
   515
			DisplayPreview(previewUri);
sl@0
   516
			}
sl@0
   517
		@endcode
sl@0
   518
sl@0
   519
		@param aAttribute The attribute to query, from ContentAccess::TStringAttribute.
sl@0
   520
		@param aValue Returns the value of the attribute.
sl@0
   521
		@param aUniqueId The UniqueId of the object within the file. 
sl@0
   522
		@return Whether the attribute value was updated.
sl@0
   523
		@return KErrNone if the attribute was retrieved.
sl@0
   524
		@return KErrNotFound if the object with the given UniqueId was not found.
sl@0
   525
		@return KErrOverflow if the buffer was not large enough to return the result.
sl@0
   526
		@return KErrCANotSupported if the requested attribute does not exist.
sl@0
   527
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.	 
sl@0
   528
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the 
sl@0
   529
				other system-wide error codes for any other errors.
sl@0
   530
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   531
		*/
sl@0
   532
		IMPORT_C TInt GetStringAttribute(TInt aAttribute, TDes& aValue, const TDesC& aUniqueId) const;
sl@0
   533
		
sl@0
   534
		/** Obtain a set of string attributes for the default content object within the file
sl@0
   535
sl@0
   536
		@see ContentAccess::TStringAttribute
sl@0
   537
	  
sl@0
   538
		@code
sl@0
   539
		CContent* content = CContent::NewLC(uri);
sl@0
   540
		
sl@0
   541
		// create the attribute set, add the attributes we are interested in
sl@0
   542
		RStringAttributeSet stringAttributeSet;
sl@0
   543
		CleanupClosePushL(stringAttributeSet);
sl@0
   544
		stringAttributeSet.AddL(EPreviewURI);
sl@0
   545
		stringAttributeSet.AddL(ETitle);
sl@0
   546
		
sl@0
   547
		User::LeaveIfError(content->GetStringAttributeSet(stringAttributeSet));
sl@0
   548
	
sl@0
   549
		// Pass the value of the string attribute to DisplayPreview()
sl@0
   550
		TFileName previewUri;		
sl@0
   551
		TInt err = stringAttributeSet.GetValue(EPreviewURI, previewUri);
sl@0
   552
		if(err == KErrNone)
sl@0
   553
			{
sl@0
   554
			DisplayPreview(previewUri);
sl@0
   555
			}
sl@0
   556
		
sl@0
   557
		CleanupStack::PopAndDestroy(2); // content, stringAttributeSet.Close()
sl@0
   558
		@endcode
sl@0
   559
	
sl@0
   560
sl@0
   561
		@param aStringAttributeSet The set of attributes to query and update.
sl@0
   562
		@return Whether the attribute set was updated.
sl@0
   563
		@return KErrNone if the attributes were retrieved successfully.
sl@0
   564
		@return KErrNotFound if the default content object was not found.
sl@0
   565
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.		 
sl@0
   566
		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   567
				other system-wide error codes for any other errors.
sl@0
   568
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   569
		*/
sl@0
   570
		IMPORT_C TInt GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet) const;
sl@0
   571
	
sl@0
   572
		/** Used to obtain a set of string attributes for an object within the file
sl@0
   573
sl@0
   574
		@see ContentAccess::TStringAttribute
sl@0
   575
	
sl@0
   576
		@code
sl@0
   577
		CContent* content = CContent::NewLC(uri);
sl@0
   578
		
sl@0
   579
		// create the attribute set, add the attributes we are interested in
sl@0
   580
		RStringAttributeSet stringAttributeSet;
sl@0
   581
		CleanupClosePushL(stringAttributeSet);
sl@0
   582
		stringAttributeSet.AddL(EPreviewURI);
sl@0
   583
		stringAttributeSet.AddL(ETitle);
sl@0
   584
		
sl@0
   585
		User::LeaveIfError(content->GetStringAttributeSet(stringAttributeSet, uniqueId));
sl@0
   586
	
sl@0
   587
		// Pass the value of the string attribute to DisplayPreview()
sl@0
   588
		TFileName previewUri;		
sl@0
   589
		TInt err = stringAttributeSet.GetValue(EPreviewURI, previewUri);
sl@0
   590
		if(err == KErrNone)
sl@0
   591
			{
sl@0
   592
			DisplayPreview(previewUri);
sl@0
   593
			}
sl@0
   594
		
sl@0
   595
		CleanupStack::PopAndDestroy(2); // content, stringAttributeSet.Close()
sl@0
   596
		@endcode
sl@0
   597
	
sl@0
   598
sl@0
   599
		@param aStringAttributeSet The set of attributes to query and update.
sl@0
   600
		@param aUniqueId The UniqueId of the container or content. 
sl@0
   601
		@return Whether the attribute set was updated.
sl@0
   602
		@return KErrNone if the attributes were retrieved successfully.
sl@0
   603
		@return KErrNotFound if the object with the given UniqueId was not found.
sl@0
   604
		@return KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.		 
sl@0
   605
		@return Otherwise one of the CAF error codes defined in \c caferr.h  or one of the 
sl@0
   606
				other system-wide error codes for any other errors.
sl@0
   607
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   608
		*/
sl@0
   609
		IMPORT_C TInt GetStringAttributeSet(RStringAttributeSet& aStringAttributeSet, const TDesC& aUniqueId) const;
sl@0
   610
sl@0
   611
		/** Allows extended synchronous calls to the CAF agent handling this file
sl@0
   612
		
sl@0
   613
		Applications familiar with the agent can pass objects in and out using serialization.
sl@0
   614
sl@0
   615
		@param aCommand The agent defined command.
sl@0
   616
		@param aInputBuffer Non modifyable input data buffer.
sl@0
   617
		@param aOutputBuffer Modifyable output buffer to hold the result of the command.
sl@0
   618
		@return The outcome of the agent specific command.
sl@0
   619
		@return KErrCANotSupported if the agent does not recognize the command.
sl@0
   620
		@return KErrOverflow if the output buffer supplied is too small.
sl@0
   621
		@return KErrPermissionDenied if the agent does not allow the client to execute the command.
sl@0
   622
		@return Otherwise one of the other CAF error codes defined in \c caferr.h  or one of the 
sl@0
   623
				other system-wide error codes for any other errors.
sl@0
   624
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   625
		*/
sl@0
   626
		IMPORT_C TInt AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer);
sl@0
   627
sl@0
   628
		/** Allows extended synchronous calls to the CAF agent handling this file
sl@0
   629
		Applications familiar with the agent can pass objects in and out using serialization.
sl@0
   630
		NB: It is important that the descriptor passed to 
sl@0
   631
		aOutputBuffer remains in scope until the request has completed.		
sl@0
   632
sl@0
   633
		@param aCommand The agent defined command.
sl@0
   634
		@param aInputBuffer Non modifyable input data buffer.
sl@0
   635
		@param aOutputBuffer Modifyable output buffer to hold the result of the command.
sl@0
   636
		@param aStatus Asynchronous request status. On completion this will contain 
sl@0
   637
						one of the following error codes:
sl@0
   638
						KErrNone if the command was successfully executed.
sl@0
   639
						KErrCANotSupported  if the agent does not recognize the command.
sl@0
   640
						KErrOverflow if the output buffer supplied is too small.
sl@0
   641
						KErrPermissionDenied if the agent does not allow the client 
sl@0
   642
						to execute the command. Otherwise one of the other CAF error codes defined 
sl@0
   643
						in \c caferr.h  or one of the other system-wide error codes 
sl@0
   644
						for any other errors.
sl@0
   645
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   646
		*/
sl@0
   647
		IMPORT_C void AgentSpecificCommand(TInt aCommand, const TDesC8& aInputBuffer, TDes8& aOutputBuffer, TRequestStatus& aStatus);
sl@0
   648
sl@0
   649
sl@0
   650
		/** Request notification for an event for the default content object within the file
sl@0
   651
sl@0
   652
		@see ContentAccess::TEventMask
sl@0
   653
sl@0
   654
		@param aMask Bitmask of events the caller is interested in.	
sl@0
   655
		@param aStatus The TRequestStatus object to complete if the event occurs.
sl@0
   656
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   657
		*/
sl@0
   658
		IMPORT_C void NotifyStatusChange(TEventMask aMask, TRequestStatus& aStatus);
sl@0
   659
sl@0
   660
		/** Request notification for an event for an object within the file
sl@0
   661
sl@0
   662
		@see ContentAccess::TEventMask
sl@0
   663
sl@0
   664
		@param aMask Bitmask of events the caller is interested in.
sl@0
   665
		@param aStatus The TRequestStatus object to complete if the event occurs.
sl@0
   666
		@param aUniqueId The UniqueId of the container or content. 						 
sl@0
   667
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   668
		*/
sl@0
   669
		IMPORT_C void NotifyStatusChange(TEventMask aMask, TRequestStatus& aStatus, const TDesC& aUniqueId);
sl@0
   670
sl@0
   671
		/** Cancel a previous notification request for the default content object
sl@0
   672
sl@0
   673
		@param aStatus The TRequestStatus supplied in the call to NotifyStatusChange().
sl@0
   674
		@return The outcome of the cancel request.
sl@0
   675
		@return KErrNone if the request was cancelled.
sl@0
   676
		@return KErrNotFound if there was no matching request outstanding.
sl@0
   677
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   678
		*/
sl@0
   679
		IMPORT_C TInt CancelNotifyStatusChange(TRequestStatus& aStatus);
sl@0
   680
sl@0
   681
		/** Cancel a previous notification request
sl@0
   682
sl@0
   683
		@param aStatus The TRequestStatus supplied in the call to NotifyStatusChange().
sl@0
   684
		@param aUniqueId The UniqueId of the content object within the file.
sl@0
   685
		@return The outcome of the cancel request.
sl@0
   686
		@return KErrNone if the request was cancelled.
sl@0
   687
		@return KErrNotFound if there was no matching request outstanding.
sl@0
   688
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   689
		*/
sl@0
   690
		IMPORT_C TInt CancelNotifyStatusChange(TRequestStatus& aStatus, const TDesC& aUniqueId);
sl@0
   691
		
sl@0
   692
		/** Request the agent to obtain rights for the default content object
sl@0
   693
sl@0
   694
		This request may be handled differently by different agents. 
sl@0
   695
		Some agents may open a browser and direct the user to a URL. Others may 
sl@0
   696
		download and install the rights in the background.
sl@0
   697
sl@0
   698
		The call should not block execution, applications can wait for a notification 
sl@0
   699
		if they are interested in the outcome.
sl@0
   700
sl@0
   701
		@param aStatus Asynchronous request status. On completion this will contain 
sl@0
   702
						one of the following error codes:
sl@0
   703
						KErrNone if the rights request was successful.
sl@0
   704
						KErrCANotSupported  if the agent does not allow rights requests.
sl@0
   705
						Otherwise one of the other CAF error codes defined in \c caferr.h  
sl@0
   706
						or one of the other system-wide error codes 
sl@0
   707
						for any other errors.
sl@0
   708
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   709
		*/
sl@0
   710
		IMPORT_C void RequestRights(TRequestStatus& aStatus);
sl@0
   711
sl@0
   712
		/** Request the agent to obtain rights for a protected content object
sl@0
   713
sl@0
   714
		This request may be handled differently by different agents. 
sl@0
   715
		Some agents may open a browser and direct the user to a URL. Others may 
sl@0
   716
		download and install the rights in the background.
sl@0
   717
sl@0
   718
		The call should not block execution, applications can wait for a notification 
sl@0
   719
		if they are interested in the outcome.
sl@0
   720
sl@0
   721
		@param aStatus Asynchronous request status. On completion this will contain 
sl@0
   722
						one of the following error codes:
sl@0
   723
						KErrNone if the rights request was successful.
sl@0
   724
						KErrCANotSupported  if the agent does not allow rights requests.
sl@0
   725
						Otherwise one of the other CAF error codes defined in \c caferr.h  
sl@0
   726
						or one of the other system-wide error codes 
sl@0
   727
						for any other errors.
sl@0
   728
sl@0
   729
		@param aUniqueId The unique id of the object within the file.					
sl@0
   730
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   731
		*/
sl@0
   732
		IMPORT_C void RequestRights(TRequestStatus& aStatus, const TDesC& aUniqueId);
sl@0
   733
sl@0
   734
sl@0
   735
		/** Cancel a previous RequestRights() request for the default content object
sl@0
   736
sl@0
   737
		@param aStatus The TRequestStatus that was supplied to the RequestRights() function.
sl@0
   738
		@return The result of the cancel rights request.
sl@0
   739
		@return KErrNone if the rights request was cancelled.
sl@0
   740
		@return KErrNotFound if there was no matching rights request outstanding.
sl@0
   741
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   742
		*/
sl@0
   743
		IMPORT_C TInt CancelRequestRights(TRequestStatus& aStatus);
sl@0
   744
sl@0
   745
		/** Cancel a previous RequestRights() request
sl@0
   746
sl@0
   747
		@param aStatus The TRequestStatus that was supplied to the RequestRights() function.
sl@0
   748
		@param aUniqueId The objects Unique Id that was supplied to the RequestRights() function.
sl@0
   749
		@return The result of the cancel rights request.
sl@0
   750
		@return KErrNone if the rights request was cancelled.
sl@0
   751
		@return KErrNotFound if there was no matching rights request outstanding.
sl@0
   752
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   753
		*/
sl@0
   754
		IMPORT_C TInt CancelRequestRights(TRequestStatus& aStatus, const TDesC& aUniqueId);
sl@0
   755
sl@0
   756
		/** View information associated with the default content object
sl@0
   757
	
sl@0
   758
		This call blocks execution and only returns once the display is dismissed 
sl@0
   759
		by the user.
sl@0
   760
sl@0
   761
		@see ContentAccess::TDisplayInfo
sl@0
   762
sl@0
   763
		@param aInfo The information to display.
sl@0
   764
		@leave KErrCANotSupported if information cannot be displayed or does not exist.
sl@0
   765
		@leave ...			One of the other CAF error codes defined in \c caferr.h  
sl@0
   766
							or one of the system-wide error codes for 
sl@0
   767
							any other errors.
sl@0
   768
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   769
		*/
sl@0
   770
		IMPORT_C void DisplayInfoL(TDisplayInfo aInfo) const;
sl@0
   771
		
sl@0
   772
		/** View information associated with a single content object
sl@0
   773
		
sl@0
   774
		This call blocks execution and only returns once the display is dismissed 
sl@0
   775
		by the user.
sl@0
   776
sl@0
   777
		@see ContentAccess::TDisplayInfo
sl@0
   778
sl@0
   779
		@param aInfo The information to display.
sl@0
   780
		@param aUniqueId The unique id of the object within the file.
sl@0
   781
		@leave KErrCANotSupported if information cannot be displayed or does not exist.
sl@0
   782
		@leave ...			One of the other CAF error codes defined in \c caferr.h  
sl@0
   783
							or one of the system-wide error codes for 
sl@0
   784
							any other errors.
sl@0
   785
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   786
		*/
sl@0
   787
		IMPORT_C void DisplayInfoL(TDisplayInfo aInfo, const TDesC& aUniqueId) const;
sl@0
   788
sl@0
   789
sl@0
   790
		/** Request the agent handling this content to set a property value. If 
sl@0
   791
		the property is set it is only set for this CContent session and does not 
sl@0
   792
		impact other CAF users and is not set for CData products created by the 
sl@0
   793
		CContent.
sl@0
   794
sl@0
   795
  		@see ContentAccess::TAgentProperty
sl@0
   796
sl@0
   797
		@param aProperty The property to set.
sl@0
   798
		@param aValue The value of the property.
sl@0
   799
		@return Whether the property was set.
sl@0
   800
		@return KErrNone if the property was set.
sl@0
   801
		@return KErrCANotSupported if the agent does not support the property or value.
sl@0
   802
		@return KErrAccessDenied if the agent does not permit the property to be changed.
sl@0
   803
		@return KErrPermissionDenied if the application does not have the necessary capability to change the property.
sl@0
   804
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted 
sl@0
   805
		*/
sl@0
   806
		IMPORT_C TInt SetProperty(TAgentProperty aProperty, TInt aValue);
sl@0
   807
		
sl@0
   808
		/** 
sl@0
   809
		 Grants read access to the default content object based on 
sl@0
   810
		 evaluation of the supplied intent information. 
sl@0
   811
		 
sl@0
   812
		 Note that the intent is simply evaluated and not executed. 
sl@0
   813
		 To force the intent to be executed, clients must use the call
sl@0
   814
		 ContentAccess::CData::ExecuteIntent(). 
sl@0
   815
		 
sl@0
   816
		 A CData object can be obtained as follows:
sl@0
   817
		 @code
sl@0
   818
		 CData* MyData = myContent->OpenContentL(ChosenIntent);
sl@0
   819
		 ...
sl@0
   820
		 delete MyData; // when finished accessing plaintext content
sl@0
   821
		 @endcode
sl@0
   822
sl@0
   823
		 @see ContentAccess::TIntent
sl@0
   824
sl@0
   825
		 @param aIntent	The intent indicator.
sl@0
   826
		 @return A CData instance. The caller gets ownership of this object.
sl@0
   827
		 
sl@0
   828
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
sl@0
   829
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
sl@0
   830
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
sl@0
   831
		 @leave KErrCANoRights		No rights exist for the content object.
sl@0
   832
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
sl@0
   833
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
sl@0
   834
		 @leave KErrAccessDenied	The content is already in use.
sl@0
   835
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
sl@0
   836
		 						or one of the other system-wide error codes for any other 
sl@0
   837
								errors.		 
sl@0
   838
 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted
sl@0
   839
		 */
sl@0
   840
		IMPORT_C CData* OpenContentL(TIntent aIntent);
sl@0
   841
sl@0
   842
		/** 
sl@0
   843
		 Grants read access to the default content object based on 
sl@0
   844
		 evaluation of the supplied intent information. 
sl@0
   845
	
sl@0
   846
		 Note that the intent is simply evaluated and not executed. 
sl@0
   847
		 To force the intent to be executed, clients must use the call
sl@0
   848
		 ContentAccess::CData::ExecuteIntent(). 
sl@0
   849
		 
sl@0
   850
		 A CData object can be obtained as follows:
sl@0
   851
		 @code
sl@0
   852
		 CData* myData = myContent->OpenContentLC(ChosenIntent);
sl@0
   853
		 ...
sl@0
   854
		 // when finished accessing plaintext content
sl@0
   855
		 CleanupStack::PopAndDestroy(myData); 
sl@0
   856
		 @endcode
sl@0
   857
sl@0
   858
		 @see ContentAccess::TIntent
sl@0
   859
sl@0
   860
		 @param aIntent	The intent indicator.
sl@0
   861
		 @return A CData instance. The caller gets ownership of this object.
sl@0
   862
		 
sl@0
   863
		 @leave KErrNotFound			The content object with the given UniqueId does not exist.
sl@0
   864
		 @leave KErrCAPendingRights		The rights have not yet arrived but are expected soon.
sl@0
   865
		 @leave KErrCANoPermission		Rights exist but the specified intent is not permitted.
sl@0
   866
		 @leave KErrCANoRights			No rights exist for the content object.
sl@0
   867
		 @leave KErrCANotSupported		Unable to open the object with the specified UniqueId, it may be a container object.
sl@0
   868
		 @leave KErrPermissionDenied	The agent does not allow the client to access the content object.
sl@0
   869
		 @leave KErrAccessDenied		The content is already in use.
sl@0
   870
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
sl@0
   871
		 						or one of the other system-wide error codes for any other 
sl@0
   872
								errors.		 
sl@0
   873
 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.
sl@0
   874
		 */
sl@0
   875
		IMPORT_C CData* OpenContentLC(TIntent aIntent);
sl@0
   876
		
sl@0
   877
		/** 
sl@0
   878
		 Grants read access to the content object based on evaluation of the
sl@0
   879
		 supplied intent information. 
sl@0
   880
		 
sl@0
   881
		 Note that the intent is simply evaluated and not executed. 
sl@0
   882
		 To force the intent to be executed, clients must use the call
sl@0
   883
		 ContentAccess::CData::ExecuteIntent(). 
sl@0
   884
		 
sl@0
   885
		 A CData object can be obtained as follows:
sl@0
   886
		 @code
sl@0
   887
		 CData* MyData = myContent->OpenContentL(ChosenIntent, uniqueId);
sl@0
   888
		 ...
sl@0
   889
		 delete MyData; // when finished accessing plaintext content
sl@0
   890
		 @endcode
sl@0
   891
		 	
sl@0
   892
		 @see ContentAccess::TIntent
sl@0
   893
sl@0
   894
		 @param aIntent	The intent indicator.
sl@0
   895
		 @param aUniqueId The object to open for reading. If the UniqueId is set to KNullDesC16() the entire file will be opened for reading with no transformation.
sl@0
   896
		 @return A CData instance. The caller gets ownership of this object.
sl@0
   897
		 
sl@0
   898
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
sl@0
   899
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
sl@0
   900
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
sl@0
   901
		 @leave KErrCANoRights		No rights exist for the content object.
sl@0
   902
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
sl@0
   903
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
sl@0
   904
		 @leave KErrAccessDenied	The content is already in use.
sl@0
   905
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
sl@0
   906
		 						or one of the other system-wide error codes for any other 
sl@0
   907
								errors.		 
sl@0
   908
 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted
sl@0
   909
		 */
sl@0
   910
		IMPORT_C CData* OpenContentL(TIntent aIntent, const TDesC& aUniqueId);
sl@0
   911
sl@0
   912
sl@0
   913
		/** 
sl@0
   914
		 Grants read access to the content object based on evaluation of the
sl@0
   915
		 supplied intent information. 
sl@0
   916
		 
sl@0
   917
		 Note that the intent is simply evaluated and not executed. 
sl@0
   918
		 To force the intent to be executed, clients must use the call
sl@0
   919
		 ContentAccess::CData::ExecuteIntent(). 
sl@0
   920
		 
sl@0
   921
		 A CData object can be obtained as follows:
sl@0
   922
		 @code
sl@0
   923
		 CData* MyData = myContent->OpenContentLC(ChosenIntent, uniqueId);
sl@0
   924
		 ...
sl@0
   925
		 PopAndDestroy(MyData); // when finished accessing plaintext content
sl@0
   926
		 @endcode
sl@0
   927
		 	
sl@0
   928
		 @see ContentAccess::TIntent
sl@0
   929
sl@0
   930
		 @param aIntent	The intent indicator.
sl@0
   931
		 @param aUniqueId The object to open for reading. If the UniqueId is set to KNullDesC16() the entire file will be opened for reading with no transformation.
sl@0
   932
		 @return A CData instance. The caller gets ownership of this object.
sl@0
   933
		 
sl@0
   934
		 @leave KErrNotFound		The content object with the given UniqueId does not exist.
sl@0
   935
		 @leave KErrCAPendingRights The rights have not yet arrived but are expected soon.
sl@0
   936
		 @leave KErrCANoPermission	Rights exist but the specified intent is not permitted.
sl@0
   937
		 @leave KErrCANoRights		No rights exist for the content object.
sl@0
   938
		 @leave KErrCANotSupported	Unable to open the object with the specified UniqueId, it may be a container object.
sl@0
   939
		 @leave KErrPermissionDenied The agent does not allow the client to access the content object.
sl@0
   940
		 @leave KErrAccessDenied	The content is already in use.
sl@0
   941
		 @leave ...				One of the other CAF error codes defined in \c caferr.h  
sl@0
   942
		 						or one of the other system-wide error codes for any other 
sl@0
   943
								errors.		 
sl@0
   944
 		 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted
sl@0
   945
		 */
sl@0
   946
		IMPORT_C CData* OpenContentLC(TIntent aIntent, const TDesC& aUniqueId);
sl@0
   947
sl@0
   948
sl@0
   949
		/** Find out which agent is handling this file
sl@0
   950
		@return The agent handling the File
sl@0
   951
		*/
sl@0
   952
		IMPORT_C const TAgent& Agent() const;
sl@0
   953
		
sl@0
   954
		/** Indicates the mode in which the content is shared.
sl@0
   955
			@return The content sharing mode
sl@0
   956
		*/
sl@0
   957
		inline TContentShareMode ShareMode() const;
sl@0
   958
		
sl@0
   959
#ifndef REMOVE_CAF1
sl@0
   960
		/** Create a CData object for reading the content 
sl@0
   961
sl@0
   962
		@see ContentAccess::TIntent
sl@0
   963
		@param aIntent The intended use of the content
sl@0
   964
		@param aShareMode The mode used to open the file. If EContentShareExclusive is required, use CData::NewL() instead
sl@0
   965
		@return A new CData object
sl@0
   966
		@leave One of the CAF error codes defined in \c caferr.h  or one of the system-wide error codes for any errors.
sl@0
   967
		@capability DRM Access to DRM agents is not permitted for processes without DRM capability
sl@0
   968
		@deprecated
sl@0
   969
		*/
sl@0
   970
		IMPORT_C CData* OpenContentL(TIntent aIntent, TContentShareMode aShareMode);
sl@0
   971
sl@0
   972
		/** Create a CAttribute object to determine the attributes of the default content object
sl@0
   973
		
sl@0
   974
		@return The agent handling the File
sl@0
   975
		@capability DRM Access to DRM agents is not permitted for processes without DRM capability
sl@0
   976
		@deprecated 
sl@0
   977
		*/
sl@0
   978
		IMPORT_C CAttribute* NewAttributeL(TBool aPreloaded);
sl@0
   979
sl@0
   980
		/** Create a CAttribute object to determine the attributes of the default content object
sl@0
   981
		
sl@0
   982
		@return The agent handling the File
sl@0
   983
		@capability DRM Access to DRM agents is not permitted for processes without DRM capability
sl@0
   984
		@deprecated 
sl@0
   985
		*/
sl@0
   986
		IMPORT_C CAttribute* NewAttributeL(TBool aPreloaded, TContentShareMode aShareMode);
sl@0
   987
sl@0
   988
#endif  // REMOVE_CAF1
sl@0
   989
		
sl@0
   990
	private:
sl@0
   991
		CContent(); 
sl@0
   992
		void ConstructL(RFile& aFile); 
sl@0
   993
		void ConstructL(const TDesC& aURI, TContentShareMode aShareMode); 
sl@0
   994
		
sl@0
   995
#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
sl@0
   996
		void ConstructL(const TDesC8& aHeaderData);
sl@0
   997
sl@0
   998
		/**
sl@0
   999
		Create a CData object for reading WMDRM content.
sl@0
  1000
		
sl@0
  1001
		@param	aIntent		The intended use of the content.
sl@0
  1002
		@param	aHeaderData	Header data of WMDRM file/stream content.
sl@0
  1003
		@return				CData object.
sl@0
  1004
		@leave 				One of the CAF error codes defined in caferr.h  or one of the system-wide error codes for any errors.
sl@0
  1005
		@capability DRM 	Access to DRM agents is not permitted for processes without DRM capability.
sl@0
  1006
		*/
sl@0
  1007
		
sl@0
  1008
		CData* OpenContentL(TIntent aIntent, const TDesC8& aHeaderData);
sl@0
  1009
		
sl@0
  1010
		/**
sl@0
  1011
		Create a CData object for reading WMDRM content.
sl@0
  1012
		
sl@0
  1013
		@param	aIntent		The intended use of the content.
sl@0
  1014
		@param	aHeaderData	Header data of WMDRM file/stream content.
sl@0
  1015
		@return				CData object.
sl@0
  1016
		@leave 				One of the CAF error codes defined in caferr.h  or one of the system-wide error codes for any errors.
sl@0
  1017
		@capability DRM 	Access to DRM agents is not permitted for processes without DRM capability.
sl@0
  1018
		*/
sl@0
  1019
		CData* OpenContentLC(TIntent aIntent, const TDesC8& aHeaderData);
sl@0
  1020
		
sl@0
  1021
#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
sl@0
  1022
sl@0
  1023
	private:	
sl@0
  1024
	
sl@0
  1025
		/** CAgentFactory object is effectively the	ECOM session handle */
sl@0
  1026
		CAgentFactory* iAgentFactory;
sl@0
  1027
sl@0
  1028
		/** 
sl@0
  1029
		 Agent object used for browsing the contents of a file
sl@0
  1030
		 */
sl@0
  1031
		CAgentContent* iAgentContent;
sl@0
  1032
sl@0
  1033
		/** Points to the default content object if the file is opened by name */
sl@0
  1034
		CVirtualPath* iVirtualPath;
sl@0
  1035
sl@0
  1036
		/** The content object referred to by CContent, either points to iVirtualPath
sl@0
  1037
		or points to (KNullDesC(), KDefaultContentObject()) 
sl@0
  1038
		*/
sl@0
  1039
		TVirtualPathPtr iDefaultVirtualPath;
sl@0
  1040
sl@0
  1041
		/* Stores the name and UID of the agent
sl@0
  1042
		*/
sl@0
  1043
		TAgent iAgent;
sl@0
  1044
		
sl@0
  1045
		/** The share mode used to open the content file*/
sl@0
  1046
		TContentShareMode iShareMode;
sl@0
  1047
sl@0
  1048
		/** Reference to the file handle if the content was opened with a file handle */
sl@0
  1049
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
sl@0
  1050
		RFile64 iFile;
sl@0
  1051
#else
sl@0
  1052
		RFile iFile;
sl@0
  1053
#endif //SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
sl@0
  1054
sl@0
  1055
#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
sl@0
  1056
		HBufC8* iHeaderData;
sl@0
  1057
#endif //#ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
sl@0
  1058
sl@0
  1059
		};
sl@0
  1060
sl@0
  1061
#include <caf/content.inl>
sl@0
  1062
	} // namespace ContentAccess
sl@0
  1063
sl@0
  1064
#endif // __CONTENT_H__ 
sl@0
  1065