| 11 | #include "Base/Resources.h" |
| 12 | |
| 13 | bool VersionParserService::isVersionValid(std::string const& otherVersionString) |
| 14 | { |
| 15 | try { |
| 16 | std::vector<std::string> versionParts; |
| 17 | boost::split(versionParts, otherVersionString, boost::is_any_of(".")); |
| 18 | if (versionParts.size() != 3 && versionParts.size() != 5) { |
| 19 | return false; |
| 20 | } |
| 21 | for (auto const& versionPart : versionParts | boost::adaptors::sliced(0, 3)) { |
| 22 | static_cast<void>(std::stoi(versionPart)); |
| 23 | } |
| 24 | if (versionParts.size() == 5) { |
| 25 | if (versionParts[3] != "alpha" && versionParts[3] != "beta") { |
| 26 | return false; |
| 27 | } |
| 28 | static_cast<void>(std::stoi(versionParts[4])); |
| 29 | } |
| 30 | } catch (...) { |
| 31 | return false; |
| 32 | } |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | VersionParserService::VersionParts VersionParserService::getVersionParts(std::string const& versionString) |
| 37 | { |
no test coverage detected