class MMdEObjectObserver |
Observer interface for modifications of the objects in the metadata engine database.
Examples of observers. A class that is interested in observing events in the DB must implement observer interfaces and register as observer. Following examples show how this is done for objects but observing relations and events works the same way.
class CMdeObserverExample : public MMdEObjectObserver , public MMdEObjectPresentObserver { void HandleObjectNotification(CMdESession& aSession, TObserverNotificationType aType, const RArray<TItemId> & aObjectIdArray); void HandleObjectPresentNotification(CMdESession& aSession, TBool aPresent, const RArray<TItemId> & aObjectIdArray); ... CMdESession* iMdeSession; };
void CMdeObserverExample::ConstructL() { // Register this class as observer and start listening to object remove events. // The logic condition can be as complicated as is necessary. In this example // the condition as simple as possible. CMdELogicCondition* condition = CMdELogicCondition::NewL( ELogicConditionOperatorAnd ); iMdeSession->AddObjectObserverL( *this, condition, ENotifyRemove, &iMdeSession->GetDefaultNamespaceDefL() );
// Start listening to changes in object present status. iMdeSession->AddObjectPresentObserverL( *this ); }
MMdEObjectObserver::HandleObjectNotification void CMdeObserverExample::HandleObjectNotification(CMdESession& aSession, TObserverNotificationType aType, const RArray<TItemId> & aObjectIdArray) { if ( aType == ENotifyAdd ) { // object was added to DB } else if ( aType == ENotifyModify ) { // object was modified } else if ( aType == ENotifyRemove ) { // object was removed from DB }// aObjectIdArray contains ids for all objects that were added/modified/removed }
void CMdeObserverExample::HandleObjectPresentNotification(CMdESession& aSession, TBool aPresent, const RArray<TItemId> & aObjectIdArray) { if ( aPresent ) { // objects in aObjectIdArray were set as present } }
Public Member Functions | |
---|---|
void | HandleObjectNotification (CMdESession &, TObserverNotificationType , const RArray < TItemId > &) |
void | HandleObjectNotification | ( | CMdESession & | aSession, |
TObserverNotificationType | aType, | |||
const RArray < TItemId > & | aObjectIdArray | |||
) | [pure virtual] |
Called to notify the observer that new objects has been added/modified/removed in the metadata engine database.
CMdESession::AddObjectObserverL CMdELogicCondition
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.