diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/PackageVersion.hpp | 56 | ||||
-rw-r--r-- | include/curl.hpp | 12 |
2 files changed, 67 insertions, 1 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 diff --git a/include/curl.hpp b/include/curl.hpp index 49dfe12..7c0ddbe 100644 --- a/include/curl.hpp +++ b/include/curl.hpp @@ -2,13 +2,23 @@ #define SIBS_CURL_HPP #include "Result.hpp" +#include <string> namespace sibs { + class HttpResult + { + public: + long httpCode; + bool success; + std::string str; + }; + class curl { public: - static Result<bool> downloadFile(const char *url, const char *filepath); + static sibs::Result<bool> downloadFile(const char *url, const char *filepath); + static HttpResult get(const char *url); }; } |