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:
50 void handleReceiveData(const QSet<Feature> &data) override final;
51
56 QSet<Feature> supportedFeatures() override;
57
63 bool sendResuylt(const QVariantMap &result);
64
70 bool sendResuylt(const QString &result);
71
75 virtual void createApplication() = 0;
76
80 bool onStart() override = 0;
81
85 void onStop() override;
86
90 void onResume() override;
91
95 void onPause() override;
96
101 Controller *controller();
102
107 QCoreApplication *core();
108
113 void setCore(QCoreApplication *core);
114
115private:
116
117 void printDefaultHelp();
118
119 ServicePrivate *d_ptr = nullptr;
120 Controller *_controller = nullptr;
121
125 QCoreApplication *_core = nullptr;
126
127};
128
129}
130
131
132#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 ...