MythTV master
mythsystemprivate.h
Go to the documentation of this file.
1
2
3#ifndef MYTHSYSTEMPRIVATE_H_
4#define MYTHSYSTEMPRIVATE_H_
5
6// C header
7#include <cstdint> // for uint
8
9// Qt header
10#include <QPointer> // FIXME: QPointer is deprecated
11#include <QObject>
12
13// MythTV header
14#include "referencecounter.h"
15#include "mythbaseexp.h"
16#include "mythsystemlegacy.h"
17
18// FIXME: do we really need reference counting?
19// it shouldn't be difficult to track the lifetime of a private object.
20// FIXME: This should not live in the same header as MythSystemLegacy
21class MythSystemLegacyPrivate : public QObject, public ReferenceCounter
22{
23 Q_OBJECT
24
25 public:
26 explicit MythSystemLegacyPrivate(const QString &debugName);
27
28 virtual void Fork(std::chrono::seconds timeout) = 0;
29 virtual void Manage(void) = 0;
30
31 virtual void Term(bool force=false) = 0;
32 virtual void Signal(int sig) = 0;
33 virtual void JumpAbort(void) = 0;
34
35 virtual bool ParseShell(const QString &cmd, QString &abscmd,
36 QStringList &args) = 0;
37
38 protected:
39 // FIXME: QPointer uses global hash & is deprecated for good reason
40 QPointer<MythSystemLegacy> m_parent;
41
42 uint GetStatus(void) { return m_parent->GetStatus(); }
43 void SetStatus(uint status) { m_parent->SetStatus(status); }
44
45 // FIXME: We should not return a reference here
46 QString& GetLogCmd(void) { return m_parent->GetLogCmd(); }
47 // FIXME: We should not return a reference here
48 QString& GetDirectory(void) { return m_parent->GetDirectory(); }
49
50 bool GetSetting(const char *setting)
51 { return m_parent->GetSetting(setting); }
52
53 // FIXME: We should not return a reference here
54 QString& GetCommand(void) { return m_parent->GetCommand(); }
55 void SetCommand(const QString &cmd) { m_parent->SetCommand(cmd); }
56
57 // FIXME: We should not return a reference here
58 // FIXME: Rename "GetArguments"
59 QStringList &GetArgs(void) { return m_parent->GetArgs(); }
60 // FIXME: Rename "SetArguments"
61 void SetArgs(const QStringList &args) { m_parent->SetArgs(args); }
62
63 // FIXME: This is likely a bad idea, but possibly manageable
64 // since this is a private class.
65 QBuffer *GetBuffer(int index) { return m_parent->GetBuffer(index); }
66 // FIXME: This is likely a bad idea, but possibly manageable
67 // since this is a private class.
68 void Unlock(void) { if (m_parent) m_parent->Unlock(); }
69
70 signals:
71 void started(void);
72 void finished(void);
73 void error(uint status);
74 void readDataReady(int fd);
75};
76
77#endif // MYTHSYSTEMPRIVATE_H_
virtual void Fork(std::chrono::seconds timeout)=0
void readDataReady(int fd)
QString & GetCommand(void)
void SetArgs(const QStringList &args)
QBuffer * GetBuffer(int index)
bool GetSetting(const char *setting)
MythSystemLegacyPrivate(const QString &debugName)
void SetStatus(uint status)
virtual void Signal(int sig)=0
void error(uint status)
virtual void Term(bool force=false)=0
QPointer< MythSystemLegacy > m_parent
virtual bool ParseShell(const QString &cmd, QString &abscmd, QStringList &args)=0
QString & GetDirectory(void)
virtual void JumpAbort(void)=0
void SetCommand(const QString &cmd)
QStringList & GetArgs(void)
virtual void Manage(void)=0
General purpose reference counter.
unsigned int uint
Definition: freesurround.h:24