QXmpp: QXmppFileSharingProvider Class Reference

QXmpp Version: 1.14.2

Loading...
Searching...
No Matches
QXmppFileSharingProvider Class Referenceabstract

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

`#include <QXmppFileSharingProvider.h>`

Inheritance diagram for QXmppFileSharingProvider:

## 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;
QXmppHttpFileSource
Definition QXmppHttpFileSource.h:17

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

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

## ◆ UploadResult

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

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

  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.

## ◆ 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

  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.

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

- QXmppFileSharingProvider.h