id3v2frame.h
Go to the documentation of this file.
/***************************************************************************
copyright : (C) 2002 - 2008 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#ifndef TAGLIB_ID3V2FRAME_H
#define TAGLIB_ID3V2FRAME_H
#include "tstring.h"
#include "tbytevector.h"
#include "taglib_export.h"
namespace TagLib {
class StringList;
class PropertyMap;
namespace ID3v2 {
class Tag;
class FrameFactory;
class TAGLIB_EXPORT Frame
{
friend class Tag;
public:
class Header;
virtual ~Frame();
Frame(const Frame &) = delete;
Frame &operator=(const Frame &) = delete;
ByteVector frameID() const;
unsigned int size() const;
unsigned int headerSize() const;
void setData(const ByteVector &data);
virtual void setText(const String &text);
virtual String toString() const = 0;
virtual StringList toStringList() const;
ByteVector render() const;
Header *header() const;
static ByteVector textDelimiter(String::Type t);
static ByteVector keyToFrameID(const String &);
static String frameIDToKey(const ByteVector &);
static const String instrumentPrefix;
static const String commentPrefix;
static const String lyricsPrefix;
static const String urlPrefix;
protected:
explicit Frame(const ByteVector &data);
Frame(Header *h);
void setHeader(Header *h, bool deleteCurrent = true);
void parse(const ByteVector &data);
virtual void parseFields(const ByteVector &data) = 0;
virtual ByteVector renderFields() const = 0;
ByteVector fieldData(const ByteVector &frameData) const;
String readStringField(const ByteVector &data, String::Type encoding,
int *position = nullptr);
String::Type checkTextEncoding(const StringList &fields,
String::Type encoding) const;
virtual PropertyMap asProperties() const;
static void splitProperties(const PropertyMap &original, PropertyMap &singleFrameProperties,
PropertyMap &tiplProperties, PropertyMap &tmclProperties);
private:
class FramePrivate;
friend class FramePrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<FramePrivate> d;
};
class TAGLIB_EXPORT Frame::Header
{
public:
explicit Header(const ByteVector &data, unsigned int version = 4);
virtual ~Header();
Header(const Header &) = delete;
Header &operator=(const Header &) = delete;
void setData(const ByteVector &data, unsigned int version = 4);
ByteVector frameID() const;
void setFrameID(const ByteVector &id);
unsigned int frameSize() const;
void setFrameSize(unsigned int size);
unsigned int version() const;
void setVersion(unsigned int version);
unsigned int size() const;
bool tagAlterPreservation() const;
void setTagAlterPreservation(bool preserve);
bool fileAlterPreservation() const;
bool readOnly() const;
bool groupingIdentity() const;
bool compression() const;
bool encryption() const;
bool unsynchronisation() const;
bool dataLengthIndicator() const;
ByteVector render() const;
private:
class HeaderPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
std::unique_ptr<HeaderPrivate> d;
};
} // namespace ID3v2
} // namespace TagLib
#endif
TagLib::ByteVector
A byte vector.
Definition tbytevector.h:46
TagLib::ID3v2::FrameFactory
A factory for creating ID3v2 frames during parsing.
Definition id3v2framefactory.h:68
TagLib::ID3v2::Frame::Header
ID3v2 frame header implementation.
Definition id3v2frame.h:293
TagLib::ID3v2::Frame::Header::setVersion
void setVersion(unsigned int version)
TagLib::ID3v2::Frame::Header::~Header
virtual ~Header()
TagLib::ID3v2::Frame::Header::encryption
bool encryption() const
TagLib::ID3v2::Frame::Header::unsynchronisation
bool unsynchronisation() const
TagLib::ID3v2::Frame::Header::fileAlterPreservation
bool fileAlterPreservation() const
TagLib::ID3v2::Frame::Header::Header
Header(const ByteVector &data, unsigned int version=4)
TagLib::ID3v2::Frame::Header::size
unsigned int size() const
TagLib::ID3v2::Frame::Header::dataLengthIndicator
bool dataLengthIndicator() const
TagLib::ID3v2::Frame::Header::setFrameSize
void setFrameSize(unsigned int size)
TagLib::ID3v2::Frame::Header::compression
bool compression() const
TagLib::ID3v2::Frame::Header::tagAlterPreservation
bool tagAlterPreservation() const
TagLib::ID3v2::Frame::Header::Header
Header(const Header &)=delete
TagLib::ID3v2::Frame::Header::readOnly
bool readOnly() const
TagLib::ID3v2::Frame::Header::render
ByteVector render() const
TagLib::ID3v2::Frame::Header::frameID
ByteVector frameID() const
TagLib::ID3v2::Frame::Header::operator=
Header & operator=(const Header &)=delete
TagLib::ID3v2::Frame::Header::version
unsigned int version() const
TagLib::ID3v2::Frame::Header::setData
void setData(const ByteVector &data, unsigned int version=4)
TagLib::ID3v2::Frame::Header::frameSize
unsigned int frameSize() const
TagLib::ID3v2::Frame::Header::setFrameID
void setFrameID(const ByteVector &id)
TagLib::ID3v2::Frame::Header::groupingIdentity
bool groupingIdentity() const
TagLib::ID3v2::Frame::Header::setTagAlterPreservation
void setTagAlterPreservation(bool preserve)
TagLib::ID3v2::Frame::parse
void parse(const ByteVector &data)
TagLib::ID3v2::Frame::readStringField
String readStringField(const ByteVector &data, String::Type encoding, int *position=nullptr)
TagLib::ID3v2::Frame::lyricsPrefix
static const String lyricsPrefix
Definition id3v2frame.h:167
TagLib::ID3v2::Frame::checkTextEncoding
String::Type checkTextEncoding(const StringList &fields, String::Type encoding) const
TagLib::ID3v2::Frame::fieldData
ByteVector fieldData(const ByteVector &frameData) const
TagLib::ID3v2::Frame::urlPrefix
static const String urlPrefix
Definition id3v2frame.h:172
TagLib::ID3v2::Frame::frameIDToKey
static String frameIDToKey(const ByteVector &)
TagLib::ID3v2::Frame::Frame
Frame(Header *h)
TagLib::ID3v2::Frame::~Frame
virtual ~Frame()
TagLib::ID3v2::Frame::size
unsigned int size() const
TagLib::ID3v2::Frame::parseFields
virtual void parseFields(const ByteVector &data)=0
TagLib::ID3v2::Frame::operator=
Frame & operator=(const Frame &)=delete
TagLib::ID3v2::Frame::render
ByteVector render() const
TagLib::ID3v2::Frame::Frame
Frame(const ByteVector &data)
TagLib::ID3v2::Frame::FramePrivate
friend class FramePrivate
Definition id3v2frame.h:271
TagLib::ID3v2::Frame::setHeader
void setHeader(Header *h, bool deleteCurrent=true)
TagLib::ID3v2::Frame::header
Header * header() const
TagLib::ID3v2::Frame::setText
virtual void setText(const String &text)
TagLib::ID3v2::Frame::asProperties
virtual PropertyMap asProperties() const
TagLib::ID3v2::Frame::toStringList
virtual StringList toStringList() const
TagLib::ID3v2::Frame::setData
void setData(const ByteVector &data)
TagLib::ID3v2::Frame::keyToFrameID
static ByteVector keyToFrameID(const String &)
TagLib::ID3v2::Frame::textDelimiter
static ByteVector textDelimiter(String::Type t)
TagLib::ID3v2::Frame::Frame
Frame(const Frame &)=delete
TagLib::ID3v2::Frame::commentPrefix
static const String commentPrefix
Definition id3v2frame.h:162
TagLib::ID3v2::Frame::headerSize
unsigned int headerSize() const
TagLib::ID3v2::Frame::instrumentPrefix
static const String instrumentPrefix
Definition id3v2frame.h:157
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::splitProperties
static void splitProperties(const PropertyMap &original, PropertyMap &singleFrameProperties, PropertyMap &tiplProperties, PropertyMap &tmclProperties)
TagLib::ID3v2::Frame::Tag
friend class Tag
Definition id3v2frame.h:58
TagLib::ID3v2::Tag
The main class in the ID3v2 implementation.
Definition id3v2tag.h:134
TagLib::PropertyMap
A map for format-independent <key,values> tag representations.
Definition tpropertymap.h:123
TagLib::StringList
A list of strings.
Definition tstringlist.h:44
TagLib::String
A wide string class suitable for unicode.
Definition tstring.h:83
TagLib::String::Type
Type
Definition tstring.h:96
TagLib::ID3v2
An ID3v2 implementation.
Definition flacfile.h:39
TagLib
A namespace for all TagLib related classes and functions.
Definition apefile.h:41
taglib_export.h
TAGLIB_EXPORT
#define TAGLIB_EXPORT
Definition taglib_export.h:40
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
#define TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE
Definition taglib_export.h:55
tbytevector.h
tstring.h