QXmppFileSharingProvider Class
| Header: | #include <QXmppFileSharingProvider.h> |
| Since: | QXmpp 1.5 |
| Inherited By: | QXmppEncryptedFileSharingProvider and QXmppHttpFileSharingProvider |
Public Types
| class | Download |
| class | Upload |
| DownloadResult | |
| UploadResult |
Public Functions
| virtual | ~QXmppFileSharingProvider() |
| virtual std::shared_ptr<QXmppFileSharingProvider::Download> | downloadFile(const std::any &source, std::unique_ptr<QIODevice> target, std::function<void (quint64, quint64)> reportProgress, std::function<void (DownloadResult)> reportFinished) = 0 |
| virtual std::shared_ptr<QXmppFileSharingProvider::Upload> | uploadFile(std::unique_ptr<QIODevice> source, const QXmppFileMetadata &info, std::function<void (quint64, quint64)> reportProgress, std::function<void (UploadResult)> reportFinished) = 0 |
Detailed Description
Base class for Stateless File Sharing providers
A provider defines the way that files can be uploaded and downloaded.
To use it, implement all the pure virtual functions, and add a using declaration for the type of source you want to handle.
using SourceType = QXmppHttpFileSource;
An example is the QXmppHttpFileSharingProvider, which uses HTTP File Upload.
Member Type Documentation
[alias] QXmppFileSharingProvider::DownloadResult
Contains QXmpp::Success (successfully finished), QXmpp::Cancelled (manually cancelled) or QXmppError (an error occured while downloading).
[alias] QXmppFileSharingProvider::UploadResult
Contains std::any (created file source), QXmpp::Cancelled (manually cancelled) or QXmppError (an error occured while uploading).
Member Function Documentation
[virtual constexpr noexcept default] QXmppFileSharingProvider::~QXmppFileSharingProvider()
Destroys the instance of QXmppFileSharingProvider. This destructor is virtual.
[pure virtual] std::shared_ptr<QXmppFileSharingProvider::Download> QXmppFileSharingProvider::downloadFile(const std::any &source, std::unique_ptr<QIODevice> target, std::function<void (quint64, quint64)> reportProgress, std::function<void (DownloadResult)> reportFinished)
Handles the download of files for this provider.
source is 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 is the 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.
[pure virtual] std::shared_ptr<QXmppFileSharingProvider::Upload> QXmppFileSharingProvider::uploadFile(std::unique_ptr<QIODevice> source, const QXmppFileMetadata &info, std::function<void (quint64, quint64)> reportProgress, std::function<void (UploadResult)> reportFinished)
Handles the upload of a file for this provider.
source is a QIODevice from which data for uploading should be read. info is the 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.