| 34 | } |
| 35 | |
| 36 | VersionParserService::VersionParts VersionParserService::getVersionParts(std::string const& versionString) |
| 37 | { |
| 38 | if (versionString.empty()) { |
| 39 | return VersionParts(); |
| 40 | } |
| 41 | |
| 42 | std::vector<std::string> versionParts; |
| 43 | boost::split(versionParts, versionString, boost::is_any_of(".")); |
| 44 | VersionParts result{ |
| 45 | .major = std::stoi(versionParts.at(0)), |
| 46 | .minor = std::stoi(versionParts.at(1)), |
| 47 | }; |
| 48 | |
| 49 | if (versionParts.size() == 3) { |
| 50 | result.patch = std::stoi(versionParts.at(2)); |
| 51 | result.versionType = VersionType_Release; |
| 52 | } |
| 53 | if (versionParts.size() == 5) { |
| 54 | result.patch = 0; |
| 55 | if (versionParts.at(3) == "alpha") { |
| 56 | result.versionType = VersionType_Alpha; |
| 57 | } else if (versionParts.at(3) == "beta") { |
| 58 | result.versionType = VersionType_Beta; |
| 59 | } else { |
| 60 | throw std::runtime_error("Unexpected version number."); |
| 61 | } |
| 62 | result.preRelease = std::stoi(versionParts.at(4)); |
| 63 | } |
| 64 | return result; |
| 65 | } |
| 66 | |
| 67 | bool VersionParserService::isVersionOutdated(std::string const& otherVersionString) |
| 68 | { |
no test coverage detected