Baloo

vectorpostingiterator.cpp
1 /*
2  This file is part of the KDE Baloo project.
3  SPDX-FileCopyrightText: 2015 Vishesh Handa <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7 
8 #include "vectorpostingiterator.h"
9 
10 using namespace Baloo;
11 
12 VectorPostingIterator::VectorPostingIterator(const QVector<quint64>& values)
13  : m_values(values)
14  , m_pos(-1)
15 {
16 }
17 
18 quint64 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 
27 quint64 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
QVector< V > values(const QMultiHash< K, V > &c)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Nov 29 2023 03:56:26 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.