util/version.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | #pragma once | ||
| 3 | |||
| 4 | #include <string> | ||
| 5 | #include <string_view> | ||
| 6 | #include <tuple> | ||
| 7 | |||
| 8 | #include "chrono_batch_render/export.h" | ||
| 9 | |||
| 10 | namespace chrono::batch_render { | ||
| 11 | |||
| 12 | struct Version { | ||
| 13 | int major = 0; | ||
| 14 | int minor = 0; | ||
| 15 | int patch = 0; | ||
| 16 | |||
| 17 | 4 | friend constexpr bool operator==(const Version& a, const Version& b) { | |
| 18 | 4 | return std::tie(a.major, a.minor, a.patch) == std::tie(b.major, b.minor, b.patch); | |
| 19 | } | ||
| 20 | |||
| 21 | 2 | friend constexpr bool operator!=(const Version& a, const Version& b) { | |
| 22 | 2 | return !(a == b); | |
| 23 | } | ||
| 24 | |||
| 25 | 61 | friend constexpr bool operator<(const Version& a, const Version& b) { | |
| 26 | 61 | return std::tie(a.major, a.minor, a.patch) < std::tie(b.major, b.minor, b.patch); | |
| 27 | } | ||
| 28 | |||
| 29 | 1 | friend constexpr bool operator>(const Version& a, const Version& b) { | |
| 30 | 1 | return b < a; | |
| 31 | } | ||
| 32 | |||
| 33 | 2 | friend constexpr bool operator<=(const Version& a, const Version& b) { | |
| 34 | 2 | return !(b < a); | |
| 35 | } | ||
| 36 | |||
| 37 | 2 | friend constexpr bool operator>=(const Version& a, const Version& b) { | |
| 38 | 2 | return !(a < b); | |
| 39 | } | ||
| 40 | |||
| 41 | CHRONO_BATCH_RENDER_API std::string ToString() const; | ||
| 42 | }; | ||
| 43 | |||
| 44 | struct CHRONO_BATCH_RENDER_API BuildInfo { | ||
| 45 | Version version; | ||
| 46 | std::string_view commit; | ||
| 47 | bool modified = false; | ||
| 48 | std::string_view commitDate; | ||
| 49 | std::string_view buildDate; | ||
| 50 | std::string_view fullVersion; | ||
| 51 | }; | ||
| 52 | |||
| 53 | CHRONO_BATCH_RENDER_API const BuildInfo& GetBuildInfo(); | ||
| 54 | |||
| 55 | } | ||
| 56 |