summaryrefslogtreecommitdiffstats
path: root/server/src/xml.cppm
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/xml.cppm')
-rw-r--r--server/src/xml.cppm28
1 files changed, 14 insertions, 14 deletions
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}