CApfMimeContentPolicy Class Reference

class CApfMimeContentPolicy : public CBase

CApfMimeContentPolicy is utility class for checking MIME types and file extensions against closed content list. It also provides a function for checking if a given file is a DRM envelope, and a convinience function which combines all the checks mentioned above.

Usage:

        TFileName fileName = <name of the file to be checked>
  TUid uid;
  TDataType recData;

  CApfMimeContentPolicy *ccp = CApfMimeContentPolicy::NewLC();

  if (ccp->IsDRMEnvelope( fileName ))	
	{
     // Whatever needs to be done if file is DRM envelope.
	}

  // Check file extension.	
  TParse parser;
  parser.Set(fileName, NULL, NULL);
  if (IsClosedExtension(parser.Ext()))
	{
    // Do what needs to be done if closed content.
	}

  iLs.AppForDocument(fileName, uid, recData);  // Get MIME type for file.

  if (ccp->IsClosedType(recData.Des())   // Check if this mime type is closed.
	{
     // Whatever needs to be done if type is closed.
	}
	
  // Or you can achieve same result calling a convinience function
  // which combines all the steps above:
  if (cpp->IsClosedFileL( fileName );
 	{
    // Do whatever has to be done if file is closed.	
	}

  // Don't forget to clean up.
	CleanupStack::PopAndDestroy();  // ccp
       

Inherits from

Constructor & Destructor Documentation

CApfMimeContentPolicy()

CApfMimeContentPolicy ( ) [private]

C++ default constructor.

~CApfMimeContentPolicy()

IMPORT_C ~CApfMimeContentPolicy ( )

Destructor.

Member Functions Documentation

ConstructL()

void ConstructL ( ) [private]

By default Symbian 2nd phase constructor is private.

ConstructL(RFs &)

void ConstructL ( RFs & aFs ) [private]

By default Symbian 2nd phase constructor is private.

Parameters

RFs & aFs A handle to a shared file server session.

IsClosedExtension(const TDesC &)

IMPORT_C TBool IsClosedExtension ( const TDesC & aFileExtension )

Checks the extension of given file against list of closed file extensions.

Parameters

const TDesC & aFileExtension File extension to be checked.

IsClosedFileL(const TDesC &)

IMPORT_C TBool IsClosedFileL ( const TDesC & aFileName )

Checks if given file is Closed or not. This method checks for forward lock and superdistribution statuses of the file, in addition to IsClosedExtension and IsClosedType checks.

leave
KErrNone, if successful; otherwise one of the other system-wide error codes

Parameters

const TDesC & aFileName A file to be checked

IsClosedFileL(RFile &)

IMPORT_C TBool IsClosedFileL ( RFile & aFileHandle )
Checks if given file is Closed or not. This method checks for forward lock and superdistribution statuses of the file, in addition to IsClosedExtension and IsClosedType checks. Remember to make a file handle sharable. When a file handle is shared, the RFs handle has to be shared too.
leave
KErrNone, if successful; KErrBadHandle if an invalid handle has been passed as a parameter. otherwise one of the other system-wide error codes

Parameters

RFile & aFileHandle Handle to the file to be checked.

IsClosedType(const TDesC &)

IMPORT_C TBool IsClosedType ( const TDesC & aMimeType )

Checks if given MIME type is included in closed content list.

Parameters

const TDesC & aMimeType The mime type to be checked.

IsDRMEnvelopeL(const TDesC &)

IMPORT_C TBool IsDRMEnvelopeL ( const TDesC & aFileName )
Checks if given file is a DRM envelope. Can leave if file handling fails.
leave
KErrCANotSupported if the requested attribute does not exist. KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent. 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.

Parameters

const TDesC & aFileName A file to be checked.

IsDRMEnvelopeL(RFile &)

IMPORT_C TBool IsDRMEnvelopeL ( RFile & aFileHandle )
Checks if given file is a DRM envelope. Can leave if file handling fails.
leave
KErrCANotSupported if the requested attribute does not exist. KErrPermissionDenied if the access to the protected content is not permitted by the CAF Agent. 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.

Parameters

RFile & aFileHandle Handle to the file to be checked.

NewL()

IMPORT_C CApfMimeContentPolicy * NewL ( ) [static]

Creates a new Mime Content Policy object.

NewL(RFs &)

IMPORT_C CApfMimeContentPolicy * NewL ( RFs & aFs ) [static]

Creates a new Mime Content Policy object.

Parameters

RFs & aFs A handle to a shared file server session.

NewLC()

IMPORT_C CApfMimeContentPolicy * NewLC ( ) [static]

Creates a new Mime Content Policy object, and puts a pointer to it onto the cleanup stack.

NewLC(RFs &)

IMPORT_C CApfMimeContentPolicy * NewLC ( RFs & aFs ) [static]

Creates a new Mime Content Policy object, and puts a pointer to it onto the cleanup stack.

Parameters

RFs & aFs A handle to a shared file server session.

Member Data Documentation

CApfMimeContentPolicyImpl * iImpl

CApfMimeContentPolicyImpl * iImpl [private]