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 "vectorpostingiterator.h"
9
10using namespace Baloo;
11
12VectorPostingIterator::VectorPostingIterator(const QVector<quint64>& values)
13 : m_values(values)
14 , m_pos(-1)
15{
16}
17
18quint64 VectorPostingIterator::docId() const
19{
20 if (m_pos < 0 || m_pos >= m_values.size()) {
21 return 0;
22 }
23
24 return m_values[m_pos];
25}
26
27quint64 VectorPostingIterator::next()
28{
29 if (m_pos >= m_values.size() - 1) {
30 m_pos = m_values.size();
31 m_values.clear();
32 return 0;
33 }
34
35 m_pos++;
36 return m_values[m_pos];
37}
38

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