-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsemVerVersion.h
76 lines (57 loc) · 2.99 KB
/
semVerVersion.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* ********************************************************************
itom software
URL: http://www.uni-stuttgart.de/ito
Copyright (C) 2020, Institut für Technische Optik (ITO),
Universität Stuttgart, Germany
This file is part of itom and its software development toolkit (SDK).
itom is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public Licence as published by
the Free Software Foundation; either version 2 of the Licence, or (at
your option) any later version.
In addition, as a special exception, the Institut für Technische
Optik (ITO) gives you certain additional rights.
These rights are described in the ITO LGPL Exception version 1.0,
which can be found in the file LGPL_EXCEPTION.txt in this package.
itom is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
General Public Licence for more details.
You should have received a copy of the GNU Library General Public License
along with itom. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************** */
#ifndef SEMVERVERSION_H
#define SEMVERVERSION_H
/* includes */
#include "commonGlobal.h"
#include "typeDefs.h"
#include <qstring.h>
#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC) //only moc this file in itomCommonQtLib but not in other libraries or executables linking against this itomCommonQtLib
namespace ito
{
class ITOMCOMMONQT_EXPORT SemVerVersion
{
public:
SemVerVersion(int major, int minor, int patch = 0);
SemVerVersion(); //constructs an empty version (major = minor = patch = 0)
QString toString() const;
int toInt() const; //returns the major, minor and patch in the form 0xAABBCC (AA: major, BB: minor, CC: patch)
static SemVerVersion fromString(const QString &versionString, bool *ok = NULL);
static SemVerVersion fromInt(int versionNumber); //the integer must be 0xAABBCC where AA is the major, BB is the minor, CC is the patch
bool operator==(const SemVerVersion &other) const; //returns true if this and other are exactly the same
bool isCompatible(const SemVerVersion &other) const; //returns true if this and other have the same major and if the minor of other is <= this.minor.
bool isValid() const; //returns false if major=minor==patch==0
bool operator>=(const SemVerVersion &other) const;
bool operator>(const SemVerVersion &other) const;
bool operator<=(const SemVerVersion &other) const;
bool operator<(const SemVerVersion &other) const;
int svMajor() const;
int svMinor() const;
int svPatch() const;
private:
int m_major;
int m_minor;
int m_patch;
};
}; // end namespace ito
#endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
#endif