]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lilypond-version.cc
Run grand-replace (issue 3765)
[lilypond.git] / lily / lilypond-version.cc
index 6479f0a91cfd70ce4d2cbcf83e2c75c91963871d..fd76deec67e1ea33654c1a44db35381fed1d9d6a 100644 (file)
@@ -1,16 +1,27 @@
 /*
-  lilypond-version.cc -- implement Lilypond_version
+  This file is part of LilyPond, the GNU music typesetter.
 
-  source file of the GNU LilyPond music typesetter
+  Copyright (C) 1998--2014 Jan Nieuwenhuizen <janneke@gnu.org>
 
-  (c) 1998--2005 Jan Nieuwenhuizen <janneke@gnu.org>
+  LilyPond is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  LilyPond is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include <ctype.h>
 
-#include "lilypond-input-version.hh"
+#include "lilypond-version.hh"
 #include "string-convert.hh"
-#include "array.hh"
+#include "misc.hh"
 
 Lilypond_version::Lilypond_version (int major, int minor, int patch)
 {
@@ -19,33 +30,35 @@ Lilypond_version::Lilypond_version (int major, int minor, int patch)
   patch_ = patch;
 }
 
-Lilypond_version::Lilypond_version (String str)
+Lilypond_version::Lilypond_version (const string &str)
 {
-  major_ = 0; 
+  major_ = 0;
   minor_ = 0;
   patch_ = 0;
-  
-  Array<String> version;
-  version = String_convert::split (str, '.');
+
+  vector<string> version;
+  version = string_split (str, '.');
 
   if (version.size () > 0 && isdigit (version[0][0]))
-    major_ = version[0].to_int ();
+    major_ = String_convert::dec2int (version[0]);
   if (version.size () > 1 && isdigit (version[1][0]))
-    minor_ = version[1].to_int ();
-  
+    minor_ = String_convert::dec2int (version[1]);
+
   patch_ = 0;
   if (version.size () >= 3
       && isdigit (version[2][0]))
-    patch_ = version[2].to_int ();
+    patch_ = String_convert::dec2int (version[2]);
 
   if (version.size () >= 4)
     extra_patch_string_ = version[3];
 }
 
-String
+string
 Lilypond_version::to_string () const
 {
-  return ::to_string (major_) + "." + ::to_string (minor_) + "." + ::to_string (patch_);
+  return ::to_string (major_)
+         + "." + ::to_string (minor_)
+         + "." + ::to_string (patch_);
 }
 
 Lilypond_version::operator int () const