Update Version To 3.0.1
[zynaddsubfx-code.git] / src / zyn-version.h.in
blob52c134445678fd9130234687291d2625a82d6097
1 /*
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.
15 #ifndef VERSION_H
16 #define VERSION_H
18 #include <iosfwd>
20 //! class containing a zynaddsubfx version
21 class version_type
23 char version[3];
25 // strcmp-like comparison against another version_type
26 constexpr int v_strcmp(const version_type& v2, int i) const
28 return (i == sizeof(version))
29 ? 0
30 : ((version[i] == v2.version[i])
31 ? v_strcmp(v2, i+1)
32 : (version[i] - v2.version[i]));
35 public:
36 constexpr version_type(char maj, char min, char rev) :
37 version{maj, min, rev}
41 //! constructs the current zynaddsubfx version
42 constexpr version_type() :
43 version_type(${VERSION_MAJOR},
44 ${VERSION_MINOR},
45 ${VERSION_REVISION})
49 void set_major(int maj) { version[0] = maj; }
50 void set_minor(int min) { version[1] = min; }
51 void set_revision(int rev) { version[2] = rev; }
53 int get_major() const { return version[0]; }
54 int get_minor() const { return version[1]; }
55 int get_revision() const { return version[2]; }
57 constexpr bool operator<(const version_type& other) const
59 return v_strcmp(other, 0) < 0;
62 //! prints version as <major>.<minor>.<revision>
63 friend std::ostream& operator<< (std::ostream& os,
64 const version_type& v);
67 //! the current zynaddsubfx version
68 constexpr version_type version;
70 #endif