CMsvAttachment Class Reference

class CMsvAttachment : public CBase

Represents a single attachment and information about the attachment.

This object is used to represent all types of attachments (file, linked file or message entry). Note that some APIs may not be valid for particular attachment types. This is described under each method. It is the responsibility of the client to ensure that the data about the attachment is set such as its mime-type or size.

Inherits from

Public Member Functions
~CMsvAttachment ()
IMPORT_C const TDesC & AttachmentName ()
IMPORT_C TBool Complete ()
IMPORT_C TMsvId EntryAttachmentId ()
void ExternalizeL ( RWriteStream &)
IMPORT_C const TDesC & FilePath ()
IMPORT_C TInt GetDesC8Attribute ( TUid , TPtrC8 &)
IMPORT_C TInt GetIntAttribute ( TUid , TInt &)
IMPORT_C TMsvAttachmentId Id ()
void InternalizeL ( RReadStream &)
TBool IsPathRequired ()
IMPORT_C const TDesC8 & MimeType ()
IMPORT_C CMsvAttachment * NewL ( TMsvAttachmentType )
IMPORT_C CMsvAttachment * NewL ( TMsvAttachmentType , TInt , HBufC8 *, HBufC *)
IMPORT_C CMsvAttachment * NewL (const CMsvAttachment &)
IMPORT_C void RemoveDesC8Attribute ( TUid )
IMPORT_C void RemoveIntAttribute ( TUid )
IMPORT_C void SetAttachmentNameL (const TDesC &)
IMPORT_C void SetComplete ( TBool )
IMPORT_C void SetDesC8AttributeL ( TUid , const TDesC8 &)
void SetEntryAttachmentId ( TMsvId )
void SetFilePathL (const TDesC &)
IMPORT_C void SetId ( TMsvAttachmentId )
IMPORT_C void SetIntAttributeL ( TUid , TInt )
IMPORT_C void SetMimeTypeL (const TDesC8 &)
IMPORT_C void SetSize ( TInt )
IMPORT_C TInt Size ()
IMPORT_C TMsvAttachmentType Type ()
Private Member Functions
CMsvAttachment ( TMsvAttachmentType )
CMsvAttachment ( TMsvAttachmentType , TInt , HBufC8 *, HBufC *)
void ConstructL ()
void ConstructL (const CMsvAttachment &)
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()
Public Member Enumerations
enum TMsvAttachmentType { EMsvFile  = 0, EMsvLinkedFile , EMsvMessageEntry }
Private Attributes
HBufC * iAttachmentName
CMsvAttributeManager * iAttributeManager
TBool iComplete
TMsvId iEntryId
HBufC * iFilePath
TMsvAttachmentId iId
HBufC8 * iMimeType
TBool iNeedsPath
TInt iSize
TMsvAttachmentType iType

Constructor & Destructor Documentation

CMsvAttachment(TMsvAttachmentType)

CMsvAttachment ( TMsvAttachmentType aType ) [private]

Parameters

TMsvAttachmentType aType

CMsvAttachment(TMsvAttachmentType, TInt, HBufC8 *, HBufC *)

CMsvAttachment ( TMsvAttachmentType aType,
TInt aSize,
HBufC8 * aMimeType,
HBufC * aAttachmentName
) [private]

Parameters

TMsvAttachmentType aType
TInt aSize
HBufC8 * aMimeType
HBufC * aAttachmentName

~CMsvAttachment()

IMPORT_C ~CMsvAttachment ( )

Standard destructor.

Member Functions Documentation

AttachmentName()

IMPORT_C const TDesC & AttachmentName ( ) const

Returns the attachment name.

The attachment name is a readable text attribute to identify the attachment.

Complete()

IMPORT_C TBool Complete ( ) const

Indicates whether attachment is complete or not.

This allows support for incomplete or pending attachments.

ConstructL()

void ConstructL ( ) [private]

ConstructL(const CMsvAttachment &)

void ConstructL ( const CMsvAttachment & aAttachment ) [private]

Parameters

const CMsvAttachment & aAttachment

EntryAttachmentId()

IMPORT_C TMsvId EntryAttachmentId ( ) const

