]> git.donarmstrong.com Git - lilypond.git/blob - lily/lilypond-version.cc
Use two uppercase letters in LilyPond.
[lilypond.git] / lily / lilypond-version.cc
1 /*
2   lilypond-version.cc -- implement LilyPond_version
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1998--2003 Jan Nieuwenhuizen <janneke@gnu.org>
7
8 */
9
10 #include "lilypond-input-version.hh"
11 #include "string-convert.hh"
12 #include "array.hh"
13
14 LilyPond_version::LilyPond_version (int major, int minor, int patch)
15 {
16   major_ = major;
17   minor_ = minor;
18   patch_ = patch;
19 }
20
21 LilyPond_version::LilyPond_version (String str)
22 {
23   Array<String> version;
24   version = String_convert::split (str, '.');
25   
26   major_ = version[0].to_int ();
27   minor_ = version[1].to_int ();
28   patch_ = 0;
29   if (version.size () >= 3)
30     patch_ = version[2].to_int ();
31
32   if (version.size () >= 4)
33     extra_patch_string_ = version[3];
34 }
35
36 String
37 LilyPond_version::to_string () const
38 {
39   return ::to_string (major_) + "." + ::to_string (minor_) + "." + ::to_string (patch_);
40 }
41
42 LilyPond_version::operator int () const
43 {
44     // ugh
45   return 100000 * major_ + 1000 * minor_ + patch_;
46 }
47