ContentAccess::CContent Class Reference

class ContentAccess::CContent : public CBase

CContent allows applications to browse the content objects contained within a single file and construct a CData object for reading that content.

Applications will use an object of this type rather than the traditional RFile mechanisms. They will, however, be required to indicate DRM Intent - something that determines whether (and how) access to the content should be permitted by a Content-Access agent.

CContent allows direct access to meta-data such as the attributes of the content and indirect access to the plaintext data itself through the CData class.

Applications can use CContent to browse the hierarchy of content objects within a file containing several content objects.

During construction CContent loads the correct CAF Agent plugin to handle the file specified by the URI.

Inherits from

  • ContentAccess::CContent
Public Member Functions
~CContent()
IMPORT_C const TAgent &Agent()
IMPORT_C TIntAgentSpecificCommand(TInt, const TDesC8 &, TDes8 &)
IMPORT_C voidAgentSpecificCommand(TInt, const TDesC8 &, TDes8 &, TRequestStatus &)
IMPORT_C TIntCancelNotifyStatusChange(TRequestStatus &)
IMPORT_C TIntCancelNotifyStatusChange(TRequestStatus &, const TDesC &)
IMPORT_C TIntCancelRequestRights(TRequestStatus &)
IMPORT_C TIntCancelRequestRights(TRequestStatus &, const TDesC &)
IMPORT_C TIntCloseContainer()
IMPORT_C voidDisplayInfoL(TDisplayInfo)
IMPORT_C voidDisplayInfoL(TDisplayInfo, const TDesC &)
IMPORT_C TIntGetAttribute(TInt, TInt &)
IMPORT_C TIntGetAttribute(TInt, TInt &, const TDesC &)
IMPORT_C TIntGetAttributeSet(RAttributeSet &)
IMPORT_C TIntGetAttributeSet(RAttributeSet &, const TDesC &)
IMPORT_C voidGetEmbeddedObjectsL(RStreamablePtrArray< CEmbeddedObject > &)
IMPORT_C voidGetEmbeddedObjectsL(RStreamablePtrArray< CEmbeddedObject > &, TEmbeddedType)
IMPORT_C TIntGetStringAttribute(TInt, TDes &)
IMPORT_C TIntGetStringAttribute(TInt, TDes &, const TDesC &)
IMPORT_C TIntGetStringAttributeSet(RStringAttributeSet &)
IMPORT_C TIntGetStringAttributeSet(RStringAttributeSet &, const TDesC &)
IMPORT_C CAttribute *NewAttributeL(TBool)
IMPORT_C CAttribute *NewAttributeL(TBool, TContentShareMode)
IMPORT_C CContent *NewL(const TDesC &)
IMPORT_C CContent *NewL(const TDesC &, TContentShareMode)
IMPORT_C CContent *NewL(RFile &)
IMPORT_C CContent *NewLC(const TDesC &)
IMPORT_C CContent *NewLC(const TDesC &, TContentShareMode)
IMPORT_C CContent *NewLC(RFile &)
IMPORT_C voidNotifyStatusChange(TEventMask, TRequestStatus &)
IMPORT_C voidNotifyStatusChange(TEventMask, TRequestStatus &, const TDesC &)
IMPORT_C TIntOpenContainer(const TDesC &)
IMPORT_C CData *OpenContentL(TIntent)
IMPORT_C CData *OpenContentL(TIntent, const TDesC &)
IMPORT_C CData *OpenContentL(TIntent, TContentShareMode)
IMPORT_C CData *OpenContentLC(TIntent)
IMPORT_C CData *OpenContentLC(TIntent, const TDesC &)
IMPORT_C voidRequestRights(TRequestStatus &)
IMPORT_C voidRequestRights(TRequestStatus &, const TDesC &)
IMPORT_C TIntSearch(RStreamablePtrArray< CEmbeddedObject > &, const TDesC8 &, TBool)
IMPORT_C TIntSetProperty(TAgentProperty, TInt)
TContentShareMode ShareMode()
Private Member Functions
CContent()
voidConstructL(RFile &)
voidConstructL(const TDesC &, TContentShareMode)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
TAgent iAgent
CAgentContent *iAgentContent
CAgentFactory *iAgentFactory
TVirtualPathPtr iDefaultVirtualPath
RFile iFile
TContentShareMode iShareMode
CVirtualPath *iVirtualPath

