TagLib  2.2.1
id3v1tag.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_ID3V1TAG_H
27 #define TAGLIB_ID3V1TAG_H
28 
29 #include "tbytevector.h"
30 #include "taglib.h"
31 #include "taglib_export.h"
32 #include "tag.h"
33 
34 namespace TagLib {
35 
36  class File;
37 
39 
40  namespace ID3v1 {
41 
43 
62  {
63  public:
64  StringHandler();
65 
66  virtual ~StringHandler();
67 
68  StringHandler(const StringHandler &) = delete;
69  StringHandler &operator=(const StringHandler &) = delete;
70 
75  virtual String parse(const ByteVector &data) const;
76 
86  virtual ByteVector render(const String &s) const;
87 
88  private:
89  class StringHandlerPrivate;
91  std::unique_ptr<StringHandlerPrivate> d;
92  };
93 
95 
115  {
116  public:
120  Tag();
121 
126  Tag(File *file, offset_t tagOffset);
127 
131  ~Tag() override;
132 
133  Tag(const Tag &) = delete;
134  Tag &operator=(const Tag &) = delete;
135 
140  ByteVector render() const;
141 
146  static ByteVector fileIdentifier();
147 
148  // Reimplementations.
149 
150  String title() const override;
151  String artist() const override;
152  String album() const override;
153  String comment() const override;
154  String genre() const override;
155  unsigned int year() const override;
156  unsigned int track() const override;
157 
158  void setTitle(const String &s) override;
159  void setArtist(const String &s) override;
160  void setAlbum(const String &s) override;
161  void setComment(const String &s) override;
162  void setGenre(const String &s) override;
163  void setYear(unsigned int i) override;
164  void setTrack(unsigned int i) override;
165 
171  unsigned int genreNumber() const;
172 
179  void setGenreNumber(unsigned int i);
180 
192  static void setStringHandler(const StringHandler *handler);
193 
194  protected:
198  void read();
202  void parse(const ByteVector &data);
203 
204  private:
205  class TagPrivate;
207  std::unique_ptr<TagPrivate> d;
208  };
209  } // namespace ID3v1
210 } // namespace TagLib
211 
212 #endif
A simple, generic interface to common audio metadata fields.
Definition: tag.h:48
A file class with some useful methods for tag manipulation.
Definition: tfile.h:50
A wide string class suitable for unicode.
Definition: tstring.h:82
The main class in the ID3v1 implementation.
Definition: id3v1tag.h:114
A byte vector.
Definition: tbytevector.h:45
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
An abstraction for the string to data encoding in ID3v1 tags.
Definition: id3v1tag.h:61
String TAGLIB_EXPORT genre(int index)
off_t offset_t
Definition: taglib.h:64
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41