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 // 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
21 class 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_
force
bool force
Definition: mythtv/programs/mythcommflag/main.cpp:72
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:55
MythSystemLegacyPrivate
-*- Mode: c++ -*-
Definition: mythsystemprivate.h:21
mythbaseexp.h
MythSystemLegacyPrivate::finished
void finished(void)
MythSystemLegacyPrivate::SetArgs
void SetArgs(const QStringList &args)
Definition: mythsystemprivate.h:61
MythSystemLegacyPrivate::MythSystemLegacyPrivate
MythSystemLegacyPrivate(const QString &debugName)
Definition: mythsystemlegacy.cpp:497
MythSystemLegacyPrivate::SetStatus
void SetStatus(uint status)
Definition: mythsystemprivate.h:43
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::GetLogCmd
QString & GetLogCmd(void)
Definition: mythsystemprivate.h:46
MythSystemLegacyPrivate::Signal
virtual void Signal(int sig)=0
MythSystemLegacyPrivate::Unlock
void Unlock(void)
Definition: mythsystemprivate.h:68
uint
unsigned int uint
Definition: compat.h:140
MythSystemLegacyPrivate::readDataReady
void readDataReady(int fd)
MythSystemLegacyPrivate::GetArgs
QStringList & GetArgs(void)
Definition: mythsystemprivate.h:59
referencecounter.h
MythSystemLegacyPrivate::GetSetting
bool GetSetting(const char *setting)
Definition: mythsystemprivate.h:50
MythSystemLegacyPrivate::GetBuffer
QBuffer * GetBuffer(int index)
Definition: mythsystemprivate.h:65
MythSystemLegacyPrivate::Fork
virtual void Fork(std::chrono::seconds timeout)=0
MythSystemLegacyPrivate::JumpAbort
virtual void JumpAbort(void)=0
MythSystemLegacyPrivate::error
void error(uint status)
MythSystemLegacyPrivate::GetStatus
uint GetStatus(void)
Definition: mythsystemprivate.h:42
MythSystemLegacyPrivate::GetDirectory
QString & GetDirectory(void)
Definition: mythsystemprivate.h:48
MythSystemLegacyPrivate::GetCommand
QString & GetCommand(void)
Definition: mythsystemprivate.h:54
MythSystemLegacyPrivate::m_parent
QPointer< MythSystemLegacy > m_parent
Definition: mythsystemprivate.h:40
MythSystemLegacyPrivate::Manage
virtual void Manage(void)=0
ReferenceCounter
General purpose reference counter.
Definition: referencecounter.h:26