AnCH Framework 0.1
Another C++ Hack Framework
Loading...
Searching...
No Matches
endpointFunction.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3 Copyright (C) 2020 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <functional>
23#include <concepts>
24
25#include "rest/constants.hpp"
26#include "rest/request.hpp"
27#include "rest/response.hpp"
28
29
30namespace anch::rest {
31
42 public:
43 // Destructor +
47 virtual ~EndpointFunc();
48 // Destructor -
49
50 // Methods +
59 // Methods -
60 };
61
72
73 // Attributes +
74 private:
76 std::function<anch::rest::Response(const anch::rest::Request&)> _func;
77 // Attributes -
78
79 // Constructors +
80 public:
85
92 // Constructors -
93
94 // Destructor +
95 public:
100 // Destructor
101
102 // Methods +
103 public:
111 virtual anch::rest::Response execute(const anch::rest::Request& request) override;
112 // Methods -
113
114 };
115
127 template<typename... T>
129
130 // Attributes +
131 private:
133 std::function<anch::rest::Response(const anch::rest::Request&, T...)> _func;
134 // Attributes -
135
136 // Constructors +
137 public:
142
149 // Constructors -
150
151 // Destructors +
152 public:
157 // Destructors -
158
159 public:
160 // Methods +
168 virtual anch::rest::Response execute(const anch::rest::Request& request) override;
169 // Methods -
170 };
171
182 template<typename T>
183 T convertPathParam(const std::string& param);
184
185} // anch::rest
186
187#include "rest/impl/endpointFunction.hpp"
Endpoint function interface.
Definition endpointFunction.hpp:41
virtual anch::rest::Response execute(const anch::rest::Request &request)=0
EndpointParamsFunc(std::function< anch::rest::Response(const anch::rest::Request &, T...)> func)
virtual anch::rest::Response execute(const anch::rest::Request &request) override
EndpointSimpleFunc(std::function< anch::rest::Response(const anch::rest::Request &)> func)
virtual anch::rest::Response execute(const anch::rest::Request &request) override
HTTP request.
Definition request.hpp:43
HTTP response.
Definition response.hpp:45