⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileparser.cpp

📁 一个统计文件大小和程序信息的插件程序(vc或vc.net下使用)
💻 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 "FileParser.h"
#include "Config.h"
#include "Utils.h"

CString CFileInfo::GetTotalLinesStr(bool bDecorated) const
{
    return DecoratedNumber(m_iTotalLines, bDecorated, false);
}

CString CFileInfo::GetLinesWithCodeStr(bool bDecorated) const
{
    return DecoratedNumber(m_iLinesWithCode, bDecorated, false);
}

CString CFileInfo::GetLinesWithCommentsStr(bool bDecorated) const
{
    return DecoratedNumber(m_iLinesWithComments, bDecorated, 
        !cfg_bProcessComments);
}

CString CFileInfo::GetMixedLinesStr(bool bDecorated) const
{
    return DecoratedNumber(CalculateMixedLines(), bDecorated, 
        !cfg_bProcessComments);
}

CString CFileInfo::GetBlankLinesStr(bool bDecorated) const
{
    return DecoratedNumber(m_iBlankLines, bDecorated, 
        !cfg_bProcessBlanks);
}


void CFileInfo::SetFileName(LPCTSTR pszFullFileName)
{
    char drive[_MAX_DRIVE];
    char dir[_MAX_DIR];
    char fname[_MAX_FNAME];
    char ext[_MAX_EXT];
    m_sFullFileName = pszFullFileName;
    _splitpath(m_sFullFileName, drive, dir, fname, ext);
    m_sFilePath = drive;
    m_sFilePath += dir;
    m_sFileName = fname;
    m_sFileExt = ext;
}

CString CFileInfo::DecoratedNumber(int iNum, bool bDecorated, bool bNA) const
{
    switch (m_stat)
    {
        case file_error:
        case unknown:
            return cfg_sMarkerBadFile;

        case filtered:
            return cfg_sMarkerFiltered;

        default:
            if (bNA)
            {
                return "n/a";
            }
            if (bDecorated)
            {
                return NumberWithCommas(iNum);
            }
            else
            {
                CString cStr;
                cStr.Format("%d", iNum);
                return cStr;
            }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -