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 #ifndef ITEMRETRIEVALREQUEST_H
8 #define ITEMRETRIEVALREQUEST_H
9 
10 #include <QByteArray>
11 #include <QString>
12 #include <QVector>
13 #include <QDebug>
14 
15 #include <optional>
16 
17 namespace Akonadi
18 {
19 namespace Server
20 {
21 
22 class ItemRetrievalRequest;
23 
26 {
27 public:
28  struct Id {
29  explicit Id(uint32_t value): mValue(value) {};
30  bool operator==(Id other) const { return mValue == other.mValue; }
31  private:
32  uint32_t mValue;
33  Id next() { return Id{++mValue}; }
34 
35  friend class ItemRetrievalRequest;
36  friend QDebug operator<<(QDebug, Id);
37  };
38 
39  explicit ItemRetrievalRequest();
40 
41  Id id;
42  QVector<qint64> ids;
43  QString resourceId;
44  QByteArrayList parts; // list instead of vector to simplify client-side handling
45 
46 private:
47  static Id lastId;
48 };
49 
50 
51 class ItemRetrievalResult
52 {
53 public:
54  explicit ItemRetrievalResult() = default; // don't use, sadly Qt metatype system requires type to be default-constructible
55  ItemRetrievalResult(ItemRetrievalRequest request)
56  : request(std::move(request))
57  {}
58 
59  ItemRetrievalRequest request;
60 
61  std::optional<QString> errorMsg{};
62 };
63 
64 inline QDebug operator<<(QDebug dbg, ItemRetrievalRequest::Id id)
65 {
66  dbg.nospace() << id.mValue;
67  return dbg.space();
68 }
69 
70 } // namespace Server
71 } // namespace Akonadi
72 #endif
QDebug & nospace()
QDebug & space()
Details of a single item retrieval request.
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jul 8 2020 23:15:03 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.