📄 cpgpcontext.h
字号:
/*____________________________________________________________________________
Copyright (C) 2002 PGP Corporation
All rights reserved.
$Id: CPGPContext.h,v 1.2 2002/08/06 20:10:19 dallen Exp $
____________________________________________________________________________*/
#ifndef Included_CPGPContext_h // [
#define Included_CPGPContext_h
#include "pgpUtilities.h"
_PGP_BEGIN
// Class CPGPContext
class CPGPContext
{
NOT_COPYABLE(CPGPContext)
public:
CPGPContext();
CPGPContext(PGPContextRef pgpContext);
~CPGPContext();
operator PGPContextRef() const {return mPGPContext;}
CPGPContext& operator=(PGPContextRef pgpContext);
PGPContextRef Get() const {return mPGPContext;}
PGPBoolean IsAttached() const;
PGPBoolean WeCreated() const {return mWeCreated;}
void Attach(PGPContextRef pgpContext);
void Create();
void Clear();
private:
PGPBoolean mWeCreated;
PGPContextRef mPGPContext;
};
// Class CPGPContext member functions
inline
CPGPContext::CPGPContext() :
mWeCreated(FALSE), mPGPContext(kInvalidPGPContextRef)
{
}
inline
CPGPContext::CPGPContext(PGPContextRef pgpContext) :
mWeCreated(FALSE), mPGPContext(kInvalidPGPContextRef)
{
Attach(pgpContext);
}
inline
CPGPContext::~CPGPContext()
{
Clear();
}
inline
CPGPContext&
CPGPContext::operator=(PGPContextRef pgpContext)
{
Attach(pgpContext);
return *this;
}
inline
PGPBoolean
CPGPContext::IsAttached() const
{
return PGPContextRefIsValid(mPGPContext);
}
inline
void
CPGPContext::Attach(PGPContextRef pgpContext)
{
if (mPGPContext == pgpContext)
return;
Clear();
pgpAssert(PGPContextRefIsValid(pgpContext));
mPGPContext = pgpContext;
mWeCreated = FALSE;
}
inline
void
CPGPContext::Create()
{
Clear();
PGPError pgpErr = PGPNewContext(kPGPsdkAPIVersion, &mPGPContext);
THROW_IF_PGPERROR(pgpErr);
mWeCreated = TRUE;
}
inline
void
CPGPContext::Clear()
{
if (WeCreated())
PGPFreeContext(mPGPContext);
mWeCreated = FALSE;
mPGPContext = kInvalidPGPContextRef;
}
_PGP_END
#endif // ] Included_CPGPContext_h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -