Fix examples for clang-tidy, clang-format
This commit is contained in:
parent
2cd8bbdb60
commit
0f5d7f182b
3 changed files with 24 additions and 16 deletions
|
@ -1,8 +1,7 @@
|
|||
#include <cserver/components/cli/manager.hpp>
|
||||
#include <cserver/components/cli/struct.hpp>
|
||||
#include <cserver/server/server/server.hpp>
|
||||
#include <cserver/server/handlers/http_handler_base.hpp>
|
||||
|
||||
#include <cserver/server/server/server.hpp>
|
||||
|
||||
struct SomeStruct {
|
||||
static_assert(utempl::OpenStruct<SomeStruct>());
|
||||
|
@ -19,17 +18,16 @@ struct SomeOtherComponent : public cserver::server::handlers::HttpHandlerBaseWit
|
|||
static constexpr utempl::ConstexprString kName = "name";
|
||||
static constexpr utempl::ConstexprString kHandlerManagerName = "server";
|
||||
SomeComponent& some;
|
||||
inline constexpr SomeOtherComponent(auto& context) :
|
||||
HttpHandlerBaseWithAdder(context),
|
||||
some(context.template FindComponent<"component">()) {};
|
||||
explicit constexpr SomeOtherComponent(auto& context) :
|
||||
HttpHandlerBaseWithAdder(context), some(context.template FindComponent<"component">()) {};
|
||||
|
||||
inline auto HandleRequestThrow(const cserver::server::http::HttpRequest&) -> cserver::Task<cserver::server::http::HttpResponse> {
|
||||
co_return cserver::server::http::HttpResponse{.body = this->some.field};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
// clang-format off
|
||||
// NOLINTBEGIN
|
||||
auto main(int argc, const char** argv) -> int {
|
||||
cserver::ServiceContextBuilder{}
|
||||
.AppendConfigParam<"threads", 8>()
|
||||
|
@ -47,3 +45,5 @@ auto main(int argc, const char** argv) -> int {
|
|||
.Sort()
|
||||
.Run(argc, argv);
|
||||
};
|
||||
// NOLINTEND
|
||||
// clang-format on
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
#include <cserver/server/server/server.hpp>
|
||||
#include <cserver/engine/basic/task_processor.hpp>
|
||||
#include <cserver/server/handlers/http_handler_base.hpp>
|
||||
#include <cserver/server/server/server.hpp>
|
||||
|
||||
struct SomeComponent : public cserver::server::handlers::HttpHandlerBaseWithAdder<SomeComponent> {
|
||||
static constexpr utempl::ConstexprString kPath = "/v1/some/";
|
||||
static constexpr utempl::ConstexprString kName = "name";
|
||||
static constexpr utempl::ConstexprString kHandlerManagerName = "server";
|
||||
inline constexpr SomeComponent(auto& context) :
|
||||
HttpHandlerBaseWithAdder(context) {};
|
||||
explicit constexpr SomeComponent(auto& context) : HttpHandlerBaseWithAdder(context) {};
|
||||
|
||||
inline auto HandleRequestThrow(const cserver::server::http::HttpRequest& request) -> cserver::Task<cserver::server::http::HttpResponse> {
|
||||
co_return cserver::server::http::HttpResponse{.body = request.url.data()};
|
||||
};
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
// NOLINTBEGIN
|
||||
|
||||
auto main() -> int {
|
||||
cserver::ServiceContextBuilder{}
|
||||
.AppendConfigParam<"threads", 8>()
|
||||
|
@ -28,3 +30,6 @@ auto main() -> int {
|
|||
.Sort()
|
||||
.Run();
|
||||
};
|
||||
|
||||
// NOLINTEND
|
||||
// clang-format on
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <cserver/components/loggable_component_base.hpp>
|
||||
|
||||
|
||||
struct SomeComponent : cserver::ComponentBase {
|
||||
static constexpr utempl::ConstexprString kName = "component";
|
||||
using cserver::ComponentBase::ComponentBase;
|
||||
|
@ -10,7 +9,8 @@ struct SomeComponent : cserver::ComponentBase {
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
// clang-format off
|
||||
// NOLINTBEGIN
|
||||
auto main() -> int {
|
||||
cserver::ServiceContextBuilder{}
|
||||
.AppendConfigParam<"threads", 8>()
|
||||
|
@ -21,3 +21,6 @@ auto main() -> int {
|
|||
.Sort()
|
||||
.Run();
|
||||
};
|
||||
|
||||
// NOLINTEND
|
||||
// clang-format on
|
||||
|
|
Loading…
Reference in a new issue