|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // A reusable timer class together with an observer interface |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __CIMAPOBSERVABLETIMER_H__ |
|
19 #define __CIMAPOBSERVABLETIMER_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 // Forward declaration |
|
24 class CImapObservableTimer; |
|
25 |
|
26 /** |
|
27 To use CImapObservableTimer, an object must implement this interface, which informs the user |
|
28 of the timer when a requested timer event has occurred. |
|
29 @internalTechnology |
|
30 @prototype |
|
31 */ |
|
32 class MImapTimerObserver |
|
33 { |
|
34 public: |
|
35 /** |
|
36 The implementaton of this method will be called when a requested timer event occurs. |
|
37 Use the CTimer base class methods to request a timer event. |
|
38 @param aSourceTimer A reference to the timer object that called this method. This makes it helps an implementation |
|
39 of MImapTimerObserver to use more than one CObserveableTimer at once, as the implementaiton will know |
|
40 which of its CImapObservableTimer objects called this methiod. |
|
41 */ |
|
42 virtual void OnTimerL(const CImapObservableTimer& aSourceTimer) =0; |
|
43 }; |
|
44 |
|
45 /** |
|
46 A timer object that invokes the supplied observer's OnTimer() method whenever a requested timer event occurs. |
|
47 Use the CTimer base class methods to request and cancel timer events. |
|
48 @internalTechnology |
|
49 @prototype |
|
50 */ |
|
51 class CImapObservableTimer : public CTimer |
|
52 { |
|
53 public: |
|
54 IMPORT_C static CImapObservableTimer* NewL(MImapTimerObserver& aObserver); |
|
55 |
|
56 private: |
|
57 CImapObservableTimer(MImapTimerObserver& aObserver); |
|
58 |
|
59 private: |
|
60 // CTimer implementation |
|
61 void RunL(); |
|
62 |
|
63 private: |
|
64 MImapTimerObserver& iObserver; |
|
65 }; |
|
66 |
|
67 #endif // __CIMAPOBSERVABLETIMER_H__ |