libmusicbrainz3
3.0.3
|
A first-level MusicBrainz class. More...
Public Member Functions | |
virtual | ~Entity () |
Destructor. More... | |
virtual std::string | getId () const |
Returns a MusicBrainz ID. More... | |
virtual void | setId (const std::string &value) |
Sets a MusicBrainz ID. More... | |
RelationList | getRelations (const std::string &targetType=std::string(), const std::string &relationType=std::string()) const |
Returns a list of relations. More... | |
void | addRelation (Relation *relation) |
Adds a relation. More... | |
int | getNumRelations () const |
Returns number of relations. More... | |
Relation * | getRelation (int index) |
Returns an relation specified by index. More... | |
TagList & | getTags () |
int | getNumTags () const |
Tag * | getTag (int index) |
float | getRating () const |
void | setRating (float rating) |
int | getRatingVoteCount () const |
void | setRatingVoteCount (int count) |
Protected Member Functions | |
Entity (const std::string &id) | |
Constructor. More... | |
A first-level MusicBrainz class.
All entities in MusicBrainz have unique IDs (which are absolute URIs) and may have any number of relations (Relation) to other entities. This class is abstract and should not be instantiated.
Relations are differentiated by their target type, that means, where they link to. MusicBrainz currently supports four target types (artists, releases, tracks, and URLs) each identified using a URI. To get all relations with a specific target type, you can use getRelations and pass one of the following constants as the parameter:
|
protected |
Constructor.
This should only used by derived classes.
id | a string containing an absolute URI |
|
virtual |
Destructor.
void MusicBrainz::Entity::addRelation | ( | Relation * | relation | ) |
Adds a relation.
This method adds relation to the list of relations. The given relation has to be initialized, at least the target type has to be set.
relation | a pointer to Relation object to add |
|
virtual |
Returns a MusicBrainz ID.
int MusicBrainz::Entity::getNumRelations | ( | ) | const |
Returns number of relations.
This is equivalent to getRelations()
.size()
int MusicBrainz::Entity::getNumTags | ( | ) | const |
float MusicBrainz::Entity::getRating | ( | ) | const |
int MusicBrainz::Entity::getRatingVoteCount | ( | ) | const |
Relation* MusicBrainz::Entity::getRelation | ( | int | index | ) |
Returns an relation specified by index.
This is equivalent to getRelations()
[index]
RelationList MusicBrainz::Entity::getRelations | ( | const std::string & | targetType = std::string() , |
const std::string & | relationType = std::string() |
||
) | const |
Returns a list of relations.
If targetType is given, only relations of that target type are returned. For MusicBrainz, the following target types are defined:
If targetType is Relation::TO_ARTIST, for example, this method returns all relations between this Entity and artists.
You may use the relationType parameter to further restrict the selection. If it is set, only relations with the given relation type are returned.
targetType | a string containing an absolute URI |
relationType | a string containing an absolute URI |
Tag* MusicBrainz::Entity::getTag | ( | int | index | ) |
TagList& MusicBrainz::Entity::getTags | ( | ) |
|
virtual |
Sets a MusicBrainz ID.
value | a string containing an absolute URI |
void MusicBrainz::Entity::setRating | ( | float | rating | ) |
void MusicBrainz::Entity::setRatingVoteCount | ( | int | count | ) |