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. *
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. *
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, *
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 ////////////////////////////////////////////////////////////////////////////////
36 * A union of two TagLib::Tags.
38 class CombinedTag
: public TagLib::Tag
41 explicit CombinedTag(Tag
*tag1
= 0, Tag
*tag2
= 0)
43 tag1(tag1
), tag2(tag2
) {}
45 virtual String
title() const {
46 if(tag1
&& !tag1
->title().isEmpty())
55 virtual String
artist() const {
56 if(tag1
&& !tag1
->artist().isEmpty())
57 return tag1
->artist();
60 return tag2
->artist();
65 virtual String
album() const {
66 if(tag1
&& !tag1
->album().isEmpty())
75 virtual String
comment() const {
76 if(tag1
&& !tag1
->comment().isEmpty())
77 return tag1
->comment();
80 return tag2
->comment();
85 virtual String
genre() const {
86 if(tag1
&& !tag1
->genre().isEmpty())
95 virtual TagLib::uint
year() const {
96 if(tag1
&& tag1
->year() > 0)
105 virtual TagLib::uint
track() const {
106 if(tag1
&& tag1
->track() > 0)
107 return tag1
->track();
110 return tag2
->track();
115 virtual void setTitle(const String
&s
) {
122 virtual void setArtist(const String
&s
) {
129 virtual void setAlbum(const String
&s
) {
136 virtual void setComment(const String
&s
) {
143 virtual void setGenre(const String
&s
) {
150 virtual void setYear(uint i
) {
157 virtual void setTrack(uint i
) {