2 ZynAddSubFX - a software synthesizer
4 version.h - declaration of version_type class
5 contains the current zynaddsubfx version
6 Copyright (C) 2016 Johannes Lorenz
7 Author: Johannes Lorenz
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
22 //! class containing a zynaddsubfx version
27 // strcmp-like comparison against another version_type
28 constexpr int v_strcmp(const version_type
& v2
, int i
) const
30 return (i
== sizeof(version
))
32 : ((version
[i
] == v2
.version
[i
])
34 : (version
[i
] - v2
.version
[i
]));
38 constexpr version_type(char maj
, char min
, char rev
) :
39 version
{maj
, min
, rev
}
43 //! constructs the current zynaddsubfx version
44 constexpr version_type() :
45 version_type($
{VERSION_MAJOR
},
51 void set_major(int maj
) { version
[0] = maj
; }
52 void set_minor(int min
) { version
[1] = min
; }
53 void set_revision(int rev
) { version
[2] = rev
; }
55 int get_major() const { return version
[0]; }
56 int get_minor() const { return version
[1]; }
57 int get_revision() const { return version
[2]; }
59 constexpr bool operator<(const version_type
& other
) const
61 return v_strcmp(other
, 0) < 0;
64 //! prints version as <major>.<minor>.<revision>
65 friend std::ostream
& operator<< (std::ostream
& os
,
66 const version_type
& v
);
69 //! the current zynaddsubfx version
70 constexpr version_type version
;