| 22 | namespace arrayfire { |
| 23 | namespace common { |
| 24 | class Version { |
| 25 | int major_ = -1; |
| 26 | int minor_ = -1; |
| 27 | int patch_ = -1; |
| 28 | |
| 29 | public: |
| 30 | /// Checks if the major version is defined before minor and minor is defined |
| 31 | /// before patch |
| 32 | constexpr static bool validate(int major_, int minor_, |
| 33 | int patch_) noexcept { |
| 34 | return !(major_ < 0 && (minor_ >= 0 || patch_ >= 0)) && |
| 35 | !(minor_ < 0 && patch_ >= 0); |
| 36 | } |
| 37 | |
| 38 | constexpr int major() const { return major_; } |
| 39 | constexpr int minor() const { return minor_; } |
| 40 | constexpr int patch() const { return patch_; } |
| 41 | |
| 42 | constexpr Version(const int ver_major, const int ver_minor = -1, |
| 43 | const int ver_patch = -1) noexcept |
| 44 | : major_(ver_major), minor_(ver_minor), patch_(ver_patch) {} |
| 45 | }; |
| 46 | |
| 47 | constexpr bool operator==(const Version& lhs, const Version& rhs) { |
| 48 | return lhs.major() == rhs.major() && lhs.minor() == rhs.minor() && |
no outgoing calls
no test coverage detected