infotag.h
Go to the documentation of this file.
1 /***************************************************************************
2  copyright : (C) 2012 by Tsuda Kageyu
3  email : tsuda.kageyu@gmail.com
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 
133  FieldListMap fieldListMap() const;
134 
135  /*
136  * Gets the value of the field with the ID \a id.
137  */
138  String fieldText(const ByteVector &id) const;
139 
140  /*
141  * Sets the value of the field with the ID \a id to \a s.
142  * If the field does not exist, it is created.
143  * If \s is empty, the field is removed.
144  *
145  * \note fieldId must be four-byte long pure ASCII string. This function
146  * performs nothing if fieldId is invalid.
147  */
148  void setFieldText(const ByteVector &id, const String &s);
149 
150  /*
151  * Removes the field with the ID \a id.
152  */
153  void removeField(const ByteVector &id);
154 
160  ByteVector render() const;
161 
173  static void setStringHandler(const StringHandler *handler);
174 
175  protected:
179  void parse(const ByteVector &data);
180 
181 
182  private:
183  Tag(const Tag &);
184  Tag &operator=(const Tag &);
185 
186  class TagPrivate;
187  TagPrivate *d;
188  };
189  }}
190 }
191 
192 #endif