Patronum
Loading...
Searching...
No Matches
PServiceBase.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2025 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8#ifndef SERVICE_BASE_H
9#define SERVICE_BASE_H
10#include "Patronum_global.h"
11#include "PFeature.h"
12#include <IPService.h>
13#include <quasarapp.h>
14
15namespace Patronum {
16
17class ServicePrivate;
18class Controller;
19
24{
25public:
32 ServiceBase(int argc, char *argv[]);
33
34 ~ServiceBase() override;
35 // IService interface
36
41 virtual int exec();
42
43
44protected:
52 void handleReceiveData(const QHash<QString, Feature> &data) override;
53
58 QSet<Feature> supportedFeatures() override;
59
65 bool sendResuylt(const QVariantMap &result);
66
72 bool sendResuylt(const QString &result);
73
79 bool sendRawResuylt(const QByteArray &result);
80
84 virtual void createApplication() = 0;
85
89 bool onStart() override = 0;
90
94 void onStop() override;
95
99 void onResume() override;
100
104 void onPause() override;
105
110 Controller *controller();
111
116 QCoreApplication *core();
117
122 void setCore(QCoreApplication *core);
123
124private:
125
126 void printDefaultHelp();
127
128 ServicePrivate *d_ptr = nullptr;
129 Controller *_controller = nullptr;
130
134 QCoreApplication *_core = nullptr;
135
136};
137
138}
139
140
141#endif // SERVICE_BASE_H
#define PATRONUM_LIBRARYSHARED_EXPORT
The Controller class provide control functionality for your service.
Definition PController.h:57
The IService class is base interface of the service.
Definition IPService.h:22
The ServiceBase class This is Base service class. Please for create your own services use the Patronu...
virtual void createApplication()=0
createApplication Default implementation create a Application object and parse arguments.
bool onStart() override=0
onStart Called when get start command from terminal. Override this method work correctly work of serv...
The Patronum namespace - It is main name space of Patronum Library. The Patronum library support the ...