📄 simpleparsers.cpp
字号:
/***************************************************************************/
/* NOTE: */
/* This document is copyright (c) by Oz Solomonovich, and is bound by the */
/* MIT open source license (www.opensource.org/licenses/mit-license.html). */
/* See License.txt for more information. */
/***************************************************************************/
#include "StdAfx.h"
#include "Resource.h"
#include "SimpleParsers.h"
#include "Config.h"
CSimpleCommentParser::CSimpleCommentParser(LPCTSTR pszCommentPrefix) :
m_sCommentPrefix(pszCommentPrefix)
{
}
void CSimpleCommentParser::ParseFile(ifstream& ifs, CFileInfo& info)
{
const int comment_length = m_sCommentPrefix.GetLength();
CString sLine;
while (!ifs.eof() && ifs.good())
{
ifs.getline(sLine.GetBuffer(10240), 10240);
sLine.ReleaseBuffer();
sLine.TrimLeft();
sLine.TrimRight();
if (sLine.IsEmpty() && cfg_bProcessBlanks)
{
++info.m_iBlankLines;
}
else
{
if (comment_length > 0 &&
sLine.GetLength() >= comment_length &&
sLine.Left(comment_length) == m_sCommentPrefix)
{
++info.m_iLinesWithComments;
}
else
{
++info.m_iLinesWithCode;
}
}
++info.m_iTotalLines;
}
info.m_stat = CFileInfo::full;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -