LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1998--2019 Jan Nieuwenhuizen <janneke@gnu.org> | 4 Copyright (C) 1998--2019 Jan Nieuwenhuizen <janneke@gnu.org> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 6 LilyPond is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
8 the Free Software Foundation, either version 3 of the License, or | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return; | 61 return; |
62 major_ = String_convert::dec2int (version[0]); | 62 major_ = String_convert::dec2int (version[0]); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 string | 66 string |
67 Lilypond_version::to_string () const | 67 Lilypond_version::to_string () const |
68 { | 68 { |
69 if (major_ < 0) | 69 if (major_ < 0) |
70 return "invalid"; | 70 return "invalid"; |
71 return ::to_string (major_) | 71 return std::to_string (major_) |
72 + "." + ::to_string (minor_) | 72 + "." + std::to_string (minor_) |
73 + "." + ::to_string (patch_); | 73 + "." + std::to_string (patch_); |
74 } | 74 } |
75 | 75 |
76 Lilypond_version::operator bool () const | 76 Lilypond_version::operator bool () const |
77 { | 77 { |
78 return !(major_ < 0); | 78 return !(major_ < 0); |
79 } | 79 } |
80 | 80 |
81 int | 81 int |
82 Lilypond_version::compare (const Lilypond_version &a, const Lilypond_version &b) | 82 Lilypond_version::compare (const Lilypond_version &a, const Lilypond_version &b) |
83 { | 83 { |
84 if (!a || !b) | 84 if (!a || !b) |
85 return 0; | 85 return 0; |
86 if (a.major_ != b.major_) | 86 if (a.major_ != b.major_) |
87 return a.major_ > b.major_ ? 1 : -1; | 87 return a.major_ > b.major_ ? 1 : -1; |
88 if (a.minor_ != b.minor_) | 88 if (a.minor_ != b.minor_) |
89 return a.minor_ > b.minor_ ? 1 : -1; | 89 return a.minor_ > b.minor_ ? 1 : -1; |
90 if (a.patch_ != b.patch_) | 90 if (a.patch_ != b.patch_) |
91 return a.patch_ > b.patch_ ? 1 : -1; | 91 return a.patch_ > b.patch_ ? 1 : -1; |
92 return 0; | 92 return 0; |
93 } | 93 } |
LEFT | RIGHT |