KDAV

davitem.h
1/*
2 SPDX-FileCopyrightText: 2009 Grégory Oestreicher <greg@kamago.net>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KDAV_DAVITEM_H
8#define KDAV_DAVITEM_H
9
10#include "kdav_export.h"
11
12#include <QByteArray>
13#include <QDataStream>
14#include <QList>
15#include <QSharedDataPointer>
16#include <QString>
17
18class DavItemPrivate;
19
20namespace KDAV
21{
22class DavUrl;
23}
24
25namespace KDAV
26{
27/**
28 * @class DavItem davitem.h <KDAV/DavItem>
29 *
30 * @short A helper class to store information about DAV resources.
31 *
32 * This class is used as container to transfer information about DAV
33 * resources between the Akonadi resource and the DAV jobs.
34 *
35 * @note While the DAV RFC names them DAV resource we call them items
36 * to comply to Akonadi terminology.
37 */
38class KDAV_EXPORT DavItem
39{
40public:
41 /**
42 * Defines a list of DAV item objects.
43 */
45
46 /**
47 * Creates an empty DAV item.
48 */
49 DavItem();
50
51 /**
52 * Creates a new DAV item.
53 *
54 * @param url The URL that identifies the item.
55 * @param contentType The content type of the item.
56 * @param data The actual raw content data of the item.
57 * @param etag The ETag of the item.
58 */
59 DavItem(const DavUrl &url, const QString &contentType, const QByteArray &data, const QString &etag);
60
61 DavItem(const DavItem &other);
62 DavItem(DavItem &&);
63 DavItem &operator=(const DavItem &other);
64 DavItem &operator=(DavItem &&);
65
66 ~DavItem();
67
68 /**
69 * Sets the @p url that identifies the item.
70 */
71 void setUrl(const DavUrl &url);
72
73 /**
74 * Returns the URL that identifies the item.
75 */
76 Q_REQUIRED_RESULT DavUrl url() const;
77
78 /**
79 * Sets the content @p type of the item.
80 */
81 void setContentType(const QString &type);
82
83 /**
84 * Returns the content type of the item.
85 */
86 Q_REQUIRED_RESULT QString contentType() const;
87
88 /**
89 * Sets the raw content @p data of the item.
90 */
91 void setData(const QByteArray &data);
92
93 /**
94 * Returns the raw content data of the item.
95 */
96 Q_REQUIRED_RESULT QByteArray data() const;
97
98 /**
99 * Sets the @p etag of the item.
100 * @see https://tools.ietf.org/html/rfc4918#section-8.6
101 */
102 void setEtag(const QString &etag);
103
104 /**
105 * Returns the ETag of the item.
106 * @see https://tools.ietf.org/html/rfc4918#section-8.6
107 */
108 Q_REQUIRED_RESULT QString etag() const;
109
110private:
112};
113
114KDAV_EXPORT QDataStream &operator<<(QDataStream &out, const DavItem &item);
115KDAV_EXPORT QDataStream &operator>>(QDataStream &in, DavItem &item);
116}
117
118Q_DECLARE_TYPEINFO(KDAV::DavItem, Q_RELOCATABLE_TYPE);
119
120#endif
A helper class to store information about DAV resources.
Definition davitem.h:39
QList< DavItem > List
Defines a list of DAV item objects.
Definition davitem.h:44
A helper class to combine URL and protocol of a DAV URL.
Definition davurl.h:27
The KDAV namespace.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.