Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: msventry.h
Link against: msgs.lib

Class CMsvServerEntry

CMsvServerEntry

Support

Supported from 5.0

Description

Accesses and acts upon a particular Message Server entry. It provides similar functionality to that which CMsvEntry gives to client-side programs. The current entry that a CMsvServerEntry object relates is similarly referred to as its context.

A difference to note is that CMsvEntry functions, when used on a remote context, can result in requests to Server-side MTMs to change data on a remote server, as well as the local Message Server index. Naturally, as CMsvServerEntry is designed to be used by Server-side MTMs themselves, its comparable functions only alter the Message Server index.

A CBaseServerMTM-derived object gets an initial CMsvServerEntry on construction. It can get further CMsvServerEntry objects by calling NewEntryL(). The context can be changed by SetEntry().

The context is locked, preventing it being accessed by other MTMs. The lock is released when the object is deleted, or the context changes.

As with CMsvEntry, CBaseServerMTM functions can be divided into two broad groups. The first provides means to access the various types of storage associated with an entry. The second provides a means to discover and access other entries that the entry owns (its children).

In pre-Unicode releases, this class had an import library msvd.lib and was derived only from CBase.

Derivation

CActiveThe core class of the active object abstraction
CBaseBase class for all classes to be instantiated on the heap
CMsvServerEntryAccesses and acts upon a particular Message Server entry
MMsvStoreObserverAn intermediary class used in the derivation of CMsvServerEntry and CMsvEntry

Defined in CMsvServerEntry:
Cancel(), CancelMoveEntry(), ChangeAttributes(), ChangeEntry(), CopyEntriesL(), CopyEntryL(), CreateEntry(), DeleteEntries(), DeleteEntry(), EditStoreL(), Entry(), FileSession(), GetChildren(), GetChildrenWithMtm(), GetChildrenWithService(), GetChildrenWithType(), GetFilePath(), HasDirectory(), HasDirectoryL(), HasStore(), HasStoreL(), MoveEntriesL(), MoveEntriesWithinService(), MoveEntry(), MoveEntryCompleted(), MoveEntryL(), MoveEntryWithinService(), NewEntryL(), OwningService(), ReadStoreL(), SetEntry(), SetMtm(), SetSort(), Sort(), ~CMsvServerEntry()

Inherited from CActive:
Deque(), DoCancel(), EPriorityHigh, EPriorityIdle, EPriorityLow, EPriorityStandard, EPriorityUserInput, IsActive(), IsAdded(), Priority(), RunError(), RunL(), SetActive(), SetPriority(), TPriority, iStatus

Inherited from CBase:
operator new()


Destructor


~CMsvServerEntry()

~CMsvServerEntry();

Description

Frees resources for the object. It:

[Top]


Get new CMsvServerEntry


NewEntryL()

CMsvServerEntry* NewEntryL(TMsvId aId);

Description

Gets a new CMsvServerEntry object for the specified entry ID.

The call locks the entry, preventing it being accessed by other clients.

The object must be deleted when it is no longer required. The lock is released when the object is deleted or the context is changed with SetEntry().

Parameters

TMsvId aId

ID of the entry to access

Return value

CMsvServerEntry*

If the function succeeds, this is a pointer to a newly allocated and initialised object.

Leave codes

KErrLocked

Entry is locked

KErrNoMemory

A memory allocation failed

KErrNotFound

The entry does not exist

[Top]


Index entry access


ChangeAttributes()

TInt ChangeAttributes(const CMsvEntrySelection& aSelection, TUint aSetAttributes, TUint aClearAttributes);

Support

Supported from 5.1

Description

Provides a quick way to set or clear multiple fields in a selection of entries.

Fields to change are specified using a bitmask of TMsvAttribute values. Possible fields that can be changed using this function are:

Parameters

const CMsvEntrySelection& aSelection

The entries to change

TUint aSetAttributes

A bitmask of the fields to set

TUint aClearAttributes

A bitmask of the fields to clear

Return value

TInt

KErrNone if successful, otherwise one of the system-wide error codes. KErrNotFound if a specified entry does not exist.

See also:


ChangeEntry()

TInt ChangeEntry(const TMsvEntry& aEntry);

Description

Sets the context’s index entry to the specified values.

Parameters

const TMsvEntry& aEntry

The new details for the entry

Return value

KErrNone

Success

KErrAccessDenied

The entry is read only (deleted entry, standard folder, or locked)

KErrNotSupported

aEntry is invalid or the ID specified in aEntry is not the same as the context ID or no context has been set for the object

KErrNoMemory

A memory allocation failed


Entry()

const TMsvEntry& Entry() const;

Description

Gets the context’s index entry.

Return value

TMsvEntry&

The current entry


OwningService()

TMsvId OwningService() const;

Description

