diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-06-11 17:11:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-06-11 17:11:54 +0200 |
commit | 161d105204eb66148c28ef2615f1a12d3ba33136 (patch) | |
tree | 16e7541ffd0ddc182e8f05d19a14ecfcb80d7dbe /bpkg | |
parent | f4660720e3ab0dc70d31fd39d48199590810ab03 (diff) |
Manifest object model, take 1
Diffstat (limited to 'bpkg')
-rw-r--r-- | bpkg/buildfile | 2 | ||||
-rw-r--r-- | bpkg/manifest | 129 | ||||
-rw-r--r-- | bpkg/manifest.cxx | 11 |
3 files changed, 141 insertions, 1 deletions
diff --git a/bpkg/buildfile b/bpkg/buildfile index 45d9d89..8d11e61 100644 --- a/bpkg/buildfile +++ b/bpkg/buildfile @@ -3,4 +3,4 @@ # license : MIT; see accompanying LICENSE file import libs += libhello -lib{bpkg}: cxx{manifest-parser manifest-serializer} $libs +lib{bpkg}: cxx{manifest-parser manifest-serializer manifest} $libs diff --git a/bpkg/manifest b/bpkg/manifest new file mode 100644 index 0000000..bf17a64 --- /dev/null +++ b/bpkg/manifest @@ -0,0 +1,129 @@ +// 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 <string> +#include <vector> + +#include <butl/optional> + +namespace bpkg +{ + using strings = std::vector<std::string>; + + // 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_comparison> version; + }; + + struct dependency_alternatives: std::vector<dependency> + { + bool conditional; + std::string comment; + }; + + // requires + // + struct requirement_alternatives: strings + { + bool conditional; + std::string comment; + }; + + struct manifest + { + 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<licenses> license_alternatives; + strings tags; + std::vector<description> descriptions; + std::vector<change> changes; + url_type url; + butl::optional<url_type> package_url; + email_type email; + butl::optional<email_type> package_email; + std::vector<dependency_alternatives> dependencies; + std::vector<requirement_alternatives> requirements; + }; + + using manifests = std::vector<manifest>; +} + +#endif // BPKG_MANIFEST diff --git a/bpkg/manifest.cxx b/bpkg/manifest.cxx new file mode 100644 index 0000000..40c7a32 --- /dev/null +++ b/bpkg/manifest.cxx @@ -0,0 +1,11 @@ +// file : bpkg/manifest.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include <bpkg/manifest> + +using namespace std; + +namespace bpkg +{ +} |