Change ALSA device default to 'default' from hw:0
[zynaddsubfx-code.git] / src / zyn-version.h.in
blobd2b9608c01d89f829ee0878d91042506ab77d456
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 ZYN_VERSION_H
16 #define ZYN_VERSION_H
18 #include <iosfwd>
20 namespace zyn {
22 //! class containing a zynaddsubfx version
23 class version_type
25 char version[3];
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))
31 ? 0
32 : ((version[i] == v2.version[i])
33 ? v_strcmp(v2, i+1)
34 : (version[i] - v2.version[i]));
37 public:
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},
46 ${VERSION_MINOR},
47 ${VERSION_REVISION})
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;
74 #endif