summaryrefslogtreecommitdiff
path: root/server/src/versionstr.h
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/versionstr.h')
-rw-r--r--server/src/versionstr.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/server/src/versionstr.h b/server/src/versionstr.h
index a840bd2..ceed42f 100644
--- a/server/src/versionstr.h
+++ b/server/src/versionstr.h
@@ -41,15 +41,60 @@
#undef patch
#endif
+/**
+ * VersionStr class.
+ * It hold a version number and is capable of correct sorting, as well as string
+ * conversion both ways.
+ */
class VersionStr {
public:
+ /**
+ * Constructor.
+ * @param v A std::string containing a version string on the form a.b or a.b.c
+ */
VersionStr(std::string v);
+
+ /**
+ * Constructor.
+ * @param major A size_t containing the major version number.
+ * @param minor A size_t containing the minor version number.
+ * @param patch A size_t containing the patch level.
+ */
+ VersionStr(size_t major = 0, size_t minor = 0, size_t patch = 0);
+
+ /**
+ * Typecast to std::string operator.
+ * It simply converts the version numbers into a string of the form major.minor
+ * (if patch i 0) or major.minor.patch
+ */
operator std::string() const;
+
+ /**
+ * Assignment from std::string operator.
+ * Same as in the VersionStr(std::string v) constructor.
+ */
void operator=(std::string v);
+
+ /**
+ * Comparison operator.
+ * The version objects are sorted according to their major, minor and patch
+ * level numbers.
+ */
bool operator<(const VersionStr &other) const;
+ /**
+ * @return Major version number.
+ */
size_t major() const;
+
+ /**
+ * @return Minor version number.
+ */
size_t minor() const;
+
+ /**
+ * @return Patch level.
+ */
size_t patch() const;
private: