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 ***************************************************************************/
29 #include "taglib_export.h"
34 //! A simple, generic interface to common audio meta data fields
37 * This is an attempt to abstract away the difference in the meta data formats
38 * of various audio codecs and tagging schemes. As such it is generally a
39 * subset of what is available in the specific formats but should be suitable
40 * for most applications. This is meant to compliment the generic APIs found
41 * in TagLib::AudioProperties, TagLib::File and TagLib::FileRef.
44 class TAGLIB_EXPORT Tag
49 * Detroys this Tag instance.
54 * Returns the track name; if no track name is present in the tag
55 * String::null will be returned.
57 virtual String title() const = 0;
60 * Returns the artist name; if no artist name is present in the tag
61 * String::null will be returned.
63 virtual String artist() const = 0;
66 * Returns the album name; if no album name is present in the tag
67 * String::null will be returned.
69 virtual String album() const = 0;
72 * Returns the track comment; if no comment is present in the tag
73 * String::null will be returned.
75 virtual String comment() const = 0;
78 * Returns the genre name; if no genre is present in the tag String::null
81 virtual String genre() const = 0;
84 * Returns the year; if there is no year set, this will return 0.
86 virtual uint year() const = 0;
89 * Returns the track number; if there is no track number set, this will
92 virtual uint track() const = 0;
95 * Sets the title to \a s. If \a s is String::null then this value will be
98 virtual void setTitle(const String &s) = 0;
101 * Sets the artist to \a s. If \a s is String::null then this value will be
104 virtual void setArtist(const String &s) = 0;
107 * Sets the album to \a s. If \a s is String::null then this value will be
110 virtual void setAlbum(const String &s) = 0;
113 * Sets the comment to \a s. If \a s is String::null then this value will be
116 virtual void setComment(const String &s) = 0;
119 * Sets the genre to \a s. If \a s is String::null then this value will be
120 * cleared. For tag formats that use a fixed set of genres, the appropriate
121 * value will be selected based on a string comparison. A list of available
122 * genres for those formats should be available in that type's
125 virtual void setGenre(const String &s) = 0;
128 * Sets the year to \a i. If \a s is 0 then this value will be cleared.
130 virtual void setYear(uint i) = 0;
133 * Sets the track to \a i. If \a s is 0 then this value will be cleared.
135 virtual void setTrack(uint i) = 0;
138 * Returns true if the tag does not contain any data. This should be
139 * reimplemented in subclasses that provide more than the basic tagging
140 * abilities in this class.
142 virtual bool isEmpty() const;
145 * Copies the generic data from one tag to another.
147 * \note This will no affect any of the lower level details of the tag. For
148 * instance if any of the tag type specific data (maybe a URL for a band) is
149 * set, this will not modify or copy that. This just copies using the API
152 * If \a overwrite is true then the values will be unconditionally copied.
153 * If false only empty values will be overwritten.
155 static void duplicate(const Tag *source, Tag *target, bool overwrite = true);
159 * Construct a Tag. This is protected since tags should only be instantiated
160 * through subclasses.
166 Tag &operator=(const Tag &);