📄 scope.cpp
字号:
#include "stdafx.h"
#include "Scope.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
BEGIN_TEST_DUMP(CScope)
TEST_DUMP(mCurrScope)
TEST_DUMP(mCurrScopeName)
TEST_DUMP(mEyeableScopes)
END_TEST_DUMP()
CScope::CScope()
{
Init();
}
CScope::~CScope()
{
Init();
}
NOTEST
void CScope::Init()
{
POSITION pos = NULL;
pos = mCurrScope.GetHeadPosition();
while(pos != NULL)
delete mCurrScope.GetNext(pos);
mCurrScope.RemoveAll();
pos = mEyeableScopes.GetHeadPosition();
while(pos != NULL)
delete mEyeableScopes.GetNext(pos);
mEyeableScopes.RemoveAll();
mCurrScopeName = "";
}
void CScope::EnterScope(LPCTSTR iScope)
{
ASSERT(iScope != NULL);
CString* pScope = new CString(iScope);
mCurrScope.AddTail(pScope);
mCurrScopeName.Empty();
POSITION pos = mCurrScope.GetHeadPosition();
while(pos != NULL)
{
CString* pScope = mCurrScope.GetNext(pos);
ASSERT(pScope != NULL);
mCurrScopeName += *pScope;
mCurrScopeName += "::";
}
TEST_TRACE(mCurrScopeName);
}
void CScope::ExitScope()
{
if(!mCurrScope.IsEmpty())
{
delete mCurrScope.GetTail();
mCurrScope.RemoveTail();
}
if(mCurrScope.IsEmpty())
{
mCurrScopeName = "";
return;
}
mCurrScopeName.Empty();
POSITION pos = mCurrScope.GetHeadPosition();
while(pos != NULL)
{
CString* pScope = mCurrScope.GetNext(pos);
ASSERT(pScope != NULL);
mCurrScopeName += *pScope;
mCurrScopeName += "::";
}
TEST_TRACE(mCurrScopeName);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -