aboutsummaryrefslogtreecommitdiff
path: root/include/PackageVersion.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-28 01:02:16 +0100
committerdec05eba <dec05eba@protonmail.com>2017-12-28 01:27:11 +0100
commit0cf81a4421f9a4d267245a3041508b617a01d68d (patch)
tree1eb816c05cc005abe317439516ba6b06c4dfbdfb /include/PackageVersion.hpp
parent5100c0659e39dd82a3b979b859704e7dbf01e2f1 (diff)
Add curl get, add packages file
Diffstat (limited to 'include/PackageVersion.hpp')
-rw-r--r--include/PackageVersion.hpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/include/PackageVersion.hpp b/include/PackageVersion.hpp
new file mode 100644
index 0000000..99f8342
--- /dev/null
+++ b/include/PackageVersion.hpp
@@ -0,0 +1,56 @@
+#ifndef SIBS_PACKAGEVERSION_HPP
+#define SIBS_PACKAGEVERSION_HPP
+
+#include <string>
+
+namespace sibs
+{
+ /*
+ * Different package version syntax:
+ * ANY: "major.minor.patch" (xxx.xxx.xxx)
+ * Checks for package in several different places. First pkg-config, then local lib dir (~/.sibs/lib), then git/server.
+ * Example: "2.1.002"
+ * GIT: "branch:revision"
+ * Checks for package in any of the configures git servers (default: github).
+ * Example: "master:HEAD"
+ * LATEST: "latest"
+ * Checks for package in several different places. First git/server then pkg-config then local lib dir (~/.sibs/lib).
+ *
+ *
+ * GIT and LATEST first check if local lib (~/.sibs/lib) contains latest version by comparing the revision to remote revision.
+ */
+ class PackageVersion
+ {
+ public:
+ enum class Type
+ {
+ ANY,
+ GIT,
+ LATEST
+ };
+
+ PackageVersion(int _major, int _minor, int _patch) : type(Type::ANY), major(_major), minor(_minor), patch(_patch) {}
+ PackageVersion(const std::string &&_gitBranch, const std::string &&_gitRevision) :
+ type(Type::GIT),
+ gitBranch(_gitBranch),
+ gitRevision(_gitRevision)
+ {
+
+ }
+
+ static PackageVersion latest() { return PackageVersion(Type::LATEST); }
+ private:
+ PackageVersion(Type _type) : type(_type) {}
+ private:
+ Type type;
+
+ int major;
+ int minor;
+ int patch;
+
+ std::string gitBranch;
+ std::string gitRevision;
+ };
+}
+
+#endif //SIBS_PACKAGEVERSION_HPP