Constructor & Destructor Documentation

CContent()

CContent()[private]

~CContent()

~CContent()[virtual]

destructor

Member Functions Documentation

Agent()

IMPORT_C const TAgent &Agent()const

Find out which agent is handling this file

AgentSpecificCommand(TInt, const TDesC8 &, TDes8 &)

IMPORT_C TIntAgentSpecificCommand(TIntaCommand,
const TDesC8 &aInputBuffer,
TDes8 &aOutputBuffer
)

Allows extended synchronous calls to the CAF agent handling this file

Applications familiar with the agent can pass objects in and out using serialization.

capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TInt aCommandThe agent defined command.
const TDesC8 & aInputBufferNon modifyable input data buffer.
TDes8 & aOutputBufferModifyable output buffer to hold the result of the command.

AgentSpecificCommand(TInt, const TDesC8 &, TDes8 &, TRequestStatus &)

IMPORT_C voidAgentSpecificCommand(TIntaCommand,
const TDesC8 &aInputBuffer,
TDes8 &aOutputBuffer,
TRequestStatus &aStatus
)

Allows extended synchronous calls to the CAF agent handling this file Applications familiar with the agent can pass objects in and out using serialization. NB: It is important that the descriptor passed to aOutputBuffer remains in scope until the request has completed.

capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TInt aCommandThe agent defined command.
const TDesC8 & aInputBufferNon modifyable input data buffer.
TDes8 & aOutputBufferModifyable output buffer to hold the result of the command.
TRequestStatus & aStatusAsynchronous request status. On completion this will contain one of the following error codes: KErrNone if the command was successfully executed. KErrCANotSupported if the agent does not recognize the command. KErrOverflow if the output buffer supplied is too small. KErrPermissionDenied if the agent does not allow the client to execute the command. Otherwise one of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

CancelNotifyStatusChange(TRequestStatus &)

IMPORT_C TIntCancelNotifyStatusChange(TRequestStatus &aStatus)

Cancel a previous notification request for the default content object

capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TRequestStatus & aStatusThe TRequestStatus supplied in the call to NotifyStatusChange().

CancelNotifyStatusChange(TRequestStatus &, const TDesC &)

IMPORT_C TIntCancelNotifyStatusChange(TRequestStatus &aStatus,
const TDesC &aUniqueId
)

Cancel a previous notification request

capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TRequestStatus & aStatusThe TRequestStatus supplied in the call to NotifyStatusChange().
const TDesC & aUniqueIdThe UniqueId of the content object within the file.

CancelRequestRights(TRequestStatus &)

IMPORT_C TIntCancelRequestRights(TRequestStatus &aStatus)

Cancel a previous RequestRights() request for the default content object

capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TRequestStatus & aStatusThe TRequestStatus that was supplied to the RequestRights() function.

CancelRequestRights(TRequestStatus &, const TDesC &)

IMPORT_C TIntCancelRequestRights(TRequestStatus &aStatus,
const TDesC &aUniqueId
)

Cancel a previous RequestRights() request

capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TRequestStatus & aStatusThe TRequestStatus that was supplied to the RequestRights() function.
const TDesC & aUniqueIdThe objects Unique Id that was supplied to the RequestRights() function.

CloseContainer()

IMPORT_C TIntCloseContainer()

Close the current container object and go back to previous enclosing container within the file.

Allows an application to access the content objects and any nested container objects within parent container.

capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

ConstructL(RFile &)

voidConstructL(RFile &aFile)[private]

Parameters

RFile & aFile

ConstructL(const TDesC &, TContentShareMode)

