TagLib  1.13.1
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
55 {
56 friend class Tag;
57 friend class FrameFactory;
59 friend class ChapterFrame;
60
61 public:
62
68 static Frame *createTextualFrame(const String &key, const StringList &values);
69
73 virtual ~Frame();
74
80
84 unsigned int size() const;
85
94 static unsigned int headerSize(); // BIC: make non-static
95
101 // BIC: remove
102 static unsigned int headerSize(unsigned int version);
103
110 void setData(const ByteVector &data);
111
121 virtual void setText(const String &text);
122
128 virtual String toString() const = 0;
129
134
140
151 static const String commentPrefix;
156 static const String lyricsPrefix;
161 static const String urlPrefix;
162
163 protected:
164 class Header;
165
173 explicit Frame(const ByteVector &data);
174
182
186 Header *header() const;
187
195 void setHeader(Header *h, bool deleteCurrent = true);
196
201 void parse(const ByteVector &data);
202
208 virtual void parseFields(const ByteVector &data) = 0;
209
214 virtual ByteVector renderFields() const = 0;
215
221 ByteVector fieldData(const ByteVector &frameData) const;
222
230 int *position = 0);
231
236 // BIC: remove and make non-static
238 String::Type encoding);
239
246 // BIC: remove and make non-static
248 String::Type encoding, unsigned int version);
249
257 String::Type encoding) const;
258
259
267
273
279
283 static String keyToTXXX(const String &);
284
288 static String txxxToKey(const String &);
289
303 static void splitProperties(const PropertyMap &original, PropertyMap &singleFrameProperties,
304 PropertyMap &tiplProperties, PropertyMap &tmclProperties);
305
306 private:
307 Frame(const Frame &);
308 Frame &operator=(const Frame &);
309
310 class FramePrivate;
311 friend class FramePrivate;
312 FramePrivate *d;
313 };
314
316
330 {
331 public:
340 TAGLIB_DEPRECATED Header(const ByteVector &data, bool synchSafeInts);
341
349 explicit Header(const ByteVector &data, unsigned int version = 4);
350
354 virtual ~Header();
355
362 TAGLIB_DEPRECATED void setData(const ByteVector &data, bool synchSafeInts);
363
368 void setData(const ByteVector &data, unsigned int version = 4);
369
375
384 void setFrameID(const ByteVector &id);
385
390 unsigned int frameSize() const;
391
395 void setFrameSize(unsigned int size);
396
401 unsigned int version() const;
402
407 void setVersion(unsigned int version);
408
417 // BIC: make non-static
418 static unsigned int size();
419
426 // BIC: remove
427 static unsigned int size(unsigned int version);
428
439
451 void setTagAlterPreservation(bool discard);
452
459
465 bool readOnly() const;
466
472 bool groupingIdentity() const;
473
479 bool compression() const;
480
486 bool encryption() const;
487
488#ifndef DO_NOT_DOCUMENT
489 bool unsycronisation() const;
490#endif
491
495 bool unsynchronisation() const;
496
501
506
511
512 private:
513 Header(const Header &);
514 Header &operator=(const Header &);
515
516 class HeaderPrivate;
517 HeaderPrivate *d;
518 };
519
520 } // namespace ID3v2
521} // namespace TagLib
522
523#endif
A byte vector.
Definition: tbytevector.h:46
An implementation of ID3v2 chapter frames.
Definition: chapterframe.h:45
A factory for creating ID3v2 frames during parsing.
Definition: id3v2framefactory.h:66
ID3v2 frame implementation.
Definition: id3v2frame.h:55
bool encryption() const
void parse(const ByteVector &data)
bool dataLengthIndicator() const
static const String lyricsPrefix
Definition: id3v2frame.h:156
bool unsynchronisation() const
static String::Type checkEncoding(const StringList &fields, String::Type encoding)
String readStringField(const ByteVector &data, String::Type encoding, int *position=0)
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:161
static String frameIDToKey(const ByteVector &)
bool groupingIdentity() const
Header(const ByteVector &data, unsigned int version=4)
unsigned int size() const
static unsigned int headerSize()
virtual void parseFields(const ByteVector &data)=0
ByteVector render() const
PropertyMap asProperties() const
Frame(const ByteVector &data)
bool fileAlterPreservation() const
void setHeader(Header *h, bool deleteCurrent=true)
bool tagAlterPreservation() const
Header * header() const
virtual void setText(const String &text)
void setFrameSize(unsigned int size)
static Frame * createTextualFrame(const String &key, const StringList &values)
static String txxxToKey(const String &)
void setVersion(unsigned int version)
void setData(const ByteVector &data)
static unsigned int headerSize(unsigned int version)
static ByteVector keyToFrameID(const String &)
bool readOnly() const
bool compression() const
static ByteVector textDelimiter(String::Type t)
TAGLIB_DEPRECATED Header(const ByteVector &data, bool synchSafeInts)
static unsigned int size(unsigned int version)
TAGLIB_DEPRECATED void setData(const ByteVector &data, bool synchSafeInts)
static const String commentPrefix
Definition: id3v2frame.h:151
static String::Type checkEncoding(const StringList &fields, String::Type encoding, unsigned int version)
static const String instrumentPrefix
Definition: id3v2frame.h:146
void setFrameID(const ByteVector &id)
TAGLIB_DEPRECATED bool frameAlterPreservation() const
static String keyToTXXX(const String &)
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)
void setTagAlterPreservation(bool discard)
static unsigned int size()
An implementation of ID3v2 headers.
Definition: id3v2header.h:49
An implementation of ID3v2 table of contents frames.
Definition: tableofcontentsframe.h:46
The main class in the ID3v2 implementation.
Definition: id3v2tag.h:128
A map for format-independent <key,valuelist> tag representations.
Definition: tpropertymap.h:119
A list of strings.
Definition: tstringlist.h:46
A wide string class suitable for unicode.
Definition: tstring.h:85
Type
Definition: tstring.h:97
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
#define TAGLIB_DEPRECATED
Definition: taglib.h:54
#define TAGLIB_EXPORT
Definition: taglib_export.h:40