QXmpp Version: 1.10.0
|
The interface of a provider for the QXmppFileSharingManager. More...
#include <QXmppFileSharingProvider.h>
Classes | |
class | Download |
Used to control ongoing downloads. More... | |
class | Upload |
Used to control ongoing uploads. More... | |
Public Types | |
using | DownloadResult = std::variant< QXmpp::Success, QXmpp::Cancelled, QXmppError > |
using | UploadResult = std::variant< std::any, QXmpp::Cancelled, QXmppError > |
Public Member Functions | |
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. More... | |
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. More... | |
The interface of a provider for the QXmppFileSharingManager.
To use it, implement all the pure virtual functions, and add a using declaration for the type of source you want to handle.
Base class for Stateless File Sharing providers
A provider defines the way that files can be uploaded and downloaded.
An example is the QXmppHttpFileSharingProvider, which uses HTTP File Upload.
using QXmppFileSharingProvider::DownloadResult = std::variant<QXmpp::Success, QXmpp::Cancelled, QXmppError> |
Contains QXmpp::Success (successfully finished), QXmpp::Cancelled (manually cancelled) or QXmppError (an error occured while downloading).
using QXmppFileSharingProvider::UploadResult = std::variant<std::any , QXmpp::Cancelled, QXmppError> |
Contains std::any (created file source), QXmpp::Cancelled (manually cancelled) or QXmppError (an error occured while uploading).
|
pure virtual |
Handles the download of files for this provider.
source | A type-erased source object. The provider will only ever have to handle its own sources, so this can safely be casted to the defined source type. |
target | QIODevice into which the received data should be written |
reportProgress | Can be called to report received bytes and total bytes |
reportFinished | Finalizes the download, no more progress must be reported after this |
Implemented in QXmppEncryptedFileSharingProvider, and QXmppHttpFileSharingProvider.
|
pure virtual |
Handles the upload of a file for this provider.
source | A QIODevice from which data for uploading should be read. |
info | Metadata of the file |
reportProgress | Can be called to report sent bytes and total bytes |
reportFinished | Finalizes the upload, no more progress must be reported after this |
Implemented in QXmppEncryptedFileSharingProvider, and QXmppHttpFileSharingProvider.