Use unique_ptr for d-pointers (#1095)

* clang-tidy: make deleted members public

One oversight of modernize-use-equals-delete is that the C++11 way of
doing this is to make it public, which makes the warning still trigger.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* clang-tidy: add missing deleted functions

Found with cppcoreguidelines-special-member-functions

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* unique_ptr conversions

unique_ptr is a safer and cleaner way to handle d pointers.

Also added missing = default.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-08-07 13:08:40 -07:00 committed by GitHub
parent 843a8aac80
commit 185bb7042e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
183 changed files with 836 additions and 835 deletions

View File

@ -70,6 +70,9 @@ public:
delete properties;
}
FilePrivate(const FilePrivate &) = delete;
FilePrivate &operator=(const FilePrivate &) = delete;
offset_t APELocation;
long APESize;
@ -102,7 +105,7 @@ bool APE::File::isSupported(IOStream *stream)
APE::File::File(FileName file, bool readProperties, Properties::ReadStyle) :
TagLib::File(file),
d(new FilePrivate())
d(std::make_unique<FilePrivate>())
{
if(isOpen())
read(readProperties);
@ -110,16 +113,13 @@ APE::File::File(FileName file, bool readProperties, Properties::ReadStyle) :
APE::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) :
TagLib::File(stream),
d(new FilePrivate())
d(std::make_unique<FilePrivate>())
{
if(isOpen())
read(readProperties);
}
APE::File::~File()
{
delete d;
}
APE::File::~File() = default;
TagLib::Tag *APE::File::tag() const
{

View File

@ -109,6 +109,9 @@ namespace TagLib {
*/
~File() override;
File(const File &) = delete;
File &operator=(const File &) = delete;
/*!
* Returns the Tag for this file. This will be an APE tag, an ID3v1 tag
* or a combination of the two.
@ -221,13 +224,10 @@ namespace TagLib {
static bool isSupported(IOStream *stream);
private:
File(const File &) = delete;
File &operator=(const File &) = delete;
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
std::unique_ptr<FilePrivate> d;
};
} // namespace APE
} // namespace TagLib

View File

@ -76,20 +76,17 @@ ByteVector APE::Footer::fileIdentifier()
////////////////////////////////////////////////////////////////////////////////
APE::Footer::Footer() :
d(new FooterPrivate())
d(std::make_unique<FooterPrivate>())
{
}
APE::Footer::Footer(const ByteVector &data) :
d(new FooterPrivate())
d(std::make_unique<FooterPrivate>())
{
parse(data);
}
APE::Footer::~Footer()
{
delete d;
}
APE::Footer::~Footer() = default;
unsigned int APE::Footer::version() const
{

View File

@ -61,6 +61,9 @@ namespace TagLib {
*/
virtual ~Footer();
Footer(const Footer &) = delete;
Footer &operator=(const Footer &) = delete;
/*!
* Returns the version number. (Note: This is the 1000 or 2000.)
*/
@ -160,11 +163,8 @@ namespace TagLib {
ByteVector render(bool isHeader) const;
private:
Footer(const Footer &) = delete;
Footer &operator=(const Footer &) = delete;
class FooterPrivate;
FooterPrivate *d;
std::unique_ptr<FooterPrivate> d;
};
} // namespace APE

View File

@ -50,19 +50,19 @@ public:
////////////////////////////////////////////////////////////////////////////////
APE::Item::Item() :
d(new ItemPrivate())
d(std::make_unique<ItemPrivate>())
{
}
APE::Item::Item(const String &key, const StringList &values) :
d(new ItemPrivate())
d(std::make_unique<ItemPrivate>())
{
d->key = key;
d->text = values;
}
APE::Item::Item(const String &key, const ByteVector &value, bool binary) :
d(new ItemPrivate())
d(std::make_unique<ItemPrivate>())
{
d->key = key;
if(binary) {
@ -75,14 +75,11 @@ APE::Item::Item(const String &key, const ByteVector &value, bool binary) :
}
APE::Item::Item(const Item &item) :
d(new ItemPrivate(*item.d))
d(std::make_unique<ItemPrivate>(*item.d))
{
}
APE::Item::~Item()
{
delete d;
}
APE::Item::~Item() = default;
Item &APE::Item::operator=(const Item &item)
{

View File

@ -205,7 +205,7 @@ namespace TagLib {
private:
class ItemPrivate;
ItemPrivate *d;
std::unique_ptr<ItemPrivate> d;
};
} // namespace APE
} // namespace TagLib

View File

@ -65,15 +65,12 @@ public:
APE::Properties::Properties(File *file, offset_t streamLength, ReadStyle style) :
AudioProperties(style),
d(new PropertiesPrivate())
d(std::make_unique<PropertiesPrivate>())
{
read(file, streamLength);
}
APE::Properties::~Properties()
{
delete d;
}
APE::Properties::~Properties() = default;
int APE::Properties::lengthInMilliseconds() const
{

View File

@ -61,6 +61,9 @@ namespace TagLib {
*/
~Properties() override;
Properties(const Properties &) = delete;
Properties &operator=(const Properties &) = delete;
/*!
* Returns the length of the file in milliseconds.
*
@ -99,16 +102,13 @@ namespace TagLib {
int version() const;
private:
Properties(const Properties &) = delete;
Properties &operator=(const Properties &) = delete;
void read(File *file, offset_t streamLength);
void analyzeCurrent(File *file);
void analyzeOld(File *file);
class PropertiesPrivate;
PropertiesPrivate *d;
std::unique_ptr<PropertiesPrivate> d;
};
} // namespace APE
} // namespace TagLib

View File

@ -94,12 +94,12 @@ public:
////////////////////////////////////////////////////////////////////////////////
APE::Tag::Tag() :
d(new TagPrivate())
d(std::make_unique<TagPrivate>())
{
}
APE::Tag::Tag(TagLib::File *file, offset_t footerLocation) :
d(new TagPrivate())
d(std::make_unique<TagPrivate>())
{
d->file = file;
d->footerLocation = footerLocation;
@ -107,10 +107,7 @@ APE::Tag::Tag(TagLib::File *file, offset_t footerLocation) :
read();
}
APE::Tag::~Tag()
{
delete d;
}
APE::Tag::~Tag() = default;
ByteVector APE::Tag::fileIdentifier()
{

View File

@ -73,6 +73,9 @@ namespace TagLib {
*/
~Tag() override;
Tag(const Tag &) = delete;
Tag &operator=(const Tag &) = delete;
/*!
* Renders the in memory values to a ByteVector suitable for writing to
* the file.
@ -196,11 +199,8 @@ namespace TagLib {
void parse(const ByteVector &data);
private:
Tag(const Tag &) = delete;
Tag &operator=(const Tag &) = delete;
class TagPrivate;
TagPrivate *d;
std::unique_ptr<TagPrivate> d;
};
} // namespace APE
} // namespace TagLib

View File

@ -70,6 +70,9 @@ public:
delete properties;
}
FilePrivate(const FilePrivate &) = delete;
FilePrivate &operator=(const FilePrivate &) = delete;
unsigned long long headerSize;
ASF::Tag *tag;
@ -490,7 +493,7 @@ bool ASF::File::isSupported(IOStream *stream)
ASF::File::File(FileName file, bool, Properties::ReadStyle) :
TagLib::File(file),
d(new FilePrivate())
d(std::make_unique<FilePrivate>())
{
if(isOpen())
read();
@ -498,16 +501,13 @@ ASF::File::File(FileName file, bool, Properties::ReadStyle) :
ASF::File::File(IOStream *stream, bool, Properties::ReadStyle) :
TagLib::File(stream),
d(new FilePrivate())
d(std::make_unique<FilePrivate>())
{
if(isOpen())
read();
}
ASF::File::~File()
{
delete d;
}
ASF::File::~File() = default;
ASF::Tag *ASF::File::tag() const
{

View File

@ -73,6 +73,9 @@ namespace TagLib {
*/
~File() override;
File(const File &) = delete;
File &operator=(const File &) = delete;
/*!
* Returns a pointer to the ASF tag of the file.
*
@ -126,7 +129,7 @@ namespace TagLib {
void read();
class FilePrivate;
FilePrivate *d;
std::unique_ptr<FilePrivate> d;
};
} // namespace ASF
} // namespace TagLib

View File

@ -58,14 +58,11 @@ public:
ASF::Properties::Properties() :
AudioProperties(AudioProperties::Average),
d(new PropertiesPrivate())
d(std::make_unique<PropertiesPrivate>())
{
}
ASF::Properties::~Properties()
{
delete d;
}
ASF::Properties::~Properties() = default;
int ASF::Properties::lengthInMilliseconds() const
{

View File

@ -78,6 +78,9 @@ namespace TagLib {
*/
~Properties() override;
Properties(const Properties &) = delete;
Properties &operator=(const Properties &) = delete;
/*!
* Returns the length of the file in milliseconds.
*
@ -151,7 +154,7 @@ namespace TagLib {
private:
class PropertiesPrivate;
PropertiesPrivate *d;
std::unique_ptr<PropertiesPrivate> d;
};
} // namespace ASF
} // namespace TagLib

View File

@ -42,14 +42,11 @@ public:
};
ASF::Tag::Tag() :
d(new TagPrivate())
d(std::make_unique<TagPrivate>())
{
}
ASF::Tag::~Tag()
{
delete d;
}
ASF::Tag::~Tag() = default;
String ASF::Tag::title() const
{

View File

@ -49,6 +49,9 @@ namespace TagLib {
~Tag() override;
Tag(const Tag &) = delete;
Tag &operator=(const Tag &) = delete;
/*!
* Returns the track name.
*/
@ -204,7 +207,7 @@ namespace TagLib {
private:
class TagPrivate;
TagPrivate *d;
std::unique_ptr<TagPrivate> d;
};
} // namespace ASF
} // namespace TagLib

View File

@ -29,7 +29,6 @@ using namespace TagLib;
class AudioProperties::AudioPropertiesPrivate
{
};
////////////////////////////////////////////////////////////////////////////////
@ -67,8 +66,6 @@ int AudioProperties::sampleRate() const
// protected methods
////////////////////////////////////////////////////////////////////////////////
AudioProperties::AudioProperties(ReadStyle) :
d(nullptr)
AudioProperties::AudioProperties(ReadStyle)
{
}

View File

@ -28,6 +28,8 @@
#include "taglib_export.h"
#include <memory>
namespace TagLib {
//! A simple, abstract interface to common audio properties
@ -64,6 +66,9 @@ namespace TagLib {
*/
virtual ~AudioProperties();
AudioProperties(const AudioProperties &) = delete;
AudioProperties &operator=(const AudioProperties &) = delete;
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
@ -118,11 +123,8 @@ namespace TagLib {
AudioProperties(ReadStyle style);
private:
AudioProperties(const AudioProperties &) = delete;
AudioProperties &operator=(const AudioProperties &) = delete;
class AudioPropertiesPrivate;
AudioPropertiesPrivate *d;
std::unique_ptr<AudioPropertiesPrivate> d;
};
} // namespace TagLib

View File

@ -57,6 +57,14 @@
using namespace TagLib;
class FileRef::FileTypeResolver::FileTypeResolverPrivate
{
};
class FileRef::StreamTypeResolver::StreamTypeResolverPrivate
{
};
namespace
{
typedef List<const FileRef::FileTypeResolver *> ResolverList;
@ -304,6 +312,9 @@ public:
delete stream;
}
FileRefPrivate(const FileRefPrivate &) = delete;
FileRefPrivate &operator=(const FileRefPrivate &) = delete;
File *file;
IOStream *stream;
};
@ -509,6 +520,8 @@ void FileRef::parse(IOStream *stream, bool readAudioProperties,
d->file = detectByContent(stream, readAudioProperties, audioPropertiesStyle);
}
FileRef::FileTypeResolver::FileTypeResolver() = default;
FileRef::FileTypeResolver::~FileTypeResolver() = default;
FileRef::StreamTypeResolver::StreamTypeResolver() = default;
FileRef::StreamTypeResolver::~StreamTypeResolver() = default;

View File

@ -92,11 +92,15 @@ namespace TagLib {
class TAGLIB_EXPORT FileTypeResolver
{
public:
FileTypeResolver();
/*!
* Destroys this FileTypeResolver instance.
*/
virtual ~FileTypeResolver() = 0;
FileTypeResolver(const FileTypeResolver &) = delete;
FileTypeResolver &operator=(const FileTypeResolver &) = delete;
/*!
* This method must be overridden to provide an additional file type
* resolver. If the resolver is able to determine the file type it should
@ -112,24 +116,28 @@ namespace TagLib {
audioPropertiesStyle = AudioProperties::Average) const = 0;
private:
class FileTypeResolverPrivate;
FileTypeResolverPrivate *d;
std::unique_ptr<FileTypeResolverPrivate> d;
};
class TAGLIB_EXPORT StreamTypeResolver : public FileTypeResolver
{
public:
StreamTypeResolver();
/*!
* Destroys this StreamTypeResolver instance.
*/
~StreamTypeResolver() override = 0;
StreamTypeResolver(const StreamTypeResolver &) = delete;
StreamTypeResolver &operator=(const StreamTypeResolver &) = delete;
virtual File *createFileFromStream(IOStream *stream,
bool readAudioProperties = true,
AudioProperties::ReadStyle
audioPropertiesStyle = AudioProperties::Average) const = 0;
private:
class StreamTypeResolverPrivate;
StreamTypeResolverPrivate *d;
std::unique_ptr<StreamTypeResolverPrivate> d;
};
/*!

View File

@ -79,6 +79,9 @@ public:
delete properties;
}
FilePrivate(const FilePrivate &) = delete;
FilePrivate &operator=(const FilePrivate &) = delete;
const ID3v2::FrameFactory *ID3v2FrameFactory;
offset_t ID3v2Location;
long ID3v2OriginalSize;
@ -114,7 +117,7 @@ bool FLAC::File::isSupported(IOStream *stream)
FLAC::File::File(FileName file, bool readProperties, Properties::ReadStyle) :
TagLib::File(file),
d(new FilePrivate())
d(std::make_unique<FilePrivate>())
{
if(isOpen())
read(readProperties);
@ -123,7 +126,7 @@ FLAC::File::File(FileName file, bool readProperties, Properties::ReadStyle) :
FLAC::File::File(FileName file, ID3v2::FrameFactory *frameFactory,
bool readProperties, Properties::ReadStyle) :
TagLib::File(file),
d(new FilePrivate(frameFactory))
d(std::make_unique<FilePrivate>(frameFactory))
{
if(isOpen())
read(readProperties);
@ -132,16 +135,13 @@ FLAC::File::File(FileName file, ID3v2::FrameFactory *frameFactory,
FLAC::File::File(IOStream *stream, ID3v2::FrameFactory *frameFactory,
bool readProperties, Properties::ReadStyle) :
TagLib::File(stream),
d(new FilePrivate(frameFactory))
d(std::make_unique<FilePrivate>(frameFactory))
{
if(isOpen())
read(readProperties);
}
FLAC::File::~File()
{
delete d;
}
FLAC::File::~File() = default;
TagLib::Tag *FLAC::File::tag() const
{

View File

@ -130,6 +130,9 @@ namespace TagLib {
*/
~File() override;
File(const File &) = delete;
File &operator=(const File &) = delete;
/*!
* Returns the Tag for this file. This will be a union of XiphComment,
* ID3v1 and ID3v2 tags.
@ -301,14 +304,11 @@ namespace TagLib {
static bool isSupported(IOStream *stream);
private:
File(const File &) = delete;
File &operator=(const File &) = delete;
void read(bool readProperties);
void scan();
class FilePrivate;
FilePrivate *d;
std::unique_ptr<FilePrivate> d;
};
} // namespace FLAC
} // namespace TagLib

View File

@ -31,13 +31,8 @@ using namespace TagLib;
class FLAC::MetadataBlock::MetadataBlockPrivate
{
public:
MetadataBlockPrivate() = default;
};
FLAC::MetadataBlock::MetadataBlock()
: d(nullptr)
{
}
FLAC::MetadataBlock::MetadataBlock() = default;
FLAC::MetadataBlock::~MetadataBlock() = default;

View File

@ -38,6 +38,9 @@ namespace TagLib {
MetadataBlock();
virtual ~MetadataBlock();
MetadataBlock(const MetadataBlock &item) = delete;
MetadataBlock &operator=(const MetadataBlock &item) = delete;
enum BlockType {
StreamInfo = 0,
Padding,
@ -59,11 +62,8 @@ namespace TagLib {
virtual ByteVector render() const = 0;
private:
MetadataBlock(const MetadataBlock &item) = delete;
MetadataBlock &operator=(const MetadataBlock &item) = delete;
class MetadataBlockPrivate;
MetadataBlockPrivate *d;
std::unique_ptr<MetadataBlockPrivate> d;
};
} // namespace FLAC
} // namespace TagLib

View File

@ -51,20 +51,17 @@ public:
};
FLAC::Picture::Picture() :
d(new PicturePrivate())
d(std::make_unique<PicturePrivate>())
{
}
FLAC::Picture::Picture(const ByteVector &data) :
d(new PicturePrivate())
d(std::make_unique<PicturePrivate>())
{
parse(data);
}
FLAC::Picture::~Picture()
{
delete d;
}
FLAC::Picture::~Picture() = default;
int FLAC::Picture::code() const
{

View File

@ -90,6 +90,9 @@ namespace TagLib {
Picture(const ByteVector &data);
~Picture() override;
Picture(const Picture &item) = delete;
Picture &operator=(const Picture &item) = delete;
/*!
* Returns the type of the image.
*/
@ -190,11 +193,8 @@ namespace TagLib {
bool parse(const ByteVector &rawData);
private:
Picture(const Picture &item) = delete;
Picture &operator=(const Picture &item) = delete;
class PicturePrivate;
PicturePrivate *d;
std::unique_ptr<PicturePrivate> d;
};
typedef List<Picture> PictureList;

View File

@ -58,15 +58,12 @@ public:
FLAC::Properties::Properties(const ByteVector &data, offset_t streamLength, ReadStyle style) :
AudioProperties(style),
d(new PropertiesPrivate())
d(std::make_unique<PropertiesPrivate>())
{
read(data, streamLength);
}
FLAC::Properties::~Properties()
{
delete d;
}
FLAC::Properties::~Properties() = default;
int FLAC::Properties::lengthInMilliseconds() const
{

View File

@ -55,6 +55,9 @@ namespace TagLib {
*/
~Properties() override;
Properties(const Properties &) = delete;
Properties &operator=(const Properties &) = delete;
/*!
* Returns the length of the file in milliseconds.
*
@ -95,13 +98,10 @@ namespace TagLib {
ByteVector signature() const;
private:
Properties(const Properties &) = delete;
Properties &operator=(const Properties &) = delete;
void read(const ByteVector &data, offset_t streamLength);
class PropertiesPrivate;
PropertiesPrivate *d;
std::unique_ptr<PropertiesPrivate> d;
};
} // namespace FLAC
} // namespace TagLib

View File

@ -40,16 +40,13 @@ public:
};
FLAC::UnknownMetadataBlock::UnknownMetadataBlock(int code, const ByteVector &data) :
d(new UnknownMetadataBlockPrivate())
d(std::make_unique<UnknownMetadataBlockPrivate>())
{
d->code = code;
d->data = data;
}
FLAC::UnknownMetadataBlock::~UnknownMetadataBlock()
{
delete d;
}
FLAC::UnknownMetadataBlock::~UnknownMetadataBlock() = default;
int FLAC::UnknownMetadataBlock::code() const
{

View File

@ -39,6 +39,9 @@ namespace TagLib {
UnknownMetadataBlock(int blockType, const ByteVector &data);
~UnknownMetadataBlock() override;
UnknownMetadataBlock(const UnknownMetadataBlock &item) = delete;
UnknownMetadataBlock &operator=(const UnknownMetadataBlock &item) = delete;
/*!
* Returns the FLAC metadata block type.
*/
@ -65,11 +68,8 @@ namespace TagLib {
ByteVector render() const override;
private:
UnknownMetadataBlock(const MetadataBlock &item);
UnknownMetadataBlock &operator=(const MetadataBlock &item);
class UnknownMetadataBlockPrivate;
UnknownMetadataBlockPrivate *d;
std::unique_ptr<UnknownMetadataBlockPrivate> d;
};
} // namespace FLAC
} // namespace TagLib

View File

@ -48,7 +48,7 @@ public:
IT::File::File(FileName file, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::FileBase(file),
d(new FilePrivate(propertiesStyle))
d(std::make_unique<FilePrivate>(propertiesStyle))
{
if(isOpen())
read(readProperties);
@ -57,16 +57,13 @@ IT::File::File(FileName file, bool readProperties,
IT::File::File(IOStream *stream, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::FileBase(stream),
d(new FilePrivate(propertiesStyle))
d(std::make_unique<FilePrivate>(propertiesStyle))
{
if(isOpen())
read(readProperties);
}
IT::File::~File()
{
delete d;
}
IT::File::~File() = default;
Mod::Tag *IT::File::tag() const
{

View File

@ -65,6 +65,9 @@ namespace TagLib {
*/
~File() override;
File(const File &) = delete;
File &operator=(const File &) = delete;
Mod::Tag *tag() const override;
/*!
@ -81,15 +84,11 @@ namespace TagLib {
*/
bool save() override;
private:
File(const File &) = delete;
File &operator=(const File &) = delete;
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
std::unique_ptr<FilePrivate> d;
};
} // namespace IT
} // namespace TagLib

View File

@ -70,14 +70,11 @@ public:
IT::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
AudioProperties(propertiesStyle),
d(new PropertiesPrivate())
d(std::make_unique<PropertiesPrivate>())
{
}
IT::Properties::~Properties()
{
delete d;
}
IT::Properties::~Properties() = default;
int IT::Properties::channels() const
{

View File

@ -54,6 +54,9 @@ namespace TagLib {
Properties(AudioProperties::ReadStyle propertiesStyle);
~Properties() override;
Properties(const Properties &) = delete;
Properties &operator=(const Properties &) = delete;
int channels() const override;
unsigned short lengthInPatterns() const;
@ -89,11 +92,8 @@ namespace TagLib {
void setPitchWheelDepth(unsigned char pitchWheelDepth);
private:
Properties(const Properties&) = delete;
Properties &operator=(const Properties&) = delete;
class PropertiesPrivate;
PropertiesPrivate *d;
std::unique_ptr<PropertiesPrivate> d;
};
} // namespace IT
} // namespace TagLib

View File

@ -48,7 +48,7 @@ public:
Mod::File::File(FileName file, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::FileBase(file),
d(new FilePrivate(propertiesStyle))
d(std::make_unique<FilePrivate>(propertiesStyle))
{
if(isOpen())
read(readProperties);
@ -57,16 +57,13 @@ Mod::File::File(FileName file, bool readProperties,
Mod::File::File(IOStream *stream, bool readProperties,
AudioProperties::ReadStyle propertiesStyle) :
Mod::FileBase(stream),
d(new FilePrivate(propertiesStyle))
d(std::make_unique<FilePrivate>(propertiesStyle))
{
if(isOpen())
read(readProperties);
}
Mod::File::~File()
{
delete d;
}
Mod::File::~File() = default;
Mod::Tag *Mod::File::tag() const
{

View File

@ -68,6 +68,9 @@ namespace TagLib {
*/
~File() override;
File(const File &) = delete;
File &operator=(const File &) = delete;
Mod::Tag *tag() const override;
/*!
@ -96,13 +99,10 @@ namespace TagLib {
bool save() override;
private:
File(const File &) = delete;
File &operator=(const File &) = delete;
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
std::unique_ptr<FilePrivate> d;
};
} // namespace Mod
} // namespace TagLib

View File

@ -30,6 +30,12 @@
using namespace TagLib;
using namespace Mod;
class Mod::FileBase::FileBasePrivate
{
};
Mod::FileBase::~FileBase() = default;
Mod::FileBase::FileBase(FileName file) : TagLib::File(file)
{
}

View File

@ -38,6 +38,12 @@ namespace TagLib {
namespace Mod {
class TAGLIB_EXPORT FileBase : public TagLib::File
{
public:
~FileBase() override;
FileBase(const FileBase &) = delete;
FileBase& operator=(const FileBase &) = delete;
protected:
FileBase(FileName file);
FileBase(IOStream *stream);
@ -57,7 +63,7 @@ namespace TagLib {
bool readU32B(unsigned long &number);
private:
class FileBasePrivate;
FileBasePrivate *d;
std::unique_ptr<FileBasePrivate> d;
};
} // namespace Mod
} // namespace TagLib

View File

@ -46,14 +46,11 @@ public:
Mod::Properties::Properties(AudioProperties::ReadStyle propertiesStyle) :
AudioProperties(propertiesStyle),
d(new PropertiesPrivate())
d(std::make_unique<PropertiesPrivate>())
{
}
Mod::Properties::~Properties()
{
delete d;
}
Mod::Properties::~Properties() = default;
int Mod::Properties::bitrate() const
{

View File

@ -37,6 +37,9 @@ namespace TagLib {
Properties(AudioProperties::ReadStyle propertiesStyle);
~Properties() override;
Properties(const Properties &) = delete;
Properties &operator=(const Properties &) = delete;
int bitrate() const override;
int sampleRate() const override;
int channels() const override;
@ -50,11 +53,8 @@ namespace TagLib {
void setLengthInPatterns(unsigned char lengthInPatterns);
private:
Properties(const Properties&) = delete;
Properties &operator=(const Properties&) = delete;
class PropertiesPrivate;
PropertiesPrivate *d;
std::unique_ptr<PropertiesPrivate> d;
};
} // namespace Mod
} // namespace TagLib

View File

@ -34,22 +34,17 @@ using namespace Mod;
class Mod::Tag::TagPrivate
{
public:
TagPrivate() = default;
String title;
String comment;
String trackerName;
};
Mod::Tag::Tag() :
d(new TagPrivate())
d(std::make_unique<TagPrivate>())
{
}
Mod::Tag::~Tag()
{
delete d;
}
Mod::Tag::~Tag() = default;
String Mod::Tag::title() const
{

View File

@ -48,6 +48,9 @@ namespace TagLib {
Tag();
~Tag() override;
Tag(const Tag &) = delete;
Tag &operator=(const Tag &) = delete;
/*!
* Returns the track name; if no track name is present in the tag
* String::null will be returned.
@ -178,11 +181,8 @@ namespace TagLib {
PropertyMap setProperties(const PropertyMap &) override;
private:
Tag(const Tag &) = delete;
Tag &operator=(const Tag &) = delete;
class TagPrivate;
TagPrivate *d;
std::unique_ptr<TagPrivate> d;
};
} // namespace Mod
} // namespace TagLib

View File

@ -191,8 +191,7 @@ MP4::Atoms::Atoms(File *file)
}
}
MP4::Atoms::~Atoms()
= default;
MP4::Atoms::~Atoms() = default;
MP4::Atom *
MP4::Atoms::find(const char *name1, const char *name2, const char *name3, const char *name4)

View File

@ -79,6 +79,8 @@ namespace TagLib {
public:
Atom(File *file);
~Atom();
Atom(const Atom &) = delete;
Atom &operator=(const Atom &) = delete;
Atom *find(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr);
bool path(AtomList &path, const char *name1, const char *name2 = nullptr, const char *name3 = nullptr);
AtomList findall(const char *name, bool recursive = false);
@ -94,6 +96,8 @@ namespace TagLib {
public:
Atoms(File *file);
~Atoms();
Atoms(const Atoms &) = delete;
Atoms &operator=(const Atoms &) = delete;
Atom *find(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr);
AtomList path(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr);
AtomList atoms;

View File

@ -64,6 +64,9 @@ public:
delete properties;
}
FilePrivate(const FilePrivate &) = delete;
FilePrivate &operator=(const FilePrivate &) = delete;
MP4::Tag *tag;
MP4::Atoms *atoms;
MP4::Properties *properties;
@ -87,7 +90,7 @@ bool MP4::File::isSupported(IOStream *stream)
MP4::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle) :
TagLib::File(file),
d(new FilePrivate())
d(std::make_unique<FilePrivate>())
{
if(isOpen())
read(readProperties);
@ -95,16 +98,13 @@ MP4::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle)
MP4::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle) :
TagLib::File(stream),
d(new FilePrivate())
d(std::make_unique<FilePrivate>())
{
if(isOpen())
read(readProperties);
}
MP4::File::~File()
{
delete d;
}
MP4::File::~File() = default;
MP4::Tag *
MP4::File::tag() const

View File

@ -85,6 +85,9 @@ namespace TagLib {
*/
~File() override;
File(const File &) = delete;
File &operator=(const File &) = delete;
/*!
* Returns a pointer to the MP4 tag of the file.
*
@ -153,7 +156,7 @@ namespace TagLib {
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
std::unique_ptr<FilePrivate> d;
};
} // namespace MP4
} // namespace TagLib

View File

@ -79,15 +79,12 @@ public:
MP4::Properties::Properties(File *file, MP4::Atoms *atoms, ReadStyle style) :
AudioProperties(style),
d(new PropertiesPrivate())
d(std::make_unique<PropertiesPrivate>())
{
read(file, atoms);
}
MP4::Properties::~Properties()
{
delete d;
}
MP4::Properties::~Properties() = default;
int
MP4::Properties::channels() const

View File

@ -47,6 +47,9 @@ namespace TagLib {
Properties(File *file, Atoms *atoms, ReadStyle style = Average);
~Properties() override;
Properties(const Properties &) = delete;
Properties &operator=(const Properties &) = delete;
/*!
* Returns the length of the file in milliseconds.
*
@ -88,7 +91,7 @@ namespace TagLib {
void read(File *file, Atoms *atoms);
class PropertiesPrivate;
PropertiesPrivate *d;
std::unique_ptr<PropertiesPrivate> d;
};
} // namespace MP4
} // namespace TagLib

View File

@ -47,12 +47,12 @@ public:
};
MP4::Tag::Tag() :
d(new TagPrivate())
d(std::make_unique<TagPrivate>())
{
}
MP4::Tag::Tag(TagLib::File *file, MP4::Atoms *atoms) :
d(new TagPrivate())
d(std::make_unique<TagPrivate>())
{
d->file = file;
d->atoms = atoms;
@ -116,10 +116,7 @@ MP4::Tag::Tag(TagLib::File *file, MP4::Atoms *atoms) :
}
}
MP4::Tag::~Tag()
{
delete d;
}
MP4::Tag::~Tag() = default;
MP4::AtomDataList
MP4::Tag::parseData2(const MP4::Atom *atom, int expectedFlags, bool freeForm)

View File

@ -45,6 +45,8 @@ namespace TagLib {
Tag();
Tag(TagLib::File *file, Atoms *atoms);
~Tag() override;
Tag(const Tag &) = delete;
Tag &operator=(const Tag &) = delete;
bool save();
String title() const override;
@ -148,7 +150,7 @@ namespace TagLib {
void addItem(const String &name, const Item &value);
class TagPrivate;
TagPrivate *d;
std::unique_ptr<TagPrivate> d;
};
} // namespace MP4
} // namespace TagLib

View File

@ -62,6 +62,9 @@ public:
delete properties;
}
FilePrivate(const FilePrivate &) = delete;
FilePrivate &operator=(const FilePrivate &) = delete;
offset_t APELocation;
long APESize;
@ -95,7 +98,7 @@ bool MPC::File::isSupported(IOStream *stream)
MPC::File::File(FileName file, bool readProperties, Properties::ReadStyle) :
TagLib::File(file),
d(new FilePrivate())
d(std::make_unique<FilePrivate>())
{
if(isOpen())
read(readProperties);
@ -103,16 +106,13 @@ MPC::File::File(FileName file, bool readProperties, Properties::ReadStyle) :
MPC::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle) :
TagLib::File(stream),
d(new FilePrivate())
d(std::make_unique<FilePrivate>())
{
if(isOpen())
read(readProperties);
}
MPC::File::~File()
{
delete d;
}
MPC::File::~File() = default;
TagLib::Tag *MPC::File::tag() const
{

View File

@ -109,6 +109,9 @@ namespace TagLib {
*/
~File() override;
File(const File &) = delete;
File &operator=(const File &) = delete;
/*!
* Returns the Tag for this file. This will be an APE tag, an ID3v1 tag
* or a combination of the two.
@ -218,13 +221,10 @@ namespace TagLib {
static bool isSupported(IOStream *stream);
private:
File(const File &) = delete;
File &operator=(const File &) = delete;
void read(bool readProperties);
class FilePrivate;
FilePrivate *d;
std::unique_ptr<FilePrivate> d;
};
} // namespace MPC
} // namespace TagLib

View File

@ -70,7 +70,7 @@ public:
MPC::Properties::Properties(File *file, offset_t streamLength, ReadStyle style) :
AudioProperties(style),
d(new PropertiesPrivate())
d(std::make_unique<PropertiesPrivate>())
{
ByteVector magic = file->readBlock(4);
if(magic == "MPCK") {
@ -83,10 +83,7 @@ MPC::Properties::Properties(File *file, offset_t streamLength, ReadStyle style)
}
}
MPC::Properties::~Properties()
{
delete d;
}
MPC::Properties::~Properties() = default;
int MPC::Properties::lengthInMilliseconds() const
{

View File

@ -59,6 +59,9 @@ namespace TagLib {
*/
~Properties() override;
Properties(const Properties &) = delete;
Properties &operator=(const Properties &) = delete;
/*!
* Returns the length of the file in milliseconds.
*
@ -116,14 +119,11 @@ namespace TagLib {
int albumPeak() const;
private:
Properties(const Properties &) = delete;
Properties &operator=(const Properties &) = delete;
void readSV7(const ByteVector &data, offset_t streamLength);
void readSV8(File *file, offset_t streamLength);
class PropertiesPrivate;
PropertiesPrivate *d;
std::unique_ptr<PropertiesPrivate> d;
};
} // namespace MPC
} // namespace TagLib

View File

@ -60,6 +60,10 @@ public:
unsigned char genre;
};
class ID3v1::StringHandler::StringHandlerPrivate
{
};
////////////////////////////////////////////////////////////////////////////////
// StringHandler implementation
////////////////////////////////////////////////////////////////////////////////
@ -85,12 +89,12 @@ ByteVector ID3v1::StringHandler::render(const String &s) const
////////////////////////////////////////////////////////////////////////////////
ID3v1::Tag::Tag() :
d(new TagPrivate())
d(std::make_unique<TagPrivate>())
{
}
ID3v1::Tag::Tag(File *file, offset_t tagOffset) :
d(new TagPrivate())
d(std::make_unique<TagPrivate>())
{
d->file = file;
d->tagOffset = tagOffset;
@ -98,10 +102,7 @@ ID3v1::Tag::Tag(File *file, offset_t tagOffset) :
read();
}
ID3v1::Tag::~Tag()
{
delete d;
}
ID3v1::Tag::~Tag() = default;
ByteVector ID3v1::Tag::render() const
{

View File

@ -64,6 +64,9 @@ namespace TagLib {
virtual ~StringHandler();
StringHandler(const StringHandler &) = delete;
StringHandler &operator=(const StringHandler &) = delete;
/*!
* Decode a string from \a data. The default implementation assumes that
* \a data is an ISO-8859-1 (Latin1) character array.
@ -83,7 +86,7 @@ namespace TagLib {
private:
class StringHandlerPrivate;
StringHandlerPrivate *d;
std::unique_ptr<StringHandlerPrivate> d;
};
//! The main class in the ID3v1 implementation
@ -125,6 +128,9 @@ namespace TagLib {
*/
~Tag() override;
Tag(const Tag &) = delete;
Tag &operator=(const Tag &) = delete;
/*!
* Renders the in memory values to a ByteVector suitable for writing to
* the file.
@ -194,11 +200,8 @@ namespace TagLib {
void parse(const ByteVector &data);
private:
Tag(const Tag &) = delete;
Tag &operator=(const Tag &) = delete;
class TagPrivate;
TagPrivate *d;
std::unique_ptr<TagPrivate> d;
};
} // namespace ID3v1
} // namespace TagLib

View File

@ -50,21 +50,18 @@ public:
AttachedPictureFrame::AttachedPictureFrame() :
Frame("APIC"),
d(new AttachedPictureFramePrivate())
d(std::make_unique<AttachedPictureFramePrivate>())
{
}
AttachedPictureFrame::AttachedPictureFrame(const ByteVector &data) :
Frame(data),
d(new AttachedPictureFramePrivate())
d(std::make_unique<AttachedPictureFramePrivate>())
{
setData(data);
}
AttachedPictureFrame::~AttachedPictureFrame()
{
delete d;
}
AttachedPictureFrame::~AttachedPictureFrame() = default;
String AttachedPictureFrame::toString() const
{
@ -173,7 +170,7 @@ ByteVector AttachedPictureFrame::renderFields() const
AttachedPictureFrame::AttachedPictureFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new AttachedPictureFramePrivate())
d(std::make_unique<AttachedPictureFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -113,6 +113,9 @@ namespace TagLib {
*/
~AttachedPictureFrame() override;
AttachedPictureFrame(const AttachedPictureFrame &) = delete;
AttachedPictureFrame &operator=(const AttachedPictureFrame &) = delete;
/*!
* Returns a string containing the description and mime-type
*/
@ -206,13 +209,10 @@ namespace TagLib {
void parseFields(const ByteVector &data) override;
ByteVector renderFields() const override;
class AttachedPictureFramePrivate;
AttachedPictureFramePrivate *d;
std::unique_ptr<AttachedPictureFramePrivate> d;
private:
AttachedPictureFrame(const AttachedPictureFrame &) = delete;
AttachedPictureFrame &operator=(const AttachedPictureFrame &) = delete;
AttachedPictureFrame(const ByteVector &data, Header *h);
};
//! support for ID3v2.2 PIC frames

View File

@ -62,7 +62,7 @@ public:
ChapterFrame::ChapterFrame(const ID3v2::Header *tagHeader, const ByteVector &data) :
ID3v2::Frame(data),
d(new ChapterFramePrivate())
d(std::make_unique<ChapterFramePrivate>())
{
d->tagHeader = tagHeader;
setData(data);
@ -73,7 +73,7 @@ ChapterFrame::ChapterFrame(const ByteVector &elementID,
unsigned int startOffset, unsigned int endOffset,
const FrameList &embeddedFrames) :
ID3v2::Frame("CHAP"),
d(new ChapterFramePrivate())
d(std::make_unique<ChapterFramePrivate>())
{
// setElementID has a workaround for a previously silly API where you had to
// specifically include the null byte.
@ -89,10 +89,7 @@ ChapterFrame::ChapterFrame(const ByteVector &elementID,
addEmbeddedFrame(*it);
}
ChapterFrame::~ChapterFrame()
{
delete d;
}
ChapterFrame::~ChapterFrame() = default;
ByteVector ChapterFrame::elementID() const
{
@ -302,7 +299,7 @@ ByteVector ChapterFrame::renderFields() const
ChapterFrame::ChapterFrame(const ID3v2::Header *tagHeader, const ByteVector &data, Header *h) :
Frame(h),
d(new ChapterFramePrivate())
d(std::make_unique<ChapterFramePrivate>())
{
d->tagHeader = tagHeader;
parseFields(fieldData(data));

View File

@ -71,6 +71,9 @@ namespace TagLib {
*/
~ChapterFrame() override;
ChapterFrame(const ChapterFrame &) = delete;
ChapterFrame &operator=(const ChapterFrame &) = delete;
/*!
* Returns the element ID of the frame. Element ID
* is a null terminated string, however it's not human-readable.
@ -237,11 +240,9 @@ namespace TagLib {
private:
ChapterFrame(const ID3v2::Header *tagHeader, const ByteVector &data, Header *h);
ChapterFrame(const ChapterFrame &) = delete;
ChapterFrame &operator=(const ChapterFrame &) = delete;
class ChapterFramePrivate;
ChapterFramePrivate *d;
std::unique_ptr<ChapterFramePrivate> d;
};
} // namespace ID3v2
} // namespace TagLib

View File

@ -51,22 +51,19 @@ public:
CommentsFrame::CommentsFrame(String::Type encoding) :
Frame("COMM"),
d(new CommentsFramePrivate())
d(std::make_unique<CommentsFramePrivate>())
{
d->textEncoding = encoding;
}
CommentsFrame::CommentsFrame(const ByteVector &data) :
Frame(data),
d(new CommentsFramePrivate())
d(std::make_unique<CommentsFramePrivate>())
{
setData(data);
}
CommentsFrame::~CommentsFrame()
{
delete d;
}
CommentsFrame::~CommentsFrame() = default;
String CommentsFrame::toString() const
{
@ -191,7 +188,7 @@ ByteVector CommentsFrame::renderFields() const
CommentsFrame::CommentsFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new CommentsFramePrivate())
d(std::make_unique<CommentsFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -61,6 +61,9 @@ namespace TagLib {
*/
~CommentsFrame() override;
CommentsFrame(const CommentsFrame &) = delete;
CommentsFrame &operator=(const CommentsFrame &) = delete;
/*!
* Returns the text of this comment.
*
@ -167,11 +170,9 @@ namespace TagLib {
* The constructor used by the FrameFactory.
*/
CommentsFrame(const ByteVector &data, Header *h);
CommentsFrame(const CommentsFrame &) = delete;
CommentsFrame &operator=(const CommentsFrame &) = delete;
class CommentsFramePrivate;
CommentsFramePrivate *d;
std::unique_ptr<CommentsFramePrivate> d;
};
} // namespace ID3v2

View File

@ -47,21 +47,18 @@ public:
EventTimingCodesFrame::EventTimingCodesFrame() :
Frame("ETCO"),
d(new EventTimingCodesFramePrivate())
d(std::make_unique<EventTimingCodesFramePrivate>())
{
}
EventTimingCodesFrame::EventTimingCodesFrame(const ByteVector &data) :
Frame(data),
d(new EventTimingCodesFramePrivate())
d(std::make_unique<EventTimingCodesFramePrivate>())
{
setData(data);
}
EventTimingCodesFrame::~EventTimingCodesFrame()
{
delete d;
}
EventTimingCodesFrame::~EventTimingCodesFrame() = default;
String EventTimingCodesFrame::toString() const
{
@ -136,7 +133,7 @@ ByteVector EventTimingCodesFrame::renderFields() const
EventTimingCodesFrame::EventTimingCodesFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new EventTimingCodesFramePrivate())
d(std::make_unique<EventTimingCodesFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -133,6 +133,9 @@ namespace TagLib {
*/
~EventTimingCodesFrame() override;
EventTimingCodesFrame(const EventTimingCodesFrame &) = delete;
EventTimingCodesFrame &operator=(const EventTimingCodesFrame &) = delete;
/*!
* Returns a null string.
*/
@ -173,11 +176,9 @@ namespace TagLib {
* The constructor used by the FrameFactory.
*/
EventTimingCodesFrame(const ByteVector &data, Header *h);
EventTimingCodesFrame(const EventTimingCodesFrame &) = delete;
EventTimingCodesFrame &operator=(const EventTimingCodesFrame &) = delete;
class EventTimingCodesFramePrivate;
EventTimingCodesFramePrivate *d;
std::unique_ptr<EventTimingCodesFramePrivate> d;
};
} // namespace ID3v2

View File

@ -52,21 +52,18 @@ public:
GeneralEncapsulatedObjectFrame::GeneralEncapsulatedObjectFrame() :
Frame("GEOB"),
d(new GeneralEncapsulatedObjectFramePrivate())
d(std::make_unique<GeneralEncapsulatedObjectFramePrivate>())
{
}
GeneralEncapsulatedObjectFrame::GeneralEncapsulatedObjectFrame(const ByteVector &data) :
Frame(data),
d(new GeneralEncapsulatedObjectFramePrivate())
d(std::make_unique<GeneralEncapsulatedObjectFramePrivate>())
{
setData(data);
}
GeneralEncapsulatedObjectFrame::~GeneralEncapsulatedObjectFrame()
{
delete d;
}
GeneralEncapsulatedObjectFrame::~GeneralEncapsulatedObjectFrame() = default;
String GeneralEncapsulatedObjectFrame::toString() const
{
@ -181,7 +178,7 @@ ByteVector GeneralEncapsulatedObjectFrame::renderFields() const
GeneralEncapsulatedObjectFrame::GeneralEncapsulatedObjectFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new GeneralEncapsulatedObjectFramePrivate())
d(std::make_unique<GeneralEncapsulatedObjectFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -74,6 +74,9 @@ namespace TagLib {
*/
~GeneralEncapsulatedObjectFrame() override;
GeneralEncapsulatedObjectFrame(const GeneralEncapsulatedObjectFrame &) = delete;
GeneralEncapsulatedObjectFrame &operator=(const GeneralEncapsulatedObjectFrame &) = delete;
/*!
* Returns a string containing the description, file name and mime-type
*/
@ -167,11 +170,9 @@ namespace TagLib {
private:
GeneralEncapsulatedObjectFrame(const ByteVector &data, Header *h);
GeneralEncapsulatedObjectFrame(const GeneralEncapsulatedObjectFrame &) = delete;
GeneralEncapsulatedObjectFrame &operator=(const GeneralEncapsulatedObjectFrame &) = delete;
class GeneralEncapsulatedObjectFramePrivate;
GeneralEncapsulatedObjectFramePrivate *d;
std::unique_ptr<GeneralEncapsulatedObjectFramePrivate> d;
};
} // namespace ID3v2
} // namespace TagLib

View File

@ -47,22 +47,19 @@ public:
OwnershipFrame::OwnershipFrame(String::Type encoding) :
Frame("OWNE"),
d(new OwnershipFramePrivate())
d(std::make_unique<OwnershipFramePrivate>())
{
d->textEncoding = encoding;
}
OwnershipFrame::OwnershipFrame(const ByteVector &data) :
Frame(data),
d(new OwnershipFramePrivate())
d(std::make_unique<OwnershipFramePrivate>())
{
setData(data);
}
OwnershipFrame::~OwnershipFrame()
{
delete d;
}
OwnershipFrame::~OwnershipFrame() = default;
String OwnershipFrame::toString() const
{
@ -170,7 +167,7 @@ ByteVector OwnershipFrame::renderFields() const
OwnershipFrame::OwnershipFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new OwnershipFramePrivate())
d(std::make_unique<OwnershipFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -60,6 +60,9 @@ namespace TagLib {
*/
~OwnershipFrame() override;
OwnershipFrame(const OwnershipFrame &) = delete;
OwnershipFrame &operator=(const OwnershipFrame &) = delete;
/*!
* Returns the text of this popularimeter.
*
@ -139,11 +142,9 @@ namespace TagLib {
* The constructor used by the FrameFactory.
*/
OwnershipFrame(const ByteVector &data, Header *h);
OwnershipFrame(const OwnershipFrame &) = delete;
OwnershipFrame &operator=(const OwnershipFrame &) = delete;
class OwnershipFramePrivate;
OwnershipFramePrivate *d;
std::unique_ptr<OwnershipFramePrivate> d;
};
} // namespace ID3v2

View File

@ -41,15 +41,12 @@ public:
PodcastFrame::PodcastFrame() :
Frame("PCST"),
d(new PodcastFramePrivate())
d(std::make_unique<PodcastFramePrivate>())
{
d->fieldData = ByteVector(4, '\0');
}
PodcastFrame::~PodcastFrame()
{
delete d;
}
PodcastFrame::~PodcastFrame() = default;
String PodcastFrame::toString() const
{
@ -83,7 +80,7 @@ ByteVector PodcastFrame::renderFields() const
PodcastFrame::PodcastFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new PodcastFramePrivate())
d(std::make_unique<PodcastFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -52,6 +52,9 @@ namespace TagLib {
*/
~PodcastFrame() override;
PodcastFrame(const PodcastFrame &) = delete;
PodcastFrame &operator=(const PodcastFrame &) = delete;
/*!
* Returns a null string.
*/
@ -70,11 +73,9 @@ namespace TagLib {
* The constructor used by the FrameFactory.
*/
PodcastFrame(const ByteVector &data, Header *h);
PodcastFrame(const PodcastFrame &) = delete;
PodcastFrame &operator=(const PodcastFrame &) = delete;
class PodcastFramePrivate;
PodcastFramePrivate *d;
std::unique_ptr<PodcastFramePrivate> d;
};
} // namespace ID3v2

View File

@ -45,21 +45,18 @@ public:
PopularimeterFrame::PopularimeterFrame() :
Frame("POPM"),
d(new PopularimeterFramePrivate())
d(std::make_unique<PopularimeterFramePrivate>())
{
}
PopularimeterFrame::PopularimeterFrame(const ByteVector &data) :
Frame(data),
d(new PopularimeterFramePrivate())
d(std::make_unique<PopularimeterFramePrivate>())
{
setData(data);
}
PopularimeterFrame::~PopularimeterFrame()
{
delete d;
}
PopularimeterFrame::~PopularimeterFrame() = default;
String PopularimeterFrame::toString() const
{
@ -134,7 +131,7 @@ ByteVector PopularimeterFrame::renderFields() const
PopularimeterFrame::PopularimeterFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new PopularimeterFramePrivate())
d(std::make_unique<PopularimeterFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -1,4 +1,5 @@
/***************************************************************************
*
copyright : (C) 2008 by Lukas Lalinsky
email : lalinsky@gmail.com
***************************************************************************/
@ -60,6 +61,9 @@ namespace TagLib {
*/
~PopularimeterFrame() override;
PopularimeterFrame(const PopularimeterFrame &) = delete;
PopularimeterFrame &operator=(const PopularimeterFrame &) = delete;
/*!
* Returns the text of this popularimeter.
*
@ -120,11 +124,9 @@ namespace TagLib {
* The constructor used by the FrameFactory.
*/
PopularimeterFrame(const ByteVector &data, Header *h);
PopularimeterFrame(const PopularimeterFrame &) = delete;
PopularimeterFrame &operator=(const PopularimeterFrame &) = delete;
class PopularimeterFramePrivate;
PopularimeterFramePrivate *d;
std::unique_ptr<PopularimeterFramePrivate> d;
};
} // namespace ID3v2

View File

@ -47,21 +47,18 @@ public:
PrivateFrame::PrivateFrame() :
Frame("PRIV"),
d(new PrivateFramePrivate())
d(std::make_unique<PrivateFramePrivate>())
{
}
PrivateFrame::PrivateFrame(const ByteVector &data) :
Frame(data),
d(new PrivateFramePrivate())
d(std::make_unique<PrivateFramePrivate>())
{
Frame::setData(data);
}
PrivateFrame::~PrivateFrame()
{
delete d;
}
PrivateFrame::~PrivateFrame() = default;
String PrivateFrame::toString() const
{
@ -125,7 +122,7 @@ ByteVector PrivateFrame::renderFields() const
PrivateFrame::PrivateFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new PrivateFramePrivate())
d(std::make_unique<PrivateFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -58,6 +58,9 @@ namespace TagLib {
*/
~PrivateFrame() override;
PrivateFrame(const PrivateFrame &) = delete;
PrivateFrame &operator=(const PrivateFrame &) = delete;
/*!
* Returns the text of this private frame, currently just the owner.
*
@ -99,11 +102,8 @@ namespace TagLib {
*/
PrivateFrame(const ByteVector &data, Header *h);
PrivateFrame(const PrivateFrame &) = delete;
PrivateFrame &operator=(const PrivateFrame &) = delete;
class PrivateFramePrivate;
PrivateFramePrivate *d;
std::unique_ptr<PrivateFramePrivate> d;
};
} // namespace ID3v2

View File

@ -53,21 +53,18 @@ public:
RelativeVolumeFrame::RelativeVolumeFrame() :
Frame("RVA2"),
d(new RelativeVolumeFramePrivate())
d(std::make_unique<RelativeVolumeFramePrivate>())
{
}
RelativeVolumeFrame::RelativeVolumeFrame(const ByteVector &data) :
Frame(data),
d(new RelativeVolumeFramePrivate())
d(std::make_unique<RelativeVolumeFramePrivate>())
{
setData(data);
}
RelativeVolumeFrame::~RelativeVolumeFrame()
{
delete d;
}
RelativeVolumeFrame::~RelativeVolumeFrame() = default;
String RelativeVolumeFrame::toString() const
{
@ -180,7 +177,7 @@ ByteVector RelativeVolumeFrame::renderFields() const
RelativeVolumeFrame::RelativeVolumeFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new RelativeVolumeFramePrivate())
d(std::make_unique<RelativeVolumeFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -116,6 +116,9 @@ namespace TagLib {
*/
~RelativeVolumeFrame() override;
RelativeVolumeFrame(const RelativeVolumeFrame &) = delete;
RelativeVolumeFrame &operator=(const RelativeVolumeFrame &) = delete;
/*!
* Returns the frame's identification.
*
@ -219,11 +222,9 @@ namespace TagLib {
private:
RelativeVolumeFrame(const ByteVector &data, Header *h);
RelativeVolumeFrame(const RelativeVolumeFrame &) = delete;
RelativeVolumeFrame &operator=(const RelativeVolumeFrame &) = delete;
class RelativeVolumeFramePrivate;
RelativeVolumeFramePrivate *d;
std::unique_ptr<RelativeVolumeFramePrivate> d;
};
} // namespace ID3v2

View File

@ -53,22 +53,19 @@ public:
SynchronizedLyricsFrame::SynchronizedLyricsFrame(String::Type encoding) :
Frame("SYLT"),
d(new SynchronizedLyricsFramePrivate())
d(std::make_unique<SynchronizedLyricsFramePrivate>())
{
d->textEncoding = encoding;
}
SynchronizedLyricsFrame::SynchronizedLyricsFrame(const ByteVector &data) :
Frame(data),
d(new SynchronizedLyricsFramePrivate())
d(std::make_unique<SynchronizedLyricsFramePrivate>())
{
setData(data);
}
SynchronizedLyricsFrame::~SynchronizedLyricsFrame()
{
delete d;
}
SynchronizedLyricsFrame::~SynchronizedLyricsFrame() = default;
String SynchronizedLyricsFrame::toString() const
{
@ -234,7 +231,7 @@ ByteVector SynchronizedLyricsFrame::renderFields() const
SynchronizedLyricsFrame::SynchronizedLyricsFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new SynchronizedLyricsFramePrivate())
d(std::make_unique<SynchronizedLyricsFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -112,6 +112,9 @@ namespace TagLib {
*/
~SynchronizedLyricsFrame() override;
SynchronizedLyricsFrame(const SynchronizedLyricsFrame &) = delete;
SynchronizedLyricsFrame &operator=(const SynchronizedLyricsFrame &) = delete;
/*!
* Returns the description of this synchronized lyrics frame.
*
@ -220,11 +223,9 @@ namespace TagLib {
* The constructor used by the FrameFactory.
*/
SynchronizedLyricsFrame(const ByteVector &data, Header *h);
SynchronizedLyricsFrame(const SynchronizedLyricsFrame &) = delete;
SynchronizedLyricsFrame &operator=(const SynchronizedLyricsFrame &) = delete;
class SynchronizedLyricsFramePrivate;
SynchronizedLyricsFramePrivate *d;
std::unique_ptr<SynchronizedLyricsFramePrivate> d;
};
} // namespace ID3v2

View File

@ -83,7 +83,7 @@ namespace {
TableOfContentsFrame::TableOfContentsFrame(const ID3v2::Header *tagHeader, const ByteVector &data) :
ID3v2::Frame(data),
d(new TableOfContentsFramePrivate())
d(std::make_unique<TableOfContentsFramePrivate>())
{
d->tagHeader = tagHeader;
setData(data);
@ -93,7 +93,7 @@ TableOfContentsFrame::TableOfContentsFrame(const ByteVector &elementID,
const ByteVectorList &children,
const FrameList &embeddedFrames) :
ID3v2::Frame("CTOC"),
d(new TableOfContentsFramePrivate())
d(std::make_unique<TableOfContentsFramePrivate>())
{
d->elementID = elementID;
strip(d->elementID);
@ -103,10 +103,7 @@ TableOfContentsFrame::TableOfContentsFrame(const ByteVector &elementID,
addEmbeddedFrame(*it);
}
TableOfContentsFrame::~TableOfContentsFrame()
{
delete d;
}
TableOfContentsFrame::~TableOfContentsFrame() = default;
ByteVector TableOfContentsFrame::elementID() const
{
@ -349,7 +346,7 @@ ByteVector TableOfContentsFrame::renderFields() const
TableOfContentsFrame::TableOfContentsFrame(const ID3v2::Header *tagHeader,
const ByteVector &data, Header *h) :
Frame(h),
d(new TableOfContentsFramePrivate())
d(std::make_unique<TableOfContentsFramePrivate>())
{
d->tagHeader = tagHeader;
parseFields(fieldData(data));

View File

@ -67,6 +67,9 @@ namespace TagLib {
*/
~TableOfContentsFrame() override;
TableOfContentsFrame(const TableOfContentsFrame &) = delete;
TableOfContentsFrame &operator=(const TableOfContentsFrame &) = delete;
/*!
* Returns the elementID of the frame. Element ID
* is a null terminated string, however it's not human-readable.
@ -248,11 +251,9 @@ namespace TagLib {
private:
TableOfContentsFrame(const ID3v2::Header *tagHeader, const ByteVector &data, Header *h);
TableOfContentsFrame(const TableOfContentsFrame &) = delete;
TableOfContentsFrame &operator=(const TableOfContentsFrame &) = delete;
class TableOfContentsFramePrivate;
TableOfContentsFramePrivate *d;
std::unique_ptr<TableOfContentsFramePrivate> d;
};
} // namespace ID3v2
} // namespace TagLib

View File

@ -42,20 +42,24 @@ public:
StringList fieldList;
};
class UserTextIdentificationFrame::UserTextIdentificationFramePrivate
{
};
////////////////////////////////////////////////////////////////////////////////
// TextIdentificationFrame public members
////////////////////////////////////////////////////////////////////////////////
TextIdentificationFrame::TextIdentificationFrame(const ByteVector &type, String::Type encoding) :
Frame(type),
d(new TextIdentificationFramePrivate())
d(std::make_unique<TextIdentificationFramePrivate>())
{
d->textEncoding = encoding;
}
TextIdentificationFrame::TextIdentificationFrame(const ByteVector &data) :
Frame(data),
d(new TextIdentificationFramePrivate())
d(std::make_unique<TextIdentificationFramePrivate>())
{
setData(data);
}
@ -89,10 +93,7 @@ TextIdentificationFrame *TextIdentificationFrame::createTMCLFrame(const Property
return frame;
}
TextIdentificationFrame::~TextIdentificationFrame()
{
delete d;
}
TextIdentificationFrame::~TextIdentificationFrame() = default;
void TextIdentificationFrame::setText(const StringList &l)
{
@ -278,7 +279,7 @@ ByteVector TextIdentificationFrame::renderFields() const
TextIdentificationFrame::TextIdentificationFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new TextIdentificationFramePrivate())
d(std::make_unique<TextIdentificationFramePrivate>())
{
parseFields(fieldData(data));
}
@ -336,9 +337,10 @@ PropertyMap TextIdentificationFrame::makeTMCLProperties() const
// UserTextIdentificationFrame public members
////////////////////////////////////////////////////////////////////////////////
UserTextIdentificationFrame::~UserTextIdentificationFrame() = default;
UserTextIdentificationFrame::UserTextIdentificationFrame(String::Type encoding) :
TextIdentificationFrame("TXXX", encoding),
d(nullptr)
TextIdentificationFrame("TXXX", encoding)
{
StringList l;
l.append(String());
@ -354,8 +356,7 @@ UserTextIdentificationFrame::UserTextIdentificationFrame(const ByteVector &data)
}
UserTextIdentificationFrame::UserTextIdentificationFrame(const String &description, const StringList &values, String::Type encoding) :
TextIdentificationFrame("TXXX", encoding),
d(nullptr)
TextIdentificationFrame("TXXX", encoding)
{
setDescription(description);
setText(values);

View File

@ -144,6 +144,9 @@ namespace TagLib {
*/
~TextIdentificationFrame() override;
TextIdentificationFrame(const TextIdentificationFrame &) = delete;
TextIdentificationFrame &operator=(const TextIdentificationFrame &) = delete;
/*!
* Text identification frames are a list of string fields.
*
@ -209,9 +212,6 @@ namespace TagLib {
TextIdentificationFrame(const ByteVector &data, Header *h);
private:
TextIdentificationFrame(const TextIdentificationFrame &) = delete;
TextIdentificationFrame &operator=(const TextIdentificationFrame &) = delete;
/*!
* Parses the special structure of a TIPL frame
* Only the whitelisted roles "ARRANGER", "ENGINEER", "PRODUCER",
@ -223,7 +223,7 @@ namespace TagLib {
*/
PropertyMap makeTMCLProperties() const;
class TextIdentificationFramePrivate;
TextIdentificationFramePrivate *d;
std::unique_ptr<TextIdentificationFramePrivate> d;
};
/*!
@ -258,6 +258,11 @@ namespace TagLib {
*/
UserTextIdentificationFrame(const String &description, const StringList &values, String::Type encoding = String::UTF8);
~UserTextIdentificationFrame() override;
UserTextIdentificationFrame(const UserTextIdentificationFrame &) = delete;
UserTextIdentificationFrame &operator=(const UserTextIdentificationFrame &) = delete;
String toString() const override;
/*!
@ -300,12 +305,11 @@ namespace TagLib {
private:
UserTextIdentificationFrame(const ByteVector &data, Header *h);
UserTextIdentificationFrame(const TextIdentificationFrame &);
UserTextIdentificationFrame &operator=(const UserTextIdentificationFrame &);
void checkFields();
class UserTextIdentificationFramePrivate;
UserTextIdentificationFramePrivate *d;
std::unique_ptr<UserTextIdentificationFramePrivate> d;
};
} // namespace ID3v2

View File

@ -47,23 +47,20 @@ public:
UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const ByteVector &data) :
ID3v2::Frame(data),
d(new UniqueFileIdentifierFramePrivate())
d(std::make_unique<UniqueFileIdentifierFramePrivate>())
{
setData(data);
}
UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const String &owner, const ByteVector &id) :
ID3v2::Frame("UFID"),
d(new UniqueFileIdentifierFramePrivate())
d(std::make_unique<UniqueFileIdentifierFramePrivate>())
{
d->owner = owner;
d->identifier = id;
}
UniqueFileIdentifierFrame::~UniqueFileIdentifierFrame()
{
delete d;
}
UniqueFileIdentifierFrame::~UniqueFileIdentifierFrame() = default;
String UniqueFileIdentifierFrame::owner() const
{
@ -141,7 +138,7 @@ ByteVector UniqueFileIdentifierFrame::renderFields() const
UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new UniqueFileIdentifierFramePrivate())
d(std::make_unique<UniqueFileIdentifierFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -61,6 +61,9 @@ namespace TagLib {
*/
~UniqueFileIdentifierFrame() override;
UniqueFileIdentifierFrame(const UniqueFileIdentifierFrame &) = delete;
UniqueFileIdentifierFrame &operator=(const UniqueFileIdentifierFrame &) = delete;
/*!
* Returns the owner for the frame; essentially this is the key for
* determining which identification scheme this key belongs to. This
@ -109,13 +112,10 @@ namespace TagLib {
ByteVector renderFields() const override;
private:
UniqueFileIdentifierFrame(const UniqueFileIdentifierFrame &) = delete;
UniqueFileIdentifierFrame &operator=(const UniqueFileIdentifierFrame &) = delete;
UniqueFileIdentifierFrame(const ByteVector &data, Header *h);
class UniqueFileIdentifierFramePrivate;
UniqueFileIdentifierFramePrivate *d;
std::unique_ptr<UniqueFileIdentifierFramePrivate> d;
};
} // namespace ID3v2
} // namespace TagLib

View File

@ -40,15 +40,12 @@ public:
UnknownFrame::UnknownFrame(const ByteVector &data) :
Frame(data),
d(new UnknownFramePrivate())
d(std::make_unique<UnknownFramePrivate>())
{
setData(data);
}
UnknownFrame::~UnknownFrame()
{
delete d;
}
UnknownFrame::~UnknownFrame() = default;
String UnknownFrame::toString() const
{
@ -80,7 +77,7 @@ ByteVector UnknownFrame::renderFields() const
UnknownFrame::UnknownFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new UnknownFramePrivate())
d(std::make_unique<UnknownFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -54,6 +54,9 @@ namespace TagLib {
UnknownFrame(const ByteVector &data);
~UnknownFrame() override;
UnknownFrame(const UnknownFrame &) = delete;
UnknownFrame &operator=(const UnknownFrame &) = delete;
String toString() const override;
/*!
@ -67,11 +70,9 @@ namespace TagLib {
private:
UnknownFrame(const ByteVector &data, Header *h);
UnknownFrame(const UnknownFrame &) = delete;
UnknownFrame &operator=(const UnknownFrame &) = delete;
class UnknownFramePrivate;
UnknownFramePrivate *d;
std::unique_ptr<UnknownFramePrivate> d;
};
} // namespace ID3v2

View File

@ -51,22 +51,19 @@ public:
UnsynchronizedLyricsFrame::UnsynchronizedLyricsFrame(String::Type encoding) :
Frame("USLT"),
d(new UnsynchronizedLyricsFramePrivate())
d(std::make_unique<UnsynchronizedLyricsFramePrivate>())
{
d->textEncoding = encoding;
}
UnsynchronizedLyricsFrame::UnsynchronizedLyricsFrame(const ByteVector &data) :
Frame(data),
d(new UnsynchronizedLyricsFramePrivate())
d(std::make_unique<UnsynchronizedLyricsFramePrivate>())
{
setData(data);
}
UnsynchronizedLyricsFrame::~UnsynchronizedLyricsFrame()
{
delete d;
}
UnsynchronizedLyricsFrame::~UnsynchronizedLyricsFrame() = default;
String UnsynchronizedLyricsFrame::toString() const
{
@ -192,7 +189,7 @@ ByteVector UnsynchronizedLyricsFrame::renderFields() const
UnsynchronizedLyricsFrame::UnsynchronizedLyricsFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new UnsynchronizedLyricsFramePrivate())
d(std::make_unique<UnsynchronizedLyricsFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -59,6 +59,9 @@ namespace TagLib {
*/
~UnsynchronizedLyricsFrame() override;
UnsynchronizedLyricsFrame(const UnsynchronizedLyricsFrame &) = delete;
UnsynchronizedLyricsFrame &operator=(const UnsynchronizedLyricsFrame &) = delete;
/*!
* Returns the text of this unsynchronized lyrics frame.
*
@ -167,11 +170,9 @@ namespace TagLib {
* The constructor used by the FrameFactory.
*/
UnsynchronizedLyricsFrame(const ByteVector &data, Header *h);
UnsynchronizedLyricsFrame(const UnsynchronizedLyricsFrame &) = delete;
UnsynchronizedLyricsFrame &operator=(const UnsynchronizedLyricsFrame &) = delete;
class UnsynchronizedLyricsFramePrivate;
UnsynchronizedLyricsFramePrivate *d;
std::unique_ptr<UnsynchronizedLyricsFramePrivate> d;
};
} // namespace ID3v2

View File

@ -55,15 +55,12 @@ public:
UrlLinkFrame::UrlLinkFrame(const ByteVector &data) :
Frame(data),
d(new UrlLinkFramePrivate())
d(std::make_unique<UrlLinkFramePrivate>())
{
setData(data);
}
UrlLinkFrame::~UrlLinkFrame()
{
delete d;
}
UrlLinkFrame::~UrlLinkFrame() = default;
void UrlLinkFrame::setUrl(const String &s)
{
@ -113,7 +110,7 @@ ByteVector UrlLinkFrame::renderFields() const
UrlLinkFrame::UrlLinkFrame(const ByteVector &data, Header *h) :
Frame(h),
d(new UrlLinkFramePrivate())
d(std::make_unique<UrlLinkFramePrivate>())
{
parseFields(fieldData(data));
}
@ -124,22 +121,19 @@ UrlLinkFrame::UrlLinkFrame(const ByteVector &data, Header *h) :
UserUrlLinkFrame::UserUrlLinkFrame(String::Type encoding) :
UrlLinkFrame("WXXX"),
d(new UserUrlLinkFramePrivate())
d(std::make_unique<UserUrlLinkFramePrivate>())
{
d->textEncoding = encoding;
}
UserUrlLinkFrame::UserUrlLinkFrame(const ByteVector &data) :
UrlLinkFrame(data),
d(new UserUrlLinkFramePrivate())
d(std::make_unique<UserUrlLinkFramePrivate>())
{
setData(data);
}
UserUrlLinkFrame::~UserUrlLinkFrame()
{
delete d;
}
UserUrlLinkFrame::~UserUrlLinkFrame() = default;
String UserUrlLinkFrame::toString() const
{
@ -240,7 +234,7 @@ ByteVector UserUrlLinkFrame::renderFields() const
UserUrlLinkFrame::UserUrlLinkFrame(const ByteVector &data, Header *h) :
UrlLinkFrame(data, h),
d(new UserUrlLinkFramePrivate())
d(std::make_unique<UserUrlLinkFramePrivate>())
{
parseFields(fieldData(data));
}

View File

@ -55,6 +55,9 @@ namespace TagLib {
*/
~UrlLinkFrame() override;
UrlLinkFrame(const UrlLinkFrame &) = delete;
UrlLinkFrame &operator=(const UrlLinkFrame &) = delete;
/*!
* Returns the URL.
*/
@ -81,11 +84,8 @@ namespace TagLib {
UrlLinkFrame(const ByteVector &data, Header *h);
private:
UrlLinkFrame(const UrlLinkFrame &) = delete;
UrlLinkFrame &operator=(const UrlLinkFrame &) = delete;
class UrlLinkFramePrivate;
UrlLinkFramePrivate *d;
std::unique_ptr<UrlLinkFramePrivate> d;
};
//! ID3v2 User defined URL frame
@ -119,6 +119,9 @@ namespace TagLib {
*/
~UserUrlLinkFrame() override;
UserUrlLinkFrame(const UserUrlLinkFrame &) = delete;
UserUrlLinkFrame &operator=(const UserUrlLinkFrame &) = delete;
// Reimplementations.
String toString() const override;
@ -178,11 +181,8 @@ namespace TagLib {
UserUrlLinkFrame(const ByteVector &data, Header *h);
private:
UserUrlLinkFrame(const UserUrlLinkFrame &) = delete;
UserUrlLinkFrame &operator=(const UserUrlLinkFrame &) = delete;
class UserUrlLinkFramePrivate;
UserUrlLinkFramePrivate *d;
std::unique_ptr<UserUrlLinkFramePrivate> d;
};
} // namespace ID3v2

View File

@ -42,14 +42,11 @@ public:
////////////////////////////////////////////////////////////////////////////////
ExtendedHeader::ExtendedHeader() :
d(new ExtendedHeaderPrivate())
d(std::make_unique<ExtendedHeaderPrivate>())
{
}
ExtendedHeader::~ExtendedHeader()
{
delete d;
}
ExtendedHeader::~ExtendedHeader() = default;
unsigned int ExtendedHeader::size() const
{

View File

@ -58,6 +58,9 @@ namespace TagLib {
*/
virtual ~ExtendedHeader();
ExtendedHeader(const ExtendedHeader &) = delete;
ExtendedHeader &operator=(const ExtendedHeader &) = delete;
/*!
* Returns the size of the extended header. This is variable for the
* extended header.
@ -81,11 +84,8 @@ namespace TagLib {
void parse(const ByteVector &data);
private:
ExtendedHeader(const ExtendedHeader &) = delete;
ExtendedHeader &operator=(const ExtendedHeader &) = delete;
class ExtendedHeaderPrivate;
ExtendedHeaderPrivate *d;
std::unique_ptr<ExtendedHeaderPrivate> d;
};
} // namespace ID3v2

View File

@ -33,10 +33,7 @@ class Footer::FooterPrivate
{
};
Footer::Footer() :
d(nullptr)
{
}
Footer::Footer() = default;
Footer::~Footer() = default;

View File

@ -59,6 +59,9 @@ namespace TagLib {
*/
virtual ~Footer();
Footer(const Footer &) = delete;
Footer &operator=(const Footer &) = delete;
/*!
* Returns the size of the footer. Presently this is always 10 bytes.
*/
@ -70,11 +73,8 @@ namespace TagLib {
ByteVector render(const Header *header) const;
private:
Footer(const Footer &) = delete;
Footer &operator=(const Footer &) = delete;
class FooterPrivate;
FooterPrivate *d;
std::unique_ptr<FooterPrivate> d;
};
} // namespace ID3v2

View File

@ -59,6 +59,9 @@ public:
delete header;
}
FramePrivate(const FramePrivate &) = delete;
FramePrivate &operator=(const FramePrivate &) = delete;
Frame::Header *header;
};
@ -153,10 +156,7 @@ Frame *Frame::createTextualFrame(const String &key, const StringList &values) //
return new UserTextIdentificationFrame(keyToTXXX(key), values, String::UTF8);
}
Frame::~Frame()
{
delete d;
}
Frame::~Frame() = default;
ByteVector Frame::frameID() const
{
@ -196,13 +196,13 @@ ByteVector Frame::render() const
////////////////////////////////////////////////////////////////////////////////
Frame::Frame(const ByteVector &data) :
d(new FramePrivate())
d(std::make_unique<FramePrivate>())
{
d->header = new Header(data);
}
Frame::Frame(Header *h) :
d(new FramePrivate())
d(std::make_unique<FramePrivate>())
{
d->header = h;
}
@ -539,15 +539,12 @@ unsigned int Frame::Header::size()
}
Frame::Header::Header(const ByteVector &data, unsigned int version) :
d(new HeaderPrivate())
d(std::make_unique<HeaderPrivate>())
{
setData(data, version);
}
Frame::Header::~Header()
{
delete d;
}
Frame::Header::~Header() = default;
void Frame::Header::setData(const ByteVector &data, unsigned int version)
{

View File

@ -72,6 +72,9 @@ namespace TagLib {
*/
virtual ~Frame();
Frame(const Frame &) = delete;
Frame &operator=(const Frame &) = delete;
/*!
* Returns the Frame ID (Structure, <a href="id3v2-structure.html#4">4</a>)
* (Frames, <a href="id3v2-frames.html#4">4</a>)
@ -272,12 +275,9 @@ namespace TagLib {
PropertyMap &tiplProperties, PropertyMap &tmclProperties);
private:
Frame(const Frame &) = delete;
Frame &operator=(const Frame &) = delete;
class FramePrivate;
friend class FramePrivate;
FramePrivate *d;
std::unique_ptr<FramePrivate> d;
};
//! ID3v2 frame header implementation
@ -311,6 +311,9 @@ namespace TagLib {
*/
virtual ~Header();
Header(const Header &) = delete;
Header &operator=(const Header &) = delete;
/*!
* Sets the data for the Header. \a version should indicate the ID3v2
* version number of the tag that this frame is contained in.
@ -440,11 +443,8 @@ namespace TagLib {
ByteVector render() const;
private:
Header(const Header &) = delete;
Header &operator=(const Header &) = delete;
class HeaderPrivate;
HeaderPrivate *d;
std::unique_ptr<HeaderPrivate> d;
};
} // namespace ID3v2

View File

@ -382,14 +382,11 @@ void FrameFactory::setDefaultTextEncoding(String::Type encoding)
////////////////////////////////////////////////////////////////////////////////
FrameFactory::FrameFactory() :
d(new FrameFactoryPrivate())
d(std::make_unique<FrameFactoryPrivate>())
{
}
FrameFactory::~FrameFactory()
{
delete d;
}
FrameFactory::~FrameFactory() = default;
namespace
{

View File

@ -65,6 +65,9 @@ namespace TagLib {
class TAGLIB_EXPORT FrameFactory
{
public:
FrameFactory(const FrameFactory &) = delete;
FrameFactory &operator=(const FrameFactory &) = delete;
static FrameFactory *instance();
/*!
@ -153,13 +156,10 @@ namespace TagLib {
const Header *tagHeader) const;
private:
FrameFactory(const FrameFactory &) = delete;
FrameFactory &operator=(const FrameFactory &) = delete;
static FrameFactory factory;
class FrameFactoryPrivate;
FrameFactoryPrivate *d;
std::unique_ptr<FrameFactoryPrivate> d;
};
} // namespace ID3v2

View File

@ -79,20 +79,17 @@ ByteVector Header::fileIdentifier()
////////////////////////////////////////////////////////////////////////////////
Header::Header() :
d(new HeaderPrivate())
d(std::make_unique<HeaderPrivate>())
{
}
Header::Header(const ByteVector &data) :
d(new HeaderPrivate())
d(std::make_unique<HeaderPrivate>())
{
parse(data);
}
Header::~Header()
{
delete d;
}
Header::~Header() = default;
unsigned int Header::majorVersion() const
{

View File

@ -64,6 +64,9 @@ namespace TagLib {
*/
virtual ~Header();
Header(const Header &) = delete;
Header &operator=(const Header &) = delete;
/*!
* Returns the major version number. (Note: This is the 4, not the 2 in
* ID3v2.4.0. The 2 is implied.)
@ -163,11 +166,8 @@ namespace TagLib {
void parse(const ByteVector &data);
private:
Header(const Header &) = delete;
Header &operator=(const Header &) = delete;
class HeaderPrivate;
HeaderPrivate *d;
std::unique_ptr<HeaderPrivate> d;
};
} // namespace ID3v2

Some files were not shown because too many files have changed in this diff Show More