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