-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHttpService
More file actions
50 lines (39 loc) · 1.22 KB
/
HttpService
File metadata and controls
50 lines (39 loc) · 1.22 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Copyright (C) 2021 Frank Mertens.
*
* Distribution and use is allowed under the terms of the GNU General Public License version 3
* (see CoreComponents/LICENSE-gpl-3.0).
*
*/
#pragma once
#include <cc/HttpServiceConfigPrototype>
#include <cc/HttpServiceInstance>
namespace cc {
/** \class HttpService cc/HttpService
* \ingroup http_server
* \brief %Web service
*/
class HttpService: public Object
{
public:
/** Create a null delivery service
*/
HttpService() = default;
HttpServiceConfigPrototype configPrototype() const { return me().configPrototype(); }
HttpServiceInstance createInstance(const MetaObject &config) const { return me().createInstance(config); }
protected:
struct State: public Object::State
{
/** Provides the service's custom configuration prototype
*/
virtual HttpServiceConfigPrototype configPrototype() const = 0;
/** Creates a new service instance with given \a config
*/
virtual HttpServiceInstance createInstance(const MetaObject &config) const = 0;
};
explicit HttpService(State *newState):
Object{newState}
{}
const State &me() const { return Object::me.as<State>(); }
};
} // namespace cc