summaryrefslogtreecommitdiff
path: root/plugin/src/Caelestia/service.hpp
blob: 6422b1f50345e40944fb6d6e137d3d2ad4ac6a5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include <qmutex.h>
#include <qobject.h>
namespace caelestia {

class Service : public QObject {
    Q_OBJECT

    Q_PROPERTY(int refCount READ refCount NOTIFY refCountChanged)

public:
    explicit Service(QObject* parent = nullptr);

    [[nodiscard]] int refCount();

    void ref();
    void unref();

signals:
    void refCountChanged();

private:
    int m_refCount;
    QMutex m_mutex;

    virtual void start() = 0;
    virtual void stop() = 0;
};

} // namespace caelestia