diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /Audio/TxIdentity.hpp | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'Audio/TxIdentity.hpp')
| -rw-r--r-- | Audio/TxIdentity.hpp | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/Audio/TxIdentity.hpp b/Audio/TxIdentity.hpp new file mode 100644 index 00000000..b0c00b49 --- /dev/null +++ b/Audio/TxIdentity.hpp @@ -0,0 +1,99 @@ +#ifndef TX_IDENTITY_HPP_ +#define TX_IDENTITY_HPP_ + +#include <QMetaType> +#include <QtGlobal> + +namespace TxEvidence +{ + struct TxSessionId + { + constexpr TxSessionId () noexcept : value_ {0} {} + explicit constexpr TxSessionId (qint64 value) noexcept : value_ {value} {} + + static constexpr TxSessionId invalid () noexcept {return TxSessionId {};} + constexpr bool isValid () const noexcept {return value_ > 0;} + constexpr qint64 value () const noexcept {return value_;} + + private: + qint64 value_; + }; + + struct TxGeneration + { + constexpr TxGeneration () noexcept : value_ {0} {} + explicit constexpr TxGeneration (qint64 value) noexcept : value_ {value} {} + + static constexpr TxGeneration invalid () noexcept {return TxGeneration {};} + constexpr bool isValid () const noexcept {return value_ > 0;} + constexpr qint64 value () const noexcept {return value_;} + + private: + qint64 value_; + }; + + inline constexpr bool operator == (TxSessionId lhs, TxSessionId rhs) noexcept + { + return lhs.value () == rhs.value (); + } + + inline constexpr bool operator != (TxSessionId lhs, TxSessionId rhs) noexcept + { + return !(lhs == rhs); + } + + inline constexpr bool operator < (TxSessionId lhs, TxSessionId rhs) noexcept + { + return lhs.value () < rhs.value (); + } + + inline constexpr bool operator <= (TxSessionId lhs, TxSessionId rhs) noexcept + { + return !(rhs < lhs); + } + + inline constexpr bool operator > (TxSessionId lhs, TxSessionId rhs) noexcept + { + return rhs < lhs; + } + + inline constexpr bool operator >= (TxSessionId lhs, TxSessionId rhs) noexcept + { + return !(lhs < rhs); + } + + inline constexpr bool operator == (TxGeneration lhs, TxGeneration rhs) noexcept + { + return lhs.value () == rhs.value (); + } + + inline constexpr bool operator != (TxGeneration lhs, TxGeneration rhs) noexcept + { + return !(lhs == rhs); + } + + inline constexpr bool operator < (TxGeneration lhs, TxGeneration rhs) noexcept + { + return lhs.value () < rhs.value (); + } + + inline constexpr bool operator <= (TxGeneration lhs, TxGeneration rhs) noexcept + { + return !(rhs < lhs); + } + + inline constexpr bool operator > (TxGeneration lhs, TxGeneration rhs) noexcept + { + return rhs < lhs; + } + + inline constexpr bool operator >= (TxGeneration lhs, TxGeneration rhs) noexcept + { + return !(lhs < rhs); + } +} + +Q_DECLARE_METATYPE (TxEvidence::TxSessionId) +Q_DECLARE_METATYPE (TxEvidence::TxGeneration) + +#endif |
