⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oneshottimer.h

📁 大名鼎鼎的远程登录软件putty的Symbian版源码
💻 H
字号:
/*    oneshottimer.h
 *
 * A one-shot timer class
 *
 * Copyright 2004 Petteri Kangaslampi
 *
 * See license.txt for full copyright and license information.
*/

#ifndef __ONESHOTTIMER_H__
#define __ONESHOTTIMER_H__

#include <e32std.h>
#include <e32base.h>


/**
 * A one-shot timer class, providing a single callback after a period
 * of time. The time countdown can be restarted at any point.
 */
class COneShotTimer : public CActive {

public:
    /** 
     * Factory method.
     * 
     * @param aCallBack Callback function for timer callbacks
     * @param aPriority Active object priority
     * 
     * @return New COneShotTimer instance
     */
    static COneShotTimer *NewL(TCallBack aCallBack,
                               TInt aPriority = EPriorityStandard);
   
    /** 
     * Destructor.
     */
    ~COneShotTimer();
    
    /** 
     * Starts the timer. The callback will be called after the given time
     * period. If a timer request is already in progress, the old request is
     * cancelled.
     * 
     * @param aTime Time interval in microseconds. Note that the final timing
     *              accuracy depends on the timer accuracy on the platform.
     */
    void After(TTimeIntervalMicroSeconds32 aTime);
    
    /** 
     * Cancels an outstanding timing request.
     */
    void CancelTimer();

    
private:
    COneShotTimer(TCallBack aCallBack, TInt aPriority);
    void ConstructL();
    void RunL();
    void DoCancel();
    
    RTimer iTimer;
    TBool iTimerOpen;
    TCallBack iCallBack;
    TBool iTimerRequestActive;
};


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -