aboutsummaryrefslogtreecommitdiff
path: root/libbrep/review-manifest.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-08-01 20:03:48 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-08-07 19:01:06 +0300
commit7db53790ca2d2c004bfd00b503eca59a8d084870 (patch)
tree5f6201d48322043e1f2802efddb28e5643a2dab7 /libbrep/review-manifest.hxx
parentee220058d977738c02ead45cc5567bbab33adf48 (diff)
Add support for loading package version reviews
Diffstat (limited to 'libbrep/review-manifest.hxx')
-rw-r--r--libbrep/review-manifest.hxx80
1 files changed, 80 insertions, 0 deletions
diff --git a/libbrep/review-manifest.hxx b/libbrep/review-manifest.hxx
new file mode 100644
index 0000000..260fdec
--- /dev/null
+++ b/libbrep/review-manifest.hxx
@@ -0,0 +1,80 @@
+// file : libbrep/review-manifest.hxx -*- C++ -*-
+// license : MIT; see accompanying LICENSE file
+
+#ifndef LIBBREP_REVIEW_MANIFEST_HXX
+#define LIBBREP_REVIEW_MANIFEST_HXX
+
+#include <libbutl/manifest-forward.hxx>
+
+#include <libbpkg/manifest.hxx>
+
+#include <libbrep/types.hxx>
+#include <libbrep/utility.hxx>
+
+namespace brep
+{
+ enum class review_result: uint8_t
+ {
+ pass,
+ fail,
+ unchanged
+ };
+
+ string
+ to_string (review_result);
+
+ review_result
+ to_review_result (const string&); // May throw invalid_argument.
+
+ inline ostream&
+ operator<< (ostream& os, review_result r)
+ {
+ return os << to_string (r);
+ }
+
+ struct review_aspect
+ {
+ string name; // code, build, test, doc, etc
+ review_result result;
+ };
+
+ class review_manifest
+ {
+ public:
+ string reviewed_by;
+ vector<review_aspect> results;
+ optional<bpkg::version> base_version;
+ optional<url> details_url;
+
+ review_manifest (string r,
+ vector<review_aspect> rs,
+ optional<bpkg::version> bv,
+ optional<url> u)
+ : reviewed_by (move (r)),
+ results (move (rs)),
+ base_version (move (bv)),
+ details_url (move (u)) {}
+
+ public:
+ review_manifest () = default;
+ review_manifest (butl::manifest_parser&, bool ignore_unknown = false);
+ review_manifest (butl::manifest_parser&,
+ butl::manifest_name_value start,
+ bool ignore_unknown = false);
+
+ void
+ serialize (butl::manifest_serializer&) const;
+ };
+
+ class review_manifests: public vector<review_manifest>
+ {
+ public:
+ review_manifests () = default;
+ review_manifests (butl::manifest_parser&, bool ignore_unknown = false);
+
+ void
+ serialize (butl::manifest_serializer&) const;
+ };
+}
+
+#endif // LIBBREP_REVIEW_MANIFEST_HXX