infotag.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_INFOTAG_H
27 #define TAGLIB_INFOTAG_H
28 
29 #include "tag.h"
30 #include "tmap.h"
31 #include "tstring.h"
32 #include "tstringlist.h"
33 #include "tbytevector.h"
34 #include "taglib_export.h"
35 
36 namespace TagLib {
37 
38  class File;
39 
41  namespace RIFF {
42  namespace Info {
43 
45 
47 
61  {
62  public:
63  StringHandler();
64  ~StringHandler();
65 
70  virtual String parse(const ByteVector &data) const;
71 
76  virtual ByteVector render(const String &s) const;
77  };
78 
80 
88  class TAGLIB_EXPORT Tag : public TagLib::Tag
89  {
90  public:
94  Tag();
95 
99  Tag(const ByteVector &data);
100 
101  virtual ~Tag();
102 
103  // Reimplementations
104 
105  virtual String title() const;
106  virtual String artist() const;
107  virtual String album() const;
108  virtual String comment() const;
109  virtual String genre() const;
110  virtual uint year() const;
111  virtual uint track() const;
112 
113  virtual void setTitle(const String &s);
114  virtual void setArtist(const String &s);
115  virtual void setAlbum(const String &s);
116  virtual void setComment(const String &s);
117  virtual void setGenre(const String &s);
118  virtual void setYear(uint i);
119  virtual void setTrack(uint i);
120 
121  virtual bool isEmpty() const;
122  /*
123  * Gets the value of the field with the ID \a id.
124  */
125  String fieldText(const ByteVector &id) const;
126 
127  /*
128  * Sets the value of the field with the ID \a id to \a s.
129  * If the field does not exist, it is created.
130  * If \s is empty, the field is removed.
131  *
132  * \note fieldId must be four-byte long pure ascii string. This function
133  * performs nothing if fieldId is invalid.
134  */
135  void setFieldText(const ByteVector &id, const String &s);
136 
137  /*
138  * Removes the field with the ID \a id.
139  */
140  void removeField(const ByteVector &id);
141 
147  ByteVector render() const;
148 
160  static void setStringHandler(const StringHandler *handler);
161 
162  protected:
166  void parse(const ByteVector &data);
167 
168 
169  private:
170  Tag(const Tag &);
171  Tag &operator=(const Tag &);
172 
173  class TagPrivate;
174  TagPrivate *d;
175  };
176  }}
177 }
178 
179 #endif