aboutsummaryrefslogtreecommitdiff
path: root/api/logic/Version.h
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2021-07-25 19:11:59 +0200
committerPetr Mrázek <peterix@gmail.com>2021-07-25 19:50:44 +0200
commit20b9f2b42a3b58b6081af271774fbcc34025dccb (patch)
tree064fa59facb3357139b47bd4e60bfc8edb35ca11 /api/logic/Version.h
parentdd133680858351e3e07690e286882327a4f42ba5 (diff)
downloadPrismLauncher-20b9f2b42a3b58b6081af271774fbcc34025dccb.tar.gz
PrismLauncher-20b9f2b42a3b58b6081af271774fbcc34025dccb.tar.bz2
PrismLauncher-20b9f2b42a3b58b6081af271774fbcc34025dccb.zip
NOISSUE Flatten gui and logic libraries into MultiMC
Diffstat (limited to 'api/logic/Version.h')
-rw-r--r--api/logic/Version.h107
1 files changed, 0 insertions, 107 deletions
diff --git a/api/logic/Version.h b/api/logic/Version.h
deleted file mode 100644
index c5d93081..00000000
--- a/api/logic/Version.h
+++ /dev/null
@@ -1,107 +0,0 @@
-#pragma once
-
-#include <QString>
-#include <QList>
-
-#include "multimc_logic_export.h"
-
-class QUrl;
-
-class MULTIMC_LOGIC_EXPORT Version
-{
-public:
- 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;
-
- QString toString() const
- {
- return m_string;
- }
-
-private:
- QString m_string;
- struct Section
- {
- explicit Section(const QString &fullString)
- {
- m_fullString = fullString;
- int cutoff = m_fullString.size();
- for(int i = 0; i < m_fullString.size(); i++)
- {
- if(!m_fullString[i].isDigit())
- {
- cutoff = i;
- break;
- }
- }
- auto numPart = m_fullString.leftRef(cutoff);
- if(numPart.size())
- {
- numValid = true;
- m_numPart = numPart.toInt();
- }
- auto stringPart = m_fullString.midRef(cutoff);
- if(stringPart.size())
- {
- m_stringPart = stringPart.toString();
- }
- }
- explicit Section() {}
- bool numValid = false;
- int m_numPart = 0;
- QString m_stringPart;
- QString m_fullString;
-
- inline bool operator!=(const Section &other) const
- {
- if(numValid && other.numValid)
- {
- return m_numPart != other.m_numPart || m_stringPart != other.m_stringPart;
- }
- else
- {
- return m_fullString != other.m_fullString;
- }
- }
- inline bool operator<(const Section &other) const
- {
- if(numValid && other.numValid)
- {
- if(m_numPart < other.m_numPart)
- return true;
- if(m_numPart == other.m_numPart && m_stringPart < other.m_stringPart)
- return true;
- return false;
- }
- else
- {
- return m_fullString < other.m_fullString;
- }
- }
- inline bool operator>(const Section &other) const
- {
- if(numValid && other.numValid)
- {
- if(m_numPart > other.m_numPart)
- return true;
- if(m_numPart == other.m_numPart && m_stringPart > other.m_stringPart)
- return true;
- return false;
- }
- else
- {
- return m_fullString > other.m_fullString;
- }
- }
- };
- QList<Section> m_sections;
-
- void parse();
-};