apetag.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2004 by Allan Sandfeld Jensen
00003     email                : kde@carewolf.org
00004  ***************************************************************************/
00005 
00006 /***************************************************************************
00007  *   This library is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU Lesser General Public License version   *
00009  *   2.1 as published by the Free Software Foundation.                     *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful, but   *
00012  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the Free Software   *
00018  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA         *
00019  *   02110-1301  USA                                                       *
00020  *                                                                         *
00021  *   Alternatively, this file is available under the Mozilla Public        *
00022  *   License Version 1.1.  You may obtain a copy of the License at         *
00023  *   http://www.mozilla.org/MPL/                                           *
00024  ***************************************************************************/
00025 
00026 #ifndef TAGLIB_APETAG_H
00027 #define TAGLIB_APETAG_H
00028 
00029 #include "tag.h"
00030 #include "tbytevector.h"
00031 #include "tmap.h"
00032 #include "tstring.h"
00033 #include "taglib_export.h"
00034 
00035 #include "apeitem.h"
00036 
00037 namespace TagLib {
00038 
00039   class File;
00040 
00042 
00043   namespace APE {
00044 
00045     class Footer;
00046 
00052     typedef Map<const String, Item> ItemListMap;
00053 
00054 
00056 
00057     class TAGLIB_EXPORT Tag : public TagLib::Tag
00058     {
00059     public:
00063       Tag();
00064 
00069       Tag(TagLib::File *file, long footerLocation);
00070 
00074       virtual ~Tag();
00075 
00080       ByteVector render() const;
00081 
00086       static ByteVector fileIdentifier();
00087 
00088       // Reimplementations.
00089 
00090       virtual String title() const;
00091       virtual String artist() const;
00092       virtual String album() const;
00093       virtual String comment() const;
00094       virtual String genre() const;
00095       virtual unsigned int year() const;
00096       virtual unsigned int track() const;
00097 
00098       virtual void setTitle(const String &s);
00099       virtual void setArtist(const String &s);
00100       virtual void setAlbum(const String &s);
00101       virtual void setComment(const String &s);
00102       virtual void setGenre(const String &s);
00103       virtual void setYear(unsigned int i);
00104       virtual void setTrack(unsigned int i);
00105 
00120       PropertyMap properties() const;
00121 
00122       void removeUnsupportedProperties(const StringList &properties);
00123 
00130       PropertyMap setProperties(const PropertyMap &);
00131 
00135       static bool checkKey(const String&);
00136 
00140       Footer *footer() const;
00141 
00154       const ItemListMap &itemListMap() const;
00155 
00159       void removeItem(const String &key);
00160 
00166       void addValue(const String &key, const String &value, bool replace = true);
00167 
00173       void setData(const String &key, const ByteVector &value);
00174 
00179       void setItem(const String &key, const Item &item);
00180 
00184       bool isEmpty() const;
00185 
00186     protected:
00187 
00191       void read();
00192 
00196       void parse(const ByteVector &data);
00197 
00198     private:
00199       Tag(const Tag &);
00200       Tag &operator=(const Tag &);
00201 
00202       class TagPrivate;
00203       TagPrivate *d;
00204     };
00205   }
00206 }
00207 
00208 #endif