File indexing completed on 2024-05-12 05:11:18

0001 /*
0002  * This file is part of the KDE Akonadi Search Project
0003  * SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006  *
0007  */
0008 
0009 #include "resultiterator.h"
0010 
0011 using namespace Akonadi::Search;
0012 
0013 ResultIterator::ResultIterator(int id, SearchStore *store)
0014     : d(new ResultIteratorPrivate)
0015 {
0016     d->queryId = id;
0017     d->store = store;
0018 }
0019 
0020 ResultIterator::ResultIterator()
0021     : d(new ResultIteratorPrivate)
0022 {
0023 }
0024 
0025 ResultIterator::ResultIterator(const ResultIterator &rhs) = default;
0026 
0027 ResultIterator::~ResultIterator() = default;
0028 
0029 ResultIterator &ResultIterator::operator=(const ResultIterator &other) = default;
0030 
0031 bool ResultIterator::next()
0032 {
0033     if (d->store) {
0034         return d->store->next(d->queryId);
0035     } else {
0036         return false;
0037     }
0038 }
0039 
0040 QByteArray ResultIterator::id() const
0041 {
0042     if (d->store) {
0043         return d->store->id(d->queryId);
0044     } else {
0045         return {};
0046     }
0047 }
0048 
0049 QUrl ResultIterator::url() const
0050 {
0051     if (d->store) {
0052         return d->store->url(d->queryId);
0053     } else {
0054         return {};
0055     }
0056 }
0057 
0058 QString ResultIterator::text() const
0059 {
0060     if (d->store) {
0061         return d->store->text(d->queryId);
0062     } else {
0063         return {};
0064     }
0065 }
0066 
0067 QString ResultIterator::icon() const
0068 {
0069     if (d->store) {
0070         return d->store->icon(d->queryId);
0071     } else {
0072         return {};
0073     }
0074 }