mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Apply smart pointers to RIFF related classes.
This commit is contained in:
parent
4dcdaaf92a
commit
c30bae9b00
@ -29,6 +29,7 @@
|
||||
#include <tstringlist.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <tagutils.h>
|
||||
#include <tsmartptr.h>
|
||||
|
||||
#include "aifffile.h"
|
||||
|
||||
@ -38,18 +39,10 @@ class RIFF::AIFF::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate() :
|
||||
properties(0),
|
||||
tag(0),
|
||||
hasID3v2(false) {}
|
||||
|
||||
~FilePrivate()
|
||||
{
|
||||
delete properties;
|
||||
delete tag;
|
||||
}
|
||||
|
||||
AudioProperties *properties;
|
||||
ID3v2::Tag *tag;
|
||||
SCOPED_PTR<AudioProperties> properties;
|
||||
SCOPED_PTR<ID3v2::Tag> tag;
|
||||
|
||||
bool hasID3v2;
|
||||
};
|
||||
@ -93,12 +86,12 @@ RIFF::AIFF::File::~File()
|
||||
|
||||
ID3v2::Tag *RIFF::AIFF::File::tag() const
|
||||
{
|
||||
return d->tag;
|
||||
return d->tag.get();
|
||||
}
|
||||
|
||||
RIFF::AIFF::AudioProperties *RIFF::AIFF::File::audioProperties() const
|
||||
{
|
||||
return d->properties;
|
||||
return d->properties.get();
|
||||
}
|
||||
|
||||
bool RIFF::AIFF::File::save()
|
||||
@ -142,7 +135,7 @@ void RIFF::AIFF::File::read(bool readProperties)
|
||||
const ByteVector name = chunkName(i);
|
||||
if(name == "ID3 " || name == "id3 ") {
|
||||
if(!d->tag) {
|
||||
d->tag = new ID3v2::Tag(this, chunkOffset(i));
|
||||
d->tag.reset(new ID3v2::Tag(this, chunkOffset(i)));
|
||||
d->hasID3v2 = true;
|
||||
}
|
||||
else {
|
||||
@ -152,8 +145,8 @@ void RIFF::AIFF::File::read(bool readProperties)
|
||||
}
|
||||
|
||||
if(!d->tag)
|
||||
d->tag = new ID3v2::Tag();
|
||||
d->tag.reset(new ID3v2::Tag());
|
||||
|
||||
if(readProperties)
|
||||
d->properties = new AudioProperties(this);
|
||||
d->properties.reset(new AudioProperties(this));
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <tstringlist.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <tagutils.h>
|
||||
#include <tsmartptr.h>
|
||||
|
||||
#include "wavfile.h"
|
||||
#include "id3v2tag.h"
|
||||
@ -45,16 +46,10 @@ class RIFF::WAV::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate() :
|
||||
properties(0),
|
||||
hasID3v2(false),
|
||||
hasInfo(false) {}
|
||||
|
||||
~FilePrivate()
|
||||
{
|
||||
delete properties;
|
||||
}
|
||||
|
||||
AudioProperties *properties;
|
||||
SCOPED_PTR<AudioProperties> properties;
|
||||
DoubleTagUnion tag;
|
||||
|
||||
bool hasID3v2;
|
||||
@ -132,7 +127,7 @@ PropertyMap RIFF::WAV::File::setProperties(const PropertyMap &properties)
|
||||
|
||||
RIFF::WAV::AudioProperties *RIFF::WAV::File::audioProperties() const
|
||||
{
|
||||
return d->properties;
|
||||
return d->properties.get();
|
||||
}
|
||||
|
||||
bool RIFF::WAV::File::save()
|
||||
@ -224,7 +219,7 @@ void RIFF::WAV::File::read(bool readProperties)
|
||||
d->tag.set(InfoIndex, new RIFF::Info::Tag());
|
||||
|
||||
if(readProperties)
|
||||
d->properties = new AudioProperties(this);
|
||||
d->properties.reset(new AudioProperties(this));
|
||||
}
|
||||
|
||||
void RIFF::WAV::File::removeTagChunks(TagTypes tags)
|
||||
|
Loading…
Reference in New Issue
Block a user