12#include <QHashFunctions>
41 explicit EntryId (
const QString&
id) :
Id_ { id } {}
63 template<
template<IdKind>
typename Id>
64 struct StrongestId : std::variant<Id<IdKind::Persistent>, Id<IdKind::Conventional>>
66 using Base = std::variant<Id<IdKind::Persistent>, Id<IdKind::Conventional>>;
73 const auto index = strongestId.index ();
74 return std::visit ([&] (
const auto&
id) {
return qHashMulti (seed, index,
id); }, strongestId.
ToVariant ());
79 return std::visit ([] (
const auto&
id) {
return id.ToString (); }, *
this);
93 return std::visit ([] (
const auto&
id) {
return id.AccountId_; }, strongestId.
ToVariant ());
137 constexpr int order [] = { 7, 3, 4, 5, 6, 1, 2, 8, 9, 10 };
138 return order [s1] < order [s2];
State
Describes possible presence states of an account or a contact.
GlobalId< IdKind::Conventional > GlobalConventionalId
EntryId< IdKind::Conventional > EntryConventionalId
bool IsLess(State s1, State s2)
Compares two states according to the implied desire to have a conversation.
StrongestId< EntryId > EntryStrongestId
StrongestId< GlobalId > GlobalStrongestId
EntryId< IdKind::Persistent > EntryPersistentId
GlobalId< IdKind::Persistent > GlobalPersistentId
QString GetAccountId(const GlobalStrongestId &strongestId)
A custom saved named status.
QString Name_
The name of this status.
State State_
The state associated with this status.
QString Text_
The status text associated with this status.
static EntryId FromString(const QString &id)
bool operator==(const EntryId &) const =default
friend size_t qHash(const EntryId &id, size_t seed=0)
Describes an entry's status.
State State_
The general state of the entry.
QString StatusString_
The string of the entry accompanying its state.
bool operator==(const EntryStatus &es2) const =default
friend size_t qHash(const GlobalId &id, size_t seed=0)
bool operator==(const GlobalId &) const =default
friend size_t qHash(const StrongestId &strongestId, size_t seed=0)
std::variant< Id< IdKind::Persistent >, Id< IdKind::Conventional > > Base
const Base & ToVariant() const
bool operator==(const StrongestId &) const =default