From 2f222e1eebd321e87135124d4fe976640a2f2c21 Mon Sep 17 00:00:00 2001 From: sha512sum Date: Fri, 5 Apr 2024 15:21:14 +0000 Subject: [PATCH] Add Adder Helpers for HTTPHandlerBase --- .../cserver/server/handlers/http_handler_base.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/cserver/server/handlers/http_handler_base.hpp b/include/cserver/server/handlers/http_handler_base.hpp index 12a199c..3dd9b85 100644 --- a/include/cserver/server/handlers/http_handler_base.hpp +++ b/include/cserver/server/handlers/http_handler_base.hpp @@ -43,7 +43,19 @@ struct HTTPHandlerBase { co_await stream.Close(); }; inline constexpr HTTPHandlerBase(auto, auto&) {}; - +}; +template +struct HTTPHandlerAdder { + template + static consteval auto Adder(const auto& context) { + return HTTPHandlerBase::template Adder(context); + }; +}; +template +struct HTTPHandlerBaseWithAdder : HTTPHandlerBase, HTTPHandlerAdder { + inline constexpr HTTPHandlerBaseWithAdder(auto name, auto& context) : + HTTPHandlerBase(name, context), + HTTPHandlerAdder{} {}; }; } // namespace cserver::server::handlers