Structured version string, for comparison. Strings are split into parts by "." and compared lexicographically. Parts are compared as the following. If both parts can be parsed as integers (such as "10" and "2"), their integer value is compared (so "10" is greater). If one part cannot be parsed as an integer (such as "2" and "beta"), the integer part is greater ("2"). If neither part can be parse
| 171 | 2.0.0 |
| 172 | */ |
| 173 | struct Version { |
| 174 | std::vector<std::string> parts; |
| 175 | |
| 176 | Version() {} |
| 177 | Version(const std::string& s); |
| 178 | Version(const char* s) : Version(std::string(s)) {} |
| 179 | operator std::string() const; |
| 180 | /** Returns whether this version is earlier than `other`. */ |
| 181 | bool operator<(const Version& other); |
| 182 | |
| 183 | std::string getMajor() const { |
| 184 | return get(parts, 0, ""); |
| 185 | } |
| 186 | std::string getMinor() const { |
| 187 | return get(parts, 1, ""); |
| 188 | } |
| 189 | std::string getRevision() const { |
| 190 | return get(parts, 2, ""); |
| 191 | } |
| 192 | }; |
| 193 | |
| 194 | |
| 195 | /** Returns translation string of the current language setting from `translations/<language>.json`, or English if not found. */ |
no outgoing calls
no test coverage detected