Gets the ID of the service that owns the context.

Local entries are considered as being members of the local service.

If the entry is the root, then the root ID (KMsvRootIndexEntryId) is returned.

Return value

TMsvId

ID of the service that owns this entry


SetEntry()

TInt SetEntry(TMsvId aId);

Description

Changes the context of the specified entry.

The call locks the entry, preventing it from being accessed by other clients. The lock is released when the object is deleted or the context is changed.

Note that you can change the context to KMsvNullIndexEntryId to unlock an entry without locking another.

Parameters

TMsvId aId

ID of the entry to access

Return value

TInt

KErrNone if successful, KErrNotFound if the entry does not exist, or KErrLocked if the entry is locked.

[Top]


Message store access


EditStoreL()

CMsvStore* EditStoreL();

Description

Obtains the message store for the current context with read-write access.

Only one client can edit a message store at one time. If another client is already writing to the store, KErrAccessDenied is returned. However, any number of clients can read from the store simultaneously.

If the message store does not exist when EditStore() is called, a new message store is created.

The returned CMsvStore must be deleted when it is no longer required.

Return value

CMsvStore*

Context’s message store open for read-write access

Leave codes

KErrAccessDenied

Store is locked by another process or is read-only

KErrNoMemory

Not enough memory to open store


HasStore()

TBool HasStore() const;

Support

Supported from 5.1
Withdrawn in 6.0

Description

Tests if the context has an associated message store.

In pre-Unicode versions a Message store flag was available and could be accessed through TMsvEntry::Store(). This function replaces that functionality.

Return value

TBool

ETrue: entry has a message store EFalse: entry does not have a message store


HasStoreL()

TBool HasStoreL() const;

Support

Supported from 6.0

Description

Tests if the context has an associated message store.

Return value

TBool

ETrue: entry has a message store EFalse: entry does not have a message store


ReadStoreL()

CMsvStore* ReadStoreL();

Description

Obtains the message store for the current context with read-only access. Multiple clients can read from a store simultaneously. If another client is already writing to the store, the function leaves with KErrAccessDenied.

The returned CMsvStore must be deleted when it is no longer required.

Return value

CMsvStore*

Context’s message store open for read-only access

Leave codes

KErrAccessDenied

Store is locked by another process

KErrNoMemory

Not enough memory to open store

KErrNotFound

There is no store associated with this entry

[Top]


Binary file directory


GetFilePath()

TInt GetFilePath(TFileName& aFilePath) const;

Description

Gets the context’s binary file directory.

If the directory specified in the context does not exist, it is created.

Parameters

TFileName& aFilePath

On return, contains the binary file directory path

Return value

KErrNone

Success

Usual file server errors

The server was unable to create the directory.


HasDirectory()

TBool HasDirectory() const;

Support

Supported from 5.1
Withdrawn in 6.0

Description

Tests if the context has an associated binary files directory.

In pre-Unicode versions a folder index flag was available, and could be accessed through TMsvEntry::Folder(). This function replaces that functionality.

Return value

TBool

ETrue: entry has a binary files directory EFalse: entry does not have a binary files directory


HasDirectoryL()

TBool HasDirectoryL() const;

Support

Supported from 6.0

Description

Tests if the context has an associated binary files directory.

Return value

TBool

ETrue: entry has a binary files directory EFalse: entry does not have a binary files directory

[Top]


Children sorting


SetMtm()

void SetMtm(TUid aMtm);

Description

Sets this MTM sorting type to specified UID. When children of an entry are sorted, entries belonging to the same MTM type can be grouped together.

Parameters

TUid aMtm

UID of MTM for sort


SetSort()

void SetSort(TMsvSelectionOrdering& aOrdering);

Description

Sets the sort order that is used when listing children, for example with GetChildren().

Parameters

TMsvSelectionOrdering& aOrdering

Sort order to use


Sort()

const TMsvSelectionOrdering& Sort();

Description

Gets the current sort order of children of the entry.

Return value

TMsvSelectionOrdering&

Current sort type

[Top]


Access children


GetChildren()

TInt GetChildren(CMsvEntrySelection& aSelection);

Description

Gets a selection containing the IDs of all the context children.

If the entry has no children, the selection is empty.

Parameters

CMsvEntrySelection& aSelection

Initially, this must be an empty selection. On return, it lists the children.

Return value

KErrNone

Success

KErrNoMemory

A memory allocation failed


GetChildrenWithService()

TInt GetChildrenWithService(TMsvId aServiceId, CMsvEntrySelection& aSelection);

Support

Supported from 6.0

Description

Gets a selection containing the IDs of all the context children with the specified service.

If the entry has no children, the selection is empty.

Parameters

TMsvId aServiceId

Service by which to filter children

CMsvEntrySelection& aSelection