Returns the message entry Id for message entry attachment. This is only valid if the attachment type is EMessageEntry.

ExternalizeL(RWriteStream &)

void ExternalizeL ( RWriteStream & aStream ) const

Parameters

RWriteStream & aStream

FilePath()

IMPORT_C const TDesC & FilePath ( ) const

Returns the full path specification for file attachments.

This is only valid for file attachments where the attachment type is EMsvFile or EMsvLinkedFile.

GetDesC8Attribute(TUid, TPtrC8 &)

IMPORT_C TInt GetDesC8Attribute ( TUid aAttributeId,
TPtrC8 & aAttribute
) const

Gets an 8-bit descriptor attribute.

Gets the attribute uniquely identified by the UID identifer set using the SetDesC8AttributeL method.

Parameters

TUid aAttributeId The unique identifier for the attribute.
TPtrC8 & aAttribute If attribute is found, this will be set to point to the attribute data.

GetIntAttribute(TUid, TInt &)

IMPORT_C TInt GetIntAttribute ( TUid aAttributeId,
TInt & aAttribute
) const

Gets an integer attribute.

Gets the attribute uniquely identified by the UID identifer set using the SetIntAttributeL method.

Parameters

TUid aAttributeId The unique identifier for the attribute.
TInt & aAttribute If attribute is found, this will be set to the attribute data.

Id()

IMPORT_C TMsvAttachmentId Id ( ) const

Returns the attachment Id.

The attachment Id is unique on a per message entry basis.

InternalizeL(RReadStream &)

void InternalizeL ( RReadStream & aStream )

Parameters

RReadStream & aStream

IsPathRequired()

TBool IsPathRequired ( ) const

MimeType()

IMPORT_C const TDesC8 & MimeType ( ) const

The mime-type of the attachment.

NewL(TMsvAttachmentType)

IMPORT_C CMsvAttachment * NewL ( TMsvAttachmentType aType ) [static]

Standard 2-phase construction, creates the attachment object.

The object should then be initialised with information about the attachment.

Parameters

TMsvAttachmentType aType The attachment type.

NewL(TMsvAttachmentType, TInt, HBufC8 *, HBufC *)

IMPORT_C CMsvAttachment * NewL ( TMsvAttachmentType aType,
TInt aSize,
HBufC8 * aMimeType,
HBufC * aAttachmentName
) [static]

Standard 2-phase construction, creates the attachment object.

The object should then be initialised with information about the attachment. This allows the caller to pass in commonly used attributes to initialise them on construction to save the caller from having to call the relavant Set... methods. The attributes that can be initialised are Mime-Type, attachment name and size. Callers should pass in NULL for any attributes that are not required to be set.

Parameters

TMsvAttachmentType aType The attachment type.
TInt aSize The size of the attachment. For file attachments this should be the file size and for message entry attachments this should be the message size.
HBufC8 * aMimeType The Mime-Type of the attachment.
HBufC * aAttachmentName The attachment name to identify the attachment.

NewL(const CMsvAttachment &)

IMPORT_C CMsvAttachment * NewL ( const CMsvAttachment & aAttachment ) [static]

Parameters

const CMsvAttachment & aAttachment

RemoveDesC8Attribute(TUid)

IMPORT_C void RemoveDesC8Attribute ( TUid aAttributeId )

Removes an 8-bit descriptor attribute.

Removes the attribute identified by its UID identifer. This methods has no effect if the attribute does not exist.

Parameters

TUid aAttributeId The unique identifier for the attribute.

RemoveIntAttribute(TUid)

IMPORT_C void RemoveIntAttribute ( TUid aAttributeId )

Removes an integer attribute.

Removes the attribute identified by its UID identifer. This methods has no effect if the attribute does not exist.

Parameters

TUid aAttributeId The unique identifier for the attribute.

SetAttachmentNameL(const TDesC &)

IMPORT_C void SetAttachmentNameL ( const TDesC & aAttachmentName )

Parameters

const TDesC & aAttachmentName

SetComplete(TBool)

IMPORT_C void SetComplete ( TBool aComplete )

