1 /* --------------------------------------------------------------------------
2 
3    libmusicbrainz5 - Client library to access MusicBrainz
4 
5    Copyright (C) 2012 Andrew Hawkins
6 
7    This file is part of libmusicbrainz5.
8 
9    This library is free software; you can redistribute it and/or
10    modify it under the terms of the GNU Lesser General Public
11    License as published by the Free Software Foundation; either
12    version 2.1 of the License, or (at your option) any later version.
13 
14    libmusicbrainz5 is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17    Lesser General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this library.  If not, see <http://www.gnu.org/licenses/>.
21 
22      $Id$
23 
24 ----------------------------------------------------------------------------*/
25 
26 #ifndef _MUSICBRAINZ5_RELATION_H
27 #define _MUSICBRAINZ5_RELATION_H
28 
29 #include <string>
30 #include <iostream>
31 
32 #include "musicbrainz5/Entity.h"
33 #include "musicbrainz5/AttributeList.h"
34 
35 #include "musicbrainz5/xmlParser.h"
36 
37 namespace MusicBrainz5
38 {
39 	class CRelationPrivate;
40 
41 	class CArtist;
42 	class CRelease;
43 	class CReleaseGroup;
44 	class CRecording;
45 	class CLabel;
46 	class CWork;
47 
48 	class CRelation: public CEntity
49 	{
50 	public:
51 		CRelation(const XMLNode& Node=XMLNode::emptyNode());
52 		CRelation(const CRelation& Other);
53 		CRelation& operator =(const CRelation& Other);
54 		virtual ~CRelation();
55 
56 		virtual CRelation *Clone();
57 
58 		std::string Type() const;
59 		std::string Target() const;
60 		std::string Direction() const;
61 		CAttributeList *AttributeList() const;
62 		std::string Begin() const;
63 		std::string End() const;
64 		std::string Ended() const;
65 		CArtist *Artist() const;
66 		CRelease *Release() const;
67 		CReleaseGroup *ReleaseGroup() const;
68 		CRecording *Recording() const;
69 		CLabel *Label() const;
70 		CWork *Work() const;
71 
72 		virtual std::ostream& Serialise(std::ostream& os) const;
73 		static std::string GetElementName();
74 
75 	protected:
76 		virtual void ParseAttribute(const std::string& Name, const std::string& Value);
77 		virtual void ParseElement(const XMLNode& Node);
78 
79 	private:
80 		void Cleanup();
81 
82 		CRelationPrivate * const m_d;
83 	};
84 }
85 
86 #endif
87