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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
00019  *   USA                                                                   *
00020  ***************************************************************************/
00021 
00022 #ifndef TAGLIB_APETAG_H
00023 #define TAGLIB_APETAG_H
00024 
00025 #include "tag.h"
00026 #include "tbytevector.h"
00027 #include "tmap.h"
00028 #include "tstring.h"
00029 
00030 #include "apeitem.h"
00031 
00032 namespace TagLib {
00033 
00034   class File;
00035 
00037 
00038   namespace APE {
00039 
00040     class Footer;
00041 
00047     typedef Map<const String, Item> ItemListMap;
00048 
00049 
00051 
00052     class Tag : public TagLib::Tag
00053     {
00054     public:
00058       Tag();
00059 
00064       Tag(File *file, long tagOffset);
00065 
00069       virtual ~Tag();
00070 
00075       ByteVector render() const;
00076 
00081       static ByteVector fileIdentifier();
00082 
00083       // Reimplementations.
00084 
00085       virtual String title() const;
00086       virtual String artist() const;
00087       virtual String album() const;
00088       virtual String comment() const;
00089       virtual String genre() const;
00090       virtual uint year() const;
00091       virtual uint track() const;
00092 
00093       virtual void setTitle(const String &s);
00094       virtual void setArtist(const String &s);
00095       virtual void setAlbum(const String &s);
00096       virtual void setComment(const String &s);
00097       virtual void setGenre(const String &s);
00098       virtual void setYear(uint i);
00099       virtual void setTrack(uint i);
00100 
00104       Footer *footer() const;
00105 
00115       const ItemListMap &itemListMap() const;
00116 
00120       void removeItem(const String &key);
00121 
00127       void addValue(const String &key, const String &value, bool replace = true);
00128 
00133       void setItem(const String &key, const Item &item);
00134 
00135     protected:
00136 
00140       void read();
00141 
00145       void parse(const ByteVector &data);
00146 
00147     private:
00148       Tag(const Tag &);
00149       Tag &operator=(const Tag &);
00150 
00151       class TagPrivate;
00152       TagPrivate *d;
00153     };
00154   }
00155 }
00156 
00157 #endif