CMsvAttachment Class Reference

#include <mw/cmsvattachment.h>

class CMsvAttachment : public CBase

Inherits from

Detailed Description

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.

Member Enumeration Documentation

Enum TMsvAttachmentType

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

EnumeratorValueDescription
EMsvFile0

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.

Constructor & Destructor Documentation

~CMsvAttachment ( )

IMPORT_C~CMsvAttachment()

Standard destructor.

Member Function Documentation

AttachmentName ( )

IMPORT_C const TDesC &AttachmentName()const

Returns the attachment name.

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

Return Value
Descriptor containing attachment name. Zero-length descriptor if attachment name is not set.

Complete ( )

IMPORT_C TBoolComplete()const

Indicates whether attachment is complete or not.

This allows support for incomplete or pending attachments.

Return Value
ETrue if the attachment is complete, EFalse otherwise.

EntryAttachmentId ( )

IMPORT_C TMsvIdEntryAttachmentId()const

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

Return Value
The message entry Id for the entry attachment.

ExternalizeL ( RWriteStream & )

voidExternalizeL(RWriteStream &aStream)const

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.

Return Value
Descriptor containing full file path of the file attachment.

GetDesC8Attribute ( TUid, TPtrC8 & )

IMPORT_C TIntGetDesC8Attribute(TUidaAttributeId,
TPtrC8 &aAttribute
)const

Gets an 8-bit descriptor attribute.

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

Parameters
aAttributeIdThe unique identifier for the attribute.
aAttributeIf attribute is found, this will be set to point to the attribute data.
Return Value
KErrNone is successful, KErrNotFound if the attribute cannot be found.

GetIntAttribute ( TUid, TInt & )

IMPORT_C TIntGetIntAttribute(TUidaAttributeId,
TInt &aAttribute
)const

Gets an integer attribute.

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

Parameters
aAttributeIdThe unique identifier for the attribute.
aAttributeIf attribute is found, this will be set to the attribute data.
Return Value
KErrNone is successful, KErrNotFound if the attribute cannot be found.

Id ( )

IMPORT_C TMsvAttachmentIdId()const

Returns the attachment Id.

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

Return Value
The attachment Id.

InternalizeL ( RReadStream & )

voidInternalizeL(RReadStream &aStream)

IsPathRequired ( )

TBool IsPathRequired()const

MimeType ( )

IMPORT_C const TDesC8 &MimeType()const

The mime-type of the attachment.

Return Value
Descriptor containing mime-type. Zero-length descriptor if mime-type is not set.

NewL ( TMsvAttachmentType )

IMPORT_C CMsvAttachment *NewL(TMsvAttachmentTypeaType)[static]

Standard 2-phase construction, creates the attachment object.

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

Parameters
aTypeThe attachment type.
Return Value
Pointer to the created attachment object.

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

IMPORT_C CMsvAttachment *NewL(TMsvAttachmentTypeaType,
TIntaSize,
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
aTypeThe attachment type.
aSizeThe size of the attachment. For file attachments this should be the file size and for message entry attachments this should be the message size.
aMimeTypeThe Mime-Type of the attachment.
aAttachmentNameThe attachment name to identify the attachment.
Return Value
Pointer to the created attachment object.

NewL ( const CMsvAttachment & )

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

RemoveDesC8Attribute ( TUid )

IMPORT_C voidRemoveDesC8Attribute(TUidaAttributeId)

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
aAttributeIdThe unique identifier for the attribute.

RemoveIntAttribute ( TUid )

IMPORT_C voidRemoveIntAttribute(TUidaAttributeId)

Removes an integer attribute.

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

Parameters
aAttributeIdThe unique identifier for the attribute.

SetAttachmentNameL ( const TDesC & )

IMPORT_C voidSetAttachmentNameL(const TDesC &aAttachmentName)

SetComplete ( TBool )

IMPORT_C voidSetComplete(TBoolaComplete)

Sets whether the attachment is complete or not.

This allows support for incomplete or pending attachments.

Parameters
aCompleteETrue if the attachment is complete, EFalse otherwise.

SetDesC8AttributeL ( TUid, const TDesC8 & )

IMPORT_C voidSetDesC8AttributeL(TUidaAttributeId,
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
aAttributeIdThe unique identifier for the attribute.
aAttributeThe attribute data to store. The descriptor is copied internally.

SetEntryAttachmentId ( TMsvId )

voidSetEntryAttachmentId(TMsvIdaEntryId)

SetFilePathL ( const TDesC & )

voidSetFilePathL(const TDesC &aFilePath)

SetId ( TMsvAttachmentId )

IMPORT_C voidSetId(TMsvAttachmentIdaId)

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
aIdThe attachment Id to set.

SetIntAttributeL ( TUid, TInt )

IMPORT_C voidSetIntAttributeL(TUidaAttributeId,
TIntaAttribute
)

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
aAttributeIdThe unique identifier for the attribute.
aAttributeThe attribute data to store.

SetMimeTypeL ( const TDesC8 & )

IMPORT_C voidSetMimeTypeL(const TDesC8 &aMimeType)

Sets the mime-type of the attachment.

Parameters
aMimeTypeDescriptor containing the mime-type.

SetSize ( TInt )

IMPORT_C voidSetSize(TIntaSize)

Sets the attachment size.

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

Parameters
aSizeThe size of the attachment in bytes.

Size ( )

IMPORT_C TIntSize()const

Size of the attachment.

Return the size of the attachment in bytes.

Return Value
The size of the attachment.

Type ( )

IMPORT_C TMsvAttachmentTypeType()const

Returns the attachment type.

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

See also: TMsvAttachmentType

Return Value
The attachment type.