2 lilypond-version.cc -- implement Lilypond_version
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2009 Jan Nieuwenhuizen <janneke@gnu.org>
11 #include "lilypond-version.hh"
12 #include "string-convert.hh"
15 Lilypond_version::Lilypond_version (int major
, int minor
, int patch
)
22 Lilypond_version::Lilypond_version (string str
)
28 vector
<string
> version
;
29 version
= string_split (str
, '.');
31 if (version
.size () > 0 && isdigit (version
[0][0]))
32 major_
= String_convert::dec2int (version
[0]);
33 if (version
.size () > 1 && isdigit (version
[1][0]))
34 minor_
= String_convert::dec2int (version
[1]);
37 if (version
.size () >= 3
38 && isdigit (version
[2][0]))
39 patch_
= String_convert::dec2int (version
[2]);
41 if (version
.size () >= 4)
42 extra_patch_string_
= version
[3];
46 Lilypond_version::to_string () const
48 return ::to_string (major_
)
49 + "." + ::to_string (minor_
)
50 + "." + ::to_string (patch_
);
53 Lilypond_version::operator int () const
56 return 100000 * major_
+ 1000 * minor_
+ patch_
;