diff options
author | hjk <qthjk@ovi.com> | 2011-11-19 00:31:28 +0100 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@nokia.com> | 2011-11-21 13:14:41 +0100 |
commit | b868c7019f7b9339c9eff35ca1f1eb33f6eb6f49 (patch) | |
tree | 167762f45886deb8043a1169aecc2d67e4a3ca54 | |
parent | 7efffd39ff3369d788a710819882b936a194956c (diff) |
Remove pimpl_ptr.
Change-Id: I059b224d04898f9e2302bcc4e6a2b623f8559b74
Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
26 files changed, 41 insertions, 327 deletions
diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdjob.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdjob.cpp index d88380ffb..f1e297bde 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdjob.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdjob.cpp @@ -52,7 +52,7 @@ KDJob::KDJob( QObject* parent ) : QObject( parent ), d( new Private( this ) ) { } KDJob::~KDJob() { - //delete d; + delete d; } bool KDJob::autoDelete() const { diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdjob.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdjob.h index 1da7f1074..5122a8668 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdjob.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdjob.h @@ -23,9 +23,9 @@ #ifndef __KDTOOLS_CORE_KDJOB_H__ #define __KDTOOLS_CORE_KDJOB_H__ -#include <QObject> +#include "kdtoolsglobal.h" -#include <pimpl_ptr.h> +#include <QObject> class KDTOOLSCORE_EXPORT KDJob : public QObject { Q_OBJECT @@ -95,7 +95,7 @@ protected: private: class Private; friend class ::KDJob::Private; - kdtools::pimpl_ptr<Private> d; + Private *d; Q_PRIVATE_SLOT( d, void delayedStart() ) }; diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdlockfile.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdlockfile.cpp index 234bc448e..bc0562c09 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdlockfile.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdlockfile.cpp @@ -38,6 +38,7 @@ KDLockFile::KDLockFile( const QString& name ) KDLockFile::~KDLockFile() { + delete d; } bool KDLockFile::lock() diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdlockfile.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdlockfile.h index 3334f385f..2cc44c381 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdlockfile.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdlockfile.h @@ -23,7 +23,7 @@ #ifndef __KDTOOLSCORE_KDLOCKFILE_H__ #define __KDTOOLSCORE_KDLOCKFILE_H__ -#include <pimpl_ptr.h> +#include <kdtoolsglobal.h> QT_BEGIN_NAMESPACE class QString; @@ -43,7 +43,7 @@ public: private: Q_DISABLE_COPY(KDLockFile) class Private; - kdtools::pimpl_ptr< Private > d; + Private *d; }; #endif // __KDTOOLSCORE_KDLOCKFILE_H__ diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdrunoncechecker.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdrunoncechecker.cpp index 457a6215a..82cd4f153 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdrunoncechecker.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdrunoncechecker.cpp @@ -60,7 +60,7 @@ KDRunOnceChecker::KDRunOnceChecker( const QString& filename ) KDRunOnceChecker::~KDRunOnceChecker() { - + delete d; } class ProcessnameEquals diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdrunoncechecker.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdrunoncechecker.h index e7099c115..59f35639d 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdrunoncechecker.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdrunoncechecker.h @@ -23,7 +23,7 @@ #ifndef __KDTOOLS_RUNONCECHECKER_H__ #define __KDTOOLS_RUNONCECHECKER_H__ -#include <pimpl_ptr.h> +#include <kdtoolsglobal.h> #include <QtCore/QString> @@ -39,8 +39,7 @@ public: private: Q_DISABLE_COPY(KDRunOnceChecker) class Private; - kdtools::pimpl_ptr< Private > d; - + Private *d; }; #endif diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdsavefile.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdsavefile.cpp index 38a4b87bf..8c2a80f49 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdsavefile.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdsavefile.cpp @@ -217,6 +217,7 @@ KDSaveFile::KDSaveFile( const QString& filename, QObject* parent ) : QIODevice( } KDSaveFile::~KDSaveFile() { + delete d; } void KDSaveFile::close() { diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdsavefile.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdsavefile.h index 2dad832e8..1be9be857 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdsavefile.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdsavefile.h @@ -24,7 +24,6 @@ #define __KDTOOLSCORE_KDSAVEFILE_H__ #include <kdtoolsglobal.h> -#include <pimpl_ptr.h> #include <QtCore/QIODevice> #include <QtCore/QFile> @@ -77,7 +76,7 @@ private: private: class Private; - kdtools::pimpl_ptr<Private> d; + Private *d; }; #endif // __KDTOOLSCORE_KDSAVEFILE_H__ diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdselfrestarter.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdselfrestarter.cpp index fcd66f238..c739f82dc 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdselfrestarter.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdselfrestarter.cpp @@ -64,6 +64,7 @@ KDSelfRestarter::KDSelfRestarter( int argc, char** argv ) : d( new Private( argc KDSelfRestarter::~KDSelfRestarter() { Q_ASSERT_X( Private::instance == this, Q_FUNC_INFO, "Cannot create more than one KDSelfRestarter instance" ); + delete d; Private::instance = 0; } diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdselfrestarter.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdselfrestarter.h index 511cf042e..f1e1892a1 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdselfrestarter.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdselfrestarter.h @@ -23,7 +23,7 @@ #ifndef __KDTOOLSCORE_KDSELFRESTARTER_H__ #define __KDTOOLSCORE_KDSELFRESTARTER_H__ -#include <pimpl_ptr.h> +#include "kdtoolsglobal.h" class KDTOOLSCORE_EXPORT KDSelfRestarter { public: @@ -36,7 +36,7 @@ public: private: Q_DISABLE_COPY(KDSelfRestarter); class Private; - kdtools::pimpl_ptr<Private> d; + Private *d; }; #endif diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdtools.pri b/installerbuilder/libinstaller/3rdparty/kdtools/kdtools.pri index 663c62434..d1914f678 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdtools.pri +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdtools.pri @@ -6,8 +6,7 @@ CONFIG(shared, static|shared) { DEFINES += BUILD_SHARED_KDUPDATER } -HEADERS += $$PWD/pimpl_ptr.h \ - $$PWD/kdtoolsglobal.h \ +HEADERS += $$PWD/kdtoolsglobal.h \ $$PWD/kdjob.h \ $$PWD/kdgenericfactory.h \ $$PWD/kdselfrestarter.h \ @@ -16,8 +15,7 @@ HEADERS += $$PWD/pimpl_ptr.h \ $$PWD/kdlockfile.h \ $$PWD/kdsysinfo.h -SOURCES += $$PWD/pimpl_ptr.cpp \ - $$PWD/kdjob.cpp \ +SOURCES += $$PWD/kdjob.cpp \ $$PWD/kdgenericfactory.cpp \ $$PWD/kdselfrestarter.cpp \ $$PWD/kdsavefile.cpp \ diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatercrypto.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatercrypto.cpp index b5808c9c2..9e2d4bc83 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatercrypto.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatercrypto.cpp @@ -581,6 +581,7 @@ KDUpdaterCrypto::KDUpdaterCrypto() KDUpdaterCrypto::~KDUpdaterCrypto() { + delete d; } QByteArray KDUpdaterCrypto::privateKey() const diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatercrypto.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatercrypto.h index 426b1fa81..981d9b764 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatercrypto.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatercrypto.h @@ -24,8 +24,7 @@ #define __KDTOOLS_KDUPDATERCRYPTO_H__ #include "kdupdater.h" - -#include <pimpl_ptr.h> +#include "kdtoolsglobal.h" QT_BEGIN_NAMESPACE class QByteArray; @@ -95,7 +94,7 @@ class KDTOOLS_UPDATER_EXPORT KDUpdaterCrypto { private: class Private; - kdtools::pimpl_ptr< Private > d; + Private *d; }; #endif diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp index 2ff1e9a4d..b33d4acb7 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.cpp @@ -110,6 +110,7 @@ HashVerificationJob::HashVerificationJob(QObject* parent) HashVerificationJob::~HashVerificationJob() { + delete d; } void HashVerificationJob::setDevice(QIODevice* dev) @@ -254,6 +255,7 @@ KDUpdater::FileDownloader::FileDownloader(const QString &scheme, QObject* parent KDUpdater::FileDownloader::~FileDownloader() { + delete d; } void KDUpdater::FileDownloader::setUrl(const QUrl &url) @@ -1345,6 +1347,7 @@ SignatureVerificationDownloader::SignatureVerificationDownloader(FileDownloader* SignatureVerificationDownloader::~SignatureVerificationDownloader() { + delete d; } QUrl SignatureVerificationDownloader::signatureUrl() const diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.h index 0bf2060b3..929b5a191 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader.h @@ -24,7 +24,7 @@ #define KD_UPDATER_FILE_DOWNLOADER_H #include "kdupdater.h" -#include <pimpl_ptr.h> +#include "kdtoolsglobal.h" #include <QtCore/QObject> #include <QtCore/QUrl> @@ -132,7 +132,7 @@ namespace KDUpdater private: struct FileDownloaderData; - kdtools::pimpl_ptr<FileDownloaderData> d; + FileDownloaderData *d; }; } diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader_p.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader_p.h index 94447334a..42ef8c8b5 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader_p.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloader_p.h @@ -24,7 +24,6 @@ #define KD_UPDATER_FILE_DOWNLOADER_P_H #include "kdupdaterfiledownloader.h" -#include <pimpl_ptr.h> #include <QtCore/QCryptographicHash> #include <QtNetwork/QNetworkReply> @@ -69,7 +68,7 @@ namespace KDUpdater private: class Private; - kdtools::pimpl_ptr<Private> d; + Private *d; }; class LocalFileDownloader : public FileDownloader @@ -250,7 +249,7 @@ namespace KDUpdater private: class Private; - kdtools::pimpl_ptr<Private> d; + Private *d; }; } diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.cpp index cba271e96..c66ac5aee 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.cpp @@ -77,6 +77,7 @@ bool FileDownloaderFactory::followRedirects() FileDownloaderFactory::~FileDownloaderFactory() { + delete d; } /*! diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.h index 4c09f4173..d0e614bf3 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterfiledownloaderfactory.h @@ -24,7 +24,6 @@ #define KD_UPDATER_FILE_DOWNLOADER_FACTORY_H #include "kdupdater.h" -#include <pimpl_ptr.h> #include <kdgenericfactory.h> #include <QtCore/QStringList> @@ -64,7 +63,7 @@ namespace KDUpdater private: struct FileDownloaderFactoryData; - kdtools::pimpl_ptr<FileDownloaderFactoryData> d; + FileDownloaderFactoryData *d; }; } diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatersignatureverificationrunnable.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatersignatureverificationrunnable.cpp index 19c6337e4..1e00ca43f 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatersignatureverificationrunnable.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatersignatureverificationrunnable.cpp @@ -47,6 +47,7 @@ Runnable::Runnable() : QRunnable(), d( new Private ) { } Runnable::~Runnable() { + delete d; } @@ -95,6 +96,7 @@ SignatureVerificationRunnable::SignatureVerificationRunnable() : Runnable(), d( } SignatureVerificationRunnable::~SignatureVerificationRunnable() { + delete d; } const SignatureVerifier* SignatureVerificationRunnable::verifier() const { diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatersignatureverificationrunnable.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatersignatureverificationrunnable.h index 72d8cd88a..e9c322551 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatersignatureverificationrunnable.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdatersignatureverificationrunnable.h @@ -23,7 +23,8 @@ #ifndef KDUPDATERSIGNATUREVERIFICATIONJOB_H #define KDUPDATERSIGNATUREVERIFICATIONJOB_H -#include <pimpl_ptr.h> +#include <kdtoolsglobal.h> + #include <QtCore/QGenericArgument> #include <QtCore/QRunnable> @@ -59,7 +60,7 @@ namespace KDUpdater { private: class Private; - kdtools::pimpl_ptr<Private> d; + Private *d; }; class SignatureVerificationRunnable : public Runnable { @@ -80,7 +81,7 @@ namespace KDUpdater { private: class Private; - kdtools::pimpl_ptr<Private> d; + Private *d; }; } diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterufuncompressor.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterufuncompressor.cpp index f5c36e44f..42d40cfbc 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterufuncompressor.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterufuncompressor.cpp @@ -48,11 +48,13 @@ void UFUncompressor::Private::setError(const QString& msg) } UFUncompressor::UFUncompressor() + : d(new Private) { } UFUncompressor::~UFUncompressor() { + delete d; } QString UFUncompressor::errorString() const diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterufuncompressor_p.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterufuncompressor_p.h index 8f9f55356..1f2d31c94 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterufuncompressor_p.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterufuncompressor_p.h @@ -23,7 +23,7 @@ #ifndef __KDTOOLS_KDUPDATERUFUNCOMPRESSOR_P_H__ #define __KDTOOLS_KDUPDATERUFUNCOMPRESSOR_P_H__ -#include <pimpl_ptr.h> +#include <kdtoolsglobal.h> #include <QtCore/QCoreApplication> @@ -53,7 +53,7 @@ namespace KDUpdater private: class Private; - kdtools::pimpl_ptr< Private > d; + Private *d; }; } diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterupdateoperationfactory.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterupdateoperationfactory.cpp index 076af5273..d603f3edb 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterupdateoperationfactory.cpp +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterupdateoperationfactory.cpp @@ -80,6 +80,7 @@ UpdateOperationFactory::UpdateOperationFactory() UpdateOperationFactory::~UpdateOperationFactory() { + delete d; } /*! diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterupdateoperationfactory.h b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterupdateoperationfactory.h index 915d4968d..834ac1394 100644 --- a/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterupdateoperationfactory.h +++ b/installerbuilder/libinstaller/3rdparty/kdtools/kdupdaterupdateoperationfactory.h @@ -26,7 +26,6 @@ #include <kdgenericfactory.h> #include "kdupdater.h" -#include <pimpl_ptr.h> namespace KDUpdater { @@ -58,7 +57,7 @@ namespace KDUpdater private: struct UpdateOperationFactoryData; - kdtools::pimpl_ptr<UpdateOperationFactoryData> d; + UpdateOperationFactoryData *d; }; } diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/pimpl_ptr.cpp b/installerbuilder/libinstaller/3rdparty/kdtools/pimpl_ptr.cpp deleted file mode 100644 index 1a7f017a1..000000000 --- a/installerbuilder/libinstaller/3rdparty/kdtools/pimpl_ptr.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/**************************************************************************** -** Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. All rights reserved. -** -** This file is part of the KD Tools library. -** -** Licensees holding valid commercial KD Tools licenses may use this file in -** accordance with the KD Tools Commercial License Agreement provided with -** the Software. -** -** -** This file may be distributed and/or modified under the terms of the -** GNU Lesser General Public License version 2 and version 3 as published by the -** Free Software Foundation and appearing in the file LICENSE.LGPL included. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** Contact info@kdab.com if any conditions of this licensing are not -** clear to you. -** -**********************************************************************/ - -#include "pimpl_ptr.h" - -/*! - \class pimpl_ptr: - \ingroup core smartptr - \brief Owning pointer for private implementations - \since_c 2.1 - - (The exception safety of this class has not been evaluated yet.) - - pimpl_ptr is a smart immutable pointer, which owns the contained object. Unlike other smart pointers, - it creates a standard constructed object when instanciated via the - \link pimpl_ptr() standard constructor\endlink. - Additionally, pimpl_ptr respects constness of the pointer object and returns \c const \c T* for - a const pimpl_ptr object. - - The content of a pimpl_ptr cannot be changed during it's lifetime. - - \section general-use General Use - - The general use case of pimpl_ptr is the "Pimpl Idiom", i.e. hiding the private implementation of a class - from the user's compiler which see \c MyClass as - - \code - class MyClass - { - public: - MyClass(); - ~MyClass(); - - // public class API - int value() const; - - private: - class Private; // defined later - kdtools::pimpl_ptr< Private > d; - }; - \endcode - - but not the private parts of it. These can only be seen (and accessed) by the code knowing \c MyClass::Private: - - \code - class MyClass::Private - { - public: - int value; - }; - - MyClass::MyClass() - { - // d was automatically filled with new Private - d->value = 42; - } - - MyClass::~MyClass() - { - // the content of d gets deleted automatically - } - - int MyClass::value() const - { - // access the private part: - // since MyClass::value() is const, the returned pointee is const, too - return d->value; - } - \endcode - -*/ - -/*! - \fn pimpl_ptr::pimpl_ptr() - - Default constructor. Constructs a pimpl_tr that contains (owns) a standard constructed - instance of \c T. - - \post \c *this owns a new object. -*/ - -/*! - \fn pimpl_ptr::pimpl_ptr( T * t ) - - Constructor. Constructs a pimpl_ptr that contains (owns) \a t. - - \post get() == obj -*/ - -/*! - \fn pimpl_ptr::~pimpl_ptr() - - Destructor. - - \post The object previously owned by \c *this has been deleted. -*/ - -/*! - \fn const T * pimpl_ptr::get() const - - \returns a const pointer to the contained (owned) object. - \overload -*/ - -/*! - \fn T * pimpl_ptr::get() - - \returns a pointer to the contained (owned) object. -*/ - -/*! - \fn const T & pimpl_ptr::operator*() const - - Dereference operator. Returns \link get() *get()\endlink. - \overload -*/ - -/*! - \fn T & pimpl_ptr::operator*() - - Dereference operator. Returns \link get() *get()\endlink. -*/ - -/*! - \fn const T * pimpl_ptr::operator->() const - - Member-by-pointer operator. Returns get(). - \overload -*/ - -/*! - \fn T * pimpl_ptr::operator->() - - Member-by-pointer operator. Returns get(). -*/ - -#ifdef KDTOOLSCORE_UNITTESTS - -#include <KDUnitTest/test.h> - -#include <QObject> -#include <QPointer> - -namespace -{ - struct ConstTester - { - bool isConst() - { - return false; - } - - bool isConst() const - { - return true; - } - }; -} - -KDAB_UNITTEST_SIMPLE( pimpl_ptr, "kdcoretools" ) { - - { - kdtools::pimpl_ptr< QObject > p; - assertNotNull( p.get() ); - assertNull( p->parent() ); - } - - - { - QPointer< QObject > o; - { - kdtools::pimpl_ptr< QObject > qobject( new QObject ); - o = qobject.get(); - assertEqual( o, qobject.operator->() ); - assertEqual( o, &(qobject.operator*()) ); - } - assertNull( o ); - } - - { - const kdtools::pimpl_ptr< QObject > qobject( new QObject ); - const QObject* o = qobject.get(); - assertEqual( o, qobject.operator->() ); - assertEqual( o, &(qobject.operator*()) ); - } - - { - kdtools::pimpl_ptr< QObject > o1; - assertTrue( o1 ); - kdtools::pimpl_ptr< QObject > o2( 0 ); - assertFalse( o2 ); - } - - { - const kdtools::pimpl_ptr< ConstTester > o1; - kdtools::pimpl_ptr< ConstTester > o2; - assertTrue( o1->isConst() ); - assertFalse( o2->isConst() ); - assertTrue( (*o1).isConst() ); - assertFalse( (*o2).isConst() ); - assertTrue( o1.get()->isConst() ); - assertFalse( o2.get()->isConst() ); - } -} - -#endif // KDTOOLSCORE_UNITTESTS diff --git a/installerbuilder/libinstaller/3rdparty/kdtools/pimpl_ptr.h b/installerbuilder/libinstaller/3rdparty/kdtools/pimpl_ptr.h deleted file mode 100644 index fa0043217..000000000 --- a/installerbuilder/libinstaller/3rdparty/kdtools/pimpl_ptr.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. All rights reserved. -** -** This file is part of the KD Tools library. -** -** Licensees holding valid commercial KD Tools licenses may use this file in -** accordance with the KD Tools Commercial License Agreement provided with -** the Software. -** -** -** This file may be distributed and/or modified under the terms of the -** GNU Lesser General Public License version 2 and version 3 as published by the -** Free Software Foundation and appearing in the file LICENSE.LGPL included. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** Contact info@kdab.com if any conditions of this licensing are not -** clear to you. -** -**********************************************************************/ - -#ifndef __KDTOOLSCORE__PIMPL_PTR_H__ -#define __KDTOOLSCORE__PIMPL_PTR_H__ - -#include <kdtoolsglobal.h> - -#ifndef DOXYGEN_RUN -namespace kdtools { -#endif - - template <typename T> - class pimpl_ptr { - T * d; - public: - pimpl_ptr() : d( new T ) {} - explicit pimpl_ptr( T * t ) : d( t ) {} - ~pimpl_ptr() { delete d; d = 0; } - - T * get() { return d; } - const T * get() const { return d; } - - T * operator->() { return get(); } - const T * operator->() const { return get(); } - - T & operator*() { return *get(); } - const T & operator*() const { return *get(); } - - private: - pimpl_ptr( const pimpl_ptr & ); - void operator=( const pimpl_ptr & ); - }; - - // these are not implemented, so's we can catch their use at - // link-time. Leaving them undeclared would open up a comparison - // via operator unspecified-bool-type(). - template <typename T, typename S> - void operator==( const pimpl_ptr<T> &, const pimpl_ptr<S> & ); - template <typename T, typename S> - void operator!=( const pimpl_ptr<T> &, const pimpl_ptr<S> & ); - -#ifndef DOXYGEN_RUN -} // namespace kdtools -#endif - -#endif /* __KDTOOLSCORE__PIMPL_PTR_H__ */ - |