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(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(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_
virtual void Term(bool force=false)=0
void SetCommand(QString &cmd)
void error(uint status)
virtual void Manage(void)=0
General purpose reference counter.
void SetStatus(uint status)
unsigned int uint
Definition: compat.h:140
MythSystemLegacyPrivate(const QString &debugName)
void SetArgs(QStringList &args)
QStringList & GetArgs(void)
virtual bool ParseShell(const QString &cmd, QString &abscmd, QStringList &args)=0
virtual void JumpAbort(void)=0
bool GetSetting(const char *setting)
void readDataReady(int fd)
virtual void Fork(time_t timeout)=0
QString & GetDirectory(void)
virtual void Signal(int sig)=0
QBuffer * GetBuffer(int index)
QPointer< MythSystemLegacy > m_parent
QString & GetCommand(void)