MusicBrainz::Track Class Reference

Represents a track. More...

Inheritance diagram for MusicBrainz::Track:

MusicBrainz::Entity

List of all members.

Public Member Functions

 Track (const std::string &id=std::string(), const std::string &title=std::string())
 Constructor.
virtual ~Track ()
 Destructor.
std::string getTitle () const
 Returns the track's title.
void setTitle (const std::string &title)
 Sets the track's title.
ArtistgetArtist ()
 Returns the main artist of this track.
void setArtist (Artist *artist)
 Sets this track's main artist.
int getDuration () const
 Returns the duration of this track in milliseconds.
void setDuration (const int duration)
 Sets the duration of this track in milliseconds.
ReleaseListgetReleases ()
 Returns a list of releases from this artist.
int getNumReleases () const
 Returns number of releases.
ReleasegetRelease (int index)
 Returns an release specified by index.
void addRelease (Release *release)
 Adds a release to this artist's list of releases.
int getReleasesOffset () const
 Returns the offset of the release list.
void setReleasesOffset (const int offset)
 Sets the offset of the release list.
int getReleasesCount () const
 Returns the number of existing releases.
void setReleasesCount (const int count)
 Sets the count of the release list.


Detailed Description

Represents a track.

This class represents a track which may appear on one or more releases. A track may be associated with exactly one artist (the I{main} artist).

Using getReleases, you can find out on which releases this track appears. To get the track number, too, use the Release::getTracksOffset method.

Note:
Currently, the MusicBrainz server doesn't support tracks to be on more than one release.
See also:
Release, Artist

Constructor & Destructor Documentation

MusicBrainz::Track::Track ( const std::string &  id = std::string(),
const std::string &  title = std::string() 
)

Constructor.

Parameters:
id a string containing an absolute URI
title a string containing the title

virtual MusicBrainz::Track::~Track (  )  [virtual]

Destructor.


Member Function Documentation

void MusicBrainz::Track::addRelease ( Release release  ) 

Adds a release to this artist's list of releases.

Parameters:
release a pointer to Release object

Artist* MusicBrainz::Track::getArtist (  ) 

Returns the main artist of this track.

Returns:
: a pointer to Artist object, or NULL

int MusicBrainz::Track::getDuration (  )  const

Returns the duration of this track in milliseconds.

Returns:
an int containing the duration in milliseconds

int MusicBrainz::Track::getNumReleases (  )  const

Returns number of releases.

This is equivalent to getReleases().size()

Returns:
an int containing number of releases
See also:
getReleases

Release* MusicBrainz::Track::getRelease ( int  index  ) 

Returns an release specified by index.

This is equivalent to getReleases()[index]

Returns:
a pointer to Release instance
See also:
getReleases

ReleaseList& MusicBrainz::Track::getReleases (  ) 

Returns a list of releases from this artist.

This may also include releases where this artist isn't the main artist but has just contributed one or more tracks (aka VA-Releases).

Returns:
: a list of pointers to Release objects

int MusicBrainz::Track::getReleasesCount (  )  const

Returns the number of existing releases.

This may or may not match with the number of elements that getReleases and getNumReleases returns. If the count is higher than the list, it indicates that the list is incomplete.

Returns:
an integer containing the count
See also:
getReleases

int MusicBrainz::Track::getReleasesOffset (  )  const

Returns the offset of the release list.

This is used if the track list is incomplete (ie. the web service only returned part of the tracks on this release). Note that the offset value is zero-based, which means track 0 is the first track.

Returns:
an integer containing the offset
See also:
getReleases

std::string MusicBrainz::Track::getTitle (  )  const

Returns the track's title.

The style and format of this attribute is specified by the style guide.

Returns:
a string containing an absolute URI
See also:
The MusicBrainz Style Guidelines

void MusicBrainz::Track::setArtist ( Artist artist  ) 

Sets this track's main artist.

Parameters:
artist a pointer to Artist object, or NULL

void MusicBrainz::Track::setDuration ( const int  duration  ) 

Sets the duration of this track in milliseconds.

Parameters:
duration an int containing the duration in milliseconds

void MusicBrainz::Track::setReleasesCount ( const int  count  ) 

Sets the count of the release list.

Parameters:
count an integer containing the count
See also:
getReleasesCount

void MusicBrainz::Track::setReleasesOffset ( const int  offset  ) 

Sets the offset of the release list.

Parameters:
offset an integer containing the offset
See also:
getReleasesOffset

void MusicBrainz::Track::setTitle ( const std::string &  title  ) 

Sets the track's title.

Parameters:
title,: a string containing the title
See also:
: getTitle


Generated on Wed Feb 25 12:18:35 2009 for libmusicbrainz3 by  doxygen 1.5.8