|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: LandmarksUi Content File - Database event listener. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef CLMKDBEVENTLISTENER_H |
|
26 #define CLMKDBEVENTLISTENER_H |
|
27 |
|
28 // INCLUDES |
|
29 #include "EPos_Landmarks.h" |
|
30 #include <e32base.h> |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CPosLandmarkDatabase; |
|
34 class MLmkDbObserver; |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * This class is not meant for direct usage, use CLmkEventListenerSingleton |
|
40 * instead. |
|
41 * This class is associated to a database since adding the first observer, |
|
42 * until removing last observer. It is user's responsibility to remove all |
|
43 * added observers. |
|
44 */ |
|
45 class CLmkDbEventListener : public CActive |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 /** |
|
49 * Create CLmkDbEventListener object |
|
50 * @return newly instantiated object |
|
51 */ |
|
52 static CLmkDbEventListener* NewL(); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~CLmkDbEventListener(); |
|
58 |
|
59 public: // New methods |
|
60 |
|
61 /** |
|
62 * Only one database currently supported, leaves with |
|
63 * KErrNotSupported if aDb differs from already used db. |
|
64 * @param aObserver |
|
65 * @param aDb |
|
66 */ |
|
67 void AddObserverL( MLmkDbObserver& aObserver, |
|
68 CPosLandmarkDatabase& aDb ); |
|
69 |
|
70 /** |
|
71 * Remove observer |
|
72 * @param aObserver |
|
73 */ |
|
74 void RemoveObserver( MLmkDbObserver& aObserver ); |
|
75 |
|
76 protected: // New methods |
|
77 /** |
|
78 * Start listening |
|
79 */ |
|
80 void StartListening(); |
|
81 |
|
82 protected: // From CActive |
|
83 void RunL(); |
|
84 void DoCancel(); |
|
85 |
|
86 protected: // Constructors and destructor |
|
87 /** |
|
88 * C++ default constructor. |
|
89 * @return newly instantiated object |
|
90 */ |
|
91 CLmkDbEventListener(); |
|
92 |
|
93 /** |
|
94 * Symbian 2nd phase constructor |
|
95 */ |
|
96 void ConstructL(); |
|
97 |
|
98 private: // Data |
|
99 |
|
100 TPosLmEvent iEvent; |
|
101 |
|
102 ///Ref: |
|
103 CPosLandmarkDatabase* iDb; |
|
104 |
|
105 ///Own: |
|
106 HBufC* iDbURI; |
|
107 |
|
108 ///Ref: |
|
109 RPointerArray<MLmkDbObserver> iObservers; |
|
110 }; |
|
111 |
|
112 #endif // CLMKDBEVENTLISTENER_H |
|
113 |
|
114 // End of File |