File indexing completed on 2024-05-12 03:57:42

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 1999 Simon Hausmann <hausmann@kde.org>
0004     SPDX-FileCopyrightText: 1999 David Faure <faure@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef _KPARTS_PARTBASE_H
0010 #define _KPARTS_PARTBASE_H
0011 
0012 #include <kparts/kparts_export.h>
0013 
0014 #include <QObject>
0015 
0016 #include <KXMLGUIClient>
0017 #include <memory>
0018 
0019 // Internal:
0020 // As KParts::PartBase is inherited by KParts::Part which also inheriting from QObject,
0021 // which already has a protected d_ptr member, the macro Q_DECLARE_PRIVATE cannot be used
0022 // as it references d_ptr without any class qualifier, which is ambiguous then.
0023 #define KPARTS_DECLARE_PRIVATE(Class) Q_DECLARE_PRIVATE_D(PartBase::d_ptr, Class)
0024 
0025 namespace KParts
0026 {
0027 class PartBasePrivate;
0028 
0029 /**
0030  * @class PartBase partbase.h <KParts/PartBase>
0031  *
0032  * @short Base class for all parts.
0033  */
0034 class KPARTS_EXPORT PartBase : virtual public KXMLGUIClient
0035 {
0036     KPARTS_DECLARE_PRIVATE(PartBase)
0037 
0038 public:
0039     /**
0040      *  Constructor.
0041      */
0042     PartBase();
0043 
0044     /**
0045      *  Destructor.
0046      */
0047     ~PartBase() override;
0048 
0049     /**
0050      *  Internal method. Called by KParts::Part to specify the parent object for plugin objects.
0051      *
0052      * @internal
0053      */
0054     void setPartObject(QObject *object);
0055     QObject *partObject() const;
0056 
0057 protected:
0058     KPARTS_NO_EXPORT explicit PartBase(PartBasePrivate &dd);
0059 
0060     std::unique_ptr<PartBasePrivate> const d_ptr;
0061 
0062 private:
0063     Q_DISABLE_COPY(PartBase)
0064 };
0065 
0066 } // namespace
0067 
0068 #endif