📄 stopwatchtimer.h
字号:
/*
* ============================================================================
* Name : CStopwatchTimer from StopwatchTimer.h
* Part of : Stopwatch
* Created : 05.02.2006 by ToBeReplacedByAuthor
* Description:
* Declares the timer engine class.
* Version :
* Copyright: ToBeReplacedByCopyright
* ============================================================================
*/
#ifndef __STOPWATCH_TIMER_H__
#define __STOPWATCH_TIMER_H__
// INCLUDES
#include <e32base.h> // for CActive
// FORWARD DECLARATIONS
// CLASS DECLARATIONS
/**
* A simple timer with observer.
*/
class CStopwatchTimer : public CActive
{
public: // interface
/**
* The object which wants to receive timer event will implements
* this interface
*/
class MObserver
{
public:
/**
* Called when timer request completed
* @param aTime The current time
*/
virtual void OnTimerL(const TTime& aTime) = 0;
};
public: // standard construction sequence
/**
* Create a CStopwatchTimer object
* @param aObserver The timer event observer
* @result a pointer to the created instance of CStopwatchTimer
*/
static CStopwatchTimer* NewL(MObserver& aObserver);
/**
* Create a CStopwatchTimer object
* @param aObserver The timer event observer
* @result a pointer to the created instance of CStopwatchTimer
*/
static CStopwatchTimer* NewLC(MObserver& aObserver);
/**
* Destroy the object and release all memory objects
*/
~CStopwatchTimer();
public: // new functions
void Start();
void Stop();
void Resume();
void Reset();
private: // standard construction sequence
/**
* Perform the first phase of two phase construction
* @param aObserver The timer event observer
*/
CStopwatchTimer(MObserver& aObserver);
/**
* Perform the second phase construction of
*/
void ConstructL();
private: //from CActive
/**
* Used to trigger timer event
*/
void RunL();
void DoCancel();
private: // new functions
void After(TTimeIntervalMicroSeconds32 aInterval);
private: // constants
static const TInt KInterval;
private: // member variables
/**
* The timer event observer
*/
MObserver& iObserver;
/**
* The current total time
*/
TTime iTime;
/**
* The start time
*/
TTime iStartTime;
private:
RTimer iTimer;
};
#endif // __STOPWATCH_TIMER_H__
// End Of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -