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  *   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(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 uint year() const;
00096       virtual uint 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(uint i);
00104       virtual void setTrack(uint i);
00105 
00109       Footer *footer() const;
00110 
00120       const ItemListMap &itemListMap() const;
00121 
00125       void removeItem(const String &key);
00126 
00132       void addValue(const String &key, const String &value, bool replace = true);
00133 
00138       void setItem(const String &key, const Item &item);
00139 
00140     protected:
00141 
00145       void read();
00146 
00150       void parse(const ByteVector &data);
00151 
00152     private:
00153       Tag(const Tag &);
00154       Tag &operator=(const Tag &);
00155 
00156       class TagPrivate;
00157       TagPrivate *d;
00158     };
00159   }
00160 }
00161 
00162 #endif