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 KDAV::DavUrl |
23 | * \inheaderfile KDAV/DavUrl |
24 | * \inmodule KDAV |
25 | * |
26 | * \brief A helper class to combine URL and protocol of a DAV URL. |
27 | */ |
28 | class KDAV_EXPORT DavUrl |
29 | { |
30 | public: |
31 | /*! |
32 | * Defines a list of DAV URL objects. |
33 | */ |
34 | typedef QList<DavUrl> List; |
35 | |
36 | /*! |
37 | * Creates an empty DAV URL. |
38 | */ |
39 | DavUrl(); |
40 | DavUrl(const DavUrl &); |
41 | DavUrl(DavUrl &&); |
42 | ~DavUrl(); |
43 | DavUrl &operator=(const DavUrl &); |
44 | DavUrl &operator=(DavUrl &&); |
45 | |
46 | /*! |
47 | * Creates a new DAV URL. |
48 | * |
49 | * \a url The URL that identifies the DAV object. |
50 | * |
51 | * \a protocol The DAV protocol dialect that is used to retrieve the DAV object. |
52 | */ |
53 | DavUrl(const QUrl &url, Protocol protocol); |
54 | |
55 | /*! |
56 | * Sets the \a url that identifies the DAV object. |
57 | */ |
58 | void setUrl(const QUrl &url); |
59 | |
60 | /*! |
61 | * Returns the URL that identifies the DAV object. |
62 | */ |
63 | Q_REQUIRED_RESULT QUrl url() const; |
64 | |
65 | /*! |
66 | * Returns the URL in a user-friendly way without login information. |
67 | */ |
68 | Q_REQUIRED_RESULT QString toDisplayString() const; |
69 | |
70 | /*! |
71 | * Sets the DAV \a protocol dialect that is used to retrieve the DAV object. |
72 | */ |
73 | void setProtocol(Protocol protocol); |
74 | |
75 | /*! |
76 | * Returns the DAV protocol dialect that is used to retrieve the DAV object. |
77 | */ |
78 | Q_REQUIRED_RESULT Protocol protocol() const; |
79 | |
80 | private: |
81 | QSharedDataPointer<DavUrlPrivate> d; |
82 | }; |
83 | |
84 | KDAV_EXPORT QDataStream &operator<<(QDataStream &out, const DavUrl &url); |
85 | KDAV_EXPORT QDataStream &operator>>(QDataStream &in, DavUrl &url); |
86 | } |
87 | |
88 | Q_DECLARE_TYPEINFO(KDAV::DavUrl, Q_RELOCATABLE_TYPE); |
89 | |
90 | #endif |
91 | |