id3v2tag.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2002 - 2008 by Scott Wheeler
3  email : wheeler@kde.org
4  ***************************************************************************/
5 
6 /***************************************************************************
7  * This library is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU Lesser General Public License version *
9  * 2.1 as published by the Free Software Foundation. *
10  * *
11  * This library is distributed in the hope that it will be useful, but *
12  * WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the Free Software *
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
19  * 02110-1301 USA *
20  * *
21  * Alternatively, this file is available under the Mozilla Public *
22  * License Version 1.1. You may obtain a copy of the License at *
23  * http://www.mozilla.org/MPL/ *
24  ***************************************************************************/
25 
26 #ifndef TAGLIB_ID3V2TAG_H
27 #define TAGLIB_ID3V2TAG_H
28 
29 #include "tag.h"
30 #include "tbytevector.h"
31 #include "tstring.h"
32 #include "tlist.h"
33 #include "tmap.h"
34 #include "taglib_export.h"
35 
36 #include "id3v2framefactory.h"
37 
38 namespace TagLib {
39 
40  class File;
41 
43 
51  namespace ID3v2 {
52 
53  class Header;
54  class ExtendedHeader;
55  class Footer;
56 
57  typedef List<Frame *> FrameList;
59 
61 
106  {
107  public:
113  Tag();
114 
127  Tag(File *file, long tagOffset,
128  const FrameFactory *factory = FrameFactory::instance());
129 
133  virtual ~Tag();
134 
135  // Reimplementations.
136 
137  virtual String title() const;
138  virtual String artist() const;
139  virtual String album() const;
140  virtual String comment() const;
141  virtual String genre() const;
142  virtual uint year() const;
143  virtual uint track() const;
144 
145  virtual void setTitle(const String &s);
146  virtual void setArtist(const String &s);
147  virtual void setAlbum(const String &s);
148  virtual void setComment(const String &s);
149  virtual void setGenre(const String &s);
150  virtual void setYear(uint i);
151  virtual void setTrack(uint i);
152 
153  virtual bool isEmpty() const;
154 
158  Header *header() const;
159 
164  ExtendedHeader *extendedHeader() const;
165 
174  Footer *footer() const;
175 
210  const FrameListMap &frameListMap() const;
211 
222  const FrameList &frameList() const;
223 
235  const FrameList &frameList(const ByteVector &frameID) const;
236 
244  void addFrame(Frame *frame);
245 
253  void removeFrame(Frame *frame, bool del = true);
254 
261  void removeFrames(const ByteVector &id);
262 
266  ByteVector render() const;
267 
268  protected:
275  void read();
276 
281  void parse(const ByteVector &data);
282 
287  void setTextFrame(const ByteVector &id, const String &value);
288 
289  private:
290  Tag(const Tag &);
291  Tag &operator=(const Tag &);
292 
293  class TagPrivate;
294  TagPrivate *d;
295  };
296 
297  }
298 }
299 
300 #endif