summaryrefslogtreecommitdiff
path: root/lang/cpp/src/engineinfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'lang/cpp/src/engineinfo.h')
-rw-r--r--lang/cpp/src/engineinfo.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/lang/cpp/src/engineinfo.h b/lang/cpp/src/engineinfo.h
index 72e125c..aa6fcca 100644
--- a/lang/cpp/src/engineinfo.h
+++ b/lang/cpp/src/engineinfo.h
@@ -40,6 +40,12 @@ public:
struct Version
{
int major, minor, patch;
+ Version()
+ {
+ major = 0;
+ minor = 0;
+ patch = 0;
+ }
Version(const std::string& version)
{
@@ -51,6 +57,16 @@ public:
}
}
+ Version(const char *version)
+ {
+ if (!version ||
+ std::sscanf(version, "%d.%d.%d", &major, &minor, &patch) != 3) {
+ major = 0;
+ minor = 0;
+ patch = 0;
+ }
+ }
+
bool operator < (const Version& other)
{
if (major < other.major)