Version.hpp
1 #pragma once
2 #include <cstdint>
3 #include <functional>
4 
5 namespace score
6 {
12 class Version
13 {
14 public:
15  explicit constexpr Version(int32_t v) noexcept
16  : m_impl{v}
17  {
18  }
19  constexpr Version(const Version&) = default;
20  constexpr Version(Version&&) = default;
21  constexpr Version& operator=(const Version&) = default;
22  constexpr Version& operator=(Version&&) = default;
23 
24  constexpr bool operator==(Version other) const noexcept
25  {
26  return m_impl == other.m_impl;
27  }
28  constexpr bool operator!=(Version other) const noexcept
29  {
30  return m_impl != other.m_impl;
31  }
32  constexpr bool operator<(Version other) const noexcept
33  {
34  return m_impl < other.m_impl;
35  }
36  constexpr bool operator>(Version other) const noexcept
37  {
38  return m_impl > other.m_impl;
39  }
40  constexpr bool operator<=(Version other) const noexcept
41  {
42  return m_impl <= other.m_impl;
43  }
44  constexpr bool operator>=(Version other) const noexcept
45  {
46  return m_impl >= other.m_impl;
47  }
48 
49  constexpr int32_t value() const noexcept { return m_impl; }
50 
51 private:
52  int32_t m_impl = 0;
53 };
54 }
55 
56 namespace std
57 {
58 template <>
59 struct hash<score::Version>
60 {
61 public:
62  std::size_t operator()(const score::Version& s) const noexcept { return s.value(); }
63 };
64 }
Represents the version of a plug-in.
Definition: Version.hpp:13
Base toolkit upon which the software is built.
Definition: Application.cpp:90