libmusicbrainz3
3.0.2
|
00001 /* 00002 * MusicBrainz -- The Internet music metadatabase 00003 * 00004 * Copyright (C) 2006 Lukas Lalinsky 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 * 00020 * $Id: relation.h 8466 2006-09-05 08:59:44Z luks $ 00021 */ 00022 00023 #ifndef __MUSICBRAINZ3_RELATION_H__ 00024 #define __MUSICBRAINZ3_RELATION_H__ 00025 00026 #include <string> 00027 #include <vector> 00028 #include <musicbrainz3/musicbrainz.h> 00029 00030 namespace MusicBrainz 00031 { 00032 00033 class Entity; 00034 00046 class MB_API Relation 00047 { 00048 public: 00049 00051 static const std::string TO_ARTIST; 00053 static const std::string TO_RELEASE; 00055 static const std::string TO_TRACK; 00057 static const std::string TO_URL; 00058 00059 enum Direction { 00061 DIR_BOTH, 00063 DIR_FORWARD, 00065 DIR_BACKWARD 00066 }; 00067 00069 typedef std::vector<std::string> Attributes; 00070 00084 Relation(const std::string &relationType = std::string(), 00085 const std::string &targetType = std::string(), 00086 const std::string &targetId = std::string(), 00087 const Direction direction = DIR_BOTH, 00088 const Attributes &attributes = Attributes(), 00089 const std::string &beginDate = std::string(), 00090 const std::string &endDate = std::string(), 00091 Entity *target = NULL); 00092 00096 virtual ~Relation(); 00097 00103 std::string getType() const; 00104 00110 void setType(const std::string &type); 00111 00120 std::string getTargetId() const; 00121 00129 void setTargetId(const std::string &targetId); 00130 00142 std::string getTargetType() const; 00143 00151 void setTargetType(const std::string &targetType); 00152 00163 std::string getBeginDate() const; 00164 00172 void setBeginDate(const std::string &dateStr); 00173 00185 std::string getEndDate() const; 00186 00194 void setEndDate(const std::string &dateStr); 00195 00210 Direction getDirection() const; 00211 00220 void setDirection(const Direction direction); 00221 00229 Attributes &getAttributes(); 00230 00240 int getNumAttributes() const; 00241 00251 std::string getAttribute(int index) const; 00252 00258 void addAttribute(const std::string &attribute); 00259 00268 Entity *getTarget() const; 00269 00278 void setTarget(Entity *target); 00279 00280 private: 00281 00282 class RelationPrivate; 00283 RelationPrivate *d; 00284 }; 00285 00286 } 00287 00288 #endif 00289