cc_tools_qt
Common Environment for Protocol Analysis.
Loading...
Searching...
No Matches
PluginProperties.h
1//
2// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved.
3//
4
5// This file is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
19#pragma once
20
21#include <functional>
22
23#include <QtCore/QVariant>
24#include <QtCore/QVariantMap>
25#include <QtCore/QString>
26#include <QtCore/QMetaType>
27#include <QtCore/QList>
28
29#include "Socket.h"
30#include "Protocol.h"
31#include "Filter.h"
32#include "Api.h"
33
34class QAction;
35class QWidget;
36
37namespace cc_tools_qt
38{
39
42class CC_API PluginProperties
43{
44public:
46 using ListOfFilters = QList<FilterPtr>;
47
49 using ListOfGuiActions = QList<QAction*>;
50
53
56
58 using SocketCreateFunc = std::function<SocketPtr ()>;
59
61 using ProtocolCreateFunc = std::function<ProtocolPtr ()>;
62
64 using FiltersCreateFunc = std::function<ListOfFilters ()>;
65
70 using GuiActionsCreateFunc = std::function<ListOfGuiActions ()>;
71
76 using ConfigWidgetCreateFunc = std::function<QWidget* ()>;
77
81 PluginProperties& setSocketCreateFunc(SocketCreateFunc&& func);
82
86 PluginProperties& setProtocolCreateFunc(ProtocolCreateFunc&& func);
87
91 PluginProperties& setFiltersCreateFunc(FiltersCreateFunc&& func);
92
96 PluginProperties& setGuiActionsCreateFunc(GuiActionsCreateFunc&& func);
97
101 PluginProperties& setConfigWidgetCreateFunc(ConfigWidgetCreateFunc&& func);
102
106 PluginProperties& setCustomProperty(const QString& name, QVariant&& val);
107
109 SocketCreateFunc getSocketCreateFunc() const;
110
112 ProtocolCreateFunc getProtocolCreateFunc() const;
113
115 FiltersCreateFunc getFiltersCreateFunc() const;
116
118 GuiActionsCreateFunc getGuiActionsCreateFunc() const;
119
121 ConfigWidgetCreateFunc getConfigWidgetCreateFunc() const;
122
126 QVariant getCustomProperty(const QString& name) const;
127
128private:
129 QVariantMap m_props;
130};
131
132} // namespace cc_tools_qt
133
134Q_DECLARE_METATYPE(cc_tools_qt::PluginProperties::SocketCreateFunc);
139
140
Accumulation of various properties of Plugin.
Definition PluginProperties.h:43
~PluginProperties() noexcept
Destructor.
QList< QAction * > ListOfGuiActions
List of dynamically allocated QAction objects.
Definition PluginProperties.h:49
std::function< ListOfFilters()> FiltersCreateFunc
Type of callback to be used to allocate a Filter objects.
Definition PluginProperties.h:64
std::function< ListOfGuiActions()> GuiActionsCreateFunc
Type of callback to be used to allocate QAction to be displayed in the main toolbar of GUI applicatio...
Definition PluginProperties.h:70
std::function< SocketPtr()> SocketCreateFunc
Type of callback to be used to allocate a Socket object.
Definition PluginProperties.h:58
QList< FilterPtr > ListOfFilters
List of Filter objects.
Definition PluginProperties.h:46
std::function< ProtocolPtr()> ProtocolCreateFunc
Type of callback to be used to allocate a Protocol object.
Definition PluginProperties.h:61
std::function< QWidget *()> ConfigWidgetCreateFunc
Type of callback to be used when a widget responsible to configure the plugin needs to be allocated....
Definition PluginProperties.h:76
Main namespace for all classes / functions of the shared library.
std::shared_ptr< Socket > SocketPtr
Pointer to Socket object.
Definition Socket.h:246
std::shared_ptr< Protocol > ProtocolPtr
Pointer to Protocol object.
Definition Protocol.h:293