voidConstructL(const TDesC &aURI,
TContentShareModeaShareMode
)[private]

Parameters

const TDesC & aURI
TContentShareMode aShareMode

DisplayInfoL(TDisplayInfo)

IMPORT_C voidDisplayInfoL(TDisplayInfoaInfo)const

View information associated with the default content object

This call blocks execution and only returns once the display is dismissed by the user.

ContentAccess::TDisplayInfo
leave
KErrCANotSupported if information cannot be displayed or does not exist.
leave
... One of the other CAF error codes defined in caferr.h or one of the system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

TDisplayInfo aInfoThe information to display.

DisplayInfoL(TDisplayInfo, const TDesC &)

IMPORT_C voidDisplayInfoL(TDisplayInfoaInfo,
const TDesC &aUniqueId
)const

View information associated with a single content object

This call blocks execution and only returns once the display is dismissed by the user.

ContentAccess::TDisplayInfo
leave
KErrCANotSupported if information cannot be displayed or does not exist.
leave
... One of the other CAF error codes defined in caferr.h or one of the system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

TDisplayInfo aInfoThe information to display.
const TDesC & aUniqueIdThe unique id of the object within the file.

GetAttribute(TInt, TInt &)

IMPORT_C TIntGetAttribute(TIntaAttribute,
TInt &aValue
)const

Get an attribute for the default content object within the file

ContentAccess::TAttribute
		TInt value = 0;
		CContent* c = CContent::NewL(uri);
		TInt err =c->GetAttribute(EIsProtected, value);
		if(err == KErrNone && value)
			{
			DisplayPadLock();
			}
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

TInt aAttributeThe attribute to query, from ContentAccess::TAttribute.
TInt & aValueUsed to return the attribute value.

GetAttribute(TInt, TInt &, const TDesC &)

IMPORT_C TIntGetAttribute(TIntaAttribute,
TInt &aValue,
const TDesC &aUniqueId
)const

Get an attribute for an object within the file

ContentAccess::TAttribute
		TInt value = 0;
		CContent* c = CContent::NewL(uri);
		TInt err =c->GetAttribute(EIsProtected, value, uniqueId);
		if(err == KErrNone && value)
			{
			DisplayPadLock();
			}
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

TInt aAttributeThe attribute to query, from ContentAccess::TAttribute.
TInt & aValueUsed to return the attribute value.
const TDesC & aUniqueIdThe UniqueId of the object within the file.

GetAttributeSet(RAttributeSet &)

IMPORT_C TIntGetAttributeSet(RAttributeSet &aAttributeSet)const

Get a set of attributes for the default content object within the file

