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

  • CApfMimeContentPolicy

Constructor & Destructor Documentation

CApfMimeContentPolicy()

CApfMimeContentPolicy()[private]

C++ default constructor.

~CApfMimeContentPolicy()

IMPORT_C~CApfMimeContentPolicy()

Destructor.

Member Functions Documentation

ConstructL()

voidConstructL()[private]

By default Symbian 2nd phase constructor is private.

ConstructL(RFs &)

voidConstructL(RFs &aFs)[private]

By default Symbian 2nd phase constructor is private.

Parameters

RFs & aFsA handle to a shared file server session.

IsClosedExtension(const TDesC &)

IMPORT_C TBoolIsClosedExtension(const TDesC &aFileExtension)

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

Parameters

const TDesC & aFileExtensionFile extension to be checked.

IsClosedFileL(const TDesC &)

IMPORT_C TBoolIsClosedFileL(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 & aFileNameA file to be checked

IsClosedFileL(RFile &)

IMPORT_C TBoolIsClosedFileL(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 & aFileHandleHandle to the file to be checked.

IsClosedType(const TDesC &)

IMPORT_C TBoolIsClosedType(const TDesC &aMimeType)

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

Parameters

const TDesC & aMimeTypeThe mime type to be checked.

IsDRMEnvelopeL(const TDesC &)

IMPORT_C TBoolIsDRMEnvelopeL(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 & aFileNameA file to be checked.

IsDRMEnvelopeL(RFile &)

IMPORT_C TBoolIsDRMEnvelopeL(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 & aFileHandleHandle 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 & aFsA 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 & aFsA handle to a shared file server session.

Member Data Documentation

CApfMimeContentPolicyImpl * iImpl

CApfMimeContentPolicyImpl *iImpl[private]