26 using version_element = std::uint32_t;
30 constexpr version(version_element major = 0, version_element minor = 0)
noexcept :
38 return major == 0 && minor == 0;
43 explicit constexpr operator std::uint64_t()
const
45 return static_cast<std::uint64_t
>(major) << 32
46 |
static_cast<std::uint64_t
>(minor) << 0;
52 return static_cast<std::uint64_t
>(*this) ==
static_cast<std::uint64_t
>(
other);
58 return static_cast<std::uint64_t
>(*this) !=
static_cast<std::uint64_t
>(
other);
64 return static_cast<std::uint64_t
>(*this) <
static_cast<std::uint64_t
>(
other);
70 return static_cast<std::uint64_t
>(*this) <=
static_cast<std::uint64_t
>(
other);
76 return static_cast<std::uint64_t
>(*this) >
static_cast<std::uint64_t
>(
other);
82 return static_cast<std::uint64_t
>(*this) >=
static_cast<std::uint64_t
>(
other);
86 version_element major;
87 version_element minor;
90JSONV_PUBLIC std::ostream& operator<<(std::ostream&,
const version&);
An adapter for enumeration types.
Copyright (c) 2014-2020 by Travis Gockel.
#define JSONV_PUBLIC
This function or class is part of the public API for JSON Voorhees.
Represents a version used to extract and encode JSON objects from C++ classes.
constexpr bool operator<=(const version &other) const
Check that this version is less than or equal to other. The comparison is done lexicographically.
constexpr bool operator==(const version &other) const
Test for equality with other.
constexpr bool operator<(const version &other) const
Check that this version is less than other. The comparison is done lexicographically.
constexpr bool operator>=(const version &other) const
Check that this version is greater than or equal to other. The comparison is done lexicographically.
constexpr bool operator>(const version &other) const
Check that this version is greater than other. The comparison is done lexicographically.
constexpr version(version_element major=0, version_element minor=0) noexcept
Initialize an instance with the given major and minor version info.
constexpr bool empty() const noexcept
Check if this version is an "empty" value – meaning major and minor are both 0.
constexpr bool operator!=(const version &other) const
Test for inequality with other.