![]() |
|
00001 /*************************************************************************** 00002 copyright : (C) 2002 - 2008 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 * 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_ID3V2TAG_H 00027 #define TAGLIB_ID3V2TAG_H 00028 00029 #include "tag.h" 00030 #include "tbytevector.h" 00031 #include "tstring.h" 00032 #include "tlist.h" 00033 #include "tmap.h" 00034 #include "taglib_export.h" 00035 00036 #include "id3v2framefactory.h" 00037 00038 namespace TagLib { 00039 00040 class File; 00041 00043 00051 namespace ID3v2 { 00052 00053 class Header; 00054 class ExtendedHeader; 00055 class Footer; 00056 00057 typedef List<Frame *> FrameList; 00058 typedef Map<ByteVector, FrameList> FrameListMap; 00059 00061 00105 class TAGLIB_EXPORT Tag : public TagLib::Tag 00106 { 00107 public: 00113 Tag(); 00114 00127 Tag(File *file, long tagOffset, 00128 const FrameFactory *factory = FrameFactory::instance()); 00129 00133 virtual ~Tag(); 00134 00135 // Reimplementations. 00136 00137 virtual String title() const; 00138 virtual String artist() const; 00139 virtual String album() const; 00140 virtual String comment() const; 00141 virtual String genre() const; 00142 virtual uint year() const; 00143 virtual uint track() const; 00144 00145 virtual void setTitle(const String &s); 00146 virtual void setArtist(const String &s); 00147 virtual void setAlbum(const String &s); 00148 virtual void setComment(const String &s); 00149 virtual void setGenre(const String &s); 00150 virtual void setYear(uint i); 00151 virtual void setTrack(uint i); 00152 00153 virtual bool isEmpty() const; 00154 00158 Header *header() const; 00159 00164 ExtendedHeader *extendedHeader() const; 00165 00174 Footer *footer() const; 00175 00210 const FrameListMap &frameListMap() const; 00211 00222 const FrameList &frameList() const; 00223 00235 const FrameList &frameList(const ByteVector &frameID) const; 00236 00244 void addFrame(Frame *frame); 00245 00253 void removeFrame(Frame *frame, bool del = true); 00254 00261 void removeFrames(const ByteVector &id); 00262 00266 ByteVector render() const; 00267 00268 protected: 00275 void read(); 00276 00281 void parse(const ByteVector &data); 00282 00287 void setTextFrame(const ByteVector &id, const String &value); 00288 00289 private: 00290 Tag(const Tag &); 00291 Tag &operator=(const Tag &); 00292 00293 class TagPrivate; 00294 TagPrivate *d; 00295 }; 00296 00297 } 00298 } 00299 00300 #endif