TagLib API Documentation
id3v2frame.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_ID3V2FRAME_H
27#define TAGLIB_ID3V2FRAME_H
28
29#include "tstring.h"
30#include "tbytevector.h"
31#include "taglib_export.h"
32
33namespace TagLib {
34
35 class StringList;
36 class PropertyMap;
37
38 namespace ID3v2 {
39
40 class Tag;
41 class FrameFactory;
42
44
57 {
58 friend class Tag;
59
60 public:
61 class Header;
62
66 virtual ~Frame();
67
68 Frame(const Frame &) = delete;
69 Frame &operator=(const Frame &) = delete;
70
79
83 unsigned int size() const;
84
88 unsigned int headerSize() const;
89
96 void setData(const ByteVector &data);
97
107 virtual void setText(const String &text);
108
114 virtual String toString() const = 0;
115
122 virtual StringList toStringList() const;
123
128
132 Header *header() const;
133
139
145
151
162 static const String commentPrefix;
167 static const String lyricsPrefix;
172 static const String urlPrefix;
173
174 protected:
182 explicit Frame(const ByteVector &data);
183
191
199 void setHeader(Header *h, bool deleteCurrent = true);
200
205 void parse(const ByteVector &data);
206
212 virtual void parseFields(const ByteVector &data) = 0;
213
218 virtual ByteVector renderFields() const = 0;
219
225 ByteVector fieldData(const ByteVector &frameData) const;
226
234 int *position = nullptr);
235
243 String::Type encoding) const;
244
245
251 virtual PropertyMap asProperties() const;
252
266 static void splitProperties(const PropertyMap &original, PropertyMap &singleFrameProperties,
267 PropertyMap &tiplProperties, PropertyMap &tmclProperties);
268
269 private:
270 class FramePrivate;
271 friend class FramePrivate;
273 std::unique_ptr<FramePrivate> d;
274 };
275
277
293 {
294 public:
302 explicit Header(const ByteVector &data, unsigned int version = 4);
303
307 virtual ~Header();
308
309 Header(const Header &) = delete;
310 Header &operator=(const Header &) = delete;
311
316 void setData(const ByteVector &data, unsigned int version = 4);
317
326
335 void setFrameID(const ByteVector &id);
336
341 unsigned int frameSize() const;
342
346 void setFrameSize(unsigned int size);
347
352 unsigned int version() const;
353
358 void setVersion(unsigned int version);
359
363 unsigned int size() const;
364
375
387 void setTagAlterPreservation(bool preserve);
388
395
401 bool readOnly() const;
402
408 bool groupingIdentity() const;
409
415 bool compression() const;
416
422 bool encryption() const;
423
427 bool unsynchronisation() const;
428
433
438
439 private:
440 class HeaderPrivate;
442 std::unique_ptr<HeaderPrivate> d;
443 };
444
445 } // namespace ID3v2
446} // namespace TagLib
447
448#endif
A byte vector.
Definition: tbytevector.h:46
ID3v2 frame implementation.
Definition: id3v2frame.h:57
bool encryption() const
void parse(const ByteVector &data)
bool dataLengthIndicator() const
String readStringField(const ByteVector &data, String::Type encoding, int *position=nullptr)
static const String lyricsPrefix
Definition: id3v2frame.h:167
bool unsynchronisation() const
String::Type checkTextEncoding(const StringList &fields, String::Type encoding) const
void setData(const ByteVector &data, unsigned int version=4)
ByteVector fieldData(const ByteVector &frameData) const
static const String urlPrefix
Definition: id3v2frame.h:172
static String frameIDToKey(const ByteVector &)
bool groupingIdentity() const
Header(const ByteVector &data, unsigned int version=4)
unsigned int size() const
virtual void parseFields(const ByteVector &data)=0
Frame & operator=(const Frame &)=delete
ByteVector render() const
Frame(const ByteVector &data)
bool fileAlterPreservation() const
void setHeader(Header *h, bool deleteCurrent=true)
bool tagAlterPreservation() const
Header * header() const
Header(const Header &)=delete
virtual void setText(const String &text)
void setFrameSize(unsigned int size)
Header & operator=(const Header &)=delete
virtual PropertyMap asProperties() const
virtual StringList toStringList() const
void setVersion(unsigned int version)
void setData(const ByteVector &data)
static ByteVector keyToFrameID(const String &)
bool readOnly() const
bool compression() const
static ByteVector textDelimiter(String::Type t)
void setTagAlterPreservation(bool preserve)
Frame(const Frame &)=delete
static const String commentPrefix
Definition: id3v2frame.h:162
unsigned int headerSize() const
static const String instrumentPrefix
Definition: id3v2frame.h:157
void setFrameID(const ByteVector &id)
unsigned int version() const
ByteVector frameID() const
virtual ByteVector renderFields() const =0
virtual String toString() const =0
unsigned int frameSize() const
static void splitProperties(const PropertyMap &original, PropertyMap &singleFrameProperties, PropertyMap &tiplProperties, PropertyMap &tmclProperties)
An implementation of ID3v2 headers.
Definition: id3v2header.h:49
The main class in the ID3v2 implementation.
Definition: id3v2tag.h:134
A map for format-independent <key,values> tag representations.
Definition: tpropertymap.h:123
A list of strings.
Definition: tstringlist.h:44
A wide string class suitable for unicode.
Definition: tstring.h:83
Type
Definition: tstring.h:96
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition: taglib_export.h:55