2 lilypond-version.cc -- implement Lilypond_version
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2003 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "lilypond-input-version.hh"
11 #include "string-convert.hh"
14 Lilypond_version::Lilypond_version (int major
, int minor
, int patch
)
21 Lilypond_version::Lilypond_version (String str
)
23 Array
<String
> version
;
24 version
= String_convert::split (str
, '.');
26 major_
= version
[0].to_int ();
27 minor_
= version
[1].to_int ();
29 if (version
.size () >= 3)
30 patch_
= version
[2].to_int ();
32 if (version
.size () >= 4)
33 extra_patch_string_
= version
[3];
37 Lilypond_version::to_string () const
39 return ::to_string (major_
) + "." + ::to_string (minor_
) + "." + ::to_string (patch_
);
42 Lilypond_version::operator int () const
45 return 100000 * major_
+ 1000 * minor_
+ patch_
;