Baloo

vectorpostingiterator.cpp
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}
Implements storage for docIds without any associated data Instantiated for:
Definition coding.cpp:11
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:48:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.