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
36namespace TagLib {
37
38 class File;
39
41 namespace RIFF {
42 namespace Info {
43
45
47
61 {
62 public:
65
70 virtual String parse(const ByteVector &data) const;
71
76 virtual ByteVector render(const String &s) const;
77 };
78
80
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 unsigned int year() const;
111 virtual unsigned int 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(unsigned int i);
119 virtual void setTrack(unsigned int i);
120
121 virtual bool isEmpty() const;
122
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
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
A byte vector.
Definition: tbytevector.h:46
A generic, implicitly shared map.
Definition: tmap.h:44
A abstraction for the string to data encoding in Info tags.
Definition: infotag.h:61
virtual String parse(const ByteVector &data) const
virtual ByteVector render(const String &s) const
The main class in the ID3v2 implementation.
Definition: infotag.h:89
virtual void setAlbum(const String &s)
ByteVector render() const
virtual String genre() const
virtual void setArtist(const String &s)
virtual String title() const
FieldListMap fieldListMap() const
void removeField(const ByteVector &id)
virtual void setTitle(const String &s)
virtual String artist() const
virtual bool isEmpty() const
virtual String album() const
String fieldText(const ByteVector &id) const
virtual void setGenre(const String &s)
virtual void setTrack(unsigned int i)
virtual unsigned int year() const
virtual String comment() const
void setFieldText(const ByteVector &id, const String &s)
void parse(const ByteVector &data)
virtual void setComment(const String &s)
static void setStringHandler(const StringHandler *handler)
virtual void setYear(unsigned int i)
virtual unsigned int track() const
Tag(const ByteVector &data)
A wide string class suitable for unicode.
Definition: tstring.h:85
Definition: tag.h:47
Map< ByteVector, String > FieldListMap
Definition: infotag.h:44
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
#define TAGLIB_EXPORT
Definition: taglib_export.h:40