libmusicbrainz3  3.0.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
relation.h
Go to the documentation of this file.
1 /*
2  * MusicBrainz -- The Internet music metadatabase
3  *
4  * Copyright (C) 2006 Lukas Lalinsky
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  *
21  */
22 
23 #ifndef __MUSICBRAINZ3_RELATION_H__
24 #define __MUSICBRAINZ3_RELATION_H__
25 
26 #include <string>
27 #include <vector>
29 
30 namespace MusicBrainz
31 {
32 
33  class Entity;
34 
47  {
48  public:
49 
51  static const std::string TO_ARTIST;
53  static const std::string TO_RELEASE;
55  static const std::string TO_TRACK;
57  static const std::string TO_URL;
58 
59  enum Direction {
65  DIR_BACKWARD
66  };
67 
69  typedef std::vector<std::string> Attributes;
70 
84  Relation(const std::string &relationType = std::string(),
85  const std::string &targetType = std::string(),
86  const std::string &targetId = std::string(),
87  const Direction direction = DIR_BOTH,
88  const Attributes &attributes = Attributes(),
89  const std::string &beginDate = std::string(),
90  const std::string &endDate = std::string(),
91  Entity *target = NULL);
92 
96  virtual ~Relation();
97 
103  std::string getType() const;
104 
110  void setType(const std::string &type);
111 
120  std::string getTargetId() const;
121 
129  void setTargetId(const std::string &targetId);
130 
142  std::string getTargetType() const;
143 
151  void setTargetType(const std::string &targetType);
152 
163  std::string getBeginDate() const;
164 
172  void setBeginDate(const std::string &dateStr);
173 
185  std::string getEndDate() const;
186 
194  void setEndDate(const std::string &dateStr);
195 
210  Direction getDirection() const;
211 
220  void setDirection(const Direction direction);
221 
229  Attributes &getAttributes();
230 
240  int getNumAttributes() const;
241 
251  std::string getAttribute(int index) const;
252 
258  void addAttribute(const std::string &attribute);
259 
268  Entity *getTarget() const;
269 
278  void setTarget(Entity *target);
279 
280  private:
281 
282  class RelationPrivate;
283  RelationPrivate *d;
284  };
285 
286 }
287 
288 #endif
289 
static const std::string TO_URL
Identifies relations linking to an URL.
Definition: relation.h:57
Direction
Definition: relation.h:59
std::vector< std::string > Attributes
A vector of strings (attributes).
Definition: relation.h:69
Relation reading direction is from source to target.
Definition: relation.h:63
A first-level MusicBrainz class.
Definition: entity.h:56
static const std::string TO_RELEASE
Identifies relations linking to a release.
Definition: relation.h:53
Represents a relation between two Entities.
Definition: relation.h:46
static const std::string TO_ARTIST
Identifies relations linking to an artist.
Definition: relation.h:51
Relation reading direction doesn&#39;t matter.
Definition: relation.h:61
#define MB_API
Definition: defines.h:40
static const std::string TO_TRACK
Identifies relations linking to a track.
Definition: relation.h:55