1/*
2 This file is part of the KDE Baloo project.
3 SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#include "vectorpositioninfoiterator.h"
9#include "positioninfo.h"
10
11using namespace Baloo;
12
13VectorPositionInfoIterator::VectorPositionInfoIterator(const QVector<PositionInfo>& vector)
14 : m_vector(vector)
15 , m_pos(-1)
16{
17}
18
19quint64 VectorPositionInfoIterator::next()
20{
21 m_pos++;
22 if (m_pos >= m_vector.size()) {
23 m_pos = m_vector.size();
24 m_vector.clear();
25 return 0;
26 }
27
28 return m_vector[m_pos].docId;
29}
30
31quint64 VectorPositionInfoIterator::docId() const
32{
33 if (m_pos < 0 || m_pos >= m_vector.size()) {
34 return 0;
35 }
36
37 return m_vector[m_pos].docId;
38}
39
40QVector<uint> VectorPositionInfoIterator::positions()
41{
42 if (m_pos < 0 || m_pos >= m_vector.size()) {
43 return QVector<uint>();
44 }
45
46 return m_vector[m_pos].positions;
47}
48

source code of baloo/src/engine/vectorpositioninfoiterator.cpp