// file : bpkg/manifest -*- C++ -*- // copyright : Copyright (c) 2014-2015 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #ifndef BPKG_MANIFEST #define BPKG_MANIFEST #include #include #include namespace bpkg { class manifest_parser; class manifest_serializer; class manifest_name_value; using strings = std::vector; // priority // class priority { public: enum value_type {low, medium, high, security}; std::string comment; priority (value_type v = low): value (v) {} operator value_type () const {return value;} private: value_type value; // Shouldn't be necessary to access directly. }; // description // description-file // struct description: std::string { bool file; std::string comment; }; // license // struct licenses: strings { std::string comment; }; // change // change-file // struct change: std::string { bool file; std::string comment; }; // url // package-url // struct url: std::string { std::string comment; }; // email // package-email // struct email: std::string { std::string comment; }; // depends // enum class comparison {eq, lt, gt, le, ge}; struct version_comparison { std::string value; comparison operation; }; struct dependency { std::string name; butl::optional version; }; struct dependency_alternatives: std::vector { bool conditional; std::string comment; }; // requires // struct requirement_alternatives: strings { bool conditional; std::string comment; }; class package_manifest { public: using priority_type = bpkg::priority; using url_type = bpkg::url; using email_type = bpkg::email; std::string name; std::string version; priority_type priority; std::string summary; std::vector license_alternatives; strings tags; std::vector descriptions; std::vector changes; url_type url; butl::optional package_url; email_type email; butl::optional package_email; std::vector dependencies; std::vector requirements; public: package_manifest (manifest_parser&); package_manifest (manifest_parser&, const manifest_name_value& start); void serialize (manifest_serializer&) const; }; class repository_manifest { public: std::string location; public: repository_manifest (manifest_parser&); repository_manifest (manifest_parser&, const manifest_name_value& start); void serialize (manifest_serializer&) const; }; class manifests { public: std::vector repositories; std::vector packages; public: manifests (manifest_parser&); void serialize (manifest_serializer&) const; }; } #endif // BPKG_MANIFEST