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

📄 resourcesymbol.cpp

📁 一个vc中管理资源文件ID的插件
💻 CPP
字号:
/************************************************************************
 *
 *                 Resource ID Organiser Utility Library
 *
 *       (c) Copyright 2000-2001 by Andy Metcalfe (andy.metcalfe@lineone.net)
 *                         All rights reserved.
 *
 ************************************************************************
 *                                                                       
 *  Filename    : ResourceSymbol.cpp
 *
 *  Description : CResourceSymbol - class to represent a single resource symbol
 *                
 *  Compiler    : Microsoft Visual C++ 6.0, Service Pack 3 or 4
 *                                                                       
 *  Target                                                               
 *  Environment : Windows 98/NT
 *
 *  NOTE:
 *
 *    This software is provided "as is" free for personal use. All
 *    title and copyrights in and to the software, including but not
 *    limited to any images, text, etc. incorporated into it, are
 *    owned by Andy Metcalfe, except where acknowledged otherwise.
 *
 *    Your may freely to use this code in your own products, PROVIDED
 *    this notice is not removed or modified.
 *
 *
 *    Visit http://www.resorg.co.uk for latest updates
 *
 ************************************************************************
 *
 *   MODIFICATION HISTORY:
 *
 *           This is a controlled document. See project configuration
 *           control tool for latest version and full version history.
 *
 *    $Archive: /Projects/AddIns/ResOrg/ResOrgUtils/ResourceSymbol.cpp $
 *   $Revision: 4 $
 *       $Date: 2/04/01 17:03 $
 *     $Author: Andy $
 *
 *    $History: ResourceSymbol.cpp $
 * 
 * *****************  Version 4  *****************
 * User: Andy         Date: 2/04/01    Time: 17:03
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * The default constructor now has optional parameters for the Name, Value
 * and Read-Only status of the symbol
 * 
 *****************  Version 3  *****************
 * User: Andy            Date: 27/03/01  Time:  15:37
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * Added CResourceSymbol::IsValidName()
 *
 *****************  Version 2  *****************
 * User: Andy            Date: 17/02/01  Time:   6:49
 * Updated in $/Projects/AddIns/ResOrg/ResOrgUtils
 * 1.  Moved resource type identification to a separate class
 * 2.  Added SetReadOnly(), IsReadOnly() and GetConflicts()
 *
 ******************  Version 1  *****************
 * User: Andy            Date: 12/11/00  Time:  21:36
 * Created in $/Projects/AddIns/ResOrg/ResOrgUtils
 *
 * $Nokeywords: $
 *
 ************************************************************************/

// ResourceSymbol.cpp : implementation file
//

#include "StdAfx.h"
#include "ResOrgUtils_Priv.h"

#include "ResourceSymbol.h"


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif



/////////////////////////////////////////////////////////////////////////////
// CResourceSymbol


IMPLEMENT_DYNCREATE(CResourceSymbol, CResourceSymbol_BASE)


CResourceSymbol::CResourceSymbol(const CString& sName /*= _T("")*/,
								 UINT uValue /*= 0*/,
								 BOOL bReadOnly /*= FALSE*/)
{
	m_sName			= sName;
	m_uValue		= uValue;
	m_sFileName		= _T("");
	m_nLineNo		= 0;

	m_bModified		= FALSE;
	m_bReadOnly		= bReadOnly;
}


CResourceSymbol::~CResourceSymbol(void)
{
}


/////////////////////////////////////////////////////////////////////////////
// Virtual Overrides


/////////////////////////////////////////////////////////////////////////////
// Operations

int CResourceSymbol::GetType(void) const
{
	return SymbolTypes.GetType(m_sName);
}


CString CResourceSymbol::GetTypeName(void) const
{
	return SymbolTypes.GetTypeName( GetType() );
}


BOOL CResourceSymbol::IsValidName(const CString& sName)
{
	BOOL bValid = FALSE;

	if (!sName.IsEmpty())
	{
		if (::isalpha(sName[0]) )
		{
			for (int n = 0; n < sName.GetLength(); n++)
			{
				TCHAR ch = sName[n];
				if ( _T('_') == ch)
				{
					bValid = TRUE;
					continue;		// Underscores are OK
				}
				if (::isalnum(ch) )
				{
					bValid = TRUE;
					continue;
				}
				// If we get here, the symbol name isn't valid
				bValid = FALSE;
				break;
			}
		}
	}
	return bValid;
}


// Special case: changing the line no or filename of a symbol does NOT
// mark it as modified. This is by design
BOOL CResourceSymbol::SetFileName(const CString& sFileName)
{
	if (m_sFileName != sFileName)
	{
		m_sFileName = sFileName;

		return TRUE;
	}
	return FALSE;
}


// Special case: changing the line no or filename of a symbol does NOT
// mark it as modified. This is by design
BOOL CResourceSymbol::SetLineNo(int nLineNo)
{
	if (m_nLineNo != nLineNo)
	{
		m_nLineNo = nLineNo;

		return TRUE;
	}
	return FALSE;
}


BOOL CResourceSymbol::SetModifiedFlag(BOOL bModified /*= TRUE*/)
{
	BOOL bOldFlag = m_bModified;

	m_bModified = bModified;

	return bOldFlag;
}


BOOL CResourceSymbol::SetName(const CString& sName)
{
	if (m_sName != sName)
	{
		m_sName = sName;

		SetModifiedFlag();

		return TRUE;
	}
	return FALSE;
}


BOOL CResourceSymbol::SetValue(UINT uValue)
{
	if (m_uValue != uValue)
	{
		m_uValue = uValue;

		SetModifiedFlag();

		return TRUE;
	}
	return FALSE;
}

⌨️ 快捷键说明

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