File: Version.cpp

package info (click to toggle)
structure-synth 1.5.0-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,268 kB
  • ctags: 1,966
  • sloc: cpp: 10,209; python: 164; makefile: 71; sh: 15
file content (63 lines) | stat: -rw-r--r-- 1,513 bytes parent folder | download | duplicates (10)
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
#include "Version.h"

#include "../Logging/Logging.h"

using namespace SyntopiaCore::Logging;

namespace SyntopiaCore {
	namespace Misc {	

		Version::Version() : revision(0), build(0), codename("") {	
			this->major = 0;
			this->minor = 0;
		}

		Version::Version(int major, int minor, int revision, int build, QString codename)  :  revision(revision), build(build), codename(codename) {
			this->major = major;
			this->minor = minor;
		}

		QList<Version> Version::GetNewVersions(QString /*url*/) const {
			return QList<Version>();
		}

		QString Version::toLongString() const {
			QString s = QString("%1.%2").arg(major).arg(minor);
			if (revision >= 0) s+= QString(".%3").arg(revision);
			if (build >= 0) s+= QString(".%4").arg(build);

			if (!codename.isEmpty()) s+= " " + codename;

			return s;
		}

		bool Version::operator<(const Version &rhs) {
			if (major == rhs.major) {
				if (minor == rhs.minor) {
					if (revision == rhs.revision) {
						return (build < rhs.build);
					} else {
						return (revision < rhs.revision);
					}
				} else {
					return (minor < rhs.minor);
				}
			} else {
				return (major < rhs.major);
			}

		}

		bool Version::operator>(const Version &rhs) {
			if ( (*this) == rhs ) return false;
			return !((*this)<rhs);
		}

		bool Version::operator==(const Version &rhs) {
			return ((major == rhs.major) && (minor == rhs.minor) && (revision == rhs.revision) && (build == rhs.build));
		}


	}
}