QXmpp
Version: 1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
QXmppFileSharingProvider.h
1
// SPDX-FileCopyrightText: 2022 Jonah BrĂ¼chert <jbb@kaidan.im>
2
// SPDX-FileCopyrightText: 2022 Linus Jahn <lnj@kaidan.im>
3
//
4
// SPDX-License-Identifier: LGPL-2.1-or-later
5
6
#ifndef QXMPPFILESHARINGPROVIDER_H
7
#define QXMPPFILESHARINGPROVIDER_H
8
9
#include "QXmppError.h"
10
#include "QXmppGlobal.h"
11
12
#include <any>
13
#include <functional>
14
#include <memory>
15
#include <variant>
16
17
class
QIODevice;
18
class
QXmppFileMetadata
;
19
class
QXmppUpload;
20
class
QXmppDownload;
21
31
class
QXMPP_EXPORT
QXmppFileSharingProvider
32
{
33
public
:
36
using
DownloadResult
= std::variant<QXmpp::Success, QXmpp::Cancelled, QXmppError>;
37
40
using
UploadResult
= std::variant<std::any
/* source */
,
QXmpp::Cancelled
,
QXmppError
>;
41
43
class
Download
44
{
45
public
:
46
virtual
~Download
() =
default
;
48
virtual
void
cancel
() = 0;
49
};
50
52
class
Upload
53
{
54
public
:
55
virtual
~Upload
() =
default
;
57
virtual
void
cancel
() = 0;
58
};
59
61
virtual
~QXmppFileSharingProvider
() =
default
;
63
72
virtual
auto
downloadFile
(
const
std::any &source,
73
std::unique_ptr<QIODevice> target,
74
std::function<
void
(quint64, quint64)> reportProgress,
75
std::function<
void
(
DownloadResult
)> reportFinished) -> std::shared_ptr<Download> = 0;
76
84
virtual
auto
uploadFile
(std::unique_ptr<QIODevice> source,
85
const
QXmppFileMetadata
&info,
86
std::function<
void
(quint64, quint64)> reportProgress,
87
std::function<
void
(
UploadResult
)> reportFinished) -> std::shared_ptr<Upload> = 0;
88
};
89
90
#endif
// QXMPPFILESHARINGPROVIDER_H
QXmppFileMetadata
Definition
QXmppFileMetadata.h:24
QXmppFileSharingProvider::Download
Used to control ongoing downloads.
Definition
QXmppFileSharingProvider.h:44
QXmppFileSharingProvider::Download::cancel
virtual void cancel()=0
Cancels the download.
QXmppFileSharingProvider::Upload
Used to control ongoing uploads.
Definition
QXmppFileSharingProvider.h:53
QXmppFileSharingProvider::Upload::cancel
virtual void cancel()=0
Cancels the upload.
QXmppFileSharingProvider
The interface of a provider for the QXmppFileSharingManager.
Definition
QXmppFileSharingProvider.h:32
QXmppFileSharingProvider::uploadFile
virtual auto uploadFile(std::unique_ptr< QIODevice > source, const QXmppFileMetadata &info, std::function< void(quint64, quint64)> reportProgress, std::function< void(UploadResult)> reportFinished) -> std::shared_ptr< Upload >=0
Handles the upload of a file for this provider.
QXmppFileSharingProvider::downloadFile
virtual auto downloadFile(const std::any &source, std::unique_ptr< QIODevice > target, std::function< void(quint64, quint64)> reportProgress, std::function< void(DownloadResult)> reportFinished) -> std::shared_ptr< Download >=0
Handles the download of files for this provider.
QXmppFileSharingProvider::DownloadResult
std::variant< QXmpp::Success, QXmpp::Cancelled, QXmppError > DownloadResult
Definition
QXmppFileSharingProvider.h:36
QXmppFileSharingProvider::UploadResult
std::variant< std::any, QXmpp::Cancelled, QXmppError > UploadResult
Definition
QXmppFileSharingProvider.h:40
QXmppError
Definition
QXmppError.h:17
QXmpp::Cancelled
Definition
QXmppGlobal.h:190
src
client
QXmppFileSharingProvider.h
Generated by
1.17.0