| 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_DAVMANAGER_P_H |
| 8 | #define KDAV_DAVMANAGER_P_H |
| 9 | |
| 10 | #include "enums.h" |
| 11 | |
| 12 | #include <QString> |
| 13 | |
| 14 | #include <memory> |
| 15 | |
| 16 | namespace KIO |
| 17 | { |
| 18 | class DavJob; |
| 19 | } |
| 20 | |
| 21 | class QUrl; |
| 22 | |
| 23 | namespace KDAV |
| 24 | { |
| 25 | class DavProtocolBase; |
| 26 | |
| 27 | /*! |
| 28 | * \internal |
| 29 | * \brief A factory class for handling DAV jobs. |
| 30 | * |
| 31 | * This class provides factory methods to create preconfigured |
| 32 | * low-level DAV jobs and has access to the global DAV protocol dialect |
| 33 | * objects which abstract the access to the various DAV protocol dialects. |
| 34 | */ |
| 35 | class DavManager |
| 36 | { |
| 37 | public: |
| 38 | /*! |
| 39 | * Destroys the DAV manager. |
| 40 | */ |
| 41 | ~DavManager(); |
| 42 | |
| 43 | /*! |
| 44 | * Returns the global instance of the DAV manager. |
| 45 | */ |
| 46 | static DavManager *self(); |
| 47 | |
| 48 | /*! |
| 49 | * Returns a preconfigured DAV PROPFIND job. |
| 50 | * |
| 51 | * \a url The target URL of the job. |
| 52 | * \a document The query XML document. |
| 53 | * \a depth The Depth: value to send in the HTTP request |
| 54 | */ |
| 55 | KIO::DavJob *createPropFindJob(const QUrl &url, const QString &document, const QString &depth = QStringLiteral("1" )) const; |
| 56 | |
| 57 | /*! |
| 58 | * Returns a preconfigured DAV REPORT job. |
| 59 | * |
| 60 | * \a url The target URL of the job. |
| 61 | * \a document The query XML document. |
| 62 | * \a depth The Depth: value to send in the HTTP request |
| 63 | */ |
| 64 | KIO::DavJob *createReportJob(const QUrl &url, const QString &document, const QString &depth = QStringLiteral("1" )) const; |
| 65 | |
| 66 | /*! |
| 67 | * Returns a preconfigured DAV PROPPATCH job. |
| 68 | * |
| 69 | * \a url The target URL of the job. |
| 70 | * \a document The query XML document. |
| 71 | */ |
| 72 | KIO::DavJob *createPropPatchJob(const QUrl &url, const QString &document) const; |
| 73 | |
| 74 | /*! |
| 75 | * Returns the DAV protocol dialect object for the given DAV @p protocol. |
| 76 | */ |
| 77 | static const DavProtocolBase *davProtocol(Protocol protocol); |
| 78 | |
| 79 | private: |
| 80 | /*! |
| 81 | * Creates a new DAV manager. |
| 82 | */ |
| 83 | DavManager(); |
| 84 | |
| 85 | std::unique_ptr<DavProtocolBase> mProtocols[3]; |
| 86 | }; |
| 87 | } |
| 88 | |
| 89 | #endif |
| 90 | |