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., 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_APETAG_H
27 #define TAGLIB_APETAG_H
30 #include "tbytevector.h"
33 #include "taglib_export.h"
41 //! An implementation of the APE tagging format
48 * A mapping between a list of item names, or keys, and the associated item.
50 * \see APE::Tag::itemListMap()
52 typedef Map<const String, Item> ItemListMap;
55 //! An APE tag implementation
57 class TAGLIB_EXPORT Tag : public TagLib::Tag
61 * Create an APE tag with default values.
66 * Create an APE tag and parse the data in \a file with APE footer at
69 Tag(File *file, long footerLocation);
72 * Destroys this Tag instance.
77 * Renders the in memory values to a ByteVector suitable for writing to
80 ByteVector render() const;
83 * Returns the string "APETAGEX" suitable for usage in locating the tag in a
86 static ByteVector fileIdentifier();
90 virtual String title() const;
91 virtual String artist() const;
92 virtual String album() const;
93 virtual String comment() const;
94 virtual String genre() const;
95 virtual uint year() const;
96 virtual uint track() const;
98 virtual void setTitle(const String &s);
99 virtual void setArtist(const String &s);
100 virtual void setAlbum(const String &s);
101 virtual void setComment(const String &s);
102 virtual void setGenre(const String &s);
103 virtual void setYear(uint i);
104 virtual void setTrack(uint i);
107 * Returns a pointer to the tag's footer.
109 Footer *footer() const;
112 * Returns a reference to the item list map. This is an ItemListMap of
113 * all of the items in the tag.
115 * This is the most powerfull structure for accessing the items of the tag.
117 * \warning You should not modify this data structure directly, instead
118 * use setItem() and removeItem().
120 const ItemListMap &itemListMap() const;
123 * Removes the \a key item from the tag
125 void removeItem(const String &key);
128 * Adds to the item specified by \a key the data \a value. If \a replace
129 * is true, then all of the other values on the same key will be removed
132 void addValue(const String &key, const String &value, bool replace = true);
135 * Sets the \a key item to the value of \a item. If an item with the \a key is already
136 * present, it will be replaced.
138 void setItem(const String &key, const Item &item);
143 * Reads from the file specified in the constructor.
148 * Parses the body of the tag in \a data.
150 void parse(const ByteVector &data);
154 Tag &operator=(const Tag &);