1 | /* |
2 | SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | |
7 | #ifndef KDAV_DAVURL_H |
8 | #define KDAV_DAVURL_H |
9 | |
10 | #include "kdav_export.h" |
11 | |
12 | #include "enums.h" |
13 | |
14 | #include <QList> |
15 | #include <QSharedDataPointer> |
16 | #include <QUrl> |
17 | |
18 | namespace KDAV |
19 | { |
20 | class DavUrlPrivate; |
21 | /** |
22 | * @class DavUrl davurl.h <KDAV/DavUrl> |
23 | * |
24 | * @short A helper class to combine URL and protocol of a DAV URL. |
25 | */ |
26 | class KDAV_EXPORT DavUrl |
27 | { |
28 | public: |
29 | /** |
30 | * Defines a list of DAV URL objects. |
31 | */ |
32 | typedef QList<DavUrl> List; |
33 | |
34 | /** |
35 | * Creates an empty DAV URL. |
36 | */ |
37 | DavUrl(); |
38 | DavUrl(const DavUrl &); |
39 | DavUrl(DavUrl &&); |
40 | ~DavUrl(); |
41 | DavUrl &operator=(const DavUrl &); |
42 | DavUrl &operator=(DavUrl &&); |
43 | |
44 | /** |
45 | * Creates a new DAV URL. |
46 | * |
47 | * @param url The URL that identifies the DAV object. |
48 | * @param protocol The DAV protocol dialect that is used to retrieve the DAV object. |
49 | */ |
50 | DavUrl(const QUrl &url, Protocol protocol); |
51 | |
52 | /** |
53 | * Sets the @p url that identifies the DAV object. |
54 | */ |
55 | void setUrl(const QUrl &url); |
56 | |
57 | /** |
58 | * Returns the URL that identifies the DAV object. |
59 | */ |
60 | Q_REQUIRED_RESULT QUrl url() const; |
61 | |
62 | /** |
63 | * Returns the URL in a user-friendly way without login information. |
64 | */ |
65 | Q_REQUIRED_RESULT QString toDisplayString() const; |
66 | |
67 | /** |
68 | * Sets the DAV @p protocol dialect that is used to retrieve the DAV object. |
69 | */ |
70 | void setProtocol(Protocol protocol); |
71 | |
72 | /** |
73 | * Returns the DAV protocol dialect that is used to retrieve the DAV object. |
74 | */ |
75 | Q_REQUIRED_RESULT Protocol protocol() const; |
76 | |
77 | private: |
78 | QSharedDataPointer<DavUrlPrivate> d; |
79 | }; |
80 | |
81 | KDAV_EXPORT QDataStream &operator<<(QDataStream &out, const DavUrl &url); |
82 | KDAV_EXPORT QDataStream &operator>>(QDataStream &in, DavUrl &url); |
83 | } |
84 | |
85 | Q_DECLARE_TYPEINFO(KDAV::DavUrl, Q_RELOCATABLE_TYPE); |
86 | |
87 | #endif |
88 | |