Akonadi

itemretrievalrequest.h
1/*
2 SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QByteArray>
10#include <QDebug>
11#include <QList>
12#include <QString>
13
14#include <optional>
15
16namespace Akonadi
17{
18namespace Server
19{
20class ItemRetrievalRequest;
21
22/// Details of a single item retrieval request
24{
25public:
26 struct Id {
27 explicit Id(uint32_t value)
28 : mValue(value)
29 {
30 }
31 bool operator==(Id other) const
32 {
33 return mValue == other.mValue;
34 }
35
36 private:
37 uint32_t mValue;
38 Id next()
39 {
40 return Id{++mValue};
41 }
42
43 friend class ItemRetrievalRequest;
44 friend QDebug operator<<(QDebug, Id);
45 };
46
47 explicit ItemRetrievalRequest();
48
49 Id id;
50 QList<qint64> ids;
51 QString resourceId;
52 QByteArrayList parts; // list instead of vector to simplify client-side handling
53
54private:
55 static Id lastId;
56};
57
58class ItemRetrievalResult
59{
60public:
61 explicit ItemRetrievalResult() = default; // don't use, sadly Qt metatype system requires type to be default-constructible
62 ItemRetrievalResult(ItemRetrievalRequest request)
63 : request(std::move(request))
64 {
65 }
66
67 ItemRetrievalRequest request;
68
69 std::optional<QString> errorMsg{};
70};
71
72inline QDebug operator<<(QDebug dbg, ItemRetrievalRequest::Id id)
73{
74 dbg.nospace() << id.mValue;
75 return dbg.space();
76}
77
78} // namespace Server
79} // namespace Akonadi
Details of a single item retrieval request.
Helper integration between Akonadi and Qt.
QDebug operator<<(QDebug dbg, const DcrawInfoContainer &c)
QDebug & nospace()
QDebug & space()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.