| TagLib 1.13 |  |

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
33 namespace TagLib {
34
35 class StringList;
36 class PropertyMap;
37
38 namespace ID3v2 {
39
40 class Tag;
41 class FrameFactory;
42
44
54 class TAGLIB_EXPORT Frame
55 {
56 friend class Tag;
57 friend class FrameFactory;
58 friend class TableOfContentsFrame;
59 friend class ChapterFrame;
60
61 public:
62
68 static Frame *createTextualFrame(const String &key, const StringList &values);
69
73 virtual ~Frame();
74
79 ByteVector frameID() const;
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
133 ByteVector render() const;
134
139 static ByteVector textDelimiter(String::Type t);
140
146 static const String instrumentPrefix;
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
181 Frame(Header *h);
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
229 String readStringField(const ByteVector &data, String::Type encoding,
230 int *position = 0);
231
236 // BIC: remove and make non-static
237 static String::Type checkEncoding(const StringList &fields,
238 String::Type encoding);
239
246 // BIC: remove and make non-static
247 static String::Type checkEncoding(const StringList &fields,
248 String::Type encoding, unsigned int version);
249
256 String::Type checkTextEncoding(const StringList &fields,
257 String::Type encoding) const;
258
259
266 PropertyMap asProperties() const;
267
272 static ByteVector keyToFrameID(const String &);
273
278 static String frameIDToKey(const ByteVector &);
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
329 class TAGLIB_EXPORT Frame::Header
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
374 ByteVector frameID() const;
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
438 bool tagAlterPreservation() const;
439
451 void setTagAlterPreservation(bool discard);
452
458 bool fileAlterPreservation() const;
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
500 bool dataLengthIndicator() const;
501
505 ByteVector render() const;
506
510 TAGLIB_DEPRECATED bool frameAlterPreservation() const;
511
512 private:
513 Header(const Header &);
514 Header &operator=(const Header &);
515
516 class HeaderPrivate;
517 HeaderPrivate *d;
518 };
519
520 }
521}
522
523#endif
TagLib::ByteVector
A byte vector.
Definition: tbytevector.h:46
TagLib::ID3v2::ChapterFrame
An implementation of ID3v2 chapter frames.
Definition: chapterframe.h:45
TagLib::ID3v2::FrameFactory
A factory for creating ID3v2 frames during parsing.
Definition: id3v2framefactory.h:66
TagLib::ID3v2::Frame
ID3v2 frame implementation.
Definition: id3v2frame.h:55
TagLib::ID3v2::Frame::encryption
bool encryption() const
TagLib::ID3v2::Frame::parse
void parse(const ByteVector &data)
TagLib::ID3v2::Frame::dataLengthIndicator
bool dataLengthIndicator() const
TagLib::ID3v2::Frame::lyricsPrefix
static const String lyricsPrefix
Definition: id3v2frame.h:156
TagLib::ID3v2::Frame::unsynchronisation
bool unsynchronisation() const
TagLib::ID3v2::Frame::checkEncoding
static String::Type checkEncoding(const StringList &fields, String::Type encoding)
TagLib::ID3v2::Frame::readStringField
String readStringField(const ByteVector &data, String::Type encoding, int *position=0)
TagLib::ID3v2::Frame::checkTextEncoding
String::Type checkTextEncoding(const StringList &fields, String::Type encoding) const
TagLib::ID3v2::Frame::setData
void setData(const ByteVector &data, unsigned int version=4)
TagLib::ID3v2::Frame::fieldData
ByteVector fieldData(const ByteVector &frameData) const
TagLib::ID3v2::Frame::urlPrefix
static const String urlPrefix
Definition: id3v2frame.h:161
TagLib::ID3v2::Frame::frameIDToKey
static String frameIDToKey(const ByteVector &)
TagLib::ID3v2::Frame::~Header
virtual ~Header()
TagLib::ID3v2::Frame::groupingIdentity
bool groupingIdentity() const
TagLib::ID3v2::Frame::Header
Header(const ByteVector &data, unsigned int version=4)
TagLib::ID3v2::Frame::Frame
Frame(Header *h)
TagLib::ID3v2::Frame::~Frame
virtual ~Frame()
TagLib::ID3v2::Frame::size
unsigned int size() const
TagLib::ID3v2::Frame::headerSize
static unsigned int headerSize()
TagLib::ID3v2::Frame::parseFields
virtual void parseFields(const ByteVector &data)=0
TagLib::ID3v2::Frame::render
ByteVector render() const
TagLib::ID3v2::Frame::asProperties
PropertyMap asProperties() const
TagLib::ID3v2::Frame::Frame
Frame(const ByteVector &data)
TagLib::ID3v2::Frame::fileAlterPreservation
bool fileAlterPreservation() const
TagLib::ID3v2::Frame::setHeader
void setHeader(Header *h, bool deleteCurrent=true)
TagLib::ID3v2::Frame::tagAlterPreservation
bool tagAlterPreservation() const
TagLib::ID3v2::Frame::header
Header * header() const
TagLib::ID3v2::Frame::setText
virtual void setText(const String &text)
TagLib::ID3v2::Frame::setFrameSize
void setFrameSize(unsigned int size)
TagLib::ID3v2::Frame::createTextualFrame
static Frame * createTextualFrame(const String &key, const StringList &values)
TagLib::ID3v2::Frame::txxxToKey
static String txxxToKey(const String &)
TagLib::ID3v2::Frame::setVersion
void setVersion(unsigned int version)
TagLib::ID3v2::Frame::setData
void setData(const ByteVector &data)
TagLib::ID3v2::Frame::headerSize
static unsigned int headerSize(unsigned int version)
TagLib::ID3v2::Frame::keyToFrameID
static ByteVector keyToFrameID(const String &)
TagLib::ID3v2::Frame::readOnly
bool readOnly() const
TagLib::ID3v2::Frame::compression
bool compression() const
TagLib::ID3v2::Frame::textDelimiter
static ByteVector textDelimiter(String::Type t)
TagLib::ID3v2::Frame::Header
TAGLIB_DEPRECATED Header(const ByteVector &data, bool synchSafeInts)
TagLib::ID3v2::Frame::size
static unsigned int size(unsigned int version)
TagLib::ID3v2::Frame::setData
TAGLIB_DEPRECATED void setData(const ByteVector &data, bool synchSafeInts)
TagLib::ID3v2::Frame::commentPrefix
static const String commentPrefix
Definition: id3v2frame.h:151
TagLib::ID3v2::Frame::checkEncoding
static String::Type checkEncoding(const StringList &fields, String::Type encoding, unsigned int version)
TagLib::ID3v2::Frame::instrumentPrefix
static const String instrumentPrefix
Definition: id3v2frame.h:146
TagLib::ID3v2::Frame::setFrameID
void setFrameID(const ByteVector &id)
TagLib::ID3v2::Frame::frameAlterPreservation
TAGLIB_DEPRECATED bool frameAlterPreservation() const
TagLib::ID3v2::Frame::keyToTXXX
static String keyToTXXX(const String &)
TagLib::ID3v2::Frame::version
unsigned int version() const
TagLib::ID3v2::Frame::frameID
ByteVector frameID() const
TagLib::ID3v2::Frame::renderFields
virtual ByteVector renderFields() const =0
TagLib::ID3v2::Frame::toString
virtual String toString() const =0
TagLib::ID3v2::Frame::frameSize
unsigned int frameSize() const
TagLib::ID3v2::Frame::splitProperties
static void splitProperties(const PropertyMap &original, PropertyMap &singleFrameProperties, PropertyMap &tiplProperties, PropertyMap &tmclProperties)
TagLib::ID3v2::Frame::setTagAlterPreservation
void setTagAlterPreservation(bool discard)
TagLib::ID3v2::Frame::size
static unsigned int size()
TagLib::ID3v2::Header
An implementation of ID3v2 headers.
Definition: id3v2header.h:49
TagLib::ID3v2::TableOfContentsFrame
An implementation of ID3v2 table of contents frames.
Definition: tableofcontentsframe.h:46
TagLib::ID3v2::Tag
The main class in the ID3v2 implementation.
Definition: id3v2tag.h:128
TagLib::PropertyMap
A map for format-independent <key,valuelist> tag representations.
Definition: tpropertymap.h:119
TagLib::StringList
A list of strings.
Definition: tstringlist.h:46
TagLib::String
A wide string class suitable for unicode.
Definition: tstring.h:85
TagLib::String::Type
Type
Definition: tstring.h:97
TagLib
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41
TAGLIB_DEPRECATED
#define TAGLIB_DEPRECATED
Definition: taglib.h:54
taglib_export.h
TAGLIB_EXPORT
#define TAGLIB_EXPORT
Definition: taglib_export.h:40
tbytevector.h
tstring.h