Initially, this must be an empty selection. On return, it lists the children.

Return value

KErrNone

Success

KErrNoMemory

A memory allocation failed


GetChildrenWithMtm()

TInt GetChildrenWithMtm(TUid aMtm, CMsvEntrySelection& aSelection);

Support

Supported from 6.0

Description

Gets a selection containing the IDs of all the context children with the specified MTM.

If the entry has no children, the selection is empty.

Parameters

TUid aMtm

MTM by which to filter children

CMsvEntrySelection& aSelection

Initially, this must be an empty selection. On return, it lists the children.

Return value

KErrNone

Success

KErrNoMemory

A memory allocation failed


GetChildrenWithType()

TInt GetChildrenWithType(TUid aType, CMsvEntrySelection& aSelection);

Support

Supported from 6.0

Description

Gets a selection containing the IDs of all the context children with the specified entry type.

If the entry has no children, the selection is empty.

Parameters

TUid aType

Entry type by which to filter children

CMsvEntrySelection& aSelection

Initially, this must be an empty selection. On return, it lists the children.

Return value

KErrNone

Success

KErrNoMemory

A memory allocation failed

[Top]


Create and delete children


CreateEntry()

TInt CreateEntry(TMsvEntry& aEntry);

Description

Creates a new entry as a child of the current context.

The parent ID and entry ID are set by the Message Server.

Parameters

TMsvEntry& aEntry

Index entry value for the new entry

Return value

KErrNone

Success

KErrNoMemory

A memory allocation failed

KErrNotSupported

aEntry is invalid


DeleteEntry()

TInt DeleteEntry(TMsvId aId);

Description

Deletes a child entry of the context. The delete works recursively through all the descendants.

If a child or any descendant is locked by another client, then no entries are deleted.

Parameters

TMsvId aId

The ID of the entry to delete

Return value

TInt

KErrNone if successful, KErrAccessDenied if the entry or a descendant was locked by another client, KErrInUse if the store or a file associated with the entry is open, or KErrNotFound if the entry is not a child of the context.


DeleteEntry()

TInt DeleteEntry(TMsvId aId, CMsvEntrySelection& aDeletedEntries);

Support

Withdrawn in 5.1

Description

Deletes a child entry of the context. The delete works recursively through all the descendants.

If a child or any descendant is locked by another client, then no entries are deleted.

aDeletedEntries returns the IDs of all the entries deleted.

Parameters

TMsvId aId

The ID of the entry to delete

CMsvEntrySelection& aDeletedEntries

Initially, this must be an empty selection. On return, it lists the IDs of all the entries deleted.

Return value

TInt

KErrNone if successful, KErrAccessDenied if the entry or a descendant was locked by another client, KErrInUse if the store or a file associated with the entry is open, or KErrNotFound if the entry is not a child of the context.


DeleteEntries()

TInt DeleteEntries(CMsvEntrySelection& aSelection);

Support

Supported from 5.1

Description

Deletes a selection of child entries. The delete works recursively through all the descendants.

If a child or any descendant is locked by another client, then no entries are deleted.

Parameters

CMsvEntrySelection& aSelection

The entries to delete. On return, contains the children that could not be fully deleted

Return value

TInt

KErrNone if successful, KErrAccessDenied if the entry or a descendant was locked by another client, KErrInUse if the store or a file associated with the entry is open, or KErrNotFound if the entry is not a child of the context.

[Top]


Copy children


CopyEntriesL()

void CopyEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aObserverStatus);

Support

Supported from 5.1

Description

Copies a selection of children of the context to another entry that belongs to a different service. All descendants will be copied as well.

The copy is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the copy is complete.

Parameters

const CMsvEntrySelection& aSelection

The IDs of the entry to copy. On return, contains the children that could not be fully copied.

TMsvId aDestination

The ID of new parent

TRequestStatus& aObserverStatus

The request status to be completed when the operation has finished

Leave codes

KErrArgument

The destination is a child of an aSelection entry

KErrInUse

The store or a file associated with an entry is open

KErrNoMemory

A memory allocation failed

KErrNotFound

An aSelection entry is not a child of the context

KErrPathNotFound

The destination does not exist


CopyEntryL()

void CopyEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus);

Support

Supported from 5.1

Description

Copies a child of the context to another entry. All descendants will be copied as well.

The copy is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the copy is complete.

If the function leaves, no changes are made.

Parameters

TMsvId aId

The ID of the entry to copy

TMsvId aDestination

The ID of new parent

TRequestStatus& aObserverStatus

The request status to be completed when the operation has finished

Leave codes

KErrArgument

The destination is a child of an aSelection entry

KErrInUse

The store or a file associated with an entry is open

KErrNoMemory

A memory allocation failed

KErrNotFound

An aSelection entry is not a child of the context

KErrPathNotFound

The destination does not exist

[Top]


Move children


CancelMoveEntry()

void CancelMoveEntry();

Support

Withdrawn in 5.1

Description

Cancels an asynchronous move that has been begun with MoveEntryL(). For Unicode releases see Cancel().


MoveEntriesL()

void MoveEntriesL(const CMsvEntrySelection& aSelection, TMsvId aDestination, TRequestStatus& aObserverStatus);

Support

Supported from 5.1

Description

Moves a selection of children of the context to another entry that belongs to a different service. All descendants will be moved as well.

The move is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the move is complete.

Parameters

const CMsvEntrySelection& aSelection

The IDs of the entry to move. On return, contains the children that could not be fully moved.

TMsvId aDestination

The ID of new parent

TRequestStatus& aObserverStatus

The request status to be completed when the operation has finished

Leave codes

KErrArgument

The destination is a child of an aSelection entry

KErrInUse

The store or a file associated with an entry is open

KErrNoMemory

A memory allocation failed

KErrNotFound

An aSelection entry is not a child of the context

KErrPathNotFound

The destination does not exist


MoveEntriesWithinService()

TInt MoveEntriesWithinService(CMsvEntrySelection& aSelection, TMsvId aDestination);

Support

Supported from 5.1

Description

Moves a child of the context to under another entry. All descendants will be moved as well. The destination must belong to the same service as the context.

Parameters

CMsvEntrySelection& aSelection

The entries to move. On return, contains the children that could not be fully moved.

TMsvId aDestination

The ID of new parent

Return value

TInt

KErrNone if successful, KErrArgument if the destination is a child of aSelection entry, KErrInUse if the store or a file associated with an entry is open, KErrNotFound if an aSelection entry is not a child of the context the, or KErrPathNotFound if the destination does not exist.


MoveEntryCompleted()

void MoveEntryCompleted(TInt aError);

Support

Withdrawn in 5.1

Description

Informs the client of this by signalling an active object that the client has supplied for the purpose. Clients must call MoveEntryCompleted() after this occurs. This ensures that all session observers are notified of the change.

In Unicode releases the Message Server performs this function itself.

Parameters

TInt aError

Status code received when active object completed


MoveEntry()

TInt MoveEntry(TMsvId aId, TMsvId aDestination);

Support

Withdrawn in 5.1

Description

Moves a child of the context to under another entry. All descendants will be moved as well. The destination must belong to the same service as the context.

If an error occurs, no changes are made.

For Unicode releases, see MoveEntryWithinService().

Parameters

TMsvId aId

The ID of the entry to move

TMsvId aDestination

The ID of new parent

Return value

TInt

KErrNone if successful, KErrArgument if the destination is a child of aId, KErrInUse if the store or a file associated with the entry is open, KErrNotFound if the aId is not a child of the context, KErrPathNotFound if the destination does not exist.


MoveEntryL()

void MoveEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus);

Description

Moves a child of the context to another entry that belongs to a different service. All descendants will be moved as well.

The move is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the move is complete.

If the function leaves, no changes are made.

In pre-Unicode versions an asynchronous move can be cancelled through CancelMoveEntry(); in other releases, use Cancel().

Parameters

TMsvId aId

The ID of the entry to move

TMsvId aDestination

The ID of new parent

TRequestStatus& aObserverStatus

The request status to be completed when the operation has finished

Leave codes

KErrArgument

The destination is a child of aId

KErrInUse

The store or a file associated with the entry is open

KErrNoMemory

A memory allocation failed

KErrNotFound

aId is not a child of the context

KErrPathNotFound

The destination does not exist


MoveEntryWithinService()

TInt MoveEntryWithinService(TMsvId aId, TMsvId aDestination);

Support

Supported from 5.1

Description

Moves a child of the context to under another entry. All descendants will be moved as well. The destination must belong to the same service as the context.

If an error occurs, no changes are made.

For pre-Unicode releases see the synchronous overload of MoveEntry().

Parameters

TMsvId aId

The ID of the entry to move

TMsvId aDestination

The ID of new parent

Return value

TInt

KErrNone if successful, KErrArgument if the destination is a child of aId, KErrInUse if the store or a file associated with the entry is open, KErrNotFound if the aId is not a child of the context KErrPathNotFound, if the destination does not exist.

[Top]


Miscellaneous


Cancel()

void Cancel();

Support

Supported from 5.1

Description

Cancels an asynchronous move or copy operation. This function is inherited from CActive.

For pre-Unicode releases see CancelMoveEntry().


FileSession()

RFs& FileSession();

Support

Supported from 5.1

Description

Allows a Server-side MTM to access the file session handle created by the Message Server. This is preferable, as more efficient, to creating another handle.

Return value

RFs&

File session handle