aboutsummaryrefslogtreecommitdiff
path: root/include/Dependency.hpp
diff options
context:
space:
mode:
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