MythTV
master
mythtv
libs
libmythbase
mythplugin.h
Go to the documentation of this file.
1
#ifndef MYTHPLUGIN_H_
2
#define MYTHPLUGIN_H_
3
4
#include <utility>
5
6
// Qt headers
7
#include <QHash>
8
#include <QLibrary>
9
#include <QMap>
10
11
// MythTV headers
12
#include "
mythbaseexp.h
"
13
14
class
QSqlDatabase;
15
class
MythContext
;
16
class
QPainter;
17
18
enum
MythPluginType
: std::uint8_t {
19
kPluginType_Module
= 0
20
};
21
22
class
MythPlugin
:
public
QLibrary
23
{
24
public
:
25
MythPlugin
(
const
QString &libname, QString plugname)
26
: QLibrary(libname),
m_plugName
(std::move(plugname)) {}
27
~MythPlugin
()
override
=
default
;
28
29
// This method will call the mythplugin_init() function of the library.
30
int
init
(
const
char
*libversion);
31
32
// This method will call the mythplugin_run() function of the library.
33
int
run
(
void
);
34
35
// This method will call the mythplugin_config() function of the library.
36
int
config
(
void
);
37
38
// This method will call the mythplugin_type() function of the library.
39
// If such a function doesn't exist, it's a main module plugin.
40
MythPluginType
type
(
void
);
41
42
// This method will call the mythplugin_destroy() function of the library,
43
// if such a function exists.
44
void
destroy
(
void
);
45
46
bool
isEnabled
()
const
{
return
m_enabled
; }
47
void
setEnabled
(
bool
enable) {
m_enabled
= enable; }
48
49
int
getPosition
()
const
{
return
m_position
; }
50
void
setPosition
(
int
pos) {
m_position
= pos; }
51
52
QString
getName
(
void
) {
return
m_plugName
; }
53
54
private
:
55
bool
m_enabled
{
true
};
56
int
m_position
{0};
57
QString
m_plugName
;
58
QStringList
m_features
;
59
};
60
61
// this should only be instantiated through MythContext.
62
class
MBASE_PUBLIC
MythPluginManager
63
{
64
public
:
65
MythPluginManager
();
66
~
MythPluginManager
() =
default
;
67
68
bool
init_plugin(
const
QString &plugname);
69
bool
run_plugin(
const
QString &plugname);
70
bool
config_plugin(
const
QString &plugname);
71
bool
destroy_plugin(
const
QString &plugname);
72
73
MythPlugin
*GetPlugin(
const
QString &plugname);
74
75
QStringList EnumeratePlugins(
void
);
76
void
DestroyAllPlugins();
77
78
private
:
79
QHash<QString,MythPlugin*>
m_dict
;
80
81
QMap<QString, MythPlugin *>
m_moduleMap
;
82
};
83
84
#endif
MythPluginManager
Definition:
mythplugin.h:62
MythPlugin::run
int run(void)
Definition:
mythplugin.cpp:42
kPluginType_Module
@ kPluginType_Module
Definition:
mythplugin.h:19
MythPlugin::~MythPlugin
~MythPlugin() override=default
mythbaseexp.h
MythPlugin::type
MythPluginType type(void)
Definition:
mythplugin.cpp:71
MythPlugin
Definition:
mythplugin.h:22
MythContext
Startup context for MythTV.
Definition:
mythcontext.h:43
MythPlugin::MythPlugin
MythPlugin(const QString &libname, QString plugname)
Definition:
mythplugin.h:25
MythPlugin::destroy
void destroy(void)
Definition:
mythplugin.cpp:82
MythPluginManager::m_dict
QHash< QString, MythPlugin * > m_dict
Definition:
mythplugin.h:79
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition:
mythbaseexp.h:15
MythPlugin::m_enabled
bool m_enabled
Definition:
mythplugin.h:55
MythPlugin::setPosition
void setPosition(int pos)
Definition:
mythplugin.h:50
MythPlugin::getName
QString getName(void)
Definition:
mythplugin.h:52
MythPlugin::config
int config(void)
Definition:
mythplugin.cpp:55
MythPlugin::init
int init(const char *libversion)
Definition:
mythplugin.cpp:21
MythPluginManager::m_moduleMap
QMap< QString, MythPlugin * > m_moduleMap
Definition:
mythplugin.h:81
MythPlugin::m_features
QStringList m_features
Definition:
mythplugin.h:58
MythPluginType
MythPluginType
Definition:
mythplugin.h:18
MythPlugin::isEnabled
bool isEnabled() const
Definition:
mythplugin.h:46
MythPlugin::m_position
int m_position
Definition:
mythplugin.h:56
MythPlugin::m_plugName
QString m_plugName
Definition:
mythplugin.h:57
MythPlugin::setEnabled
void setEnabled(bool enable)
Definition:
mythplugin.h:47
MythPlugin::getPosition
int getPosition() const
Definition:
mythplugin.h:49
Generated on Sun Jan 5 2025 03:16:14 for MythTV by
1.8.17