Sync from quickmods
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user