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