Sets whether the attachment is complete or not.

This allows support for incomplete or pending attachments.

Parameters

TBool aComplete ETrue if the attachment is complete, EFalse otherwise.

SetDesC8AttributeL(TUid, const TDesC8 &)

IMPORT_C void SetDesC8AttributeL ( TUid aAttributeId,
const TDesC8 & aAttribute
)

Sets an 8-bit descriptor attribute for the attachment.

A UID identifier uniquely identifies the attribute. If an attibute already exists with the same identifier, the old attribute is over-written.

This can be used to store an attribute as an 8-bit descriptor or binary data.

Parameters

TUid aAttributeId The unique identifier for the attribute.
const TDesC8 & aAttribute The attribute data to store. The descriptor is copied internally.

SetEntryAttachmentId(TMsvId)

void SetEntryAttachmentId ( TMsvId aEntryId )

Parameters

TMsvId aEntryId

SetFilePathL(const TDesC &)

void SetFilePathL ( const TDesC & aFilePath )

Parameters

const TDesC & aFilePath

SetId(TMsvAttachmentId)

IMPORT_C void SetId ( TMsvAttachmentId aId )

Sets the attachment Id.

The attachment Id is automatically set when passed to the Attachment Manager. This method allows the Id to be over-ridden or set by different implementations of attachment managers.

Parameters

TMsvAttachmentId aId The attachment Id to set.

SetIntAttributeL(TUid, TInt)

IMPORT_C void SetIntAttributeL ( TUid aAttributeId,
TInt aAttribute
)

Sets an integer attribute for the attachment.

A UID identifier uniquely identifies the attribute. If an attibute already exists with the same identifier, the old attribute is over-written.

Parameters

TUid aAttributeId The unique identifier for the attribute.
TInt aAttribute The attribute data to store.

SetMimeTypeL(const TDesC8 &)

IMPORT_C void SetMimeTypeL ( const TDesC8 & aMimeType )

Sets the mime-type of the attachment.

Parameters

const TDesC8 & aMimeType Descriptor containing the mime-type.

SetSize(TInt)

IMPORT_C void SetSize ( TInt aSize )

Sets the attachment size.

When initialising or updating the attachment, this method should be used to set the size in bytes.

Parameters

TInt aSize The size of the attachment in bytes.

Size()

IMPORT_C TInt Size ( ) const

Size of the attachment.

Return the size of the attachment in bytes.

Type()

IMPORT_C TMsvAttachmentType Type ( ) const

Returns the attachment type.

The attachment types can be a file, a linked file or a message entry attachment.

TMsvAttachmentType

Member Enumerations Documentation

Enum TMsvAttachmentType

Enum to define the different types of attachments supported by messaging.

Enumerators

EMsvFile = 0

File attachment. This is a file attachment that is copied into the message store.

EMsvLinkedFile

Linked file attachment. This is an attachment that is linked to using its file path, this is not copied into the message store.

EMsvMessageEntry

Message entry attachment. This is a message entry that is registered as an attachment.

Member Data Documentation

HBufC * iAttachmentName

HBufC * iAttachmentName [private]

Name of the attachment to identify to the attachment.

CMsvAttributeManager * iAttributeManager

CMsvAttributeManager * iAttributeManager [private]

Attribute manager for handling the attributes for this attachment.

TBool iComplete

TBool iComplete [private]

Attachment entry completeness flag.

TMsvId iEntryId

TMsvId iEntryId [private]

The message entry Id of the entry attachment.

HBufC * iFilePath

HBufC * iFilePath [private]

The full file path and file name of attachment files and linked files.

TMsvAttachmentId iId

TMsvAttachmentId iId [private]

The unique attachment Id. This is unique per message entry and is auto-assigned.

HBufC8 * iMimeType

HBufC8 * iMimeType [private]

Descriptor indicating the mime type of the attachment.

TBool iNeedsPath

TBool iNeedsPath [private]

Flag to indicate whether a path needs to be added.

TInt iSize

TInt iSize [private]

Size of the attachment in bytes.

TMsvAttachmentType iType

TMsvAttachmentType iType [private]

The attachment type.