| 42 | class QUrl; |
| 43 | |
| 44 | class Version |
| 45 | { |
| 46 | public: |
| 47 | Version(const QString &str); |
| 48 | Version() {} |
| 49 | |
| 50 | bool operator<(const Version &other) const; |
| 51 | bool operator<=(const Version &other) const; |
| 52 | bool operator>(const Version &other) const; |
| 53 | bool operator>=(const Version &other) const; |
| 54 | bool operator==(const Version &other) const; |
| 55 | bool operator!=(const Version &other) const; |
| 56 | |
| 57 | QString toString() const |
| 58 | { |
| 59 | return m_string; |
| 60 | } |
| 61 | |
| 62 | private: |
| 63 | QString m_string; |
| 64 | struct Section |
| 65 | { |
| 66 | explicit Section(const QString &fullString) |
| 67 | { |
| 68 | m_fullString = fullString; |
| 69 | int cutoff = m_fullString.size(); |
| 70 | for(int i = 0; i < m_fullString.size(); i++) |
| 71 | { |
| 72 | if(!m_fullString[i].isDigit()) |
| 73 | { |
| 74 | cutoff = i; |
| 75 | break; |
| 76 | } |
| 77 | } |
| 78 | #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) |
| 79 | auto numPart = QStringView{m_fullString}.left(cutoff); |
| 80 | #else |
| 81 | auto numPart = m_fullString.leftRef(cutoff); |
| 82 | #endif |
| 83 | if(numPart.size()) |
| 84 | { |
| 85 | numValid = true; |
| 86 | m_numPart = numPart.toInt(); |
| 87 | } |
| 88 | #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) |
| 89 | auto stringPart = QStringView{m_fullString}.mid(cutoff); |
| 90 | #else |
| 91 | auto stringPart = m_fullString.midRef(cutoff); |
| 92 | #endif |
| 93 | if(stringPart.size()) |
| 94 | { |
| 95 | m_stringPart = stringPart.toString(); |
| 96 | } |
| 97 | } |
| 98 | explicit Section() {} |
| 99 | bool numValid = false; |
| 100 | int m_numPart = 0; |
| 101 | QString m_stringPart; |
no outgoing calls