diff options
| author | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
| commit | 059831534c7e884f0a607ed86b582fd00d821731 (patch) | |
| tree | 76bcb67a78f8aa2654fd34c2ad801a62136b0170 /Audio/TxIdentity.hpp | |
| parent | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff) | |
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
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 |
