| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef BALOO_POSITIONINFO_H |
| 8 | #define BALOO_POSITIONINFO_H |
| 9 | |
| 10 | #include <QVector> |
| 11 | #include <QDebug> |
| 12 | |
| 13 | namespace Baloo { |
| 14 | |
| 15 | class PositionInfo { |
| 16 | public: |
| 17 | quint64 docId; |
| 18 | QVector<uint> positions; |
| 19 | |
| 20 | PositionInfo(quint64 id = 0, const QVector<uint> posList = QVector<uint>()) |
| 21 | : docId(id), positions(posList) {} |
| 22 | |
| 23 | bool operator ==(const PositionInfo& rhs) const { |
| 24 | return docId == rhs.docId; |
| 25 | } |
| 26 | bool operator !=(const PositionInfo& rhs) const { |
| 27 | return docId != rhs.docId; |
| 28 | } |
| 29 | |
| 30 | bool operator <(const PositionInfo& rhs) const { |
| 31 | return docId < rhs.docId; |
| 32 | } |
| 33 | }; |
| 34 | |
| 35 | inline QDebug operator<<(QDebug dbg, const PositionInfo &pos) { |
| 36 | QDebugStateSaver saver(dbg); |
| 37 | dbg.nospace() << Qt::hex << "(" << pos.docId << ": " |
| 38 | << Qt::dec << pos.positions << ")" ; |
| 39 | return dbg; |
| 40 | } |
| 41 | |
| 42 | } |
| 43 | |
| 44 | Q_DECLARE_TYPEINFO(Baloo::PositionInfo, Q_RELOCATABLE_TYPE); |
| 45 | |
| 46 | #endif // BALOO_POSITIONINFO_H |
| 47 | |