Warning, file /pim/itinerary/src/calendarextras/incidencekey_p.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 #ifndef KCALENDARCORE_INCIDENCEKEY_P_H
0007 #define KCALENDARCORE_INCIDENCEKEY_P_H
0008 
0009 #include <QDateTime>
0010 #include <QString>
0011 
0012 /** A hash key for Incidences containing uid and recurrence id (if present). */
0013 struct IncidenceKey {
0014     QString uid;
0015     QDateTime recurrenceId;
0016 
0017     inline bool operator==(const IncidenceKey &other) const
0018     {
0019         return uid == other.uid && (recurrenceId.isValid() == other.recurrenceId.isValid()) && (!recurrenceId.isValid() || recurrenceId == other.recurrenceId);
0020     }
0021 };
0022 
0023 namespace std {
0024 template <>
0025 class hash<IncidenceKey> {
0026 public:
0027     std::size_t operator()(const IncidenceKey &key) const
0028     {
0029         return std::hash<QString>{}(key.uid) ^ std::hash<qint64>{}(key.recurrenceId.toSecsSinceEpoch());
0030     }
0031 };
0032 }
0033 
0034 #endif