TagLib  2.0.2
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 "tmap.h"
30 #include "tstring.h"
31 #include "tbytevector.h"
32 #include "taglib_export.h"
33 #include "tag.h"
34 
35 namespace TagLib {
36 
37  class File;
38 
39  namespace RIFF {
41  namespace Info {
42 
44 
46 
60  {
61  public:
62  StringHandler();
63  virtual ~StringHandler();
64 
65  StringHandler(const StringHandler &) = delete;
66  StringHandler &operator=(const StringHandler &) = delete;
67 
72  virtual String parse(const ByteVector &data) const;
73 
78  virtual ByteVector render(const String &s) const;
79 
80  private:
81  class StringHandlerPrivate;
83  std::unique_ptr<StringHandlerPrivate> d;
84  };
85 
87 
95  class TAGLIB_EXPORT Tag : public TagLib::Tag
96  {
97  public:
101  Tag();
102 
106  Tag(const ByteVector &data);
107 
108  ~Tag() override;
109 
110  Tag(const Tag &) = delete;
111  Tag &operator=(const Tag &) = delete;
112 
113  // Reimplementations
114 
115  String title() const override;
116  String artist() const override;
117  String album() const override;
118  String comment() const override;
119  String genre() const override;
120  unsigned int year() const override;
121  unsigned int track() const override;
122 
123  void setTitle(const String &s) override;
124  void setArtist(const String &s) override;
125  void setAlbum(const String &s) override;
126  void setComment(const String &s) override;
127  void setGenre(const String &s) override;
128  void setYear(unsigned int i) override;
129  void setTrack(unsigned int i) override;
130 
131  bool isEmpty() const override;
132 
133  PropertyMap properties() const override;
134  void removeUnsupportedProperties(const StringList &props) override;
135  PropertyMap setProperties(const PropertyMap &props) override;
136 
147  FieldListMap fieldListMap() const;
148 
152  String fieldText(const ByteVector &id) const;
153 
162  void setFieldText(const ByteVector &id, const String &s);
163 
167  void removeField(const ByteVector &id);
168 
174  ByteVector render() const;
175 
187  static void setStringHandler(const StringHandler *handler);
188 
189  protected:
193  void parse(const ByteVector &data);
194 
195  private:
196  class TagPrivate;
198  std::unique_ptr<TagPrivate> d;
199  };
200  } // namespace Info
201 } // namespace RIFF
202 } // namespace TagLib
203 
204 #endif
A map for format-independent <key,values> tag representations.
Definition: tpropertymap.h:122
A simple, generic interface to common audio metadata fields.
Definition: tag.h:48
A wide string class suitable for unicode.
Definition: tstring.h:82
A byte vector.
Definition: tbytevector.h:45
An abstraction for the string to data encoding in Info tags.
Definition: infotag.h:59
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55
A generic, implicitly shared map.
Definition: tmap.h:44
A list of strings.
Definition: tstringlist.h:43
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
String TAGLIB_EXPORT genre(int index)
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
The main class in the INFO tag implementation.
Definition: infotag.h:95