MythTV
master
mythtv
libs
libmythmetadata
cleanup.h
Go to the documentation of this file.
1
#ifndef CLEANUP_H_
2
#define CLEANUP_H_
3
4
#include "
mythmetaexp.h
"
5
6
class
META_PUBLIC
CleanupProc
7
{
8
public
:
9
virtual
void
doClean() = 0;
10
virtual
~
CleanupProc
() =
default
;
11
};
12
13
class
META_PUBLIC
CleanupHooks
14
{
15
public
:
16
static
CleanupHooks
*getInstance();
17
18
public
:
19
void
addHook(
CleanupProc
*clean_proc);
20
void
removeHook(
CleanupProc
*clean_proc);
21
void
cleanup
();
22
23
private
:
24
CleanupHooks
();
25
~
CleanupHooks
();
26
class
CleanupHooksImp
*m_imp {
nullptr
};
27
};
28
29
template
<
typename
T>
30
class
META_PUBLIC
SimpleCleanup
:
public
CleanupProc
31
{
32
public
:
33
explicit
SimpleCleanup
(T *inst) : m_inst(inst)
34
{
35
CleanupHooks::getInstance
()->
addHook
(
this
);
36
}
37
38
~SimpleCleanup
()
override
39
{
40
CleanupHooks::getInstance
()->
removeHook
(
this
);
41
}
42
43
void
doClean
() override
// CleanupProc
44
{
45
m_inst->cleanup();
46
}
47
48
private
:
49
T *m_inst {
nullptr
};
50
};
51
52
#endif // CLEANUP_H_
SimpleCleanup::SimpleCleanup
SimpleCleanup(T *inst)
Definition:
cleanup.h:33
mythmetaexp.h
CleanupHooks::removeHook
void removeHook(CleanupProc *clean_proc)
Definition:
cleanup.cpp:56
SimpleCleanup
Definition:
cleanup.h:30
SimpleCleanup::doClean
void doClean() override
Definition:
cleanup.h:43
SimpleCleanup::~SimpleCleanup
~SimpleCleanup() override
Definition:
cleanup.h:38
CleanupProc
Definition:
cleanup.h:6
cleanup
static QString cleanup(const QString &str)
Definition:
remoteencoder.cpp:673
CleanupHooks
Definition:
cleanup.h:13
CleanupHooks::addHook
void addHook(CleanupProc *clean_proc)
Definition:
cleanup.cpp:51
CleanupHooksImp
Definition:
cleanup.cpp:6
META_PUBLIC
#define META_PUBLIC
Definition:
mythmetaexp.h:9
CleanupHooks::getInstance
static CleanupHooks * getInstance()
Definition:
cleanup.cpp:42
Generated on Tue Feb 18 2025 03:17:04 for MythTV by
1.8.17