2014-02-02 18:35:07 +05:30
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QString>
|
2014-09-06 21:46:56 +05:30
|
|
|
#include <QList>
|
|
|
|
|
2014-02-02 18:35:07 +05:30
|
|
|
#include "libutil_config.h"
|
|
|
|
|
|
|
|
class QUrl;
|
|
|
|
|
|
|
|
namespace Util
|
|
|
|
{
|
|
|
|
struct Version
|
|
|
|
{
|
|
|
|
Version(const QString &str);
|
2014-09-06 21:46:56 +05:30
|
|
|
Version() {}
|
2014-02-02 18:35:07 +05:30
|
|
|
|
|
|
|
bool operator<(const Version &other) const;
|
|
|
|
bool operator<=(const Version &other) const;
|
|
|
|
bool operator>(const Version &other) const;
|
2014-09-06 21:46:56 +05:30
|
|
|
bool operator>=(const Version &other) const;
|
2014-02-02 18:35:07 +05:30
|
|
|
bool operator==(const Version &other) const;
|
|
|
|
bool operator!=(const Version &other) const;
|
|
|
|
|
|
|
|
QString toString() const
|
|
|
|
{
|
|
|
|
return m_string;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_string;
|
2014-09-06 21:46:56 +05:30
|
|
|
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();
|
2014-02-02 18:35:07 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
LIBUTIL_EXPORT bool versionIsInInterval(const QString &version, const QString &interval);
|
2014-09-06 21:46:56 +05:30
|
|
|
LIBUTIL_EXPORT bool versionIsInInterval(const Version &version, const QString &interval);
|
2014-02-02 18:35:07 +05:30
|
|
|
}
|
|
|
|
|