taglib: Make Frame::asProperties virtual
This commit is contained in:
parent
29e8316527
commit
4285f43316
|
@ -203,7 +203,7 @@ class TAGLIB_EXPORT ChapterFrame : public ID3v2::Frame {
|
|||
|
||||
String toString() const override;
|
||||
|
||||
PropertyMap asProperties() const;
|
||||
PropertyMap asProperties() const override;
|
||||
|
||||
/*!
|
||||
* CHAP frames each have a unique element ID. This searches for a CHAP frame with the element ID \a eID and returns a pointer to it.
|
||||
|
|
|
@ -140,7 +140,7 @@ class TAGLIB_EXPORT CommentsFrame : public Frame {
|
|||
* - otherwise, the key will be "COMMENT:<description>"
|
||||
* - The single value will be the frame's text().
|
||||
*/
|
||||
PropertyMap asProperties() const;
|
||||
PropertyMap asProperties() const override;
|
||||
|
||||
/*!
|
||||
* Comments each have a unique description.
|
||||
|
|
|
@ -202,7 +202,7 @@ class TAGLIB_EXPORT TableOfContentsFrame : public ID3v2::Frame {
|
|||
|
||||
String toString() const override;
|
||||
|
||||
PropertyMap asProperties() const;
|
||||
PropertyMap asProperties() const override;
|
||||
|
||||
/*!
|
||||
* CTOC frames each have a unique element ID.
|
||||
|
|
|
@ -185,7 +185,7 @@ class TAGLIB_EXPORT TextIdentificationFrame : public Frame {
|
|||
*/
|
||||
static const KeyConversionMap &involvedPeopleMap();
|
||||
|
||||
PropertyMap asProperties() const;
|
||||
PropertyMap asProperties() const override;
|
||||
|
||||
protected:
|
||||
// Reimplementations.
|
||||
|
@ -270,7 +270,7 @@ class TAGLIB_EXPORT UserTextIdentificationFrame : public TextIdentificationFrame
|
|||
* - The values will be copies of the fieldList().
|
||||
* - If the description() appears as value in fieldList(), it will be omitted in the value list, in order to be compatible with TagLib which copies the description() into the fieldList().
|
||||
*/
|
||||
PropertyMap asProperties() const;
|
||||
PropertyMap asProperties() const override;
|
||||
|
||||
/*!
|
||||
* Searches for the user defined text frame with the description \a description in \a tag.
|
||||
|
|
|
@ -89,7 +89,7 @@ class TAGLIB_EXPORT UniqueFileIdentifierFrame : public ID3v2::Frame {
|
|||
|
||||
String toString() const override;
|
||||
|
||||
PropertyMap asProperties() const;
|
||||
PropertyMap asProperties() const override;
|
||||
|
||||
/*!
|
||||
* UFID frames each have a unique owner. This searches for a UFID frame with the owner \a o and returns a pointer to it.
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include "unknownframe.h"
|
||||
#include "tpropertymap.h"
|
||||
|
||||
using namespace Strawberry_TagLib::TagLib;
|
||||
using namespace ID3v2;
|
||||
|
@ -74,3 +75,11 @@ UnknownFrame::UnknownFrame(const ByteVector &data, Header *h) : Frame(h),
|
|||
d(new UnknownFramePrivate()) {
|
||||
parseFields(fieldData(data));
|
||||
}
|
||||
|
||||
PropertyMap UnknownFrame::asProperties() const {
|
||||
|
||||
PropertyMap m;
|
||||
m.unsupportedData().append("UNKNOWN/" + frameID());
|
||||
return m;
|
||||
|
||||
}
|
||||
|
|
|
@ -59,6 +59,8 @@ class TAGLIB_EXPORT UnknownFrame : public Frame {
|
|||
*/
|
||||
ByteVector data() const;
|
||||
|
||||
PropertyMap asProperties() const override;
|
||||
|
||||
protected:
|
||||
void parseFields(const ByteVector &data) override;
|
||||
ByteVector renderFields() const override;
|
||||
|
|
|
@ -140,7 +140,7 @@ class TAGLIB_EXPORT UnsynchronizedLyricsFrame : public Frame {
|
|||
* - The single value will be the frame's text().
|
||||
* Note that currently the language() field is not supported by the PropertyMap interface.
|
||||
*/
|
||||
PropertyMap asProperties() const;
|
||||
PropertyMap asProperties() const override;
|
||||
|
||||
/*!
|
||||
* LyricsFrames each have a unique description.
|
||||
|
|
|
@ -68,7 +68,7 @@ class TAGLIB_EXPORT UrlLinkFrame : public Frame {
|
|||
|
||||
void setText(const String &s) override;
|
||||
String toString() const override;
|
||||
PropertyMap asProperties() const;
|
||||
PropertyMap asProperties() const override;
|
||||
|
||||
protected:
|
||||
void parseFields(const ByteVector &data) override;
|
||||
|
@ -155,7 +155,7 @@ class TAGLIB_EXPORT UserUrlLinkFrame : public UrlLinkFrame {
|
|||
* characters), the returned map will contain an entry "WXXX/<description>"
|
||||
* in its unsupportedData() list.
|
||||
*/
|
||||
PropertyMap asProperties() const;
|
||||
PropertyMap asProperties() const override;
|
||||
|
||||
/*!
|
||||
* Searches for the user defined url frame with the description \a description in \a tag.
|
||||
|
|
|
@ -447,30 +447,8 @@ String Frame::keyToTXXX(const String &s) {
|
|||
|
||||
PropertyMap Frame::asProperties() const {
|
||||
|
||||
if (dynamic_cast<const UnknownFrame *>(this)) {
|
||||
PropertyMap m;
|
||||
m.unsupportedData().append("UNKNOWN/" + frameID());
|
||||
return m;
|
||||
}
|
||||
const ByteVector &id = frameID();
|
||||
// workaround until this function is virtual
|
||||
if (id == "TXXX")
|
||||
return dynamic_cast<const UserTextIdentificationFrame *>(this)->asProperties();
|
||||
// Apple proprietary WFED (Podcast URL), MVNM (Movement Name), MVIN (Movement Number), GRP1 (Grouping) are in fact text frames.
|
||||
else if (id[0] == 'T' || id == "WFED" || id == "MVNM" || id == "MVIN" || id == "GRP1")
|
||||
return dynamic_cast<const TextIdentificationFrame *>(this)->asProperties();
|
||||
else if (id == "WXXX")
|
||||
return dynamic_cast<const UserUrlLinkFrame *>(this)->asProperties();
|
||||
else if (id[0] == 'W')
|
||||
return dynamic_cast<const UrlLinkFrame *>(this)->asProperties();
|
||||
else if (id == "COMM")
|
||||
return dynamic_cast<const CommentsFrame *>(this)->asProperties();
|
||||
else if (id == "USLT")
|
||||
return dynamic_cast<const UnsynchronizedLyricsFrame *>(this)->asProperties();
|
||||
else if (id == "UFID")
|
||||
return dynamic_cast<const UniqueFileIdentifierFrame *>(this)->asProperties();
|
||||
PropertyMap m;
|
||||
m.unsupportedData().append(id);
|
||||
m.unsupportedData().append(frameID());
|
||||
return m;
|
||||
|
||||
}
|
||||
|
|
|
@ -233,9 +233,8 @@ class TAGLIB_EXPORT Frame {
|
|||
/*!
|
||||
* Parses the contents of this frame as PropertyMap.
|
||||
* If that fails, the returned PropertyMap will be empty, and its unsupportedData() will contain this frame's ID.
|
||||
* BIC: Will be a virtual function in future releases.
|
||||
*/
|
||||
PropertyMap asProperties() const;
|
||||
virtual PropertyMap asProperties() const;
|
||||
|
||||
/*!
|
||||
* Returns an appropriate ID3 frame ID for the given free-form tag key. This method
|
||||
|
|
Loading…
Reference in New Issue