summaryrefslogtreecommitdiff
path: root/plugin/src/Caelestia/Services/service.hpp
blob: 7980bdde49936bb844237360d6ee66b27b63b1b3 (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() const;

    void ref();
    void unref();

signals:
    void refCountChanged();

private:
    int m_refCount;

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

} // namespace caelestia