gdpstatemc.h
来自「《SymbianOSC手机应用开发》源码」· C头文件 代码 · 共 68 行
H
68 行
// gdpstatemc.h
//
// Copyright (c) 1999 Symbian Ltd. All rights reserved.
//
#ifndef __GDPSTATEMC_H__
#define __GDPSTATEMC_H__
#include "gdpmain.h"
#include <e32std.h>
#include <e32base.h>
/*
* class CGdpStateMachine
*
* Provides an abstract state machine framework, by extending the
* active object framework through use of the state pattern.
*
* Error conditions that are not caught & handled by individual states
* are passed back to the concrete state machine to handle, if appropriate.
*
*/
class CGdpStateMachine : public CActive
//---------------------
{
public:
~CGdpStateMachine();
class TState
{
public:
virtual void EnterL()=0;
virtual TState* CompleteL()=0;
virtual TState* ErrorL(TInt aCode)=0;
virtual void Cancel()=0;
};
protected:
CGdpStateMachine(TPriority aPriority);
void ChangeState(TState* aNextState);
inline TState* CurrentState();
void SetNextState(TState* aNextState);
void ReEnterCurrentState();
//Methods to be implemented by concrete state-machines
virtual TState* ErrorOnStateEntry(TInt aError)=0;
virtual TState* ErrorOnStateExit(TInt aError)=0;
private:
// Overrides of CActive functions
void RunL();
void DoCancel();
TInt RunError(TInt aError);
private:
TState* iState;
};
/************** INLINES DECLARATIONS *****************/
CGdpStateMachine::TState* CGdpStateMachine::CurrentState() { return iState; }
/*****************************************************/
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?