1 /***************************************************************************
2 copyright : (C) 2002 - 2008 by Scott Wheeler
3 email : wheeler@kde.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
21 * Alternatively, this file is available under the Mozilla Public *
22 * License Version 1.1. You may obtain a copy of the License at *
23 * http://www.mozilla.org/MPL/ *
24 ***************************************************************************/
26 #ifndef TAGLIB_TAGUNION_H
27 #define TAGLIB_TAGUNION_H
31 #ifndef DO_NOT_DOCUMENT
39 class TagUnion : public Tag
43 enum AccessType { Read, Write };
46 * Creates a TagLib::Tag that is the union of \a first, \a second, and
47 * \a third. The TagUnion takes ownership of these tags and will handle
50 TagUnion(Tag *first = 0, Tag *second = 0, Tag *third = 0);
54 Tag *operator[](int index) const;
55 Tag *tag(int index) const;
57 void set(int index, Tag *tag);
59 virtual String title() const;
60 virtual String artist() const;
61 virtual String album() const;
62 virtual String comment() const;
63 virtual String genre() const;
64 virtual uint year() const;
65 virtual uint track() const;
67 virtual void setTitle(const String &s);
68 virtual void setArtist(const String &s);
69 virtual void setAlbum(const String &s);
70 virtual void setComment(const String &s);
71 virtual void setGenre(const String &s);
72 virtual void setYear(uint i);
73 virtual void setTrack(uint i);
74 virtual bool isEmpty() const;
76 template <class T> T *access(int index, bool create)
78 if(!create || tag(index))
79 return static_cast<T *>(tag(index));
82 return static_cast<T *>(tag(index));
86 TagUnion(const Tag &);
87 TagUnion &operator=(const Tag &);
89 class TagUnionPrivate;