Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

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



Location: agmobsrv.h
Link against: agnmodel.lib

Class CAgnObserver

CAgnObserver

Support

Supported from 5.0

Description

The abstract base class for agenda model observers. All types of agenda model observer must inherit from this class and implement the pure virtual functions it specifies.

When an entry or to-do list is added, deleted or updated, each agenda model observer receives notification of the change via the model's observer controller.

For example, after an entry has been added to the model, CAgnEntryModel::AddEntryL() calls:

ObserverController()->Send(CAgnObserver::ENotifyAddEntry,aEntry);

This in turn calls the Send() function of every observer which has been registered with the controller, passing it the same arguments (the type of operation and the to-do list or entry affected) — Send() is overloaded to take a CAgnEntry and a CAgnTodoList. The observer's Send() function implementation might carry out some processing on the entry or to-do list, depending on the type of operation.

Derivation

CAgnObserverThe abstract base class for agenda model observers
CBaseBase class for all classes to be instantiated on the heap

Defined in CAgnObserver:
CloneL(), ENotifyAddEntry, ENotifyAddTodoList, ENotifyDeleteEntry, ENotifyDeleteTodoList, ENotifyUpdateEntry, ENotifyUpdateTodoList, ExternalizeL(), InternalizeL(), ReadEndMarkerL(), Send(), StartObserving(), StopObserving(), TFunction, WriteEndMarkerL()

Inherited from CBase:
operator new()


Start/stop observing


StartObserving()

virtual void StartObserving()=0;

Description

Starts observing changes. Called during CAgnEntryModel::RegisterObserverL(), after the controller has installed the observer.


StopObserving()

virtual void StopObserving()=0;

Description

Stops observing changes. Called during CAgnEntryModel::UnregisterObserverL(), just before it is removed from the observer controller.

[Top]


Send


Send()

virtual void Send(TInt aFunction,CAgnEntry* aEntry)=0;
virtual void Send(TInt aFunction,CAgnTodoList* aTodoList)=0;

Description

This overloaded function is called when an entry or to-do list is added, deleted or updated by the agenda model. It is called by the observer controller with which this observer is registered. The overload allows for changes to both agenda entries and to-do lists to be observed.

Parameters

TInt aFunction

Indicates which function caused the change notification. For possible values, see the TFunction enumeration.

CAgnEntry* aEntry

Pointer to the entry affected.

CAgnTodoList* aTodoList

Pointer to the to-do list affected.

[Top]


Stream persistence


ExternalizeL()

virtual void ExternalizeL(RWriteStream& aStream) const=0;

Description

Externalises the observer data to a write stream. The presence of this function means that the standard templated operator<<() is available to externalise objects of this class. The last item written to the write stream by this function should be the end of observer marker (CAgnObserver::WriteEndMarkerL()).

Parameters

RWriteStream& aStream

Stream to which the data should be externalised.


InternalizeL()

virtual void InternalizeL(RReadStream& aStream)=0;

Description

Internalises the observer data from a read stream. The presence of this function means that the standard templated operator>>() is available to internalise objects of this class. The last item read from the read stream by this function should be the end of observer marker (CAgnObserver::ReadEndMarkerL()).

Parameters

RReadStream& aStream

Stream from which the data should be internalised.


WriteEndMarkerL()

void WriteEndMarkerL(RWriteStream& aStream) const;

Description

Writes the end of observer marker to the write stream. Call this function within ExternalizeL().

Note that derived classes should ensure that the combination of byte values in the end of observer marker (EEooByte1, EEooByte2 etc.) is not present in the data being externalised.

Parameters

RWriteStream& aStream

The stream to write to.


ReadEndMarkerL()

void ReadEndMarkerL(RReadStream& aStream) const;

Description

Reads the end of observer marker from the read stream. This must be the last item read by the InternalizeL() function.

Parameters

RReadStream& aStream

The stream to read from.

Leave codes

 

The function leaves with KErrCorrupt unless the byte values in the end of observer marker are correct ( EEooByte1 , EEooByte2 , EEooByte3 , EEooByte4 ).

[Top]


Clone


CloneL()

virtual CAgnObserver* CloneL()=0;

Description

Implementations should create and return a copy of the observer. Called by the observer controller during installation of the observer.

Return value

CAgnObserver*

Pointer to the observer clone.

[Top]


Enumerations


Enum TFunction

TFunction

Description

Function type

ENotifyAddEntry

An entry was added.

ENotifyDeleteEntry

An entry was deleted.

ENotifyUpdateEntry

An entry was updated.

ENotifyAddTodoList

A to-do list was added.

ENotifyDeleteTodoList

A to-do list was deleted.

ENotifyUpdateTodoList

A to-do list was updated.