![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Section Contents
Applications that use this class will not work correctly on a version of EPOC earlier than ER5.
CBase |
Abstract: CBase behaviour |
MMsvStoreObserver |
Abstract class providing the interface for notification of events from a message store. |
msventry.h
msvd.lib
This class is the central abstraction through which a Server-side MTM 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 entrysee Message store access, Binary file directory, and Index entry access. The second provides a means to discover and access other entries that the entry owns (its children)see Children sorting, Access children, Create and delete children, and Move children.
~CMsvServerEntry();
The destructor:
CMsvServerEntry* NewEntryL(TMsvId aId);
Use this function to get a new CMsvServerEntry object for the entry specified by aMsvId.
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().
TMsvId aId |
ID of the entry to access |
CMsvServerEntry* |
If the function succeeds, this is a pointer to a newly allocated and initialised object. |
KErrLocked |
Entry is locked |
KErrNoMemory |
A memory allocation failed |
KErrNotFound |
The entry does not exist |
TInt ChangeEntry(const TMsvEntry& aEntry);
Use this function to set the contexts index entry to the values specified by aEntry.
For the minimum requirements to form a valid entry, see Validity.
const TMsvEntry& aEntry |
The new details for the entry |
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 |
const TMsvEntry& Entry() const;
Use this function to get the contexts index entry.
TMsvEntry& |
The current entry |
TMsvId OwningService() const;
Use this function to get the ID of the service that owns the context.
Local entries are considered as being members of the local service: see Structure.
If the entry is the root, then the root ID (KMsvRootIndexEntryId) is returned.
TMsvId |
ID of the service that owns this entry |
TInt SetEntry(TMsvId aId);
Use this function to change the context to the entry specified by aMsvId.
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.
TMsvId aId |
ID of the entry to access |
KErrNone |
Success |
KErrNotFound |
The entry does not exist |
KErrLocked |
The entry is locked |
CMsvStore* EditStoreL();
Use this function to obtain 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.
CMsvStore* |
Contexts message store open for read-write access |
KErrAccessDenied |
Store is locked by another process or is read-only |
KErrNoMemory |
Not enough memory to open store |
CMsvStore* ReadStoreL();
Use this function to obtain 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.
CMsvStore* |
Contexts message store open for read-only access |
KErrAccessDenied |
Store is locked by another process |
KErrNoMemory |
Not enough memory to open store |
KErrNotFound |
There is no store associated with this entry |
TInt GetFilePath(TFileName& aFilePath) const;
Use this function to get the contexts binary file directory.
If the directory specified in the context does not exist, it is created.
TFileName& aFilePath |
On return, contains the binary file directory path |
KErrNone |
Success |
Usual file server errors |
The server was unable to create the directory. |
void SetMtm(TUid aMtm);
When children of an entry are sorted, entries belonging to the same MTM type can be grouped together. Use this function to set this MTM sorting type to aMtm.
TUid aMtm |
UID of MTM for sort |
void SetSort(TMsvSelectionOrdering& aOrdering);
Use this function to set the sort order that is used when listing children, for example with GetChildren().
TMsvSelectionOrdering& aOrdering |
Sort order to use |
const TMsvSelectionOrdering& Sort();
Use this function to get the current sort order of children of the entry.
TMsvSelectionOrdering& |
Current sort type |
TInt GetChildren(CMsvEntrySelection& aSelection);
Use this function to get a selection containing the IDs of all the context children. If the entry has no children, the selection is empty.
CMsvEntrySelection& aSelection |
Initially, this must be an empty selection. On return, it lists the children. |
KErrNone |
Success |
KErrNoMemory |
A memory allocation failed |
TInt CreateEntry(TMsvEntry& aEntry);
Use this function to create a new entry as a child of the current context.
The parent ID and entry ID are set by the Message Server.
For the minimum requirements to form a valid entry, see Validity.
TMsvEntry& aEntry |
Index entry value for the new entry |
KErrNone |
Success |
KErrNoMemory |
A memory allocation failed |
KErrNotSupported |
aEntry is invalid |
TInt DeleteEntry(TMsvId aId);
Use this function to delete 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.
TMsvId aId |
The ID of the entry to delete |
KErrNone |
Success |
KErrAccessDenied |
The entry or a descendant was locked by another client |
KErrInUse |
The store or a file associated with the entry is open |
KErrNotFound |
Entry is not a child of the context |
TInt DeleteEntry(TMsvId aId, CMsvEntrySelection& aDeletedEntries);
Use this function to delete 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.
CMsvEntrySelection& returns the IDs of all the entries deleted.
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. |
KErrNone |
Success |
KErrAccessDenied |
The entry or a descendant was locked by another client |
KErrInUse |
The store or a file associated with the entry is open |
KErrNotFound |
Entry is not a child of the context |
TInt MoveEntry(TMsvId aId, TMsvId aDestination);
Use this function to move 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.
TMsvId aId |
The ID of the entry to move |
TMsvId aDestination |
The ID of new parent |
KErrNone |
Success |
KErrArgument |
The destination is a child of aId |
KErrInUse |
The store or a file associated with the entry is open |
KErrNotFound |
aId is not a child of the context |
KErrPathNotFound |
The destination does not exist |
void MoveEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus& aObserverStatus);
Use this function to move 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.
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 |
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 |
void MoveEntryCompleted(TInt aError);
When an asynchronous MoveEntryL() function completes, it 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.
TInt aError |
Status code received when active object completed |
void CancelMoveEntry();
Use this function to cancel an asynchronous move that has been begun with MoveEntryL().
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |