|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : LandmarksDbEventHandler.h 00004 * Part of : Landmark Reference Application 00005 * Interface : - 00006 * Description : See class description below 00007 * Version : 1.0 00008 * 00009 * Copyright (c) 2004-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 #ifndef __LANDMARKS_DB_EVENT_HANDLER_H__ 00017 #define __LANDMARKS_DB_EVENT_HANDLER_H__ 00018 00019 // INCLUDES 00020 #include "LandmarksDbObserver.h" 00021 #include <e32base.h> 00022 #include <epos_landmarks.h> 00023 00024 // FORWARD DECLARATIONS 00025 class CPosLandmarkDatabase; 00026 class MLandmarksDbEventObserver; 00027 00028 // CLASS DECLARATION 00029 00030 /** 00031 * In the Landmark reference application there is only one instance of 00032 * CLandmarksDbEventHandler. It is the only object observing the 00033 * default landmark database directly. Other objects that want to observe the 00034 * database must register to this object. When an event occurs this object 00035 * broadcasts it to all registered observers. 00036 */ 00037 class CLandmarksDbEventHandler : public CActive 00038 { 00039 public: // Constructors and destructor 00040 00041 /** 00042 * C++ constructor. 00043 * 00044 * @param aDb the database to observer 00045 */ 00046 CLandmarksDbEventHandler( 00047 CPosLandmarkDatabase& aDb); 00048 00049 /** 00050 * Destructor. 00051 */ 00052 ~CLandmarksDbEventHandler(); 00053 00054 public: // New functions 00055 00056 /** 00057 * AddObserverL registers a db observer. 00058 * 00059 * @param aObserver the observer to register 00060 */ 00061 void AddObserverL(MLandmarksDbObserver* aObserver); 00062 00063 protected: // from CActive 00064 00065 /** 00066 * Handles an active object’s request completion event. 00067 */ 00068 void RunL(); 00069 00070 /** 00071 * Implements cancellation of an outstanding request. 00072 */ 00073 void DoCancel(); 00074 00075 /** 00076 * Handles a leave occurring in the request completion event 00077 * handler RunL(). 00078 * 00079 * @return KErrNone 00080 */ 00081 TInt RunError(TInt aError); 00082 00083 private: 00084 00085 /** 00086 * Starts observing of db enevs 00087 */ 00088 void ObserveEvents(); 00089 00090 private: 00091 00092 //! The database to observe 00093 CPosLandmarkDatabase& iDb; 00094 00095 //! A db event to be reported 00096 TPosLmEvent iEvent; 00097 00098 //! An array of registered observers 00099 RPointerArray<MLandmarksDbObserver> iDbObservers; 00100 00101 }; 00102 00103 00104 #endif // __LANDMARKS_DB_EVENT_HANDLER_H__ 00105 00106 // End of File 00107
|
© Nokia 2006 |