|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Capsulates observer and its events |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef TSATEVENTSOBSERVER_H |
|
21 #define TSATEVENTSOBSERVER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MSatEventObserver; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 |
|
31 /** |
|
32 * Capsulates observer and its events. |
|
33 * |
|
34 * @lib SatEngine.dll |
|
35 * @since Series 60 3.0 |
|
36 */ |
|
37 class TSatEventsObserver |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * C++ default constructor. |
|
43 * @param aObserver Observer of events. Panic will occur if aObserver is |
|
44 * NULL. |
|
45 */ |
|
46 TSatEventsObserver( MSatEventObserver* aObserver ); |
|
47 |
|
48 /** |
|
49 * Destructor. |
|
50 */ |
|
51 virtual ~TSatEventsObserver(); |
|
52 |
|
53 public: // New functions |
|
54 |
|
55 /** |
|
56 * Adds event to be notified for the iObserver. Same event will |
|
57 * added more than once. |
|
58 * @param aEvent Source of notification for observer. |
|
59 */ |
|
60 void AddEventL( TInt aEvent ); |
|
61 |
|
62 /** |
|
63 * Removes the event from the observable events. If aEvent is not |
|
64 * observable event, nothing is done. |
|
65 * @param aEvent Source of notification for observer. |
|
66 */ |
|
67 void RemoveEvent( TInt aEvent ); |
|
68 |
|
69 /** |
|
70 * Checks if aEvent is already in the list of events. |
|
71 * @param aEvent Event to be checked. |
|
72 * @return ETrue if aEvent is in the list. Othervise EFalse. |
|
73 */ |
|
74 TBool ObservingEvent( TInt aEvent ) const; |
|
75 |
|
76 /** |
|
77 * Gives the observer of the iEvents. |
|
78 * @return Observer of the iEvents |
|
79 */ |
|
80 MSatEventObserver* Observer(); |
|
81 |
|
82 /** |
|
83 * Gives the number of events that has been added. |
|
84 * @return Number of events. |
|
85 */ |
|
86 TInt EventCount() const; |
|
87 |
|
88 /** |
|
89 * Marks this observer for delete |
|
90 */ |
|
91 void MarkForDelete(); |
|
92 |
|
93 /** |
|
94 * Indicates is this observer marked for delete |
|
95 * @return True if marked for delete. |
|
96 */ |
|
97 TBool IsMarkedForDelete() const; |
|
98 |
|
99 private: |
|
100 |
|
101 // Prohibit copy constructor if not deriving from CBase. |
|
102 TSatEventsObserver( const TSatEventsObserver& ); |
|
103 |
|
104 // Prohibit assigment operator if not deriving from CBase. |
|
105 TSatEventsObserver& operator=( const TSatEventsObserver& ); |
|
106 |
|
107 private: // Data |
|
108 |
|
109 // Events that iObserver is observing. |
|
110 RArray<TInt> iEvents; |
|
111 |
|
112 // Observer of events. |
|
113 MSatEventObserver* iObserver; |
|
114 |
|
115 // Indicates is this observer marked to be deleted. |
|
116 // If observer is requested to delete while looping |
|
117 // in Notify events, observer cannot be deleted, but when Notify |
|
118 // loop is over, all observers marked as delete are deleted |
|
119 TBool iMarkedForDelete; |
|
120 |
|
121 }; |
|
122 |
|
123 #endif // TSATEVENTSOBSERVER_H |
|
124 |
|
125 // End of File |