DtkCore
DTK Core module
dexportedinterface.h
1/*
2 * Copyright (C) 2017 ~ 2019 Deepin Technology Co., Ltd.
3 *
4 * Author: Chris Xiong <[email protected]>
5 *
6 * Maintainer: Chris Xiong <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef DEXPORTEDINTERFACE_H
23#define DEXPORTEDINTERFACE_H
24
25#include <dtkcore_global.h>
26#include <dobject.h>
27
28#include <QObject>
29
30#include <functional>
31
32DCORE_BEGIN_NAMESPACE
33
34namespace DUtil {
35class DExportedInterfacePrivate;
36class LIBDTKCORESHARED_EXPORT DExportedInterface : public QObject, public DObject
37{
38 Q_OBJECT
39public:
40 explicit DExportedInterface(QObject *parent = nullptr);
42
43 void registerAction(const QString &action, const QString &description, const std::function<QVariant(QString)> handler = nullptr);
44 virtual QVariant invoke(const QString &action, const QString &parameters) const;
45private:
46 D_DECLARE_PRIVATE(DExportedInterface)
47};
48}
49
50DCORE_END_NAMESPACE
51
52#endif
一些宏的定义.
Definition: dobject.h:38
Definition: dexportedinterface.h:37