Commit 8eec3450 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use std::unique_ptr

parent 071aeac1
Pipeline #87181 passed with stage
in 5 minutes and 29 seconds
......@@ -50,8 +50,6 @@ Content::~Content()
Q_D(Content);
qDeleteAll(d->headers);
d->headers.clear();
delete d_ptr;
d_ptr = nullptr;
}
bool Content::hasContent() const
......
......@@ -668,7 +668,7 @@ protected:
virtual QByteArray assembleHeaders();
//@cond PRIVATE
ContentPrivate *d_ptr;
std::unique_ptr<ContentPrivate> const d_ptr;
//@endcond
private:
......
......@@ -106,10 +106,7 @@ DateFormatter::DateFormatter(FormatType ftype) :
d->mFormat = ftype;
}
DateFormatter::~DateFormatter()
{
delete d;
}
DateFormatter::~DateFormatter() = default;
DateFormatter::FormatType DateFormatter::format() const
{
......
......@@ -37,6 +37,7 @@
#include <QDateTime>
#include <QString>
#include "kmime_export.h"
#include <memory>
namespace KMime
{
......@@ -179,7 +180,7 @@ public:
private:
//@cond PRIVATE
Q_DISABLE_COPY(DateFormatter)
DateFormatterPrivate *const d;
std::unique_ptr<DateFormatterPrivate> const d;
//@endcond
};
......
......@@ -57,11 +57,7 @@
{ \
} \
\
subclass::~subclass() { \
Q_D(subclass); \
delete d; \
d_ptr = nullptr; \
}
subclass::~subclass() = default;
// end kmime_mk_trivial_ctor_with_dptr
......@@ -101,11 +97,7 @@ Base::Base(BasePrivate *dd) :
{
}
Base::~Base()
{
delete d_ptr;
d_ptr = nullptr;
}
Base::~Base() = default;
void Base::from7BitString(const char *s, size_t len)
{
......@@ -161,12 +153,7 @@ Unstructured::Unstructured() : Base(new UnstructuredPrivate)
{
}
Unstructured::~Unstructured()
{
Q_D(Unstructured);
delete d;
d_ptr = nullptr;
}
Unstructured::~Unstructured() = default;
void Unstructured::from7BitString(const QByteArray &s)
{
......@@ -218,13 +205,7 @@ Structured::Structured() : Base(new StructuredPrivate)
}
kmime_mk_dptr_ctor(Structured, Base)
Structured::~Structured()
{
Q_D(Structured);
delete d;
d_ptr = nullptr;
}
Structured::~Structured() = default;
void Structured::from7BitString(const char *s, size_t len)
......@@ -1192,12 +1173,7 @@ Generic::Generic(const char *t, int len) : Generics::Unstructured(new GenericPri
setType(t, len);
}
Generic::~Generic()
{
Q_D(Generic);
delete d;
d_ptr = nullptr;
}
Generic::~Generic() = default;
void Generic::clear()
{
......
......@@ -35,7 +35,7 @@
#include <QVector>
#include <QByteArray>
#include <QMetaType>
#include <memory>
namespace KMime
{
......@@ -190,7 +190,7 @@ protected:
QByteArray typeIntro() const;
//@cond PRIVATE
BasePrivate *d_ptr;
std::unique_ptr<BasePrivate> const d_ptr;
kmime_mk_dptr_ctor(Base)
//@endcond
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment