2018-05-10 15:29:28 +02:00
|
|
|
/***************************************************************************
|
|
|
|
copyright : (C) 2002 - 2008 by Scott Wheeler
|
|
|
|
email : wheeler@kde.org
|
|
|
|
|
|
|
|
copyright : (C) 2006 by Urs Fleisch
|
|
|
|
email : ufleisch@users.sourceforge.net
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* 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_URLLINKFRAME_H
|
|
|
|
#define TAGLIB_URLLINKFRAME_H
|
|
|
|
|
|
|
|
#include "id3v2frame.h"
|
|
|
|
|
2019-04-26 01:12:42 +02:00
|
|
|
namespace Strawberry_TagLib {
|
|
|
|
namespace TagLib {
|
2020-06-13 19:02:42 +02:00
|
|
|
namespace ID3v2 {
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
//! ID3v2 URL frame
|
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* An implementation of ID3v2 URL link frames.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
class TAGLIB_EXPORT UrlLinkFrame : public Frame {
|
|
|
|
friend class FrameFactory;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
public:
|
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* This is a dual purpose constructor. \a data can either be binary data
|
|
|
|
* that should be parsed or (at a minimum) the frame ID.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
explicit UrlLinkFrame(const ByteVector &data);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Destroys this UrlLinkFrame instance.
|
|
|
|
*/
|
2020-06-26 23:30:30 +02:00
|
|
|
~UrlLinkFrame() override;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Returns the URL.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
virtual String url() const;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Sets the URL to \a s.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
virtual void setUrl(const String &s);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
// Reimplementations.
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
void setText(const String &s) override;
|
|
|
|
String toString() const override;
|
2020-06-13 19:02:42 +02:00
|
|
|
PropertyMap asProperties() const;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
protected:
|
2020-06-26 23:30:30 +02:00
|
|
|
void parseFields(const ByteVector &data) override;
|
|
|
|
ByteVector renderFields() const override;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* The constructor used by the FrameFactory.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
UrlLinkFrame(const ByteVector &data, Header *h);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
private:
|
|
|
|
UrlLinkFrame(const UrlLinkFrame &);
|
|
|
|
UrlLinkFrame &operator=(const UrlLinkFrame &);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
class UrlLinkFramePrivate;
|
|
|
|
UrlLinkFramePrivate *d;
|
|
|
|
};
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
//! ID3v2 User defined URL frame
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* This is a specialization of URL link frames that allows for user defined entries.
|
|
|
|
* Each entry has a description in addition to the normal list of fields that a URL link frame has.
|
|
|
|
*
|
|
|
|
* This description identifies the frame and must be unique.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
class TAGLIB_EXPORT UserUrlLinkFrame : public UrlLinkFrame {
|
|
|
|
friend class FrameFactory;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
public:
|
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Constructs an empty user defined URL link frame.
|
|
|
|
* For this to be a useful frame both a description and text must be set.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
explicit UserUrlLinkFrame(String::Type encoding = String::Latin1);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* This is a dual purpose constructor.
|
|
|
|
* \a data can either be binary data that should be parsed or (at a minimum) the frame ID.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
explicit UserUrlLinkFrame(const ByteVector &data);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Destroys this UserUrlLinkFrame instance.
|
|
|
|
*/
|
2020-06-26 23:30:30 +02:00
|
|
|
~UserUrlLinkFrame() override;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
// Reimplementations.
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
String toString() const override;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Returns the text encoding that will be used in rendering this frame.
|
|
|
|
* This defaults to the type that was either specified in the constructor or read from the frame when parsed.
|
|
|
|
*
|
|
|
|
* \see setTextEncoding()
|
|
|
|
* \see render()
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
String::Type textEncoding() const;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Sets the text encoding to be used when rendering this frame to \a encoding.
|
|
|
|
*
|
|
|
|
* \see textEncoding()
|
|
|
|
* \see render()
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
void setTextEncoding(String::Type encoding);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Returns the description for this frame.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
String description() const;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Sets the description of the frame to \a s. \a s must be unique.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
void setDescription(const String &s);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Parses the UserUrlLinkFrame as PropertyMap. The description() is taken as key,
|
|
|
|
* and the URL as single value.
|
|
|
|
* - if description() is empty, the key will be "URL".
|
|
|
|
* - otherwise, if description() is not a valid key (e.g. containing non-ASCII
|
|
|
|
* characters), the returned map will contain an entry "WXXX/<description>"
|
|
|
|
* in its unsupportedData() list.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
PropertyMap asProperties() const;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* Searches for the user defined url frame with the description \a description in \a tag.
|
|
|
|
* This returns null if no matching frames were found.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
static UserUrlLinkFrame *find(Tag *tag, const String &description);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
protected:
|
2020-06-26 23:30:30 +02:00
|
|
|
void parseFields(const ByteVector &data) override;
|
|
|
|
ByteVector renderFields() const override;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-14 17:01:05 +02:00
|
|
|
* The constructor used by the FrameFactory.
|
|
|
|
*/
|
2020-06-13 19:02:42 +02:00
|
|
|
UserUrlLinkFrame(const ByteVector &data, Header *h);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
private:
|
2020-06-26 23:30:30 +02:00
|
|
|
UserUrlLinkFrame(const UserUrlLinkFrame&);
|
2020-06-22 02:32:37 +02:00
|
|
|
UserUrlLinkFrame &operator=(const UserUrlLinkFrame&);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
class UserUrlLinkFramePrivate;
|
|
|
|
UserUrlLinkFramePrivate *d;
|
|
|
|
};
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
} // namespace ID3v2
|
|
|
|
} // namespace TagLib
|
|
|
|
} // namespace Strawberry_TagLib
|
2020-06-14 17:01:05 +02:00
|
|
|
|
2018-05-10 15:29:28 +02:00
|
|
|
#endif
|