diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-08-01 20:03:48 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-08-07 19:01:06 +0300 |
commit | 7db53790ca2d2c004bfd00b503eca59a8d084870 (patch) | |
tree | 5f6201d48322043e1f2802efddb28e5643a2dab7 /mod/page.hxx | |
parent | ee220058d977738c02ead45cc5567bbab33adf48 (diff) |
Add support for loading package version reviews
Diffstat (limited to 'mod/page.hxx')
-rw-r--r-- | mod/page.hxx | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/mod/page.hxx b/mod/page.hxx index 7329e2d..3455fe8 100644 --- a/mod/page.hxx +++ b/mod/page.hxx @@ -15,6 +15,7 @@ #include <libbrep/build.hxx> #include <libbrep/package.hxx> +#include <libbrep/review-manifest.hxx> // review_result #include <mod/diagnostics.hxx> #include <mod/options-types.hxx> // page_menu @@ -371,6 +372,48 @@ namespace brep const requirements& requirements_; }; + // Generate package versions reviews summary element. + // + class TR_REVIEWS_SUMMARY + { + public: + TR_REVIEWS_SUMMARY (const optional<reviews_summary>& rs, const string& u) + : reviews_ (rs), reviews_url_ (u) {} + + void + operator() (xml::serializer&) const; + + private: + const optional<reviews_summary>& reviews_; + const string& reviews_url_; + }; + + // Generate package versions reviews summary counter element. The passed + // review result denotes which kind of counter needs to be displayed and can + // only be fail or pass. + // + class TR_REVIEWS_COUNTER + { + public: + TR_REVIEWS_COUNTER (review_result r, + const optional<reviews_summary>& rs, + const string& u) + : result (r), + reviews_ (rs), + reviews_url_ (u) + { + assert (r == review_result::fail || r == review_result::pass); + } + + void + operator() (xml::serializer&) const; + + private: + review_result result; + const optional<reviews_summary>& reviews_; + const string& reviews_url_; + }; + // Generate url element. Strip the `<scheme>://` prefix from the link text. // class TR_URL |