File indexing completed on 2024-04-14 03:49:42

0001 /*
0002     SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef BALOO_POSITIONINFO_H
0008 #define BALOO_POSITIONINFO_H
0009 
0010 #include <QVector>
0011 #include <QDebug>
0012 
0013 namespace Baloo {
0014 
0015 class PositionInfo {
0016 public:
0017     quint64 docId;
0018     QVector<uint> positions;
0019 
0020     PositionInfo(quint64 id = 0, const QVector<uint> posList = QVector<uint>())
0021         : docId(id), positions(posList) {}
0022 
0023     bool operator ==(const PositionInfo& rhs) const {
0024         return docId == rhs.docId;
0025     }
0026     bool operator !=(const PositionInfo& rhs) const {
0027         return docId != rhs.docId;
0028     }
0029 
0030     bool operator <(const PositionInfo& rhs) const {
0031         return docId < rhs.docId;
0032     }
0033 };
0034 
0035 inline QDebug operator<<(QDebug dbg, const PositionInfo &pos) {
0036     QDebugStateSaver saver(dbg);
0037     dbg.nospace() << Qt::hex << "(" << pos.docId << ": "
0038                   << Qt::dec << pos.positions << ")";
0039     return dbg;
0040 }
0041 
0042 }
0043 
0044 Q_DECLARE_TYPEINFO(Baloo::PositionInfo, Q_RELOCATABLE_TYPE);
0045 
0046 #endif // BALOO_POSITIONINFO_H