📄 gdpstatemc.h
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -