From 91ab79f1475371e6e57d00f24f98bccb7749d15a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 14 Jan 2018 18:36:20 +0100 Subject: Add git dependencies --- include/Dependency.hpp | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'include/Dependency.hpp') diff --git a/include/Dependency.hpp b/include/Dependency.hpp index b97c362..7c8bbf1 100644 --- a/include/Dependency.hpp +++ b/include/Dependency.hpp @@ -2,15 +2,66 @@ #define SIBS_DEPENDENCY_HPP #include +#include namespace sibs { + class PackageListDependency; + class GitDependency; + class Dependency { public: + enum class Source + { + PACKAGE_LIST, + GIT + }; + + virtual ~Dependency(){} + + virtual Source getSource() const = 0; + + const PackageListDependency* asPackageListDependency() const + { + assert(getSource() == Source::PACKAGE_LIST); + return (PackageListDependency*)this; + } + + const GitDependency* asGitDependency() const + { + assert(getSource() == Source::GIT); + return (GitDependency*)this; + } + }; + + class PackageListDependency : public Dependency + { + public: + virtual ~PackageListDependency(){} + virtual Source getSource() const + { + return Source::PACKAGE_LIST; + } + std::string name; std::string version; }; + + class GitDependency : public Dependency + { + public: + virtual ~GitDependency(){} + virtual Source getSource() const + { + return Source::GIT; + } + + std::string name; + std::string url; + std::string branch; + std::string revision; + }; } #endif //SIBS_DEPENDENCY_HPP -- cgit v1.2.3