define various operators for Song class

This commit is contained in:
unknown
2008-08-09 05:49:13 +02:00
parent 828ec8e2f6
commit 1cf51688ab
2 changed files with 37 additions and 0 deletions

View File

@@ -172,3 +172,36 @@ string Song::GetComment() const
return itsGetEmptyFields ? (itsComment.empty() ? "" : itsComment) : (itsComment.empty() ? EMPTY_TAG : itsComment);
}
Song & Song::operator=(const Song &s)
{
if (this == &s)
return *this;
itsFile = s.itsFile;
itsShortName = s.itsShortName;
itsDirectory = s.itsDirectory;
itsArtist = s.itsArtist;
itsTitle = s.itsTitle;
itsAlbum = s.itsAlbum;
itsTrack = s.itsTrack;
itsYear = s.itsYear;
itsGenre = s.itsGenre;
itsComment = s.itsComment;
itsHash = s.itsHash;
itsMinutesLength = s.itsMinutesLength;
itsSecondsLength = s.itsSecondsLength;
itsPosition = s.itsPosition;
itsID = s.itsID;
itsGetEmptyFields = s.itsGetEmptyFields;
return *this;
}
bool Song::operator==(const Song &s) const
{
return itsFile == s.itsFile && itsArtist == s.itsArtist && itsTitle == s.itsTitle && itsAlbum == s.itsAlbum && itsTrack == s.itsTrack && itsYear == s.itsYear && itsGenre == s.itsGenre && itsComment == s.itsComment && itsHash == s.itsHash && itsMinutesLength && s.itsMinutesLength && itsSecondsLength == s.itsSecondsLength && itsPosition == s.itsPosition && itsID == s.itsID;
}
bool Song::operator<(const Song &s) const
{
return itsPosition < s.itsPosition;
}

View File

@@ -77,6 +77,10 @@ class Song
void GetEmptyFields(bool get) { itsGetEmptyFields = get; }
void Clear();
bool Empty() const;
Song & operator=(const Song &);
bool operator==(const Song &) const;
bool operator<(const Song &rhs) const;
private:
string itsFile;
string itsShortName;