summaryrefslogtreecommitdiffstats
path: root/depends/util/include/modutils.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-09-06 18:16:56 +0200
committerPetr Mrázek <peterix@gmail.com>2014-09-06 19:03:05 +0200
commit20cb97a35af5097e9d3b2062c0dfcb5f2e5fff5c (patch)
tree56bf51e681f2e73590a549499bd83d7b505c39f8 /depends/util/include/modutils.h
parent36efcf8d3c0cbd7823fc65569cfc2b011435db2c (diff)
downloadMultiMC-20cb97a35af5097e9d3b2062c0dfcb5f2e5fff5c.tar
MultiMC-20cb97a35af5097e9d3b2062c0dfcb5f2e5fff5c.tar.gz
MultiMC-20cb97a35af5097e9d3b2062c0dfcb5f2e5fff5c.tar.lz
MultiMC-20cb97a35af5097e9d3b2062c0dfcb5f2e5fff5c.tar.xz
MultiMC-20cb97a35af5097e9d3b2062c0dfcb5f2e5fff5c.zip
Sync from quickmods
Diffstat (limited to 'depends/util/include/modutils.h')
-rw-r--r--depends/util/include/modutils.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/depends/util/include/modutils.h b/depends/util/include/modutils.h
index e04db66f..1fecd4d5 100644
--- a/depends/util/include/modutils.h
+++ b/depends/util/include/modutils.h
@@ -1,6 +1,8 @@
#pragma once
#include <QString>
+#include <QList>
+
#include "libutil_config.h"
class QUrl;
@@ -10,10 +12,12 @@ namespace Util
struct Version
{
Version(const QString &str);
+ Version() {}
bool operator<(const Version &other) const;
bool operator<=(const Version &other) const;
bool operator>(const Version &other) const;
+ bool operator>=(const Version &other) const;
bool operator==(const Version &other) const;
bool operator!=(const Version &other) const;
@@ -24,9 +28,34 @@ struct Version
private:
QString m_string;
+ struct Section
+ {
+ explicit Section(const QString &str, const int num) : numValid(true), number(num), string(str) {}
+ explicit Section(const QString &str) : numValid(false), string(str) {}
+ explicit Section() {}
+ bool numValid;
+ int number;
+ QString string;
+
+ inline bool operator!=(const Section &other) const
+ {
+ return (numValid && other.numValid) ? (number != other.number) : (string != other.string);
+ }
+ inline bool operator<(const Section &other) const
+ {
+ return (numValid && other.numValid) ? (number < other.number) : (string < other.string);
+ }
+ inline bool operator>(const Section &other) const
+ {
+ return (numValid && other.numValid) ? (number > other.number) : (string > other.string);
+ }
+ };
+ QList<Section> m_sections;
+
+ void parse();
};
-LIBUTIL_EXPORT QUrl expandQMURL(const QString &in);
LIBUTIL_EXPORT bool versionIsInInterval(const QString &version, const QString &interval);
+LIBUTIL_EXPORT bool versionIsInInterval(const Version &version, const QString &interval);
}