diff --git a/src/song.cpp b/src/song.cpp index 16ab999c..ccefb65d 100644 --- a/src/song.cpp +++ b/src/song.cpp @@ -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; +} + diff --git a/src/song.h b/src/song.h index 0087f7f5..d86bb1eb 100644 --- a/src/song.h +++ b/src/song.h @@ -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;