aboutsummaryrefslogtreecommitdiff
path: root/include/Dependency.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-01-14 18:36:20 +0100
committerdec05eba <dec05eba@protonmail.com>2018-01-26 09:13:15 +0100
commit91ab79f1475371e6e57d00f24f98bccb7749d15a (patch)
tree40fa847c783ecdc165ad1fc6b7c5cd2a026d25b9 /include/Dependency.hpp
parentb7b7b3d359765e3ffb011dc34ff928e614766666 (diff)
Add git dependencies
Diffstat (limited to 'include/Dependency.hpp')
-rw-r--r--include/Dependency.hpp51
1 files changed, 51 insertions, 0 deletions
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 <string>
+#include <cassert>
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