Commit 7d6bbad6 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use std::unique_ptr

parent 12a62c79
Pipeline #87192 passed with stage
in 9 minutes and 44 seconds
......@@ -10,14 +10,14 @@
using namespace MailImporter;
class Q_DECL_HIDDEN FilterInfo::Private
class Q_DECL_HIDDEN FilterInfo::FilterInfoPrivate
{
public:
Private()
FilterInfoPrivate()
{
}
~Private()
~FilterInfoPrivate()
{
delete m_filterInfoGui;
m_filterInfoGui = nullptr;
......@@ -28,18 +28,15 @@ public:
static bool s_terminateASAP;
};
bool FilterInfo::Private::s_terminateASAP = false;
bool FilterInfo::FilterInfoPrivate::s_terminateASAP = false;
FilterInfo::FilterInfo()
: d(new Private)
: d(new FilterInfoPrivate)
{
Private::s_terminateASAP = false;
FilterInfoPrivate::s_terminateASAP = false;
}
FilterInfo::~FilterInfo()
{
delete d;
}
FilterInfo::~FilterInfo() = default;
void FilterInfo::setFilterInfoGui(FilterInfoGui *filterinfogui)
{
......@@ -119,12 +116,12 @@ void FilterInfo::alert(const QString &message)
void FilterInfo::terminateASAP()
{
Private::s_terminateASAP = true;
FilterInfoPrivate::s_terminateASAP = true;
}
bool FilterInfo::shouldTerminate() const
{
return Private::s_terminateASAP;
return FilterInfoPrivate::s_terminateASAP;
}
void FilterInfo::setRemoveDupMessage(bool removeDupMessage)
......
......@@ -9,6 +9,7 @@
#include "mailimporter_export.h"
#include <QString>
#include <memory>
class QWidget;
namespace MailImporter
{
......@@ -43,8 +44,8 @@ public:
Q_REQUIRED_RESULT bool removeDupMessage() const;
private:
class Private;
Private *const d;
class FilterInfoPrivate;
std::unique_ptr<FilterInfoPrivate> const d;
};
}
......@@ -18,17 +18,17 @@
using namespace MailImporter;
class Q_DECL_HIDDEN Filter::Private
class Q_DECL_HIDDEN Filter::FilterPrivate
{
public:
Private(const QString &_name, const QString &_author, const QString &_info)
FilterPrivate(const QString &_name, const QString &_author, const QString &_info)
: name(_name)
, author(_author)
, info(_info)
{
}
~Private()
~FilterPrivate()
{
}
......@@ -41,14 +41,11 @@ public:
};
Filter::Filter(const QString &name, const QString &author, const QString &info)
: d(new Private(name, author, info))
: d(new FilterPrivate(name, author, info))
{
}
Filter::~Filter()
{
delete d;
}
Filter::~Filter() = default;
void Filter::clear()
{
......
......@@ -18,6 +18,7 @@
#include <MailImporter/FilterImporterBase>
#include <QDir>
#include <memory>
namespace MailImporter
{
......@@ -60,8 +61,8 @@ protected:
importMessage(const QString &folderName, const QString &msgPath, bool duplicateCheck, const MessageStatus &status = MailImporter::MessageStatus());
private:
class Private;
Private *const d;
class FilterPrivate;
std::unique_ptr<FilterPrivate> const d;
};
}
......@@ -30,10 +30,7 @@ FilterBalsa::FilterBalsa()
}
/** Destructor. */
FilterBalsa::~FilterBalsa()
{
delete d;
}
FilterBalsa::~FilterBalsa() = default;
QString FilterBalsa::isMailerFound()
{
......
......@@ -7,6 +7,7 @@
#pragma once
#include "filters.h"
#include <memory>
namespace MailImporter
{
class FilterBalsaPrivate;
......@@ -32,7 +33,7 @@ private:
void processDirectory(const QString &path);
MailImporter::MessageStatus statusFromFile(const QString &filename);
FilterBalsaPrivate *const d;
std::unique_ptr<FilterBalsaPrivate> const d;
};
}
......@@ -30,10 +30,7 @@ FilterEvolution_v3::FilterEvolution_v3()
}
/** Destructor. */
FilterEvolution_v3::~FilterEvolution_v3()
{
delete d;
}
FilterEvolution_v3::~FilterEvolution_v3() = default;
QString FilterEvolution_v3::isMailerFound()
{
......
......@@ -31,7 +31,7 @@ private:
void processDirectory(const QString &path);
MailImporter::MessageStatus statusFromFile(const QString &filename);
FilterEvolution_v3Private *const d;
std::unique_ptr<FilterEvolution_v3Private> const d;
};
}
......@@ -38,10 +38,7 @@ FilterKMail_maildir::FilterKMail_maildir()
}
/** Destructor. */
FilterKMail_maildir::~FilterKMail_maildir()
{
delete d;
}
FilterKMail_maildir::~FilterKMail_maildir() = default;
/** Recursive import of KMail maildir. */
void FilterKMail_maildir::import()
......
......@@ -31,7 +31,7 @@ private:
void importDirContents(const QString &);
void importFiles(const QString &);
FilterKMail_maildirPrivate *const d;
std::unique_ptr<FilterKMail_maildirPrivate> const d;
};
}
......@@ -37,10 +37,7 @@ FilterKMailArchive::FilterKMailArchive()
{
}
FilterKMailArchive::~FilterKMailArchive()
{
delete d;
}
FilterKMailArchive::~FilterKMailArchive() = default;
// Input: .inbox.directory
// Output: inbox
......
......@@ -32,7 +32,7 @@ private:
Q_REQUIRED_RESULT bool importMessage(const KArchiveFile *file, const QString &folderPath);
int countFiles(const KArchiveDirectory *directory) const;
FilterKMailArchivePrivate *const d;
std::unique_ptr<FilterKMailArchivePrivate> const d;
};
}
......@@ -41,10 +41,7 @@ FilterLNotes::FilterLNotes()
}
/** Destructor. */
FilterLNotes::~FilterLNotes()
{
delete d;
}
FilterLNotes::~FilterLNotes() = default;
/**
* Recursive import of The Bat! maildir.
......
......@@ -25,7 +25,7 @@ public:
void import() override;
private:
FilterLNotesPrivate *const d;
std::unique_ptr<FilterLNotesPrivate> const d;
/**
* This is were all the real action is gonna be handled.
* Gets called once for EACH file imported
......
......@@ -33,10 +33,7 @@ FilterMailApp::FilterMailApp()
{
}
FilterMailApp::~FilterMailApp()
{
delete d;
}
FilterMailApp::~FilterMailApp() = default;
void FilterMailApp::import()
{
......
......@@ -28,7 +28,7 @@ public:
void importMails(const QString &maildir);
private:
FilterMailAppPrivate *const d;
std::unique_ptr<FilterMailAppPrivate> const d;
void traverseDirectory(const QString &);
};
}
......
......@@ -38,10 +38,7 @@ FilterSylpheed::FilterSylpheed()
}
/** Destructor. */
FilterSylpheed::~FilterSylpheed()
{
delete d;
}
FilterSylpheed::~FilterSylpheed() = default;
QString FilterSylpheed::isMailerFound()
{
......
......@@ -44,7 +44,7 @@ private:
void readMarkFile(const QString &, QHash<QString, unsigned long> &);
MailImporter::MessageStatus msgFlagsToString(unsigned long flags);
FilterSylpheedPrivate *const d;
std::unique_ptr<FilterSylpheedPrivate> const d;
};
}
......@@ -39,10 +39,7 @@ FilterTheBat::FilterTheBat()
}
/** Destructor. */
FilterTheBat::~FilterTheBat()
{
delete d;
}
FilterTheBat::~FilterTheBat() = default;
/** Recursive import of The Bat! maildir. */
void FilterTheBat::import()
......
......@@ -31,7 +31,7 @@ private:
void importDirContents(const QString &);
void importFiles(const QString &);
void processDirectory(const QString &path);
FilterTheBatPrivate *const d;
std::unique_ptr<FilterTheBatPrivate> const d;
};
}
Supports Markdown
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