generated from Sithas/conan_template
Завершение контроллера
This commit is contained in:
@@ -9,19 +9,23 @@ namespace uad
|
||||
template <class Body, class Allocator, class ResponseType>
|
||||
class Controller : IController<Body, Allocator, ResponseType>
|
||||
{
|
||||
using HTTPMethodsToExecutors = std::unordered_map<boost::beast::http::verb, std::unique_ptr<IExecutor<Body, Allocator, ResponseType>>>;
|
||||
public:
|
||||
using HTTPMethodsToExecutors = std::unordered_map<boost::beast::http::verb, std::shared_ptr<IExecutor<Body, Allocator, ResponseType>>>;
|
||||
|
||||
private:
|
||||
HTTPMethodsToExecutors executors_;
|
||||
public:
|
||||
Controller() = default;
|
||||
|
||||
explicit Controller(HTTPMethodsToExecutors&& executors) {}
|
||||
explicit Controller(HTTPMethodsToExecutors&& executors): executors_(std::move(executors)) {}
|
||||
|
||||
std::optional<std::unique_ptr<IExecutor<Body, Allocator, ResponseType>>> FindExecutor(
|
||||
std::optional<std::shared_ptr<IExecutor<Body, Allocator, ResponseType>>> FindExecutor(
|
||||
boost::beast::http::verb method
|
||||
) const override
|
||||
) override
|
||||
{
|
||||
return std::nullopt;
|
||||
if (!executors_.count(method)) return std::nullopt;
|
||||
|
||||
return std::make_optional(executors_.at(method));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user