resourceid.h

来自「java实现的简单的分形树。简单易学!是学习分形知识的很好的例子。其java语法」· C头文件 代码 · 共 82 行

H
82
字号
// --------------------------------------------------------------------------
// Dingus project - a collection of subsystems for game/graphics applications
// --------------------------------------------------------------------------

#ifndef __RESOURCE_ID_H
#define __RESOURCE_ID_H

namespace dingus {

/**
 *  Resource identifier.
 *
 *  Resources are identified by CResourceId, which is essentially
 *  a read-only std::string, refering to a file in most cases.
 */
class CResourceId {
public:
	CResourceId( const char *id );
	CResourceId( const std::string& id );
	CResourceId( const CResourceId& rid );

	const std::string& getUniqueName() const;

	const CResourceId& operator=( const CResourceId& rhs );
	
	bool operator== ( const CResourceId& rhs ) const;
	bool operator!= ( const CResourceId& rhs ) const;
	bool operator< ( const CResourceId& rhs ) const;
	
private:
	std::string	mId;
};



// ------------------------------------------------------------------
//  implementation

inline CResourceId::CResourceId( const char* id )
:	mId( id )
{
}
inline CResourceId::CResourceId( const std::string& id )
:	mId( id )
{
}
inline CResourceId::CResourceId( const CResourceId& rid )
:	mId( rid.mId )
{
}
inline const std::string& CResourceId::getUniqueName() const
{
	return mId;
};
inline const CResourceId& CResourceId::operator=( const CResourceId& rhs )
{
	if( this == &rhs )
		return *this;
	mId = rhs.mId;
	return *this;
}
inline bool CResourceId::operator== ( const CResourceId& rhs ) const
{
	if( &rhs == this )
		return true;
	return ( mId == rhs.getUniqueName() );
}
inline bool CResourceId::operator!= ( const CResourceId& rhs ) const
{
	return !( CResourceId::operator==( rhs ) );
}
inline bool CResourceId::operator< ( const CResourceId& rhs ) const
{
	return ( mId < rhs.getUniqueName() );
}



}; // namespace

#endif

⌨️ 快捷键说明

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