From a2ccb6406bb1b016aaf31a47c659d06bce0cfc6a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 25 Sep 2015 10:34:15 +0200 Subject: Add role member to the repository_manifest class --- bpkg/manifest | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'bpkg/manifest') diff --git a/bpkg/manifest b/bpkg/manifest index dfbe5af..75f87bd 100644 --- a/bpkg/manifest +++ b/bpkg/manifest @@ -438,10 +438,18 @@ namespace bpkg return os << l.string (); } + enum class repository_role + { + base, + prerequisite, + complement + }; + class repository_manifest { public: repository_location location; + butl::optional role; public: repository_manifest (manifest_parser&); @@ -449,6 +457,18 @@ namespace bpkg void serialize (manifest_serializer&) const; + + // Return the effective role of the repository. If the role is not + // explicitly specified (see the role member above), then calculate + // the role based on the location. Specifically, if the location is + // empty, then the effective role is base. Otherwise -- prerequisite. + // If the role is specified, then verify that it is consistent with + // the location value (that is, base if the location is empty and + // prerequisite or complete if not) and return that. Otherwise, + // throw logic_error. + // + repository_role + effective_role () const; }; class repository_manifests: public std::vector -- cgit v1.1