Track: Implement a copy constructor

This keeps library size accurate when adding new tracks to the track_db.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2014-11-29 10:50:23 -05:00
parent 44aac0dcec
commit d7ceadafb3
2 changed files with 16 additions and 0 deletions

View File

@ -27,6 +27,15 @@ Track :: Track(Album *album, Artist *artist, Genre *genre, Library *library,
_library->inc_size();
}
Track :: Track(const Track &track)
: GenericTag(track),
_album(track._album), _artist(track._artist), _genre(track._genre),
_library(track._library), _count(track._count), _length(track._length),
_track(track._track), _date(track._date), _path(track._path)
{
_library->inc_size();
}
Track :: ~Track()
{
if (_library)

View File

@ -54,6 +54,13 @@ public:
Track(Album *, Artist *, Genre *, Library *, const std::string &,
const std::string &, unsigned int, unsigned int);
/**
* Track copy constructor
*
* @param track The Track tag that should be copied.
*/
Track(const Track &);
/** Track destructor */
~Track();