📄 delmon.h
字号:
/* Copyright (C) 2004-2005 Darrell Karbott (djk2005@users.sf.net)
** This code is free software; you can redistribute it and/or
** modify it under the terms of GNU Lesser General Public License.
** See http://www.gnu.org/ for further details of the LGPL.
**/
#ifndef __DELMON_H__
#define __DELMON_H__ 1
#include <e32base.h>
/*
** Helper classes used to keep track of when a class instance has been
** deleted from inside its own notification callback. (e.g. CSocket
** from MSocketObserver::SocketNotify()).
**
** The class that might be unexpectedly deleted has a CNotifyOnDelete
** member.
**
** The code that calls the client notification callback creates a
** TDeletionMonitor instance on the stack before calling the callback.
** It can then check TDeletionMonitor::WasDeleted() to see if the code
** in the callback deleted the monitored object.
**
** REQUIRES: No code within the scope of the TDeletionMonitor leaves.
*/
class CNotifyOnDelete : public CBase {
public:
CNotifyOnDelete();
void MarkDeleted();
virtual ~CNotifyOnDelete();
protected:
TBool* SetObserver(TBool* flagToSet);
private:
TBool* iDeleted;
friend class TDeletionMonitor;
};
class TDeletionMonitor
{
public:
TDeletionMonitor(CNotifyOnDelete* pNotifier);
~TDeletionMonitor();
TBool WasDeleted() const;
private:
CNotifyOnDelete* iNotifier;
TBool* iOldFlag;
TBool iWasDeleted;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -