LMMS
Loading...
Searching...
No Matches
zyn-version.h
Go to the documentation of this file.
1/*
2 ZynAddSubFX - a software synthesizer
3
4 version.h - declaration of version_type class
5 contains the current zynaddsubfx version
6 Copyright (C) 2016 Johannes Lorenz
7 Author: Johannes Lorenz
8
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.
13*/
14
15#ifndef VERSION_H
16#define VERSION_H
17
18#include <iosfwd>
19
20namespace zyncarla {
21
24{
25 char version[3];
26
27 // strcmp-like comparison against another version_type
28 constexpr int v_strcmp(const version_type& v2, int i) const
29 {
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]));
35 }
36
37public:
38 constexpr version_type(char maj, char min, char rev) :
39 version{maj, min, rev}
40 {
41 }
42
44 constexpr version_type() :
46 0,
47 2)
48 {
49 }
50
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; }
54
55 int get_major() const { return version[0]; }
56 int get_minor() const { return version[1]; }
57 int get_revision() const { return version[2]; }
58
59 constexpr bool operator<(const version_type& other) const
60 {
61 return v_strcmp(other, 0) < 0;
62 }
63
65 friend std::ostream& operator<< (std::ostream& os,
66 const version_type& v);
67};
68
71
72}
73
74#endif
75
class containing a zynaddsubfx version
Definition zyn-version.h:24
void set_minor(int min)
Definition zyn-version.h:52
void set_revision(int rev)
Definition zyn-version.h:53
void set_major(int maj)
Definition zyn-version.h:51
friend std::ostream & operator<<(std::ostream &os, const version_type &v)
prints version as <major>.<minor>.<revision>
Definition version.cpp:20
constexpr int v_strcmp(const version_type &v2, int i) const
Definition zyn-version.h:28
int get_revision() const
Definition zyn-version.h:57
constexpr version_type(char maj, char min, char rev)
Definition zyn-version.h:38
constexpr version_type()
constructs the current zynaddsubfx version
Definition zyn-version.h:44
char version[3]
Definition zyn-version.h:25
int get_major() const
Definition zyn-version.h:55
constexpr bool operator<(const version_type &other) const
Definition zyn-version.h:59
int get_minor() const
Definition zyn-version.h:56
unsigned v[N_MAX]
Definition inflate.c:1584
register unsigned i
Definition inflate.c:1575
static void v2(register WDL_FFT_REAL *a)
Definition fft.c:1099
Definition zynaddsubfx-src.cpp:569
constexpr version_type version
the current zynaddsubfx version
Definition zyn-version.h:70
#define min(x, y)
Definition os.h:74
static ZCONST char Far * os[NUM_HOSTS]
Definition zipinfo.c:1001