LMMS
Loading...
Searching...
No Matches
ProjectVersion.h
Go to the documentation of this file.
1/*
2 * ProjectVersion.h - version compared in import upgrades
3 *
4 * Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
5 * Copyright (c) 2015 Tres Finocchiaro <tres.finocchiaro/at/gmail.com>
6 *
7 * This file is part of LMMS - https://lmms.io
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program (see COPYING); if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA.
23 *
24 */
25
26#ifndef LMMS_PROJECT_VERSION_H
27#define LMMS_PROJECT_VERSION_H
28
29#include <QString>
30#include <QStringList>
31
32#include <limits>
33
34namespace lmms
35{
36
37
43{
44public:
45 enum class CompareType : int { None = 0, Major=1, Minor=2, Release=3, Stage=4, Build=5, All = std::numeric_limits<int>::max() };
46
47
50
51 const QString& getVersion() const { return m_version; }
52 int getMajor() const { return m_major; }
53 int getMinor() const { return m_minor; }
54 int getPatch() const { return m_patch; }
55 const QStringList& getLabels() const { return m_labels; }
57 ProjectVersion setCompareType(CompareType compareType) { m_compareType = compareType; return * this; }
58
59 static int compare(const ProjectVersion& a, const ProjectVersion& b, CompareType c);
61
62private:
63 QString m_version;
64 int m_major = 0;
65 int m_minor = 0;
66 int m_patch = 0;
67 QStringList m_labels;
69} ;
70
71/*
72 * ProjectVersion v. ProjectVersion
73 */
74inline bool operator<(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) < 0; }
75inline bool operator>(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) > 0; }
76inline bool operator<=(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) <= 0; }
77inline bool operator>=(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) >= 0; }
78inline bool operator==(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) == 0; }
79inline bool operator!=(const ProjectVersion & v1, const ProjectVersion & v2) { return ProjectVersion::compare(v1, v2) != 0; }
80
81
82} // namespace lmms
83
84#endif // LMMS_PROJECT_VERSION_H
uint8_t a
Definition Spc_Cpu.h:141
Version number parsing and comparison.
Definition ProjectVersion.h:43
QString m_version
Definition ProjectVersion.h:63
int m_patch
Definition ProjectVersion.h:66
CompareType
Definition ProjectVersion.h:45
@ Major
Definition ProjectVersion.h:45
@ Stage
Definition ProjectVersion.h:45
@ Minor
Definition ProjectVersion.h:45
@ All
Definition ProjectVersion.h:45
@ Release
Definition ProjectVersion.h:45
@ Build
Definition ProjectVersion.h:45
int m_minor
Definition ProjectVersion.h:65
ProjectVersion(QString version, CompareType c=CompareType::All)
Definition ProjectVersion.cpp:35
ProjectVersion setCompareType(CompareType compareType)
Definition ProjectVersion.h:57
QStringList m_labels
Definition ProjectVersion.h:67
int getMinor() const
Definition ProjectVersion.h:53
CompareType getCompareType() const
Definition ProjectVersion.h:56
int m_major
Definition ProjectVersion.h:64
int getPatch() const
Definition ProjectVersion.h:54
int getMajor() const
Definition ProjectVersion.h:52
const QString & getVersion() const
Definition ProjectVersion.h:51
static int compare(const ProjectVersion &a, const ProjectVersion &b, CompareType c)
Definition ProjectVersion.cpp:81
CompareType m_compareType
Definition ProjectVersion.h:68
const QStringList & getLabels() const
Definition ProjectVersion.h:55
static void v2(register WDL_FFT_REAL *a)
Definition fft.c:1099
int version
Definition jpeglib.h:901
Definition AudioAlsa.cpp:35
bool operator>=(const ProjectVersion &v1, const ProjectVersion &v2)
Definition ProjectVersion.h:77
bool operator<(const ProjectVersion &v1, const ProjectVersion &v2)
Definition ProjectVersion.h:74
bool operator<=(const ProjectVersion &v1, const ProjectVersion &v2)
Definition ProjectVersion.h:76
bool operator>(const ProjectVersion &v1, const ProjectVersion &v2)
Definition ProjectVersion.h:75
bool operator!=(const ProjectVersion &v1, const ProjectVersion &v2)
Definition ProjectVersion.h:79
bool operator==(const ProjectVersion &v1, const ProjectVersion &v2)
Definition ProjectVersion.h:78
return c
Definition crypt.c:175
b
Definition crypt.c:628
static ZCONST char Far None[]
Definition unzip.c:380