MythTV
master
mythtv
libs
libmythbase
mythobservable.h
Go to the documentation of this file.
1
#ifndef MYTHOBSERVABLE_H_
2
#define MYTHOBSERVABLE_H_
3
4
#include <QSet>
5
#include "
mythevent.h
"
6
#include "
mythbaseexp.h
"
7
8
class
QObject;
9
class
QMutex;
10
11
class
MBASE_PUBLIC
MythObservable
12
{
13
public
:
14
MythObservable
()
15
: m_lock(new QMutex()) {}
16
virtual
~
MythObservable
();
17
18
void
addListener(QObject *listener);
19
void
removeListener(QObject *listener);
20
21
void
dispatch(
const
MythEvent
&event);
22
23
bool
hasListeners
(
void
) {
return
!m_listeners.isEmpty(); }
24
25
private
:
26
Q_DISABLE_COPY_MOVE(
MythObservable
)
27
28
protected
:
29
QMutex *m_lock {
nullptr
};
30
QSet<QObject*>
m_listeners
;
31
};
32
33
#endif
/* MYTHOBSERVABLE_H */
mythevent.h
mythbaseexp.h
MythObservable
Superclass for making an object have a set of listeners.
Definition:
mythobservable.h:11
MythEvent
This class is used as a container for messages.
Definition:
mythevent.h:16
MythObservable::m_listeners
QSet< QObject * > m_listeners
Definition:
mythobservable.h:30
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition:
mythbaseexp.h:15
MythObservable::hasListeners
bool hasListeners(void)
Definition:
mythobservable.h:23
MythObservable::MythObservable
MythObservable()
Definition:
mythobservable.h:14
Generated on Sun Jan 5 2025 03:16:14 for MythTV by
1.8.17