Akonadi

itemretrievalrequest.h
1 /*
2  SPDX-FileCopyrightText: 2009 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <QByteArray>
10 #include <QDebug>
11 #include <QString>
12 #include <QVector>
13 
14 #include <optional>
15 
16 namespace Akonadi
17 {
18 namespace Server
19 {
20 class ItemRetrievalRequest;
21 
22 /// Details of a single item retrieval request
24 {
25 public:
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  QVector<qint64> ids;
51  QString resourceId;
52  QByteArrayList parts; // list instead of vector to simplify client-side handling
53 
54 private:
55  static Id lastId;
56 };
57 
58 class ItemRetrievalResult
59 {
60 public:
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 
72 inline 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
QDebug & nospace()
QDebug & space()
QDataStream & operator<<(QDataStream &out, const KDateTime &dateTime)
Details of a single item retrieval request.
A glue between Qt and the standard library.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jul 2 2022 06:41:48 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.