From b0d7600970d2fdb1eb6fff813c7336ea34d4e228 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Fri, 28 Aug 2026 22:22:24 +0200 Subject: Indent tweaks --- server/src/srv.cppm | 58 +++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'server/src/srv.cppm') diff --git a/server/src/srv.cppm b/server/src/srv.cppm index 5763bc5..aef28f4 100644 --- a/server/src/srv.cppm +++ b/server/src/srv.cppm @@ -63,17 +63,17 @@ public: auto unwrap() -> gpx::file&& { return std::visit( - util::overloaded{ - [](std::exception_ptr ex) -> gpx::file&& - { - if (ex) - std::rethrow_exception(ex); - else - throw std::runtime_error{"no GPX file parse result available"}; + util::overloaded{ + [](std::exception_ptr ex) -> gpx::file&& + { + if (ex) + std::rethrow_exception(ex); + else + throw std::runtime_error{"no GPX file parse result available"}; + }, + [](gpx::file&& f) -> gpx::file&& { return std::move(f); }, }, - [](gpx::file&& f) -> gpx::file&& { return std::move(f); }, - }, - std::move(res_)); + std::move(res_)); } }; @@ -100,7 +100,7 @@ struct readable_gpx_body auto init(boost::optional /* n */, beast::error_code& ec) noexcept - -> void + -> void { try { @@ -114,9 +114,9 @@ struct readable_gpx_body } } - auto put( - beast::concepts::const_buffer_sequence auto b, - beast::error_code& ec) noexcept -> std::size_t + auto + put(beast::concepts::const_buffer_sequence auto b, + beast::error_code& ec) noexcept -> std::size_t { auto total = 0uz; try @@ -125,7 +125,9 @@ struct readable_gpx_body it != net::buffer_sequence_end(b); it++) { r_.put( - std::string_view{static_cast(it->data()), it->size()}); + std::string_view{ + static_cast(it->data()), it->size() + }); total += it->size(); } ec = {}; @@ -166,13 +168,13 @@ public: private: auto handle_process_gpx(l0_ctx ctx, http::readable_request r) - -> net::awaitable + -> net::awaitable { auto gpx_file = gpx::file{}; try { auto req = - co_await http::read_request(ctx, std::move(r)); + co_await http::read_request(ctx, std::move(r)); gpx_file = std::move(req->body().unwrap()); } catch (std::exception& ex) @@ -184,7 +186,7 @@ private: .type_uri = "https://routemon.fautchen.eu/problems/gpx-parse-failed", }; co_return http::problem_rsp( - ctx, tpl.instantiate(), http::keep_alive{false}); + ctx, tpl.instantiate(), http::keep_alive{false}); } // TODO: catch handler exceptions and return 500 when raised? @@ -199,11 +201,11 @@ private: "internal-server-error", }; co_return http::problem_rsp( - ctx, tpl.instantiate(), http::keep_alive{true}); + ctx, tpl.instantiate(), http::keep_alive{true}); } auto rsp = http::make_rsp( - bhttp::status::ok, http::keep_alive{true}); + bhttp::status::ok, http::keep_alive{true}); rsp.set(bhttp::field::content_type, "application/json"); rsp.body() = json::serialize(json::value_from(*mres)); rsp.prepare_payload(); @@ -211,14 +213,14 @@ private: } auto handle_sysinfo(l0_ctx ctx, http::readable_request r) - -> net::awaitable + -> net::awaitable { auto req = - co_await http::read_request(ctx, std::move(r)); + co_await http::read_request(ctx, std::move(r)); auto info = inner_.sysinfo(); auto rsp = http::make_rsp( - bhttp::status::ok, http::keep_alive{true}); + bhttp::status::ok, http::keep_alive{true}); rsp.set(bhttp::field::content_type, "application/json"); rsp.body() = json::serialize(json::value_from(info)); rsp.prepare_payload(); @@ -255,13 +257,13 @@ export class server http::server srv_; static auto make_global_middleware() - -> http::middleware_t + -> http::middleware_t { return http::middleware_compose< - http::base_ctx, http::trace_id_ctx, - http::trace_id_ctx>( - http::trace_id_middleware, - http::lax_cors_middleware>); + http::base_ctx, http::trace_id_ctx, + http::trace_id_ctx>( + http::trace_id_middleware, + http::lax_cors_middleware>); } public: -- cgit v1.3