tcpcockettimer.cpp

来自「基于Symbian OS的手机开发与应用实践第16章的源代码。清华大学出版社。」· C++ 代码 · 共 65 行

CPP
65
字号
/*
* ============================================================================
*  Name     : CTcpCocketTimer from TcpCocketTimer.cpp
*  Part of  : Timer
*  Created  : 06.03.2006 by ToBeReplacedByAuthor
*  Implementation notes:
*     
*  Version  :
*  Copyright: ToBeReplacedByCopyright 
* ============================================================================
*/

// INCLUDES
#include "TcpCocketTimer.h"

// public standard construction sequence
CTcpCocketTimer* CTcpCocketTimer::NewL(MTimerObserver& aObserver)
    {
    CTcpCocketTimer* self = CTcpCocketTimer::NewLC(aObserver);
    CleanupStack::Pop();
    return self;
    }

CTcpCocketTimer* CTcpCocketTimer::NewLC(MTimerObserver& aObserver)
    {
    CTcpCocketTimer* self = new (ELeave) CTcpCocketTimer(aObserver);
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
    }

CTcpCocketTimer::~CTcpCocketTimer()
    {
    // No implementation required
    }

// public new functions
void CTcpCocketTimer::Start(TInt aSecond)
    {
    Cancel();
    After(aSecond * 1000000);
    }

// private standard construction sequence
CTcpCocketTimer::CTcpCocketTimer(MTimerObserver& aObserver)
:CTimer(EPriorityStandard),iObserver(aObserver)
    {
    // No implementation required
    }

void CTcpCocketTimer::ConstructL()
    {
    // This is explicitly decareded in the CTimer document
    CTimer::ConstructL();

    // The following line is also essencial!
    CActiveScheduler::Add(this);
    }

// private from CTimer
void CTcpCocketTimer::RunL()
    {
    iObserver.OnTimerL(iStatus.Int());
    }

⌨️ 快捷键说明

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