MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / Section

Class Section

launcher/Version.h:64–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62private:
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;
102 QString m_fullString;
103
104 inline bool operator!=(const Section &other) const
105 {
106 if(numValid && other.numValid)
107 {
108 return m_numPart != other.m_numPart || m_stringPart != other.m_stringPart;
109 }
110 else
111 {
112 return m_fullString != other.m_fullString;
113 }
114 }
115 inline bool operator<(const Section &other) const
116 {
117 if(numValid && other.numValid)
118 {
119 if(m_numPart < other.m_numPart)
120 return true;
121 if(m_numPart == other.m_numPart && m_stringPart < other.m_stringPart)

Callers 4

operator<Method · 0.85
operator>Method · 0.85
operator==Method · 0.85
parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected