QXmpp Version: 1.5.6
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
QXmppFileSharingProvider Class Referenceabstract

The interface of a provider for the QXmppFileSharingManager. More...

#include <QXmppFileSharingProvider.h>

Inheritance diagram for QXmppFileSharingProvider:
Inheritance graph
[legend]

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.
 
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.
 

Detailed Description

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.

using SourceType = QXmppHttpFileSource;
Definition QXmppHttpFileSource.h:16

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.

Since
QXmpp 1.5

Member Typedef Documentation

◆ DownloadResult

Contains QXmpp::Success (successfully finished), QXmpp::Cancelled (manually cancelled) or QXmppError (an error occured while downloading).

◆ UploadResult

Contains std::any (created file source), QXmpp::Cancelled (manually cancelled) or QXmppError (an error occured while uploading).

Member Function Documentation

◆ downloadFile()

virtual auto QXmppFileSharingProvider::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 >
pure virtual

Handles the download of files for this provider.

Parameters
sourceA 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.
targetQIODevice into which the received data should be written
reportProgressCan be called to report received bytes and total bytes
reportFinishedFinalizes the download, no more progress must be reported after this

Implemented in QXmppEncryptedFileSharingProvider, and QXmppHttpFileSharingProvider.

◆ uploadFile()

virtual auto QXmppFileSharingProvider::uploadFile ( std::unique_ptr< QIODevice >  source,
const QXmppFileMetadata info,
std::function< void(quint64, quint64)>  reportProgress,
std::function< void(UploadResult)>  reportFinished 
) -> std::shared_ptr< Upload >
pure virtual

Handles the upload of a file for this provider.

Parameters
sourceA QIODevice from which data for uploading should be read.
infoMetadata of the file
reportProgressCan be called to report sent bytes and total bytes
reportFinishedFinalizes the upload, no more progress must be reported after this

Implemented in QXmppEncryptedFileSharingProvider, and QXmppHttpFileSharingProvider.


The documentation for this class was generated from the following file: