Libkdav2

davprotocolbase.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_DAVPROTOCOLBASE_H
20#define KDAV2_DAVPROTOCOLBASE_H
21
22#include "kpimkdav2_export.h"
23
24#include "davcollection.h"
25
26#include <QtCore/QList>
27#include <QtCore/QMap>
28#include <QtXml/QDomDocument>
29#include <QSharedPointer>
30#include <QVariant>
31
32namespace KDAV2
33{
34
35/**
36 * @short Base class for XML query builders
37 */
38class KPIMKDAV2_EXPORT XMLQueryBuilder
39{
40public:
42
43 virtual ~XMLQueryBuilder();
44
45 virtual QDomDocument buildQuery() const = 0;
46 virtual QString mimeType() const = 0;
47
48 void setParameter(const QString &key, const QVariant &value);
49 QVariant parameter(const QString &key) const;
50
51private:
52 QMap<QString, QVariant> mParameters;
53};
54
55/**
56 * @short Base class for various DAV groupware dialects.
57 *
58 * This class provides an interface to query the DAV dialect
59 * specific features and abstract them.
60 *
61 * The functionality is implemented in:
62 * @li CaldavProtocol
63 * @li CarddavProtocol
64 * @li GroupdavProtocol
65 */
66class KPIMKDAV2_EXPORT DavProtocolBase
67{
68public:
69 /**
70 * Destroys the dav protocol base.
71 */
72 virtual ~DavProtocolBase();
73
74 /**
75 * Returns whether the dav protocol dialect supports principal
76 * queries. If true, it must return the home set it provides
77 * access to with principalHomeSet() and the home set namespace
78 * with principalHomeSetNS();
79 */
80 virtual bool supportsPrincipals() const = 0;
81
82 /**
83 * Return whether the dav protocol dialect supports CTags.
84 *
85 * If true, it must fetch them in the collectionsQuery().
86 */
87 virtual bool supportsCTags() const = 0;
88
89 /**
90 * Returns whether the dav protocol dialect supports the REPORT
91 * command to query all resources of a collection.
92 * If not, PROPFIND command will be used instead.
93 */
94 virtual bool useReport() const = 0;
95
96 /**
97 * Returns whether the dav protocol dialect supports the MULTIGET command.
98 *
99 * If MULTIGET is supported, the content of all dav resources
100 * can be fetched in ResourceBase::retrieveItems() already and
101 * there is no need to call ResourceBase::retrieveItem() for every single
102 * dav resource.
103 *
104 * Protocols that have MULTIGET capabilities must inherit from
105 * DavMultigetProtocol instead of this class.
106 */
107 virtual bool useMultiget() const = 0;
108
109 /**
110 * Returns the home set that this protocol supports.
111 */
112 virtual QString principalHomeSet() const;
113
114 /**
115 * Returns the namespace of the home set.
116 */
117 virtual QString principalHomeSetNS() const;
118
119 /**
120 * Returns the XML document that represents the DAV query to
121 * list all available DAV collections.
122 */
124
125 /**
126 * Returns the XQuery string that filters out the relevant XML elements
127 * from the result returned by the query that is provided by collectionQuery().
128 */
129 virtual QString collectionsXQuery() const = 0;
130
131 /**
132 * Returns a list of XML documents that represent DAV queries to
133 * list all available DAV resources inside a specific DAV collection.
134 */
136
137 /**
138 * Returns the possible content types for the collection that
139 * is described by the passed @p propstat element of a PROPFIND result.
140 */
142};
143
144}
145
146#endif
Base class for various DAV groupware dialects.
virtual XMLQueryBuilder::Ptr collectionsQuery() const =0
Returns the XML document that represents the DAV query to list all available DAV collections.
virtual DavCollection::ContentTypes collectionContentTypes(const QDomElement &propstat) const =0
Returns the possible content types for the collection that is described by the passed propstat elemen...
virtual bool useReport() const =0
Returns whether the dav protocol dialect supports the REPORT command to query all resources of a coll...
virtual bool supportsPrincipals() const =0
Returns whether the dav protocol dialect supports principal queries.
virtual QVector< XMLQueryBuilder::Ptr > itemsQueries() const =0
Returns a list of XML documents that represent DAV queries to list all available DAV resources inside...
virtual QString collectionsXQuery() const =0
Returns the XQuery string that filters out the relevant XML elements from the result returned by the ...
virtual bool supportsCTags() const =0
Return whether the dav protocol dialect supports CTags.
virtual bool useMultiget() const =0
Returns whether the dav protocol dialect supports the MULTIGET command.
Base class for XML query builders.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:05 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.