id3v2tag.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     copyright            : (C) 2002, 2003 by Scott Wheeler
00003     email                : wheeler@kde.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_ID3V2TAG_H
00023 #define TAGLIB_ID3V2TAG_H
00024 
00025 #include <tag.h>
00026 #include <tbytevector.h>
00027 #include <tstring.h>
00028 #include <tlist.h>
00029 #include <tmap.h>
00030 
00031 #include "id3v2framefactory.h"
00032 
00033 namespace TagLib {
00034 
00035   class File;
00036 
00038 
00046   namespace ID3v2 {
00047 
00048     class Header;
00049     class ExtendedHeader;
00050     class Footer;
00051 
00052     typedef List<Frame *> FrameList;
00053     typedef Map<ByteVector, FrameList> FrameListMap;
00054 
00056 
00100     class Tag : public TagLib::Tag
00101     {
00102     public:
00108       Tag();
00109 
00122       Tag(File *file, long tagOffset,
00123           const FrameFactory *factory = FrameFactory::instance());
00124 
00128       virtual ~Tag();
00129 
00130       // Reimplementations.
00131 
00132       virtual String title() const;
00133       virtual String artist() const;
00134       virtual String album() const;
00135       virtual String comment() const;
00136       virtual String genre() const;
00137       virtual uint year() const;
00138       virtual uint track() const;
00139 
00140       virtual void setTitle(const String &s);
00141       virtual void setArtist(const String &s);
00142       virtual void setAlbum(const String &s);
00143       virtual void setComment(const String &s);
00144       virtual void setGenre(const String &s);
00145       virtual void setYear(uint i);
00146       virtual void setTrack(uint i);
00147 
00148       virtual bool isEmpty() const;
00149 
00153       Header *header() const;
00154 
00159       ExtendedHeader *extendedHeader() const;
00160 
00169       Footer *footer() const;
00170 
00205       const FrameListMap &frameListMap() const;
00206 
00217       const FrameList &frameList() const;
00218 
00230       const FrameList &frameList(const ByteVector &frameID) const;
00231 
00239       void addFrame(Frame *frame);
00240 
00248       void removeFrame(Frame *frame, bool del = true);
00249 
00256       void removeFrames(const ByteVector &id);
00257 
00261       ByteVector render() const;
00262 
00263     protected:
00270       void read();
00271 
00276       void parse(const ByteVector &data);
00277 
00282       void setTextFrame(const ByteVector &id, const String &value);
00283 
00284     private:
00285       Tag(const Tag &);
00286       Tag &operator=(const Tag &);
00287 
00288       class TagPrivate;
00289       TagPrivate *d;
00290     };
00291 
00292   }
00293 }
00294 
00295 #endif