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 <[email protected]>

* clang-tidy: add missing deleted functions

Found with cppcoreguidelines-special-member-functions

Signed-off-by: Rosen Penev <[email protected]>

* unique_ptr conversions

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

Also added missing = default.

Signed-off-by: Rosen Penev <[email protected]>

---------

Signed-off-by: Rosen Penev <[email protected]>
This commit is contained in:
Rosen Penev
2023-08-07 15:08:40 -05:00
committed by GitHub
parent 843a8aac80
commit 185bb7042e
183 changed files with 836 additions and 835 deletions
+10 -2
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;
};
/*!