ContentAccess::TAttributeThe following example determines whether the default content object is protected and has rights that will enable it to be viewed by the user

		CContent* content = CContent::NewLC(uri);
				
		RAttributeSet attributeSet;
		CleanupClosePushL(attributeSet);
		attributeSet->AddL(EProtected);
		attributeSet->AddL(ECanView);

		User::LeaveIfError(content->GetAttributeSet(attributeSet);

		TInt err = attributeSet.GetValue(EProtected, value);
		if(err == KErrNone && value)
				{
				// file is DRM protected
				}

		err = attributeSet.GetValue(ECanView, value);
		if(err == KErrNone && value)
				{
				// File has rights that allow it to be displayed on screen
				}
		
		// Finished
		CleanupStack::PopAndDestroy(2); // content, attributeSet.Close()
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

RAttributeSet & aAttributeSetThe set of attributes to query and update.

GetAttributeSet(RAttributeSet &, const TDesC &)

IMPORT_C TIntGetAttributeSet(RAttributeSet &aAttributeSet,
const TDesC &aUniqueId
)const

Get a set of attributes from an object within the file

ContentAccess::TAttributeThe following example determines whether the default content object is protected and has rights that will enable it to be viewed by the user

		CContent* content = CContent::NewLC(uri);
				
		RAttributeSet attributeSet;
		CleanupClosePushL(attributeSet);
		attributeSet->AddL(EProtected);
		attributeSet->AddL(ECanView);

		User::LeaveIfError(content->GetAttributeSet(attributeSet, uniqueId);

		TInt err = attributeSet.GetValue(EProtected, value);
		if(err == KErrNone && value)
				{
				// file is DRM protected
				}

		err = attributeSet.GetValue(ECanView, value);
		if(err == KErrNone && value)
				{
				// File has rights that allow it to be displayed on screen
				}
		
		// Finished
		CleanupStack::PopAndDestroy(2); // content, attributeSet.Close()
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

RAttributeSet & aAttributeSetThe set of attributes to query and update.
const TDesC & aUniqueIdThe unique ID of the object within the file.

GetEmbeddedObjectsL(RStreamablePtrArray< CEmbeddedObject > &)

IMPORT_C voidGetEmbeddedObjectsL(RStreamablePtrArray< CEmbeddedObject > &aArray)const

List all the embedded container objects and content objects within the current container

The UniqueId() member of CEmbeddedObject can be used to refer directly to a particular object within the file.

		// Create a ccontent object for the file of interest
		CContent* content = CContent::NewLC(uri);
		
		// Define an array to store the results
		RStreamablePtrArray <CEmbeddedObject> array;
		CleanupClosePushL(array);
		
		// Find all the content and container objects within the current container
		content->GetEmbeddedObjectsL(array);
		
		// Do something with the array
		....
		
		// Finished
		CleanupStack::PopAndDestroy(2);
leave
KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent.
leave
... One of the CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

RStreamablePtrArray< CEmbeddedObject > & aArrayThe array to be populated with the embedded objects.

GetEmbeddedObjectsL(RStreamablePtrArray< CEmbeddedObject > &, TEmbeddedType)

IMPORT_C voidGetEmbeddedObjectsL(RStreamablePtrArray< CEmbeddedObject > &aArray,
TEmbeddedTypeaType
)const

List all the embedded objects within the current container that are of the specified type

		// Create a ccontent object for the file of interest
		CContent* content = CContent::NewLC(uri);
		
		// Define an array to store the results
		RStreamablePtrArray <CEmbeddedObject> array;
		CleanupClosePushL(array);
		
		// Find all the content objects within the current container
		content->GetEmbeddedObjectsL(array, EContentObject);
		
		// Do something with the array
		....
		
		// Finished
		CleanupStack::PopAndDestroy(2);
leave
KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
leave
... One of the CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

RStreamablePtrArray< CEmbeddedObject > & aArrayThe array to be populated with the embedded objects.
TEmbeddedType aTypeThe type of objects to list.

GetStringAttribute(TInt, TDes &)

IMPORT_C TIntGetStringAttribute(TIntaAttribute,
TDes &aValue
)const

Get text string attributes or meta-data for the default content object within the file

ContentAccess::TStringAttribute
		TInt err = KErrNone;
		
		CContent* c = CContent::NewL(uri);
		TBuf <MAX_PATH> previewUri;
		err = c->GetStringAttribute(EPreviewURI, previewUri);
		if(err == KErrNone)
			{
			DisplayPreview(previewUri);
			}
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

TInt aAttributeThe attribute to query, from ContentAccess::TStringAttribute.
TDes & aValueReturns the value of the attribute.

GetStringAttribute(TInt, TDes &, const TDesC &)

IMPORT_C TIntGetStringAttribute(TIntaAttribute,
TDes &aValue,
const TDesC &aUniqueId
)const

Get text string attributes or meta-data for an object within the file

ContentAccess::TStringAttribute
		TInt err = KErrNone;
		
		CContent* c = CContent::NewL(uri);
		TBuf <MAX_PATH> previewUri;
		err = c->GetStringAttribute(EPreviewURI, previewUri, uniqueId);
		if(err == KErrNone)
			{
			DisplayPreview(previewUri);
			}
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

TInt aAttributeThe attribute to query, from ContentAccess::TStringAttribute.
TDes & aValueReturns the value of the attribute.
const TDesC & aUniqueIdThe UniqueId of the object within the file.

GetStringAttributeSet(RStringAttributeSet &)

IMPORT_C TIntGetStringAttributeSet(RStringAttributeSet &aStringAttributeSet)const

Obtain a set of string attributes for the default content object within the file

ContentAccess::TStringAttribute
		CContent* content = CContent::NewLC(uri);
		
		// create the attribute set, add the attributes we are interested in
		RStringAttributeSet stringAttributeSet;
		CleanupClosePushL(stringAttributeSet);
		stringAttributeSet.AddL(EPreviewURI);
		stringAttributeSet.AddL(ETitle);
		
		User::LeaveIfError(content->GetStringAttributeSet(stringAttributeSet));
	
		// Pass the value of the string attribute to DisplayPreview()
		TFileName previewUri;		
		TInt err = stringAttributeSet.GetValue(EPreviewURI, previewUri);
		if(err == KErrNone)
			{
			DisplayPreview(previewUri);
			}
		
		CleanupStack::PopAndDestroy(2); // content, stringAttributeSet.Close()
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

RStringAttributeSet & aStringAttributeSetThe set of attributes to query and update.

GetStringAttributeSet(RStringAttributeSet &, const TDesC &)

IMPORT_C TIntGetStringAttributeSet(RStringAttributeSet &aStringAttributeSet,
const TDesC &aUniqueId
)const

Used to obtain a set of string attributes for an object within the file

ContentAccess::TStringAttribute
		CContent* content = CContent::NewLC(uri);
		
		// create the attribute set, add the attributes we are interested in
		RStringAttributeSet stringAttributeSet;
		CleanupClosePushL(stringAttributeSet);
		stringAttributeSet.AddL(EPreviewURI);
		stringAttributeSet.AddL(ETitle);
		
		User::LeaveIfError(content->GetStringAttributeSet(stringAttributeSet, uniqueId));
	
		// Pass the value of the string attribute to DisplayPreview()
		TFileName previewUri;		
		TInt err = stringAttributeSet.GetValue(EPreviewURI, previewUri);
		if(err == KErrNone)
			{
			DisplayPreview(previewUri);
			}
		
		CleanupStack::PopAndDestroy(2); // content, stringAttributeSet.Close()
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

RStringAttributeSet & aStringAttributeSetThe set of attributes to query and update.
const TDesC & aUniqueIdThe UniqueId of the container or content.

NewAttributeL(TBool)

IMPORT_C CAttribute *NewAttributeL(TBoolaPreloaded)

Create a CAttribute object to determine the attributes of the default content object

capability
DRM Access to DRM agents is not permitted for processes without DRM capability

Parameters

TBool aPreloaded

NewAttributeL(TBool, TContentShareMode)

IMPORT_C CAttribute *NewAttributeL(TBoolaPreloaded,
TContentShareModeaShareMode
)

Create a CAttribute object to determine the attributes of the default content object

capability
DRM Access to DRM agents is not permitted for processes without DRM capability

Parameters

TBool aPreloaded
TContentShareMode aShareMode

NewL(const TDesC &)

IMPORT_C CContent *NewL(const TDesC &aURI)[static]

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

leave
KErrNotFound If the file at the given URI does not exist or if an invalid URI or virtual path have been supplied.
leave
KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
leave
... One of the CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

const TDesC & aURIThe filename, URI or virtual path of the DRM file.

NewL(const TDesC &, TContentShareMode)

IMPORT_C CContent *NewL(const TDesC &aURI,
TContentShareModeaShareMode
)[static]

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

leave
KErrNotFound If the file at the given URI does not exist or if an invalid URI or virtual path have been supplied.
leave
KErrAccessDenied If the file is already open with a different share mode.
leave
KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
leave
... One of the CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

const TDesC & aURIThe filename, URI or virtual path of the DRM file.
TContentShareMode aShareModeThe sharing mode used when accessing the content.

NewL(RFile &)

IMPORT_C CContent *NewL(RFile &aFile)[static]

Constructs a new CContent object with an open file handle.

CContent will use a duplicate of this file handle, the client is free to close its file handle any time after creating the CContent object.

leave
KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
leave
... One of the CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

RFile & aFileThe file handle. The file must already be open before calling this method. 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.

NewLC(const TDesC &)

IMPORT_C CContent *NewLC(const TDesC &aURI)[static]

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

leave
KErrNotFound If the file at the given URI does not exist or if an invalid URI or virtual path have been supplied.
leave
KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
leave
... One of the CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

const TDesC & aURIThe filename, URI or virtual path of the DRM file.

NewLC(const TDesC &, TContentShareMode)

IMPORT_C CContent *NewLC(const TDesC &aURI,
TContentShareModeaShareMode
)[static]

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

leave
KErrNotFound If the file at the given URI does not exist or if an invalid URI or virtual path have been supplied.
leave
KErrAccessDenied If the file is already open with a different share mode.
leave
KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
leave
... One of the CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

const TDesC & aURIThe filename, URI or virtual path of the DRM file.
TContentShareMode aShareModeThe sharing mode used when accessing the content.

NewLC(RFile &)

IMPORT_C CContent *NewLC(RFile &aFile)[static]

Constructs a new CContent object with an open file handle.

CContent will use a duplicate of this file handle, the client is free to close its file handle any time after creating the CContent object.

leave
KErrPermissionDenied If the access to the protected content is not permitted by the CAF Agent.
leave
... One of the CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

RFile & aFileThe file handle. The file must already be open before calling NewLC. 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.

NotifyStatusChange(TEventMask, TRequestStatus &)

IMPORT_C voidNotifyStatusChange(TEventMaskaMask,
TRequestStatus &aStatus
)

Request notification for an event for the default content object within the file

ContentAccess::TEventMask
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TEventMask aMaskBitmask of events the caller is interested in.
TRequestStatus & aStatusThe TRequestStatus object to complete if the event occurs.

NotifyStatusChange(TEventMask, TRequestStatus &, const TDesC &)

IMPORT_C voidNotifyStatusChange(TEventMaskaMask,
TRequestStatus &aStatus,
const TDesC &aUniqueId
)

Request notification for an event for an object within the file

ContentAccess::TEventMask
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TEventMask aMaskBitmask of events the caller is interested in.
TRequestStatus & aStatusThe TRequestStatus object to complete if the event occurs.
const TDesC & aUniqueIdThe UniqueId of the container or content.

OpenContainer(const TDesC &)

IMPORT_C TIntOpenContainer(const TDesC &aUniqueId)

Open a Container object within the file.

Allows an application to access the content objects and any nested container objects within the specified container.

capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

const TDesC & aUniqueIdThe container object's unique ID.

OpenContentL(TIntent)

IMPORT_C CData *OpenContentL(TIntentaIntent)

Grants read access to the default content object based on evaluation of the supplied intent information.

Note that the intent is simply evaluated and not executed. To force the intent to be executed, clients must use the call ContentAccess::CData::ExecuteIntent().

A CData object can be obtained as follows:
		 CData* MyData = myContent->OpenContentL(ChosenIntent);
		 ...
		 delete MyData; // when finished accessing plaintext content
ContentAccess::TIntent
leave
KErrNotFound The content object with the given UniqueId does not exist.
leave
KErrCAPendingRights The rights have not yet arrived but are expected soon.
leave
KErrCANoPermission Rights exist but the specified intent is not permitted.
leave
KErrCANoRights No rights exist for the content object.
leave
KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.
leave
KErrPermissionDenied The agent does not allow the client to access the content object.
leave
KErrAccessDenied The content is already in use.
leave
... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TIntent aIntentThe intent indicator.

OpenContentL(TIntent, const TDesC &)

IMPORT_C CData *OpenContentL(TIntentaIntent,
const TDesC &aUniqueId
)

Grants read access to the content object based on evaluation of the supplied intent information.

Note that the intent is simply evaluated and not executed. To force the intent to be executed, clients must use the call ContentAccess::CData::ExecuteIntent().

A CData object can be obtained as follows:
		 CData* MyData = myContent->OpenContentL(ChosenIntent, uniqueId);
		 ...
		 delete MyData; // when finished accessing plaintext content
ContentAccess::TIntent
leave
KErrNotFound The content object with the given UniqueId does not exist.
leave
KErrCAPendingRights The rights have not yet arrived but are expected soon.
leave
KErrCANoPermission Rights exist but the specified intent is not permitted.
leave
KErrCANoRights No rights exist for the content object.
leave
KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.
leave
KErrPermissionDenied The agent does not allow the client to access the content object.
leave
KErrAccessDenied The content is already in use.
leave
... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TIntent aIntentThe intent indicator.
const TDesC & aUniqueIdThe object to open for reading. If the UniqueId is set to KNullDesC16() the entire file will be opened for reading with no transformation.

OpenContentL(TIntent, TContentShareMode)

IMPORT_C CData *OpenContentL(TIntentaIntent,
TContentShareModeaShareMode
)

Create a CData object for reading the content

ContentAccess::TIntent
leave
One of the CAF error codes defined in caferr.h or one of the system-wide error codes for any errors.
capability
DRM Access to DRM agents is not permitted for processes without DRM capability

Parameters

TIntent aIntentThe intended use of the content
TContentShareMode aShareModeThe mode used to open the file. If EContentShareExclusive is required, use CData::NewL() instead

OpenContentLC(TIntent)

IMPORT_C CData *OpenContentLC(TIntentaIntent)

Grants read access to the default content object based on evaluation of the supplied intent information.

Note that the intent is simply evaluated and not executed. To force the intent to be executed, clients must use the call ContentAccess::CData::ExecuteIntent().

A CData object can be obtained as follows:
		 CData* myData = myContent->OpenContentLC(ChosenIntent);
		 ...
		 // when finished accessing plaintext content
		 CleanupStack::PopAndDestroy(myData); 
ContentAccess::TIntent
leave
KErrNotFound The content object with the given UniqueId does not exist.
leave
KErrCAPendingRights The rights have not yet arrived but are expected soon.
leave
KErrCANoPermission Rights exist but the specified intent is not permitted.
leave
KErrCANoRights No rights exist for the content object.
leave
KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.
leave
KErrPermissionDenied The agent does not allow the client to access the content object.
leave
KErrAccessDenied The content is already in use.
leave
... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

TIntent aIntentThe intent indicator.

OpenContentLC(TIntent, const TDesC &)

IMPORT_C CData *OpenContentLC(TIntentaIntent,
const TDesC &aUniqueId
)

Grants read access to the content object based on evaluation of the supplied intent information.

Note that the intent is simply evaluated and not executed. To force the intent to be executed, clients must use the call ContentAccess::CData::ExecuteIntent().

A CData object can be obtained as follows:
		 CData* MyData = myContent->OpenContentLC(ChosenIntent, uniqueId);
		 ...
		 PopAndDestroy(MyData); // when finished accessing plaintext content
ContentAccess::TIntent
leave
KErrNotFound The content object with the given UniqueId does not exist.
leave
KErrCAPendingRights The rights have not yet arrived but are expected soon.
leave
KErrCANoPermission Rights exist but the specified intent is not permitted.
leave
KErrCANoRights No rights exist for the content object.
leave
KErrCANotSupported Unable to open the object with the specified UniqueId, it may be a container object.
leave
KErrPermissionDenied The agent does not allow the client to access the content object.
leave
KErrAccessDenied The content is already in use.
leave
... One of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TIntent aIntentThe intent indicator.
const TDesC & aUniqueIdThe object to open for reading. If the UniqueId is set to KNullDesC16() the entire file will be opened for reading with no transformation.

RequestRights(TRequestStatus &)

IMPORT_C voidRequestRights(TRequestStatus &aStatus)

Request the agent to obtain rights for the default content object

This request may be handled differently by different agents. Some agents may open a browser and direct the user to a URL. Others may download and install the rights in the background.

The call should not block execution, applications can wait for a notification if they are interested in the outcome.

capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

TRequestStatus & aStatusAsynchronous request status. On completion this will contain one of the following error codes: KErrNone if the rights request was successful. KErrCANotSupported if the agent does not allow rights requests. Otherwise one of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.

RequestRights(TRequestStatus &, const TDesC &)

IMPORT_C voidRequestRights(TRequestStatus &aStatus,
const TDesC &aUniqueId
)

Request the agent to obtain rights for a protected content object

This request may be handled differently by different agents. Some agents may open a browser and direct the user to a URL. Others may download and install the rights in the background.

The call should not block execution, applications can wait for a notification if they are interested in the outcome.

capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.

Parameters

TRequestStatus & aStatusAsynchronous request status. On completion this will contain one of the following error codes: KErrNone if the rights request was successful. KErrCANotSupported if the agent does not allow rights requests. Otherwise one of the other CAF error codes defined in caferr.h or one of the other system-wide error codes for any other errors.
const TDesC & aUniqueIdThe unique id of the object within the file.

Search(RStreamablePtrArray< CEmbeddedObject > &, const TDesC8 &, TBool)

IMPORT_C TIntSearch(RStreamablePtrArray< CEmbeddedObject > &aArray,
const TDesC8 &aMimeType,
TBoolaRecursive
)

Search the current container for content objects with a particular mime type

		_LIT8(KTextPlainMimeType, "text/plain");
		
		// Create a ccontent object for the file of interest
		CContent* content = CContent::NewLC(uri);
		
		// Define an array to store the results
		RStreamablePtrArray <CEmbeddedObject> array;
		CleanupClosePushL(array);
		
		// Recursively search for all the content objects with the 
		// specified mime type
		User::LeaveIfError(content->Search(array, KTextPlainMimeType(), ETrue));
		
		// Do something with the array
		....
		
		// Finished
		CleanupStack::PopAndDestroy(2);
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

RStreamablePtrArray< CEmbeddedObject > & aArrayThe array to store the results of the search. The agent will add CEmbeddedObject objects to the supplied array.
const TDesC8 & aMimeTypeThe mime type to search for.
TBool aRecursiveETrue to search inside containers embedded within the current container, EFalse to search only the current container.

SetProperty(TAgentProperty, TInt)

IMPORT_C TIntSetProperty(TAgentPropertyaProperty,
TIntaValue
)

Request the agent handling this content to set a property value. If the property is set it is only set for this CContent session and does not impact other CAF users and is not set for CData products created by the CContent.

ContentAccess::TAgentProperty
capability
DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted

Parameters

TAgentProperty aPropertyThe property to set.
TInt aValueThe value of the property.

ShareMode()

TContentShareMode ShareMode()const [inline]

Indicates the mode in which the content is shared.

Member Data Documentation

TAgent iAgent

TAgent iAgent[private]

CAgentContent * iAgentContent

CAgentContent *iAgentContent[private]

Agent object used for browsing the contents of a file

CAgentFactory * iAgentFactory

CAgentFactory *iAgentFactory[private]

CAgentFactory object is effectively the ECOM session handle

TVirtualPathPtr iDefaultVirtualPath

TVirtualPathPtr iDefaultVirtualPath[private]

The content object referred to by CContent, either points to iVirtualPath or points to (KNullDesC(), KDefaultContentObject())

RFile iFile

RFile iFile[private]

Reference to the file handle if the content was opened with a file handle

TContentShareMode iShareMode

TContentShareMode iShareMode[private]

The share mode used to open the content file

CVirtualPath * iVirtualPath

CVirtualPath *iVirtualPath[private]

Points to the default content object if the file is opened by name