summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/config.cpp4
-rw-r--r--server/src/database/sqlite3.cppm6
-rw-r--r--server/src/geo/utm_multizonal.cppm4
-rw-r--r--server/src/http/core/client.cppm2
-rw-r--r--server/src/http/core/common.cppm10
-rw-r--r--server/src/http/core/server.cppm42
-rw-r--r--server/src/http/ext/hmac_openssl.cppm1
-rw-r--r--server/src/http/handler.cpp2
-rw-r--r--server/src/locale.cppm2
-rw-r--r--server/src/log.cppm8
-rw-r--r--server/src/time.cppm34
-rw-r--r--server/src/util.cppm14
-rw-r--r--server/src/xml.cppm28
13 files changed, 78 insertions, 79 deletions
diff --git a/server/src/config.cpp b/server/src/config.cpp
index ec49aeb..4454781 100644
--- a/server/src/config.cpp
+++ b/server/src/config.cpp
@@ -80,7 +80,7 @@ public:
80 } 80 }
81 } 81 }
82 82
83 template <class T> 83 template <typename T>
84 auto allow_at(std::string_view key) -> std::optional<T> 84 auto allow_at(std::string_view key) -> std::optional<T>
85 { 85 {
86 visited_.emplace(key); 86 visited_.emplace(key);
@@ -103,7 +103,7 @@ public:
103 } 103 }
104 } 104 }
105 105
106 template <class T> 106 template <typename T>
107 auto expect_at(std::string_view key) -> T 107 auto expect_at(std::string_view key) -> T
108 { 108 {
109 if (auto&& mv = allow_at<T>(key); mv) 109 if (auto&& mv = allow_at<T>(key); mv)
diff --git a/server/src/database/sqlite3.cppm b/server/src/database/sqlite3.cppm
index 2216109..61c3257 100644
--- a/server/src/database/sqlite3.cppm
+++ b/server/src/database/sqlite3.cppm
@@ -12,18 +12,18 @@ extern "C"
12 12
13namespace routemon::database::sqlite3 { 13namespace routemon::database::sqlite3 {
14 14
15template <class T, template <class U> concept C> 15template <typename T, template <typename U> concept C>
16concept optional_of = requires { 16concept optional_of = requires {
17 typename T::value_type; 17 typename T::value_type;
18 requires std::same_as<T, std::optional<typename T::value_type>>; 18 requires std::same_as<T, std::optional<typename T::value_type>>;
19 requires C<typename T::value_type>; 19 requires C<typename T::value_type>;
20}; 20};
21 21
22template <class T> 22template <typename T>
23concept scannable_prim = std::same_as<T, std::string> || std::same_as<T, double> 23concept scannable_prim = std::same_as<T, std::string> || std::same_as<T, double>
24 || std::same_as<T, std::int64_t>; 24 || std::same_as<T, std::int64_t>;
25 25
26template <class T> 26template <typename T>
27concept scannable = scannable_prim<T> || optional_of<T, scannable_prim>; 27concept scannable = scannable_prim<T> || optional_of<T, scannable_prim>;
28 28
29class mutex_guard 29class mutex_guard
diff --git a/server/src/geo/utm_multizonal.cppm b/server/src/geo/utm_multizonal.cppm
index 56c6481..8886375 100644
--- a/server/src/geo/utm_multizonal.cppm
+++ b/server/src/geo/utm_multizonal.cppm
@@ -202,7 +202,7 @@ auto split_linestring_across_zones(utm::zonable_wgs84_linestring ls)
202 return splits; 202 return splits;
203} 203}
204 204
205template <class T> 205template <typename T>
206class linestring_rtree 206class linestring_rtree
207{ 207{
208public: 208public:
@@ -265,7 +265,7 @@ public:
265 } 265 }
266}; 266};
267 267
268template <class T> 268template <typename T>
269class point_rtree 269class point_rtree
270{ 270{
271public: 271public:
diff --git a/server/src/http/core/client.cppm b/server/src/http/core/client.cppm
index ada4f03..2bf1137 100644
--- a/server/src/http/core/client.cppm
+++ b/server/src/http/core/client.cppm
@@ -25,7 +25,7 @@ export class client
25public: 25public:
26 explicit client(net::io_context& ioc); 26 explicit client(net::io_context& ioc);
27 27
28 template <class ReqBody> 28 template <typename ReqBody>
29 auto do_request(bhttp::request<ReqBody>& req) 29 auto do_request(bhttp::request<ReqBody>& req)
30 -> bhttp::response<bhttp::dynamic_body> 30 -> bhttp::response<bhttp::dynamic_body>
31 { 31 {
diff --git a/server/src/http/core/common.cppm b/server/src/http/core/common.cppm
index e8fbe42..83d474f 100644
--- a/server/src/http/core/common.cppm
+++ b/server/src/http/core/common.cppm
@@ -12,23 +12,23 @@ namespace boost::beast {
12 12
13namespace concepts { 13namespace concepts {
14 14
15template <class T> 15template <typename T>
16concept buffers_generator = beast::is_buffers_generator<T>::value; 16concept buffers_generator = beast::is_buffers_generator<T>::value;
17 17
18template <class T> 18template <typename T>
19concept const_buffer_sequence = beast::is_const_buffer_sequence<T>::value; 19concept const_buffer_sequence = beast::is_const_buffer_sequence<T>::value;
20 20
21} // namespace concepts 21} // namespace concepts
22 22
23namespace http::concepts { 23namespace http::concepts {
24 24
25template <class T> 25template <typename T>
26concept fields = is_fields<T>::value; 26concept fields = is_fields<T>::value;
27 27
28template <class T> 28template <typename T>
29concept body = is_body<T>::value; 29concept body = is_body<T>::value;
30 30
31template <class T> 31template <typename T>
32concept body_reader = is_body_reader<T>::value; 32concept body_reader = is_body_reader<T>::value;
33 33
34} // namespace http::concepts 34} // namespace http::concepts
diff --git a/server/src/http/core/server.cppm b/server/src/http/core/server.cppm
index dbef975..19eb1c4 100644
--- a/server/src/http/core/server.cppm
+++ b/server/src/http/core/server.cppm
@@ -146,17 +146,17 @@ public:
146}; 146};
147static_assert(beast::concepts::buffers_generator<presponse>); 147static_assert(beast::concepts::buffers_generator<presponse>);
148 148
149template <class Ctx> 149template <typename Ctx>
150using next_handler_t = std::function<auto(Ctx)->net::awaitable<presponse>>; 150using next_handler_t = std::function<auto(Ctx)->net::awaitable<presponse>>;
151 151
152template <class OuterCtx, class InnerCtx> 152template <typename OuterCtx, typename InnerCtx>
153using middleware_t = 153using middleware_t =
154 std::function<auto( 154 std::function<auto(
155 OuterCtx, bhttp::request_header<bhttp::fields>&, 155 OuterCtx, bhttp::request_header<bhttp::fields>&,
156 next_handler_t<InnerCtx>) 156 next_handler_t<InnerCtx>)
157 ->net::awaitable<presponse>>; 157 ->net::awaitable<presponse>>;
158 158
159template <class Ctx> 159template <typename Ctx>
160auto id_middleware( 160auto id_middleware(
161 Ctx ctx, bhttp::request_header<bhttp::fields>&, next_handler_t<Ctx> next) 161 Ctx ctx, bhttp::request_header<bhttp::fields>&, next_handler_t<Ctx> next)
162 -> net::awaitable<presponse> 162 -> net::awaitable<presponse>
@@ -170,14 +170,14 @@ struct base_ctx
170 trace::id trace_id; 170 trace::id trace_id;
171}; 171};
172 172
173template <class Ctx> 173template <typename Ctx>
174using basic_route_handler_fn_t = 174using basic_route_handler_fn_t =
175 std::function<auto( 175 std::function<auto(
176 Ctx, readable_request, 176 Ctx, readable_request,
177 std::vector<std::string> const& matches) 177 std::vector<std::string> const& matches)
178 ->net::awaitable<presponse>>; 178 ->net::awaitable<presponse>>;
179 179
180template <class Ctx> 180template <typename Ctx>
181auto cors_middleware(std::vector<std::string> const& allow_origins) 181auto cors_middleware(std::vector<std::string> const& allow_origins)
182 -> middleware_t<Ctx, Ctx> 182 -> middleware_t<Ctx, Ctx>
183{ 183{
@@ -199,7 +199,7 @@ auto cors_middleware(std::vector<std::string> const& allow_origins)
199 }; 199 };
200} 200}
201 201
202template <class Ctx> 202template <typename Ctx>
203auto expose_trace_id_middleware( 203auto expose_trace_id_middleware(
204 Ctx ctx, bhttp::request_header<bhttp::fields>& req_hdr, 204 Ctx ctx, bhttp::request_header<bhttp::fields>& req_hdr,
205 next_handler_t<Ctx> next) -> net::awaitable<presponse> 205 next_handler_t<Ctx> next) -> net::awaitable<presponse>
@@ -214,7 +214,7 @@ auto expose_trace_id_middleware(
214 co_return std::move(prersp); 214 co_return std::move(prersp);
215} 215}
216 216
217template <class Ctx> 217template <typename Ctx>
218auto expose_content_language_middleware( 218auto expose_content_language_middleware(
219 Ctx ctx, bhttp::request_header<bhttp::fields>& req_hdr, 219 Ctx ctx, bhttp::request_header<bhttp::fields>& req_hdr,
220 next_handler_t<Ctx> next) -> net::awaitable<presponse> 220 next_handler_t<Ctx> next) -> net::awaitable<presponse>
@@ -297,17 +297,17 @@ auto read_empty_request(base_ctx const& ctx, readable_request&& r) -> net::
297 co_return r.p->release(); 297 co_return r.p->release();
298} 298}
299 299
300template <class InnerCtx> 300template <typename InnerCtx>
301struct routed_ctx : InnerCtx 301struct routed_ctx : InnerCtx
302{ 302{
303 verb_set route_methods; 303 verb_set route_methods;
304 boost::urls::url target; 304 boost::urls::url target;
305}; 305};
306 306
307template <class Ctx> 307template <typename Ctx>
308 requires requires(Ctx ctx) { 308 requires requires(Ctx ctx) {
309 // Ctx must be derived from an instantiation of routed_ctx 309 // Ctx must be derived from an instantiation of routed_ctx
310 []<class InnerCtx>(routed_ctx<InnerCtx> const&) {}(ctx); 310 []<typename InnerCtx>(routed_ctx<InnerCtx> const&) {}(ctx);
311 } 311 }
312auto default_options_handler( 312auto default_options_handler(
313 Ctx const& ctx, readable_request r, std::vector<std::string> const&) 313 Ctx const& ctx, readable_request r, std::vector<std::string> const&)
@@ -343,7 +343,7 @@ auto default_options_handler(
343auto global_options_handler(base_ctx const& ctx, readable_request r) 343auto global_options_handler(base_ctx const& ctx, readable_request r)
344 -> net::awaitable<presponse>; 344 -> net::awaitable<presponse>;
345 345
346template <class A, class B, class C> 346template <typename A, typename B, typename C>
347auto middleware_compose(middleware_t<A, B> ab, middleware_t<B, C> bc) 347auto middleware_compose(middleware_t<A, B> ab, middleware_t<B, C> bc)
348 -> middleware_t<A, C> 348 -> middleware_t<A, C>
349{ 349{
@@ -357,7 +357,7 @@ auto middleware_compose(middleware_t<A, B> ab, middleware_t<B, C> bc)
357 }; 357 };
358} 358}
359 359
360template <class A, class B> 360template <typename A, typename B>
361auto middleware_wrap_fn(middleware_t<A, B> ab, basic_route_handler_fn_t<B> fn) 361auto middleware_wrap_fn(middleware_t<A, B> ab, basic_route_handler_fn_t<B> fn)
362 -> basic_route_handler_fn_t<A> 362 -> basic_route_handler_fn_t<A>
363{ 363{
@@ -386,7 +386,7 @@ struct handler_map
386 V post = {}; 386 V post = {};
387 V put = {}; 387 V put = {};
388 388
389 template <class Self> 389 template <typename Self>
390 auto lookup(this Self&& self, supported_verb v) -> auto&& 390 auto lookup(this Self&& self, supported_verb v) -> auto&&
391 { 391 {
392 switch (v.value) 392 switch (v.value)
@@ -436,7 +436,7 @@ struct handler_map
436 } 436 }
437}; 437};
438 438
439template <class Ctx> 439template <typename Ctx>
440struct route_tree 440struct route_tree
441{ 441{
442 using leaves = handler_map<basic_route_handler_fn_t<Ctx>>; 442 using leaves = handler_map<basic_route_handler_fn_t<Ctx>>;
@@ -451,7 +451,7 @@ struct route_tree
451 std::variant<named_subtrees, wildcard_subtree> sub; 451 std::variant<named_subtrees, wildcard_subtree> sub;
452}; 452};
453 453
454template <class OuterCtx, class InnerCtx> 454template <typename OuterCtx, typename InnerCtx>
455auto middleware_wrap_tree( 455auto middleware_wrap_tree(
456 middleware_t<OuterCtx, InnerCtx> mw, route_tree<InnerCtx> const& tree) 456 middleware_t<OuterCtx, InnerCtx> mw, route_tree<InnerCtx> const& tree)
457 -> route_tree<OuterCtx> 457 -> route_tree<OuterCtx>
@@ -479,15 +479,15 @@ auto middleware_wrap_tree(
479 return {.here = new_leaves, .sub = new_sub}; 479 return {.here = new_leaves, .sub = new_sub};
480} 480}
481 481
482template <class T> 482template <typename T>
483concept match_arg = std::constructible_from<T, std::string const&>; 483concept match_arg = std::constructible_from<T, std::string const&>;
484 484
485template <class Ctx, match_arg... MatchArgs> 485template <typename Ctx, match_arg... MatchArgs>
486using route_handler_fn_t = 486using route_handler_fn_t =
487 std::function<auto(Ctx, readable_request, MatchArgs...) 487 std::function<auto(Ctx, readable_request, MatchArgs...)
488 ->net::awaitable<presponse>>; 488 ->net::awaitable<presponse>>;
489 489
490template <class Ctx, match_arg... MatchArgs> 490template <typename Ctx, match_arg... MatchArgs>
491auto degen_route_handler(route_handler_fn_t<Ctx, MatchArgs...> fn) 491auto degen_route_handler(route_handler_fn_t<Ctx, MatchArgs...> fn)
492 -> basic_route_handler_fn_t<Ctx> 492 -> basic_route_handler_fn_t<Ctx>
493{ 493{
@@ -505,10 +505,10 @@ auto degen_route_handler(route_handler_fn_t<Ctx, MatchArgs...> fn)
505 }; 505 };
506} 506}
507 507
508template <class Ctx, match_arg... MatchArgs> 508template <typename Ctx, match_arg... MatchArgs>
509struct ctree : route_tree<Ctx> 509struct ctree : route_tree<Ctx>
510{ 510{
511 template <class OuterCtx> 511 template <typename OuterCtx>
512 auto wrap(middleware_t<OuterCtx, Ctx> mw) const 512 auto wrap(middleware_t<OuterCtx, Ctx> mw) const
513 -> ctree<OuterCtx, MatchArgs...> 513 -> ctree<OuterCtx, MatchArgs...>
514 { 514 {
@@ -516,7 +516,7 @@ struct ctree : route_tree<Ctx>
516 } 516 }
517}; 517};
518 518
519template <class Ctx, match_arg... MatchArgs> 519template <typename Ctx, match_arg... MatchArgs>
520struct dtree : handler_map<route_handler_fn_t<Ctx, MatchArgs...>> 520struct dtree : handler_map<route_handler_fn_t<Ctx, MatchArgs...>>
521{ 521{
522 [[nodiscard]] auto to_leaves() const -> typename route_tree<Ctx>::leaves 522 [[nodiscard]] auto to_leaves() const -> typename route_tree<Ctx>::leaves
diff --git a/server/src/http/ext/hmac_openssl.cppm b/server/src/http/ext/hmac_openssl.cppm
index b196094..a175406 100644
--- a/server/src/http/ext/hmac_openssl.cppm
+++ b/server/src/http/ext/hmac_openssl.cppm
@@ -78,7 +78,6 @@ public:
78 ::EVP_MAC_free(mac_); 78 ::EVP_MAC_free(mac_);
79 } 79 }
80 80
81 // TODO: move to impl. unit.
82 auto init(boost::optional<std::uint64_t> n, beast::error_code& ec) noexcept 81 auto init(boost::optional<std::uint64_t> n, beast::error_code& ec) noexcept
83 -> void 82 -> void
84 { 83 {
diff --git a/server/src/http/handler.cpp b/server/src/http/handler.cpp
index d755c16..580e3f5 100644
--- a/server/src/http/handler.cpp
+++ b/server/src/http/handler.cpp
@@ -325,7 +325,7 @@ handler::handler(
325 325
326auto handler::make_routes() -> core::route_tree<core::routed_ctx<outer_ctx>> 326auto handler::make_routes() -> core::route_tree<core::routed_ctx<outer_ctx>>
327{ 327{
328 auto handler = [this]<class MemFn>(MemFn member) 328 auto handler = [this]<typename MemFn>(MemFn member)
329 { return std::bind_front(member, this); }; 329 { return std::bind_front(member, this); };
330 330
331 return core::dtree<core::routed_ctx<outer_ctx>>{}.named_subtrees({ 331 return core::dtree<core::routed_ctx<outer_ctx>>{}.named_subtrees({
diff --git a/server/src/locale.cppm b/server/src/locale.cppm
index 00a3d36..43e32c3 100644
--- a/server/src/locale.cppm
+++ b/server/src/locale.cppm
@@ -20,7 +20,7 @@ using blocale::translate;
20 20
21namespace routemon::locale { 21namespace routemon::locale {
22 22
23export template <class T> 23export template <typename T>
24concept locale_input_range = 24concept locale_input_range =
25 std::ranges::input_range<T> 25 std::ranges::input_range<T>
26 && std:: 26 && std::
diff --git a/server/src/log.cppm b/server/src/log.cppm
index 10c2d7a..22531d0 100644
--- a/server/src/log.cppm
+++ b/server/src/log.cppm
@@ -48,25 +48,25 @@ public:
48 [[nodiscard]] auto with(std::string const& k, std::string_view v) const 48 [[nodiscard]] auto with(std::string const& k, std::string_view v) const
49 -> logger; 49 -> logger;
50 50
51 template <class... Args> 51 template <typename... Args>
52 auto debug(std::format_string<Args...> fmt, Args&&... args) -> logger& 52 auto debug(std::format_string<Args...> fmt, Args&&... args) -> logger&
53 { 53 {
54 return log_at(level::debug, fmt.get(), std::make_format_args(args...)); 54 return log_at(level::debug, fmt.get(), std::make_format_args(args...));
55 } 55 }
56 56
57 template <class... Args> 57 template <typename... Args>
58 auto info(std::format_string<Args...> fmt, Args&&... args) -> logger& 58 auto info(std::format_string<Args...> fmt, Args&&... args) -> logger&
59 { 59 {
60 return log_at(level::info, fmt.get(), std::make_format_args(args...)); 60 return log_at(level::info, fmt.get(), std::make_format_args(args...));
61 } 61 }
62 62
63 template <class... Args> 63 template <typename... Args>
64 auto warn(std::format_string<Args...> fmt, Args&&... args) -> logger& 64 auto warn(std::format_string<Args...> fmt, Args&&... args) -> logger&
65 { 65 {
66 return log_at(level::warn, fmt.get(), std::make_format_args(args...)); 66 return log_at(level::warn, fmt.get(), std::make_format_args(args...));
67 } 67 }
68 68
69 template <class... Args> 69 template <typename... Args>
70 auto error(std::format_string<Args...> fmt, Args&&... args) -> logger& 70 auto error(std::format_string<Args...> fmt, Args&&... args) -> logger&
71 { 71 {
72 return log_at(level::error, fmt.get(), std::make_format_args(args...)); 72 return log_at(level::error, fmt.get(), std::make_format_args(args...));
diff --git a/server/src/time.cppm b/server/src/time.cppm
index 32df737..61f399b 100644
--- a/server/src/time.cppm
+++ b/server/src/time.cppm
@@ -4,12 +4,12 @@ import std;
4 4
5export namespace routemon::time { 5export namespace routemon::time {
6 6
7template <class Duration = std::chrono::utc_clock::duration> 7template <typename Duration = std::chrono::utc_clock::duration>
8using timestamp = std::chrono::time_point<std::chrono::utc_clock, Duration>; 8using timestamp = std::chrono::time_point<std::chrono::utc_clock, Duration>;
9 9
10auto iso8601_secs(timestamp<std::chrono::seconds> ts) -> std::string; 10auto iso8601_secs(timestamp<std::chrono::seconds> ts) -> std::string;
11 11
12template <class Duration> 12template <typename Duration>
13class period 13class period
14{ 14{
15 // Assuming [start, end). Unfortunately the DATEX II model is not 15 // Assuming [start, end). Unfortunately the DATEX II model is not
@@ -27,7 +27,7 @@ public:
27 [[nodiscard]] auto end() const -> timestamp<Duration>; 27 [[nodiscard]] auto end() const -> timestamp<Duration>;
28}; 28};
29 29
30template <class Duration> 30template <typename Duration>
31class period_seq 31class period_seq
32{ 32{
33 std::vector<period<Duration>> periods_; 33 std::vector<period<Duration>> periods_;
@@ -110,10 +110,10 @@ public:
110 [[nodiscard]] auto periods() const -> std::vector<period<Duration>> const&; 110 [[nodiscard]] auto periods() const -> std::vector<period<Duration>> const&;
111}; 111};
112 112
113template <class Duration> 113template <typename Duration>
114auto operator<<(std::ostream& os, period<Duration> const& p) -> std::ostream&; 114auto operator<<(std::ostream& os, period<Duration> const& p) -> std::ostream&;
115 115
116template <class Duration> 116template <typename Duration>
117auto operator<<(std::ostream& os, period_seq<Duration> const& ps) 117auto operator<<(std::ostream& os, period_seq<Duration> const& ps)
118 -> std::ostream&; 118 -> std::ostream&;
119 119
@@ -121,7 +121,7 @@ auto operator<<(std::ostream& os, period_seq<Duration> const& ps)
121 121
122namespace routemon::time { 122namespace routemon::time {
123 123
124template <class Duration> 124template <typename Duration>
125period<Duration>::period(timestamp<Duration> start, timestamp<Duration> end) 125period<Duration>::period(timestamp<Duration> start, timestamp<Duration> end)
126 : start_{start}, end_{end} 126 : start_{start}, end_{end}
127{ 127{
@@ -131,7 +131,7 @@ period<Duration>::period(timestamp<Duration> start, timestamp<Duration> end)
131 } 131 }
132} 132}
133 133
134template <class Duration> 134template <typename Duration>
135auto period<Duration>::intersect(period other) const -> std::optional<period> 135auto period<Duration>::intersect(period other) const -> std::optional<period>
136{ 136{
137 auto const new_start = start_ < other.start() ? other.start() : start_; 137 auto const new_start = start_ < other.start() ? other.start() : start_;
@@ -140,7 +140,7 @@ auto period<Duration>::intersect(period other) const -> std::optional<period>
140 : std::nullopt; 140 : std::nullopt;
141} 141}
142 142
143template <class Duration> 143template <typename Duration>
144auto period<Duration>::except(period other) const 144auto period<Duration>::except(period other) const
145 -> std::pair<std::optional<period>, std::optional<period>> 145 -> std::pair<std::optional<period>, std::optional<period>>
146{ 146{
@@ -156,19 +156,19 @@ auto period<Duration>::except(period other) const
156 return std::make_pair(before, after); 156 return std::make_pair(before, after);
157} 157}
158 158
159template <class Duration> 159template <typename Duration>
160auto period<Duration>::start() const -> timestamp<Duration> 160auto period<Duration>::start() const -> timestamp<Duration>
161{ 161{
162 return start_; 162 return start_;
163} 163}
164 164
165template <class Duration> 165template <typename Duration>
166auto period<Duration>::end() const -> timestamp<Duration> 166auto period<Duration>::end() const -> timestamp<Duration>
167{ 167{
168 return end_; 168 return end_;
169} 169}
170 170
171template <class Duration> 171template <typename Duration>
172period_seq<Duration>::period_seq(std::vector<period<Duration>> periods) 172period_seq<Duration>::period_seq(std::vector<period<Duration>> periods)
173 : periods_{std::move(periods)} 173 : periods_{std::move(periods)}
174{ 174{
@@ -185,13 +185,13 @@ period_seq<Duration>::period_seq(std::vector<period<Duration>> periods)
185 } 185 }
186} 186}
187 187
188template <class Duration> 188template <typename Duration>
189period_seq<Duration>::period_seq(period<Duration> singleton) 189period_seq<Duration>::period_seq(period<Duration> singleton)
190 : periods_{singleton} 190 : periods_{singleton}
191{ 191{
192} 192}
193 193
194template <class Duration> 194template <typename Duration>
195auto period_seq<Duration>::intersect(period_seq const& other) const 195auto period_seq<Duration>::intersect(period_seq const& other) const
196 -> period_seq 196 -> period_seq
197{ 197{
@@ -232,7 +232,7 @@ auto period_seq<Duration>::intersect(period_seq const& other) const
232 return period_seq{res}; 232 return period_seq{res};
233} 233}
234 234
235template <class Duration> 235template <typename Duration>
236auto period_seq<Duration>::except(period_seq const& other) const -> period_seq 236auto period_seq<Duration>::except(period_seq const& other) const -> period_seq
237{ 237{
238 // This code was pretty tricky to write, I wouldn't be surprised if it 238 // This code was pretty tricky to write, I wouldn't be surprised if it
@@ -281,20 +281,20 @@ auto period_seq<Duration>::except(period_seq const& other) const -> period_seq
281 return period_seq{res}; 281 return period_seq{res};
282} 282}
283 283
284template <class Duration> 284template <typename Duration>
285auto period_seq<Duration>::periods() const 285auto period_seq<Duration>::periods() const
286 -> std::vector<period<Duration>> const& 286 -> std::vector<period<Duration>> const&
287{ 287{
288 return periods_; 288 return periods_;
289} 289}
290 290
291template <class Duration> 291template <typename Duration>
292auto operator<<(std::ostream& os, period<Duration> const& p) -> std::ostream& 292auto operator<<(std::ostream& os, period<Duration> const& p) -> std::ostream&
293{ 293{
294 return os << "[" << p.start() << ", " << p.end() << ")"; 294 return os << "[" << p.start() << ", " << p.end() << ")";
295} 295}
296 296
297template <class Duration> 297template <typename Duration>
298auto operator<<(std::ostream& os, period_seq<Duration> const& ps) 298auto operator<<(std::ostream& os, period_seq<Duration> const& ps)
299 -> std::ostream& 299 -> std::ostream&
300{ 300{
diff --git a/server/src/util.cppm b/server/src/util.cppm
index 986e350..aedc120 100644
--- a/server/src/util.cppm
+++ b/server/src/util.cppm
@@ -7,7 +7,7 @@ import std;
7namespace routemon::util { 7namespace routemon::util {
8 8
9// For use with e.g. std::visit (on std::variant). 9// For use with e.g. std::visit (on std::variant).
10template <class... Ts> 10template <typename... Ts>
11struct overloaded : Ts... 11struct overloaded : Ts...
12{ 12{
13 using Ts::operator()...; 13 using Ts::operator()...;
@@ -48,7 +48,7 @@ constexpr auto parse_int(std::string_view s, int base = 10) noexcept
48 return x; 48 return x;
49} 49}
50 50
51template <class T> 51template <typename T>
52class aolist : public std::enable_shared_from_this<aolist<T>> 52class aolist : public std::enable_shared_from_this<aolist<T>>
53{ 53{
54 T v_; 54 T v_;
@@ -177,10 +177,10 @@ constexpr auto split_on(std::string_view s, char c)
177 return std::make_pair(s, std::nullopt); 177 return std::make_pair(s, std::nullopt);
178} 178}
179 179
180template <class T> 180template <typename T>
181class not_null; 181class not_null;
182 182
183template <class T> 183template <typename T>
184class not_null<T*> 184class not_null<T*>
185{ 185{
186 T* p_; 186 T* p_;
@@ -220,7 +220,7 @@ public:
220 220
221 auto operator->() const noexcept -> T* { return p_; } 221 auto operator->() const noexcept -> T* { return p_; }
222}; 222};
223template <class T> 223template <typename T>
224explicit not_null(T*) -> not_null<T*>; 224explicit not_null(T*) -> not_null<T*>;
225 225
226template <> 226template <>
@@ -248,7 +248,7 @@ explicit not_null(lazy_zstring_view s) -> not_null<lazy_zstring_view>;
248template <> 248template <>
249struct std::formatter<routemon::util::zstring_view, char> 249struct std::formatter<routemon::util::zstring_view, char>
250{ 250{
251 template <class ParseContext> 251 template <typename ParseContext>
252 constexpr auto parse(ParseContext& ctx) -> ParseContext::iterator 252 constexpr auto parse(ParseContext& ctx) -> ParseContext::iterator
253 { 253 {
254 auto it = ctx.begin(); 254 auto it = ctx.begin();
@@ -259,7 +259,7 @@ struct std::formatter<routemon::util::zstring_view, char>
259 return it; 259 return it;
260 } 260 }
261 261
262 template <class FmtContext> 262 template <typename FmtContext>
263 auto format(routemon::util::zstring_view s, FmtContext& ctx) const 263 auto format(routemon::util::zstring_view s, FmtContext& ctx) const
264 -> FmtContext::iterator 264 -> FmtContext::iterator
265 { 265 {
diff --git a/server/src/xml.cppm b/server/src/xml.cppm
index 2d186da..783b192 100644
--- a/server/src/xml.cppm
+++ b/server/src/xml.cppm
@@ -136,10 +136,10 @@ public:
136}; 136};
137static_assert(std::ranges::input_range<attribute_view>); 137static_assert(std::ranges::input_range<attribute_view>);
138 138
139template <class T> 139template <typename T>
140class promise; 140class promise;
141 141
142template <class T> 142template <typename T>
143struct [[clang::coro_await_elidable, clang::coro_return_type]] parser 143struct [[clang::coro_await_elidable, clang::coro_return_type]] parser
144{ 144{
145 using promise_type = promise<T>; 145 using promise_type = promise<T>;
@@ -204,7 +204,7 @@ using event = std::variant<
204 processing_instructions_event, xml_decl_event, eof_event 204 processing_instructions_event, xml_decl_event, eof_event
205>; 205>;
206 206
207template <class T> 207template <typename T>
208concept event_type = requires(event ev) { std::get<T>(ev); }; 208concept event_type = requires(event ev) { std::get<T>(ev); };
209 209
210class executor; 210class executor;
@@ -403,7 +403,7 @@ class executor
403 return std::exchange(ex_, nullptr); 403 return std::exchange(ex_, nullptr);
404 } 404 }
405 405
406 template <class T> 406 template <typename T>
407 friend class promise; 407 friend class promise;
408 408
409public: 409public:
@@ -453,7 +453,7 @@ public:
453 auto end() -> void; 453 auto end() -> void;
454}; 454};
455 455
456template <class T> 456template <typename T>
457class promise_returnable : public promise_base 457class promise_returnable : public promise_base
458{ 458{
459 std::optional<T> returned_value_; 459 std::optional<T> returned_value_;
@@ -462,7 +462,7 @@ public:
462 using result_type = T; 462 using result_type = T;
463 using promise_base::promise_base; 463 using promise_base::promise_base;
464 464
465 template <class U> 465 template <typename U>
466 auto return_value(U&& v) -> void 466 auto return_value(U&& v) -> void
467 { 467 {
468 returned_value_.emplace(std::forward<U>(v)); 468 returned_value_.emplace(std::forward<U>(v));
@@ -486,13 +486,13 @@ public:
486 auto return_void() -> void {} 486 auto return_void() -> void {}
487}; 487};
488 488
489template <class T> 489template <typename T>
490class promise : public promise_returnable<T> 490class promise : public promise_returnable<T>
491{ 491{
492public: 492public:
493 // Called with all the coroutine's arguments. 493 // Called with all the coroutine's arguments.
494 // Ignoring all but the first argument, which should be the executor. 494 // Ignoring all but the first argument, which should be the executor.
495 template <class... Args> 495 template <typename... Args>
496 explicit promise(executor_ref executor, Args&&...) 496 explicit promise(executor_ref executor, Args&&...)
497 : promise_returnable<T>{executor} 497 : promise_returnable<T>{executor}
498 { 498 {
@@ -566,7 +566,7 @@ public:
566 return awaiter{req.executor}; 566 return awaiter{req.executor};
567 } 567 }
568 568
569 template <class U> 569 template <typename U>
570 auto await_transform(parser<U> const& coro) 570 auto await_transform(parser<U> const& coro)
571 { 571 {
572 struct [[clang::coro_await_elidable]] awaiter 572 struct [[clang::coro_await_elidable]] awaiter
@@ -614,10 +614,10 @@ public:
614// Helpers for handling XML documents. Non-polymorphic functions 614// Helpers for handling XML documents. Non-polymorphic functions
615// should be marked inline to allow HALO across TU boundaries. 615// should be marked inline to allow HALO across TU boundaries.
616 616
617template <class T> 617template <typename T>
618concept unconstrained = true; 618concept unconstrained = true;
619 619
620template <class T, template <class U> concept C> 620template <typename T, template <typename U> concept C>
621concept parser_of = requires { 621concept parser_of = requires {
622 typename T::result_type; 622 typename T::result_type;
623 requires std::same_as<parser<typename T::result_type>, T>; 623 requires std::same_as<parser<typename T::result_type>, T>;
@@ -627,12 +627,12 @@ concept parser_of = requires {
627template <parser_of<unconstrained> T> 627template <parser_of<unconstrained> T>
628using parser_result_t = T::result_type; 628using parser_result_t = T::result_type;
629 629
630template <class T, class... Args> 630template <typename T, typename... Args>
631concept parser_invocable = 631concept parser_invocable =
632 std::invocable<T, Args...> 632 std::invocable<T, Args...>
633 && parser_of<std::invoke_result_t<T, Args...>, unconstrained>; 633 && parser_of<std::invoke_result_t<T, Args...>, unconstrained>;
634 634
635template <class Fn, class... Args> 635template <typename Fn, typename... Args>
636 requires parser_invocable<Fn, Args...> 636 requires parser_invocable<Fn, Args...>
637using parser_invoke_result_t = 637using parser_invoke_result_t =
638 parser_result_t<std::invoke_result_t<Fn, Args...>>; 638 parser_result_t<std::invoke_result_t<Fn, Args...>>;
@@ -833,7 +833,7 @@ inline auto read_string_contents(executor_ref e, attribute_view)
833template <auto f> 833template <auto f>
834auto hohalo() 834auto hohalo()
835{ 835{
836 return []<class... Args>( 836 return []<typename... Args>(
837 Args&&... args) -> std::invoke_result_t<decltype(f), Args...> 837 Args&&... args) -> std::invoke_result_t<decltype(f), Args...>
838 { co_return co_await f(std::forward<Args>(args)...); }; 838 { co_return co_await f(std::forward<Args>(args)...); };
839} 839}