CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkVersion.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  Library: CTK
4 
5  Copyright (c) German Cancer Research Center,
6  Division of Medical and Biological Informatics
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 =============================================================================*/
21 
22 #ifndef CTKVERSION_H
23 #define CTKVERSION_H
24 
25 #include <QString>
26 #include <QRegExp>
27 
28 #include "ctkPluginFrameworkExport.h"
29 
30 
49 class CTK_PLUGINFW_EXPORT ctkVersion {
50 
51 private:
52 
53  friend class ctkPluginPrivate;
54  friend class ctkVersionRange;
55 
56  unsigned int majorVersion;
57  unsigned int minorVersion;
58  unsigned int microVersion;
59  QString qualifier;
60 
61  static const QString SEPARATOR; // = "."
62  static const QRegExp RegExp;
63 
64  bool undefined;
65 
66 
72  void validate();
73 
74  ctkVersion& operator=(const ctkVersion& v);
75 
76  ctkVersion(bool undefined = false);
77 
78 public:
79 
84 
90 
102  ctkVersion(unsigned int majorVersion, unsigned int minorVersion, unsigned int microVersion);
103 
112  ctkVersion(unsigned int majorVersion, unsigned int minorVersion, unsigned int microVersion, const QString& qualifier);
113 
134  ctkVersion(const QString& version);
135 
141  ctkVersion(const ctkVersion& version);
142 
143 
157  static ctkVersion parseVersion(const QString& version);
158 
165  bool isUndefined() const;
166 
172  unsigned int getMajor() const;
173 
179  unsigned int getMinor() const;
180 
186  unsigned int getMicro() const;
187 
193  QString getQualifier() const;
194 
205  QString toString() const;
206 
220  bool operator==(const ctkVersion& object) const;
221 
245  int compare(const ctkVersion& object) const;
246 
257  bool operator<(const ctkVersion& object) const;
258 
259 };
260 
264 CTK_PLUGINFW_EXPORT QDebug operator<<(QDebug dbg, const ctkVersion& v);
265 
266 #endif // CTKVERSION_H
ctkVersion::getMinor
unsigned int getMinor() const
ctkVersion::ctkVersion
ctkVersion(unsigned int majorVersion, unsigned int minorVersion, unsigned int microVersion, const QString &qualifier)
ctkVersion::getQualifier
QString getQualifier() const
ctkVersion::compare
int compare(const ctkVersion &object) const
ctkVersion::ctkVersion
ctkVersion(unsigned int majorVersion, unsigned int minorVersion, unsigned int microVersion)
ctkVersion::toString
QString toString() const
ctkVersion::parseVersion
static ctkVersion parseVersion(const QString &version)
ctkVersion
Definition: ctkVersion.h:49
ctkVersion::ctkVersion
ctkVersion(const ctkVersion &version)
ctkVersion::getMajor
unsigned int getMajor() const
ctkVersion::operator==
bool operator==(const ctkVersion &object) const
ctkVersion::getMicro
unsigned int getMicro() const
ctkVersion::operator<
bool operator<(const ctkVersion &object) const
operator<<
CTK_PLUGINFW_EXPORT QDebug operator<<(QDebug dbg, const ctkVersion &v)
ctkVersion::emptyVersion
static ctkVersion emptyVersion()
ctkVersion::ctkVersion
ctkVersion(const QString &version)
ctkVersion::isUndefined
bool isUndefined() const
ctkVersion::undefinedVersion
static ctkVersion undefinedVersion()