2 lilypond-version.cc -- implement Lilypond_version
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
11 #include "lilypond-input-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 Array<String> version;
29 version = String_convert::split (str, '.');
31 if (version.size () > 0 && isdigit (version[0][0]))
32 major_ = version[0].to_int ();
33 if (version.size () > 1 && isdigit (version[1][0]))
34 minor_ = version[1].to_int ();
37 if (version.size () >= 3
38 && isdigit (version[2][0]))
39 patch_ = version[2].to_int ();
41 if (version.size () >= 4)
42 extra_patch_string_ = version[3];
46 Lilypond_version::to_string () const
48 return ::to_string (major_) + "." + ::to_string (minor_) + "." + ::to_string (patch_);
51 Lilypond_version::operator int () const
54 return 100000 * major_ + 1000 * minor_ + patch_;