versionnumber.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef VERSIONNUMBER_H
00022 #define VERSIONNUMBER_H
00023
00024 #include <QStringList>
00025 #include <QMetaType>
00026
00071 class VersionNumber
00072 {
00073
00074 public:
00075 VersionNumber();
00076 VersionNumber(const VersionNumber & value);
00077 VersionNumber(const QString & value);
00078 VersionNumber(const qint64 value);
00079 virtual ~VersionNumber();
00080 QString toString() const;
00081 VersionNumber operator=(const VersionNumber & value);
00082 VersionNumber operator=(const QString & value);
00083 VersionNumber operator=(qint64 value);
00084 bool operator<(const VersionNumber & value) const;
00085 bool operator<=(const VersionNumber & value) const;
00086 bool operator>(const VersionNumber & value) const;
00087 bool operator>=(const VersionNumber & value) const;
00088 bool operator==(const VersionNumber & value) const;
00089 bool operator!=(const VersionNumber & value) const;
00090
00091 private:
00092
00094 typedef QStringList simpleNumber;
00096 typedef QList< simpleNumber > numberWithPoints;
00098 typedef QList< numberWithPoints > numberWithPointsAndDashes;
00103 enum characterType {
00104 letter,
00105 digit,
00106 other
00107 };
00112 enum type_whichIsBigger {
00113 first_one,
00114 second_one,
00115 both_are_equal
00116 };
00117
00118
00123 QString theString;
00126 numberWithPointsAndDashes epoch;
00129 numberWithPointsAndDashes version_and_release;
00130
00131
00133 void helper_copyFromHere(const VersionNumber & value);
00137 void helper_setValue(const QString & value);
00140 static VersionNumber::characterType helper_characterType(const QChar & value);
00143 static VersionNumber::simpleNumber helper_createSimpleNumber(const QString & value);
00146 static VersionNumber::numberWithPoints helper_createNumberWithPoints(const QString & value);
00149 static VersionNumber::numberWithPointsAndDashes helper_createNumberWithPointsAndDashes(
00150 const QString & value);
00152 static VersionNumber::type_whichIsBigger whichIsBigger(const VersionNumber & firstValue,
00153 const VersionNumber & secondValue);
00155 static VersionNumber::type_whichIsBigger whichIsBigger(
00156 const numberWithPointsAndDashes & firstValue,
00157 const numberWithPointsAndDashes & secondValue);
00159 static VersionNumber::type_whichIsBigger whichIsBigger(const numberWithPoints & firstValue,
00160 const numberWithPoints & secondValue);
00162 static VersionNumber::type_whichIsBigger whichIsBigger(const simpleNumber & firstValue,
00163 const simpleNumber & secondValue);
00167 static VersionNumber::type_whichIsBigger whichIsBigger(const QString & firstValue,
00168 const QString & secondValue);
00172 static VersionNumber::type_whichIsBigger helper_whichNumberIsBigger(
00173 const QString & firstValue,
00174 const QString & secondValue);
00176 static VersionNumber::type_whichIsBigger helper_whichStringIsBigger(
00177 const QString & firstValue,
00178 const QString & secondValue);
00179
00180 };
00181
00182 Q_DECLARE_METATYPE(VersionNumber)
00183
00184 #endif