📄 readscanbasethd.cpp
字号:
else
{
szOtherBuff[iOther++] = szBuff[i];
}
}
if(iQuote == 0)
{
if(cForward == '/' && szBuff[i] =='*' && iLineStatus != LTYPE_NOTE)
{
if(iOther != 0) //把注释之前的内容取出
{
FileLine* normalLine = new FileLine();
strcpy(normalLine->m_szFileName ,szFileName);
strcpy(normalLine->m_szClassName, szClassBuff);
normalLine->m_bLineType = LTYPE_NORMAL;
normalLine->m_lLineNum = lFileLine;
strcpy(normalLine->m_szLineBuf, szOtherBuff);
memset(szOtherBuff,0,sizeof(szOtherBuff));
theApp.m_CS.Lock();
theApp.m_originListMsg.AddTail(normalLine);
theApp.m_CS.Unlock();
SetEvent(m_hEventReplace);
iOther = 0;
}
iLineStatus = LTYPE_NOTE;
strcpy(szNoteBuff,"/*");
iNote = iNote+2;
}
else if(szBuff[i] =='/' && cForward == '*' && iLineStatus == LTYPE_NOTE)
{
if(iOther != 0) //把注释之前的内容取出
{
FileLine* normalLine = new FileLine();
strcpy(normalLine->m_szFileName ,szFileName);
strcpy(normalLine->m_szClassName, szClassBuff);
normalLine->m_bLineType = LTYPE_NORMAL;
normalLine->m_lLineNum = lFileLine;
strcpy(normalLine->m_szLineBuf, szOtherBuff);
memset(szOtherBuff,0,sizeof(szOtherBuff));
theApp.m_CS.Lock();
theApp.m_originListMsg.AddTail(normalLine);
theApp.m_CS.Unlock();
SetEvent(m_hEventReplace);
iOther = 0;
}
FileLine* noteLine = new FileLine();
strcpy(noteLine->m_szFileName ,szFileName);
noteLine->m_bLineType = LTYPE_NOTE;
noteLine->m_lLineNum = lFileLine;
strcpy(noteLine->m_szLineBuf, szNoteBuff);
memset(szNoteBuff,0,sizeof(szNoteBuff));
theApp.m_CS.Lock();
theApp.m_originListMsg.AddTail(noteLine);
theApp.m_CS.Unlock();
SetEvent(m_hEventReplace);
iNote = 0;
iLineStatus = LTYPE_NORMAL;
if(szBuff[i] == '\0')
break;
cForward = 0;
i++;
continue;
}
else if(szBuff[i] =='/' && cForward == '/' && iLineStatus != LTYPE_NOTE)
{
if(iOther != 0) //把注释之前的内容取出
{
FileLine* normalLine = new FileLine();
strcpy(normalLine->m_szFileName ,szFileName);
strcpy(normalLine->m_szClassName, szClassBuff);
normalLine->m_bLineType = LTYPE_NORMAL;
normalLine->m_lLineNum = lFileLine;
strcpy(normalLine->m_szLineBuf, szOtherBuff);
memset(szOtherBuff,0,sizeof(szOtherBuff));
theApp.m_CS.Lock();
theApp.m_originListMsg.AddTail(normalLine);
theApp.m_CS.Unlock();
SetEvent(m_hEventReplace);
iOther = 0;
}
bBias = true;
iLineStatus = LTYPE_NOTE;
strcpy(szNoteBuff,"//");
iNote = iNote+2;
}
} //if(iQuote == 0)
if(szBuff[i] == '\0')
break;
cForward = szBuff[i];
i++;
} //end while(true)
if(iOther != 0) //把注释之前的内容取出
{
FileLine* normalLine = new FileLine();
strcpy(normalLine->m_szFileName ,szFileName);
strcpy(normalLine->m_szClassName, szClassBuff);
normalLine->m_bLineType = LTYPE_NORMAL;
normalLine->m_lLineNum = lFileLine;
strcpy(normalLine->m_szLineBuf, szOtherBuff);
memset(szOtherBuff,0,sizeof(szOtherBuff));
theApp.m_CS.Lock();
theApp.m_originListMsg.AddTail(normalLine);
theApp.m_CS.Unlock();
SetEvent(m_hEventReplace);
iOther = 0;
}
if(iLineStatus == LTYPE_NOTE)
{
FileLine* noteLine = new FileLine();
strcpy(noteLine->m_szFileName ,szFileName);
noteLine->m_bLineType = LTYPE_NOTE;
noteLine->m_lLineNum = lFileLine;
strcpy(noteLine->m_szLineBuf, szNoteBuff);
memset(szOtherBuff,0,sizeof(szNoteBuff));
theApp.m_CS.Lock();
theApp.m_originListMsg.AddTail(noteLine);
theApp.m_CS.Unlock();
SetEvent(m_hEventReplace);
iNote = 0;
if(bBias)
{
iLineStatus = LTYPE_NORMAL;
bBias = false;
}
cForward = 0;
}
}//end while(!feof(fp))
fclose(fp);
FileLine* endLine = new FileLine();
strcpy(endLine->m_szFileName , szFileName);
endLine->m_bLineType = LTYPE_END;
theApp.m_CS.Lock();
theApp.m_originListMsg.AddTail(endLine);
theApp.m_CS.Unlock();
SetEvent(m_hEventReplace);
// SetEvent(m_hEventRead);//扫描结束
}
// Function name : CReadScanBaseThd::GetFileType
// Description : 2005-2-26得到文件的扩展名
// Author : fanduansheng
// Input :
// Output :
// Return type : CString
// Argument : CString szFile
CString CReadScanBaseThd::GetFileType(CString szFile)
{
static CString szReturnExtFile = "";
int iOffset = szFile.ReverseFind('.');
if(iOffset != -1)
{
szReturnExtFile = szFile.Mid(iOffset);
}
return szReturnExtFile;
}
// Function name : CReadScanBaseThd::IsFileType
// Description : 2005-2-26判断是否是符合规定的文件名
// Author : fanduansheng
// Input :
// Output :
// Return type : BOOL
BOOL CReadScanBaseThd::IsFileType(CString szFile)
{
BOOL bRet = false;
CString szFileType = GetFileType(szFile);
int curType = m_hDlg->m_ctlPrgType.GetCurSel();
if(curType == 0)
{
if( szFileType == ".c" || szFileType == ".cpp" || \
szFileType == ".cxx" || szFileType == ".h")
{
bRet = true;
}
}
else if(curType == 1)
{
if(szFileType == ".java")
{
bRet = true;
}
}
else if(curType == 2)
{
CString szEx = "";
m_hDlg->m_ctlPrgType.GetWindowText(szEx);
if(szFileType == szEx)
{
bRet = true;
}
}
return bRet;
}
void CReadScanBaseThd::EndTask()
{
ResetEvent(m_hEventReplace);
ResetEvent(m_hEventStart); //等待任务重新开始
m_hDlg->WriteMacroValue();
//"符合条件的文件字符串已经提取完毕!"
m_hDlg->m_ctlDsp.SetWindowText("符合条件的文件字符串已经提取完毕!" );
m_hDlg->CloseOutFile();
m_hDlg->m_bComplete = true;
m_hDlg->m_ctlOk.EnableWindow(true);
m_hDlg->m_ctlPrgType.EnableWindow(true);
m_hDlg->m_btnDir.EnableWindow(true);
m_hDlg->m_chkSubFolder.EnableWindow(true);
m_hDlg->m_btnFile.EnableWindow(true);
m_hDlg->m_ctlMacroName.EnableWindow(true);
m_hDlg->m_ctlChoose.EnableWindow(true);
}
// Function name : CReadScanBaseThd::GetLineClass
// Description : 2005-3-8得到行的类名
// Author : fanduansheng
// Input : char *szFile,char* szLine
// Output : char* szClass
// Return type : BOOL
// Argument : char *szFile,char* szLine
BOOL CReadScanBaseThd::GetLineClass(char *szFile,char* szLine,char* szClass)
{
BOOL bRet = true;
int iType = -1;
CString fileName;
CString szFileType = GetFileType(szFile);
if( szFileType == ".c" || szFileType == ".cpp" || \
szFileType == ".cxx" || szFileType == ".h")
{
char szTmp[4096];
theApp.GetFileName(szFile,szTmp);
fileName = szTmp;
fileName.TrimRight(szFileType);
sprintf(szClass,"C%s",fileName);
}
else if(szFileType == ".java")
{
theApp.GetFileName(szFile,szClass);
fileName = szClass;
fileName.TrimRight(szFileType);
sprintf(szClass,"%s",fileName);
}
else
{
theApp.GetFileName(szFile,szClass);
fileName = szClass;
fileName.TrimRight(szFileType);
sprintf(szClass,"%s",fileName);
}
return bRet;
}
BOOL CReadScanBaseThd::GetLineClass(CString szComFile, char *szLine, char *szClass)
{
char szFile[4096];
sprintf(szFile , szComFile);
return GetLineClass(szFile, szLine, szClass);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -