TScore.cpp
上传用户:snevogroup
上传日期:2008-06-06
资源大小:432k
文件大小:1k
- #include "TScore.h"
- // construct
- TScore::TScore()
- {
- iName = KTextBase;
- iValue= 0;
- }
- TScore::TScore(TInt aValue)
- {
- iName = KTextBase;
- iValue= -aValue;
- }
- TScore::TScore(TInt aValue, const TDesC& aName)
- {
- iName = aName;
- iValue= -aValue;
- }
- /////////////////////////////////////////////////
- // other methods
- TInt TScore::Score()
- {
- return -iValue;
- }
- TInt TScore::Score(TPlayerName& aName)
- {
- aName = iName;
- return -iValue;
- }
- // operators
- TInt TScore::operator >(const TScore& aScore)
- {
- if(iValue > aScore.iValue)
- return 1;
- else
- return 0;
- }
- TInt TScore::operator <(const TScore& aScore)
- {
- if(iValue < aScore.iValue)
- return 1;
- else
- return 0;
- }
- TInt TScore::operator ==(const TScore& aScore)
- {
- if(iValue == aScore.iValue)
- return 1;
- else
- return 0;
- }
- // >> & <<
- void TScore::ExternalizeL(RWriteStream& aStream) const
- {
- aStream.WriteInt32L(iValue);
- aStream << iName;
- }
- void TScore::InternalizeL(RReadStream& aStream)
- {
- iValue = aStream.ReadInt32L();
- aStream >> iName;
- }