MythTV
master
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
#include "
qtuplift.h
"
8
9
class
QObject;
10
class
QMutex;
11
12
class
MBASE_PUBLIC
MythObservable
13
{
14
public
:
15
MythObservable
()
16
: m_lock(new QMutex()) {}
17
virtual
~
MythObservable
();
18
19
void
addListener(QObject *listener);
20
void
removeListener(QObject *listener);
21
22
void
dispatch(
const
MythEvent
&event);
23
24
bool
hasListeners
(
void
) {
return
!m_listeners.isEmpty(); }
25
26
private
:
27
Q_DISABLE_COPY_MOVE(
MythObservable
)
28
29
protected
:
30
QMutex *m_lock {
nullptr
};
31
QSet<QObject*>
m_listeners
;
32
};
33
34
#endif
/* MYTHOBSERVABLE_H */
mythevent.h
mythbaseexp.h
MythObservable
Superclass for making an object have a set of listeners.
Definition:
mythobservable.h:12
MythEvent
This class is used as a container for messages.
Definition:
mythevent.h:16
qtuplift.h
MythObservable::m_listeners
QSet< QObject * > m_listeners
Definition:
mythobservable.h:31
MBASE_PUBLIC
#define MBASE_PUBLIC
Definition:
mythbaseexp.h:15
MythObservable::hasListeners
bool hasListeners(void)
Definition:
mythobservable.h:24
MythObservable::MythObservable
MythObservable()
Definition:
mythobservable.h:15
Generated on Thu Jun 1 2023 03:21:28 for MythTV by
1.8.17