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

📄 resourcesymbol.cpp

📁 ResOrg 图形化管理Vc项目的资源ID的工具的源代码。 ResOrg - Manage and Renumber Resource Symbol IDs Introduction The
💻 CPP
📖 第 1 页 / 共 2 页
字号:
				bValid = false;
				break;
			}
		}
	}
	return bValid;
}


/// Get the pathname of the resource symbol file in which this symbol is defined.
///
/// \return				The contents of m_sFileName, which holds the pathname of the resource symbol file.
///
CString CResourceSymbol::GetFileName(void) const
{
	return m_sFileName;
}
	

/// Set the pathname of the resource symbol file in which this symbol is defined.
///
/// \param sFileName	The pathname of the resource symbol file
/// \return				true if m_sFileName was changed, false otherwise
///
/// Note that changing the line no. or pathname of a symbol does \b 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;
}


/// Set the line number of this symbol in its resource symbol file
///
/// \param nLineNo		The line number of the symbol
/// \return				true if m_nLineNo was changed, false otherwise
///
/// Note that changing the line no or pathname of a symbol does \b 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;
}


/// Return the name of this symbol
///
/// \return			The name of the symbol
///
CString	CResourceSymbol::GetName(void) const
{
	return m_sName;
}


/// Set the name of this symbol
///
/// \param sName	The new value of the symbol
/// \return			true if m_sName was changed, false otherwise
///
bool CResourceSymbol::SetName(const CString& sName)
{
	if (m_sName != sName)
	{
		m_sName = sName;

		SetModifiedFlag();

		return true;
	}
	return false;
}


/// Get the value of this symbol
///
/// \return			The contents of m_uValue, which holds the value of the symbol.
///
UINT CResourceSymbol::GetValue(void) const
{
	return m_uValue;
}


/// Set the value of this symbol
///
/// \param uValue	The new value of the symbol.
/// \return			true if m_uValue was changed, false otherwise.
///
bool CResourceSymbol::SetValue(UINT uValue)
{
	if (m_uValue != uValue)
	{
		// If the sybol wasn't modified before, save the original value before changing it
		if (!m_bModified)
		{
			m_uOriginalValue = m_uValue;
		}
		m_uValue = uValue;

		SetModifiedFlag();

		return true;
	}
	return false;
}


/// Get the previous value of this symbol. This operation is only valid if the symbol has been modified.
///
/// \return			The contents of m_uOriginalValue, which holds the previous value of the symbol.
///
UINT CResourceSymbol::GetOriginalValue(void) const
{
	return m_uOriginalValue;
}


/// Get the modification flag of this symbol.
///
/// \return			The contents of m_bModified, which holds the modification flag for the symbol.
///
bool CResourceSymbol::IsModified(void) const
{
	return m_bModified;
}


/// Set/reset the modification flag of this symbol.
///
/// \param bModified	true if the symbol is to be marked as modifed, false otherwise.
/// \return				true if m_bModified was changed, false otherwise.
///
bool CResourceSymbol::SetModifiedFlag(bool bModified /*= true*/)
{
	if (m_bModified != bModified)
	{
		m_bModified = bModified;

		if (!m_bModified)
		{
			m_uOriginalValue = 0;
		}
		return true;
	}
	return false;
}


/// Get the Read Only flag of this symbol.
///
/// \return			The contents of m_bReadOnly, which holds the Read Only flag for the symbol.
///
bool CResourceSymbol::IsReadOnly(void) const
{
	return m_bReadOnly;
}


/// Set this symbol read only or read write.
///
/// \param bReadOnly	true if the symbol is to be Read Only, false otherwise
/// \return				true if m_bReadOnly was changed, false otherwise
///
bool CResourceSymbol::SetReadOnly(bool bReadOnly /*= true*/)
{
	if (m_bReadOnly != bReadOnly)
	{
		m_bReadOnly = bReadOnly;
	
		SetModifiedFlag();

		return true;
	}
	return false;
}


/// Get the user defined data with this symbol.
///
/// In normal operation this is usually a pointer to the CResourceSymbolManager object containing the symbol.
///
/// \return				The contents of m_nUserData, which holds the user data for the symbol.
///
INT_PTR CResourceSymbol::GetUserData(void) const
{
	return m_nUserData;
}

			
/// Set the value of m_nUserData, which can be used to store user defined data with this symbol.
///
/// In normal operation this is usually a pointer to the CResourceSymbolManager object containing the symbol.
///
/// \param nUserData	The user data to be set.
/// \return				true if m_nUserData was changed, false otherwise.
///
bool CResourceSymbol::SetUserData(INT_PTR nUserData)
{
	if (m_nUserData != nUserData)
	{
		m_nUserData = nUserData;

		return true;
	}
	return false;
}


/// Return a reference to the conflict list for this symbol.
///
/// \return			A reference to m_listConflicts.
///
CSymbolConflictList& CResourceSymbol::GetConflicts(void)
{
	return m_listConflicts;
}


/// Determine whether this symbol conflicts with others.
///
/// \return			true if m_listConflicts is not empty; false otherwise.
///
bool CResourceSymbol::HasConflicts(void) const
{
	return !m_listConflicts.IsEmpty();
}


/// Adds the given symbol to the list of conflicts (m_listConflicts).
///
/// \param pSymbol	A pointer to symbols to be removed.
/// \return			true if added, false otherwise.
///
bool CResourceSymbol::AddConflict(CResourceSymbol* pSymbol)
{
	if ( (NULL != pSymbol) && (this != pSymbol) )
	{
		if (NULL == m_listConflicts.Find(pSymbol) )
		{
			m_listConflicts.AddTail(pSymbol);

			return true;
		}
	}
	return false;
}



/// Removes the given symbol from the list of conflicts (m_listConflicts)
///
/// \param pSymbol	A pointer to the symbol to be removed from the list of conflicts.
/// \return			true if the symbol was removed successfully; false if not found.
///
bool CResourceSymbol::RemoveConflict(CResourceSymbol* pSymbol)
{
	POSITION pos = m_listConflicts.Find(pSymbol);
	if (NULL != pos)
	{
		m_listConflicts.RemoveAt(pos);

		return true;
	}
	return false;
}

⌨️ 快捷键说明

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