Commit 449e2e09 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use unique_ptr

parent b5beabdf
Pipeline #86899 passed with stage
in 4 minutes and 18 seconds
......@@ -73,7 +73,6 @@ Ber::Ber(const QByteArray &value)
Ber::~Ber()
{
ber_free(d->mBer, 1);
delete d;
}
Ber::Ber(const Ber &that)
......
......@@ -10,7 +10,7 @@
#include <QByteArray>
#include "kldap_export.h"
#include <memory>
// clazy:excludeall=copyable-polymorphic
namespace KLDAP
......@@ -109,6 +109,6 @@ public:
private:
class BerPrivate;
BerPrivate *const d;
std::unique_ptr<BerPrivate> const d;
};
}
......@@ -88,7 +88,6 @@ LdapConnection::LdapConnection(const LdapServer &server)
LdapConnection::~LdapConnection()
{
close();
delete d;
}
void LdapConnection::setUrl(const LdapUrl &url)
......
......@@ -8,6 +8,7 @@
#pragma once
#include <QString>
#include <memory>
#include "kldap_export.h"
#include "ldapserver.h"
......@@ -115,7 +116,7 @@ public:
private:
class LdapConnectionPrivate;
LdapConnectionPrivate *const d;
std::unique_ptr<LdapConnectionPrivate> const d;
Q_DISABLE_COPY(LdapConnection)
};
......
......@@ -109,10 +109,7 @@ LdapDN &LdapDN::operator=(const LdapDN &that)
return *this;
}
LdapDN::~LdapDN()
{
delete d;
}
LdapDN::~LdapDN() = default;
void LdapDN::clear()
{
......
......@@ -9,7 +9,7 @@
#include "kldap_export.h"
#include <QString>
#include <memory>
namespace KLDAP
{
class KLDAP_EXPORT LdapDN
......@@ -65,7 +65,7 @@ public:
private:
class LdapDNPrivate;
LdapDNPrivate *const d;
std::unique_ptr<LdapDNPrivate> const d;
};
}
......@@ -85,10 +85,7 @@ LdapOperation::LdapOperation(LdapConnection &conn)
setConnection(conn);
}
LdapOperation::~LdapOperation()
{
delete d;
}
LdapOperation::~LdapOperation() = default;
void LdapOperation::setConnection(LdapConnection &conn)
{
......
......@@ -19,6 +19,8 @@
#include <QList>
#include <QString>
#include <memory>
namespace KLDAP
{
/**
......@@ -264,7 +266,7 @@ public:
private:
class LdapOperationPrivate;
LdapOperationPrivate *const d;
std::unique_ptr<LdapOperationPrivate> const d;
Q_DISABLE_COPY(LdapOperation)
};
......
......@@ -253,7 +253,6 @@ LdapSearch::LdapSearch(LdapConnection &connection)
LdapSearch::~LdapSearch()
{
d->closeConnection();
delete d;
}
void LdapSearch::setConnection(LdapConnection &connection)
......
......@@ -126,7 +126,7 @@ Q_SIGNALS:
void result(KLDAP::LdapSearch *search);
private:
LdapSearchPrivate *const d;
std::unique_ptr<LdapSearchPrivate> const d;
Q_DISABLE_COPY(LdapSearch)
};
}
......
......@@ -67,10 +67,7 @@ LdapServer &LdapServer::operator=(const LdapServer &that)
return *this;
}
LdapServer::~LdapServer()
{
delete d;
}
LdapServer::~LdapServer() = default;
void LdapServer::clear()
{
......
......@@ -309,7 +309,7 @@ public:
private:
class LdapServerPrivate;
LdapServerPrivate *const d;
std::unique_ptr<LdapServerPrivate> const d;
};
}
KLDAP_EXPORT QDebug operator<<(QDebug d, const KLDAP::LdapServer &t);
......
......@@ -56,10 +56,7 @@ LdapUrl &LdapUrl::operator=(const LdapUrl &that)
return *this;
}
LdapUrl::~LdapUrl()
{
delete d;
}
LdapUrl::~LdapUrl() = default;
void LdapUrl::setDn(const LdapDN &dn)
{
......
......@@ -162,7 +162,7 @@ public:
private:
class LdapUrlPrivate;
LdapUrlPrivate *const d;
std::unique_ptr<LdapUrlPrivate> const d;
};
}
......@@ -52,10 +52,7 @@ Ldif &Ldif::operator=(const Ldif &that)
return *this;
}
Ldif::~Ldif()
{
delete d;
}
Ldif::~Ldif() = default;
QByteArray Ldif::assembleLine(const QString &fieldname, const QByteArray &value, uint linelen, bool url)
{
......
......@@ -169,7 +169,7 @@ public:
private:
class LdifPrivate;
LdifPrivate *const d;
std::unique_ptr<LdifPrivate> const d;
};
}
......@@ -128,10 +128,7 @@ AddHostDialog::AddHostDialog(KLDAP::LdapServer *server, QWidget *parent)
d->readConfig();
}
AddHostDialog::~AddHostDialog()
{
delete d;
}
AddHostDialog::~AddHostDialog() = default;
void AddHostDialog::slotHostEditChanged(const QString &text)
{
......
......@@ -35,7 +35,7 @@ private Q_SLOTS:
void slotOk();
private:
AddHostDialogPrivate *const d;
std::unique_ptr<AddHostDialogPrivate> const d;
};
}
......@@ -21,15 +21,15 @@
using namespace KLDAP;
class Q_DECL_HIDDEN LdapClient::Private
class Q_DECL_HIDDEN LdapClient::LdapClientPrivate
{
public:
Private(LdapClient *qq)
LdapClientPrivate(LdapClient *qq)
: q(qq)
{
}
~Private()
~LdapClientPrivate()
{
q->cancelQuery();
}
......@@ -60,16 +60,13 @@ public:
LdapClient::LdapClient(int clientNumber, QObject *parent)
: QObject(parent)
, d(new Private(this))
, d(new LdapClientPrivate(this))
{
d->mClientNumber = clientNumber;
d->mCompletionWeight = 50 - d->mClientNumber;
}
LdapClient::~LdapClient()
{
delete d;
}
LdapClient::~LdapClient() = default;
bool LdapClient::isActive() const
{
......@@ -144,17 +141,17 @@ void LdapClient::cancelQuery()
d->mActive = false;
}
void LdapClient::Private::slotData(KIO::Job *, const QByteArray &data)
void LdapClient::LdapClientPrivate::slotData(KIO::Job *, const QByteArray &data)
{
parseLDIF(data);
}
void LdapClient::Private::slotInfoMessage(KJob *, const QString &info, const QString &)
void LdapClient::LdapClientPrivate::slotInfoMessage(KJob *, const QString &info, const QString &)
{
qCDebug(LDAPCLIENT_LOG) << "Job said :" << info;
}
void LdapClient::Private::slotDone()
void LdapClient::LdapClientPrivate::slotDone()
{
endParseLDIF();
mActive = false;
......@@ -168,17 +165,17 @@ void LdapClient::Private::slotDone()
Q_EMIT q->done();
}
void LdapClient::Private::startParseLDIF()
void LdapClient::LdapClientPrivate::startParseLDIF()
{
mCurrentObject.clear();
mLdif.startParsing();
}
void LdapClient::Private::endParseLDIF()
void LdapClient::LdapClientPrivate::endParseLDIF()
{
}
void LdapClient::Private::finishCurrentObject()
void LdapClient::LdapClientPrivate::finishCurrentObject()
{
mCurrentObject.setDn(mLdif.dn());
KLDAP::LdapAttrValue objectclasses;
......@@ -228,7 +225,7 @@ void LdapClient::Private::finishCurrentObject()
mCurrentObject.clear();
}
void LdapClient::Private::parseLDIF(const QByteArray &data)
void LdapClient::LdapClientPrivate::parseLDIF(const QByteArray &data)
{
// qCDebug(LDAPCLIENT_LOG) <<"LdapClient::parseLDIF(" << QCString(data.data(), data.size()+1) <<" )";
if (!data.isEmpty()) {
......
......@@ -8,9 +8,9 @@
#pragma once
#include "kldap_export.h"
#include <QObject>
#include <QStringList>
#include <memory>
namespace KLDAP
{
......@@ -132,8 +132,8 @@ Q_SIGNALS:
private:
//@cond PRIVATE
class Private;
Private *const d;
class LdapClientPrivate;
std::unique_ptr<LdapClientPrivate> const d;
//@endcond
};
}
......
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