| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
|---|---|
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef FRAMEWORK_H |
| 6 | #define FRAMEWORK_H |
| 7 | |
| 8 | #include "framework/framework_global.h" |
| 9 | #include "framework/lifecycle/lifecycle.h" |
| 10 | #include "framework/listener/listener.h" |
| 11 | #include "framework/event/eventcallproxy.h" |
| 12 | #include "framework/service/pluginservicecontext.h" |
| 13 | |
| 14 | #include <QObject> |
| 15 | |
| 16 | DPF_BEGIN_NAMESPACE |
| 17 | |
| 18 | class FrameworkPrivate; |
| 19 | |
| 20 | |
| 21 | /*! |
| 22 | * \brief The Framework class |
| 23 | */ |
| 24 | class DPF_EXPORT Framework |
| 25 | { |
| 26 | Q_DISABLE_COPY(Framework) |
| 27 | public: |
| 28 | static Framework &instance(); |
| 29 | |
| 30 | bool initialize(); |
| 31 | bool start(); |
| 32 | const LifeCycle &lifeCycle() const; |
| 33 | PluginServiceContext &serviceContext() const; |
| 34 | EventCallProxy &eventProxy() const; |
| 35 | private: |
| 36 | Framework(); |
| 37 | |
| 38 | Q_DECLARE_PRIVATE_D(qGetPtrHelper(d), Framework) |
| 39 | QScopedPointer<FrameworkPrivate> d; |
| 40 | }; |
| 41 | |
| 42 | |
| 43 | DPF_END_NAMESPACE |
| 44 | |
| 45 | #define dpfInstance ::dpf::Framework::instance() |
| 46 | #define dpfContext dpfInstance.serviceContext() |
| 47 | #define dpfGetService(T) dpfInstance.serviceContext().service<T>(T::name()) |
| 48 | |
| 49 | #endif // FRAMEWORK_H |
| 50 |