Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: CMsvAttachment.h
Link against: msgs.lib
Link against: msgs_autoshutdown.lib

Class CMsvAttachment

class CMsvAttachment : public CBase;

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.

Derivation

Members

Defined in CMsvAttachment:
AttachmentName(), Complete(), EMsvFile, EMsvLinkedFile, EMsvMessageEntry, EntryAttachmentId(), FilePath(), GetDesC8Attribute(), GetIntAttribute(), Id(), MimeType(), NewL(), NewL(), NewL(), RemoveDesC8Attribute(), RemoveIntAttribute(), SetAttachmentNameL(), SetComplete(), SetDesC8AttributeL(), SetId(), SetIntAttributeL(), SetMimeTypeL(), SetSize(), Size(), TMsvAttachmentType, Type(), ~CMsvAttachment()

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


NewL()

static IMPORT_C CMsvAttachment *NewL(TMsvAttachmentType aType);

Description

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.

Return value

CMsvAttachment *

Pointer to the created attachment object.


NewL()

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

Description

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.

Return value

CMsvAttachment *

Pointer to the created attachment object.


NewL()

static IMPORT_C CMsvAttachment *NewL(const CMsvAttachment &aAttachment);

Description

Parameters

const CMsvAttachment &aAttachment

Return value

CMsvAttachment *


~CMsvAttachment()

IMPORT_C ~CMsvAttachment();

Description

Standard destructor.

[Top]


Member functions


Id()

IMPORT_C TMsvAttachmentId Id() const;

Description

Returns the attachment Id.

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

Return value

TMsvAttachmentId

The attachment Id.


SetId()

IMPORT_C void SetId(TMsvAttachmentId aId);

Description

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.


Type()

IMPORT_C TMsvAttachmentType Type() const;

Description

Returns the attachment type.

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

Return value

TMsvAttachmentType

The attachment type.

See also:


EntryAttachmentId()

IMPORT_C TMsvId EntryAttachmentId() const;

Description

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

Return value

TMsvId

The message entry Id for the entry attachment.


AttachmentName()

IMPORT_C const TDesC &AttachmentName() const;

Description

Returns the attachment name.

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

Return value

const TDesC &

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


SetAttachmentNameL()

IMPORT_C void SetAttachmentNameL(const TDesC &aAttachmentName);

Description

Parameters

const TDesC &aAttachmentName


FilePath()

IMPORT_C const TDesC &FilePath() const;

Description

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

const TDesC &

Descriptor containing full file path of the file attachment.


Size()

IMPORT_C TInt Size() const;

Description

Size of the attachment.

Return the size of the attachment in bytes.

Return value

TInt

The size of the attachment.


SetSize()

IMPORT_C void SetSize(TInt aSize);

Description

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.


MimeType()

IMPORT_C const TDesC8 &MimeType() const;

Description

The mime-type of the attachment.

Return value

const TDesC8 &

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


SetMimeTypeL()

IMPORT_C void SetMimeTypeL(const TDesC8 &aMimeType);

Description

Sets the mime-type of the attachment.

Parameters

const TDesC8 &aMimeType

Descriptor containing the mime-type.


Complete()

IMPORT_C TBool Complete() const;

Description

Indicates whether attachment is complete or not.

This allows support for incomplete or pending attachments.

Return value

TBool

ETrue if the attachment is complete, EFalse otherwise.


SetComplete()

IMPORT_C void SetComplete(TBool aComplete);

Description

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()

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

Description

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.


GetDesC8Attribute()

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

Description

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.

Return value

TInt

KErrNone is successful, KErrNotFound if the attribute cannot be found.


RemoveDesC8Attribute()

IMPORT_C void RemoveDesC8Attribute(TUid aAttributeId);

Description

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.


SetIntAttributeL()

IMPORT_C void SetIntAttributeL(TUid aAttributeId, TInt aAttribute);

Description

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.


GetIntAttribute()

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

Description

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.

Return value

TInt

KErrNone is successful, KErrNotFound if the attribute cannot be found.


RemoveIntAttribute()

IMPORT_C void RemoveIntAttribute(TUid aAttributeId);

Description

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.

[Top]


Member enumerations


Enum TMsvAttachmentType

TMsvAttachmentType

Description

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

EMsvFile

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.