lilypond-1.3.67
[lilypond.git] / lily / mudela-version.cc
blob7b2e9d58ee3e964d175d93bf06e1d57e1c06533b
1 /*
2 mudela-version.cc -- implement Mudela_version
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
8 */
10 #include "mudela-version.hh"
11 #include "string-convert.hh"
12 #include "array.hh"
14 Mudela_version::Mudela_version (int major, int minor, int patch)
16 major_i_ = major;
17 minor_i_ = minor;
18 patch_i_ = patch;
21 Mudela_version::Mudela_version (String str)
23 Array<String> version;
24 version = String_convert::split_arr (str, '.');
25 assert (version.size () == 3);
26 major_i_ = version[0].value_i ();
27 minor_i_ = version[1].value_i ();
28 patch_i_ = version[2].value_i ();
31 String
32 Mudela_version::str () const
34 return to_str (major_i_) + "." + to_str (minor_i_) + "." + to_str (patch_i_);
37 Mudela_version::operator int () const
39 // ugh
40 return 100000 * major_i_ + 1000 * minor_i_ + patch_i_;