apetag.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2004 by Allan Sandfeld Jensen
3  email : kde@carewolf.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_APETAG_H
27 #define TAGLIB_APETAG_H
28 
29 #include "tag.h"
30 #include "tbytevector.h"
31 #include "tmap.h"
32 #include "tstring.h"
33 #include "taglib_export.h"
34 
35 #include "apeitem.h"
36 
37 namespace TagLib {
38 
39  class File;
40 
42 
43  namespace APE {
44 
45  class Footer;
46 
53 
54 
56 
57  class TAGLIB_EXPORT Tag : public TagLib::Tag
58  {
59  public:
63  Tag();
64 
69  Tag(TagLib::File *file, long footerLocation);
70 
74  virtual ~Tag();
75 
80  ByteVector render() const;
81 
86  static ByteVector fileIdentifier();
87 
88  // Reimplementations.
89 
90  virtual String title() const;
91  virtual String artist() const;
92  virtual String album() const;
93  virtual String comment() const;
94  virtual String genre() const;
95  virtual uint year() const;
96  virtual uint track() const;
97 
98  virtual void setTitle(const String &s);
99  virtual void setArtist(const String &s);
100  virtual void setAlbum(const String &s);
101  virtual void setComment(const String &s);
102  virtual void setGenre(const String &s);
103  virtual void setYear(uint i);
104  virtual void setTrack(uint i);
105 
120  PropertyMap properties() const;
121 
122  void removeUnsupportedProperties(const StringList &properties);
123 
130  PropertyMap setProperties(const PropertyMap &);
131 
135  static bool checkKey(const String&);
136 
140  Footer *footer() const;
141 
154  const ItemListMap &itemListMap() const;
155 
159  void removeItem(const String &key);
160 
166  void addValue(const String &key, const String &value, bool replace = true);
167 
173  void setData(const String &key, const ByteVector &value);
174 
179  void setItem(const String &key, const Item &item);
180 
184  bool isEmpty() const;
185 
186  protected:
187 
191  void read();
192 
196  void parse(const ByteVector &data);
197 
198  private:
199  Tag(const Tag &);
200  Tag &operator=(const Tag &);
201 
202  class TagPrivate;
203  TagPrivate *d;
204  };
205  }
206 }
207 
208 #endif