Revert previous commit, was incorrect
[amarok.git] / src / metadata / trueaudio / combinedtag.h
blobbf131d9329b29ce1c0ab5c45af4d67d8a8a19364
1 /***************************************************************************
2 copyright : (C) 2004 by Allan Sandfeld Jensen
3 email : kde@carewolf.org
4 ***************************************************************************/
6 /***************************************************************************
7 * This library is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU Lesser General Public License version *
9 * 2.1 as published by the Free Software Foundation. *
10 * *
11 * This library is distributed in the hope that it will be useful, but *
12 * 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, *
19 * MA 02110-1301 USA *
20 ***************************************************************************/
22 #ifndef DO_NOT_DOCUMENT // Tell Doxygen not to document this header
24 #ifndef TAGLIB_COMBINEDTAG_H
25 #define TAGLIB_COMBINEDTAG_H
27 ////////////////////////////////////////////////////////////////////////////////
28 // Note that this header is not installed.
29 ////////////////////////////////////////////////////////////////////////////////
31 #include <tag.h>
33 namespace TagLib {
35 /*!
36 * A union of two TagLib::Tags.
38 class CombinedTag : public TagLib::Tag
40 public:
41 explicit CombinedTag(Tag *tag1 = 0, Tag *tag2 = 0)
42 : TagLib::Tag(),
43 tag1(tag1), tag2(tag2) {}
45 virtual String title() const {
46 if(tag1 && !tag1->title().isEmpty())
47 return tag1->title();
49 if(tag2)
50 return tag2->title();
52 return String::null;
55 virtual String artist() const {
56 if(tag1 && !tag1->artist().isEmpty())
57 return tag1->artist();
59 if(tag2)
60 return tag2->artist();
62 return String::null;
65 virtual String album() const {
66 if(tag1 && !tag1->album().isEmpty())
67 return tag1->album();
69 if(tag2)
70 return tag2->album();
72 return String::null;
75 virtual String comment() const {
76 if(tag1 && !tag1->comment().isEmpty())
77 return tag1->comment();
79 if(tag2)
80 return tag2->comment();
82 return String::null;
85 virtual String genre() const {
86 if(tag1 && !tag1->genre().isEmpty())
87 return tag1->genre();
89 if(tag2)
90 return tag2->genre();
92 return String::null;
95 virtual TagLib::uint year() const {
96 if(tag1 && tag1->year() > 0)
97 return tag1->year();
99 if(tag2)
100 return tag2->year();
102 return 0;
105 virtual TagLib::uint track() const {
106 if(tag1 && tag1->track() > 0)
107 return tag1->track();
109 if(tag2)
110 return tag2->track();
112 return 0;
115 virtual void setTitle(const String &s) {
116 if(tag1)
117 tag1->setTitle(s);
118 if(tag2)
119 tag2->setTitle(s);
122 virtual void setArtist(const String &s) {
123 if(tag1)
124 tag1->setArtist(s);
125 if(tag2)
126 tag2->setArtist(s);
129 virtual void setAlbum(const String &s) {
130 if(tag1)
131 tag1->setAlbum(s);
132 if(tag2)
133 tag2->setAlbum(s);
136 virtual void setComment(const String &s) {
137 if(tag1)
138 tag1->setComment(s);
139 if(tag2)
140 tag2->setComment(s);
143 virtual void setGenre(const String &s) {
144 if(tag1)
145 tag1->setGenre(s);
146 if(tag2)
147 tag2->setGenre(s);
150 virtual void setYear(uint i) {
151 if(tag1)
152 tag1->setYear(i);
153 if(tag2)
154 tag2->setYear(i);
157 virtual void setTrack(uint i) {
158 if(tag1)
159 tag1->setTrack(i);
160 if(tag2)
161 tag2->setTrack(i);
164 private:
165 Tag *tag1;
166 Tag *tag2;
170 #endif
171 #endif