cutelyst  4.4.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
abstractfork.h
1 /*
2  * SPDX-FileCopyrightText: (C) 2017 Daniel Nicoletti <dantti12@gmail.com>
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 #ifndef ABSTRACTFORK_H
6 #define ABSTRACTFORK_H
7 
8 #include <QObject>
9 
10 class QTimer;
11 class QFileSystemWatcher;
12 class AbstractFork : public QObject
13 {
14  Q_OBJECT
15 public:
16  explicit AbstractFork(QObject *parent = nullptr);
17 
24  virtual bool continueMaster(int *exit = nullptr) = 0;
25 
30  virtual int exec(bool lazy, bool master) = 0;
31 
35  virtual void killChild() = 0;
36 
40  virtual void terminateChild() = 0;
41 
45  virtual void restart() = 0;
46 
47  void setTouchReload(const QStringList &paths);
48 
49  void installTouchReload();
50  void removeTouchReload();
51 
52 Q_SIGNALS:
53  void forked(int workerId);
54  void shutdown();
55 
56 protected:
57  void fileChanged(const QString &path);
58  void directoryChanged(const QString &path);
59 
60 private:
61  QStringList m_touchReloadPaths;
62  QFileSystemWatcher *m_touchReloadWatcher = nullptr;
63  QTimer *m_restartTimer = nullptr;
64 };
65 
66 #endif // ABSTRACTFORK_H
virtual void restart()=0
virtual bool continueMaster(int *exit=nullptr)=0
virtual int exec(bool lazy, bool master)=0
virtual void terminateChild()=0
virtual void killChild()=0
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const