Add TagUnion::removeUnsupportedProperties, further reducing SLOCs. :-)

This commit is contained in:
Michael Helmling 2012-12-27 13:32:01 +01:00
parent fa38c805f5
commit 90fd336a22
14 changed files with 11 additions and 82 deletions

View File

@ -112,14 +112,6 @@ TagLib::Tag *APE::File::tag() const
return &d->tag;
}
void APE::File::removeUnsupportedProperties(const StringList &properties)
{
if(d->hasAPE)
d->tag.access<APE::Tag>(ApeAPEIndex, false)->removeUnsupportedProperties(properties);
if(d->hasID3v1)
d->tag.access<ID3v1::Tag>(ApeID3v1Index, false)->removeUnsupportedProperties(properties);
}
PropertyMap APE::File::setProperties(const PropertyMap &properties)
{
if(d->hasID3v1)

View File

@ -113,12 +113,6 @@ namespace TagLib {
*/
virtual TagLib::Tag *tag() const;
/*!
* Removes unsupported properties. Forwards to the actual Tag's
* removeUnsupportedProperties() function.
*/
void removeUnsupportedProperties(const StringList &properties);
/*!
* Implements the unified property interface -- import function.
* Creates an APEv2 tag if necessary. A pontentially existing ID3v1

View File

@ -138,16 +138,6 @@ TagLib::Tag *FLAC::File::tag() const
return &d->tag;
}
void FLAC::File::removeUnsupportedProperties(const StringList &unsupported)
{
if(d->hasXiphComment)
d->tag.access<Ogg::XiphComment>(FlacXiphIndex, false)->removeUnsupportedProperties(unsupported);
if(d->hasID3v2)
d->tag.access<ID3v2::Tag>(FlacID3v2Index, false)->removeUnsupportedProperties(unsupported);
if(d->hasID3v1)
d->tag.access<ID3v1::Tag>(FlacID3v1Index, false)->removeUnsupportedProperties(unsupported);
}
PropertyMap FLAC::File::setProperties(const PropertyMap &properties)
{
return d->tag.access<Ogg::XiphComment>(FlacXiphIndex, true)->setProperties(properties);

View File

@ -110,8 +110,6 @@ namespace TagLib {
*/
virtual TagLib::Tag *tag() const;
void removeUnsupportedProperties(const StringList &);
/*!
* Implements the unified property interface -- import function.
* This always creates a Xiph comment, if none exists. The return value

View File

@ -116,14 +116,6 @@ TagLib::Tag *MPC::File::tag() const
return &d->tag;
}
void MPC::File::removeUnsupportedProperties(const StringList &properties)
{
if(d->hasAPE)
d->tag.access<APE::Tag>(MPCAPEIndex, false)->removeUnsupportedProperties(properties);
if(d->hasID3v1)
d->tag.access<ID3v1::Tag>(MPCID3v1Index, false)->removeUnsupportedProperties(properties);
}
PropertyMap MPC::File::setProperties(const PropertyMap &properties)
{
if(d->hasID3v1)

View File

@ -113,8 +113,6 @@ namespace TagLib {
*/
virtual TagLib::Tag *tag() const;
void removeUnsupportedProperties(const StringList &properties);
/*!
* Implements the unified property interface -- import function.
* Affects only the APEv2 tag which will be created if necessary.

View File

@ -134,16 +134,6 @@ TagLib::Tag *MPEG::File::tag() const
return &d->tag;
}
void MPEG::File::removeUnsupportedProperties(const StringList &properties)
{
if(d->hasID3v2)
d->tag.access<ID3v2::Tag>(ID3v2Index, false)->removeUnsupportedProperties(properties);
else if(d->hasAPE)
d->tag.access<APE::Tag>(APEIndex, false)->removeUnsupportedProperties(properties);
else if(d->hasID3v1)
d->tag.access<ID3v1::Tag>(ID3v1Index, false)->removeUnsupportedProperties(properties);
}
PropertyMap MPEG::File::setProperties(const PropertyMap &properties)
{
if(d->hasID3v1)

View File

@ -132,8 +132,6 @@ namespace TagLib {
*/
virtual Tag *tag() const;
void removeUnsupportedProperties(const StringList &properties);
/*!
* Implements the writing part of the unified tag dictionary interface.
* In order to avoid problems with deprecated tag formats, this method

View File

@ -113,6 +113,15 @@ PropertyMap TagUnion::properties() const
return PropertyMap();
}
void TagUnion::removeUnsupportedProperties(const StringList &unsupported)
{
for(uint i = 0; i < 3; ++i) {
if(tag(i))
tag(i)->removeUnsupportedProperties(unsupported);
}
}
String TagUnion::title() const
{
stringUnion(title);

View File

@ -58,6 +58,8 @@ namespace TagLib {
virtual PropertyMap properties() const;
virtual void removeUnsupportedProperties(const StringList& properties);
virtual String title() const;
virtual String artist() const;
virtual String album() const;

View File

@ -128,17 +128,6 @@ TagLib::Tag *TrueAudio::File::tag() const
return &d->tag;
}
PropertyMap TrueAudio::File::properties() const
{
// once Tag::properties() is virtual, this case distinction could actually be done
// within TagUnion.
if(d->hasID3v2)
return d->tag.access<ID3v2::Tag>(TrueAudioID3v2Index, false)->properties();
if(d->hasID3v1)
return d->tag.access<ID3v1::Tag>(TrueAudioID3v1Index, false)->properties();
return PropertyMap();
}
PropertyMap TrueAudio::File::setProperties(const PropertyMap &properties)
{
if(d->hasID3v1)

View File

@ -130,13 +130,6 @@ namespace TagLib {
*/
virtual TagLib::Tag *tag() const;
/*!
* Implements the unified property interface -- export function.
* If the file contains both ID3v1 and v2 tags, only ID3v2 will be
* converted to the PropertyMap.
*/
PropertyMap properties() const;
/*!
* Implements the unified property interface -- import function.
* Creates in ID3v2 tag if necessary. If an ID3v1 tag exists, it will

View File

@ -108,15 +108,6 @@ TagLib::Tag *WavPack::File::tag() const
return &d->tag;
}
PropertyMap WavPack::File::properties() const
{
if(d->hasAPE)
return d->tag.access<APE::Tag>(WavAPEIndex, false)->properties();
if(d->hasID3v1)
return d->tag.access<ID3v1::Tag>(WavID3v1Index, false)->properties();
return PropertyMap();
}
PropertyMap WavPack::File::setProperties(const PropertyMap &properties)
{
if(d->hasID3v1)

View File

@ -109,13 +109,6 @@ namespace TagLib {
*/
virtual TagLib::Tag *tag() const;
/*!
* Implements the unified property interface -- export function.
* If the file contains both an APE and an ID3v1 tag, only APE
* will be converted to the PropertyMap.
*/
PropertyMap properties() const;
/*!
* Implements the unified property interface -- import function.
* Creates an APE tag if it does not exists and calls setProperties() on