TaskTree: Hide some parts of the API in protected/private sections

They are meant to be used from subclasses only.
For the private virtual TaskInterface::start() -
it's meant to be implemented from subclasses only,
but not to be called from them.

Change-Id: I526c40766c204c868b4b3c857a382b2b61bbadd0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-06-21 19:09:02 +02:00
parent 1e7f68e296
commit 434d677b3e

View File

@@ -26,12 +26,14 @@ class TASKING_EXPORT TaskInterface : public QObject
{
Q_OBJECT
public:
TaskInterface() = default;
virtual void start() = 0;
signals:
void done(bool success);
private:
template <typename Task> friend class TaskAdapter;
friend class TaskNode;
TaskInterface() = default;
virtual void start() = 0;
};
class TASKING_EXPORT TreeStorageBase
@@ -300,12 +302,14 @@ private:
template <typename Task>
class TaskAdapter : public TaskInterface
{
public:
protected:
using Type = Task;
TaskAdapter() = default;
Task *task() { return &m_task; }
const Task *task() const { return &m_task; }
private:
template <typename Adapter> friend class CustomTask;
Task m_task;
};