Libkdav2

davitem.h
1/*
2 Copyright (c) 2009 Grégory Oestreicher <greg@kamago.net>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17*/
18
19#ifndef KDAV2_DAVITEM_H
20#define KDAV2_DAVITEM_H
21
22#include "kpimkdav2_export.h"
23
24#include <memory>
25
26#include <QtCore/QByteArray>
27#include <QtCore/QDataStream>
28#include <QtCore/QString>
29#include <QtCore/QVector>
30
31
32class DavItemPrivate;
33
34namespace KDAV2
35{
36 class DavUrl;
37}
38
39namespace KDAV2
40{
41
42/**
43 * @short A helper class to store information about DAV resources.
44 *
45 * This class is used as container to transfer information about DAV
46 * resources between the Akonadi resource and the DAV jobs.
47 *
48 * @note While the DAV RFC names them DAV resource we call them items
49 * to comply to Akonadi terminology.
50 */
51class KPIMKDAV2_EXPORT DavItem
52{
53public:
54 /**
55 * Defines a list of DAV item objects.
56 */
58
59 /**
60 * Creates an empty DAV item.
61 */
62 DavItem();
63
64 /**
65 * Creates a new DAV item.
66 *
67 * @param url The url that identifies the item.
68 * @param contentType The content type of the item.
69 * @param data The actual raw content data of the item.
70 * @param etag The etag of the item.
71 */
72 DavItem(const DavUrl &url, const QString &contentType, const QByteArray &data, const QString &etag);
73
74 DavItem(const DavItem &other);
75 DavItem &operator=(const DavItem &other);
76
77 ~DavItem();
78
79 /**
80 * Sets the @p url that identifies the item.
81 */
82 void setUrl(const DavUrl &url);
83
84 /**
85 * Returns the url that identifies the item.
86 */
87 DavUrl url() const;
88
89 /**
90 * Sets the content @p type of the item.
91 */
92 void setContentType(const QString &type);
93
94 /**
95 * Returns the content type of the item.
96 */
97 QString contentType() const;
98
99 /**
100 * Sets the raw content @p data of the item.
101 */
102 void setData(const QByteArray &data);
103
104 /**
105 * Returns the raw content data of the item.
106 */
107 QByteArray data() const;
108
109 /**
110 * Sets the @p etag of the item.
111 */
112 void setEtag(const QString &etag);
113
114 /**
115 * Returns the etag of the item.
116 */
117 QString etag() const;
118
119private:
120 std::unique_ptr<DavItemPrivate> d;
121};
122
123KPIMKDAV2_EXPORT QDataStream &operator<<(QDataStream &out, const DavItem &item);
124KPIMKDAV2_EXPORT QDataStream &operator>>(QDataStream &in, DavItem &item);
125
126}
127
128Q_DECLARE_TYPEINFO(KDAV2::DavItem, Q_MOVABLE_TYPE);
129
130#endif
A helper class to store information about DAV resources.
Definition davitem.h:52
QVector< DavItem > List
Defines a list of DAV item objects.
Definition davitem.h:57
A helper class to combine url and protocol of a DAV url.
Definition davurl.h:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.