LeechCraft
0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
idownload.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#pragma once
10
11
#include <QUrl>
12
#include <QtPlugin>
13
#include <
util/sll/eitherfwd.h
>
14
#include "
structures.h
"
15
16
template
<
typename
>
17
class
QFuture
;
18
19
struct
EntityTestHandleResult
;
20
42
class
Q_DECL_EXPORT
IDownload
43
{
44
public
:
45
struct
Error
46
{
47
enum class
Type
48
{
49
Unknown,
50
NoError,
51
NotFound,
52
Gone,
53
AccessDenied,
54
AuthRequired,
55
ProtocolError,
56
NetworkError,
57
ContentError,
58
ProxyError,
59
ServerError,
60
LocalError,
61
UserCanceled
62
} Type_;
63
64
QString
Message_
;
65
66
bool
operator==
(
const
Error
& other)
const
67
{
68
return
Type_ == other.
Type_
&& Message_ == other.
Message_
;
69
}
70
};
71
72
struct
Success
{};
73
74
using
Result
=
LC::Util::Either<Error, Success>
;
75
86
virtual
qint64 GetDownloadSpeed ()
const
= 0;
97
virtual
qint64 GetUploadSpeed ()
const
= 0;
98
114
virtual
EntityTestHandleResult
CouldDownload (
const
LC::Entity
& entity)
const
= 0;
115
126
virtual
QFuture<Result>
AddJob (
LC::Entity
entity) = 0;
127
130
virtual
~IDownload
() {}
131
};
132
133
Q_DECLARE_INTERFACE (
IDownload
,
"org.Deviant.LeechCraft.IDownload/1.0"
)
134
135
Q_DECLARE_METATYPE
(
QList
<QUrl>)
QList
Definition:
ianrulesstorage.h:14
IDownload::Error::Type
Type
Definition:
idownload.h:47
IDownload::~IDownload
virtual ~IDownload()
Virtual destructor.
Definition:
idownload.h:130
LC::Util::Either
Definition:
either.h:33
LC::Entity
A message used for inter-plugin communication.
Definition:
structures.h:95
structures.h
IDownload
Common interface for all the downloaders.
Definition:
idownload.h:42
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QVariantList *)
IDownload::Success
Definition:
idownload.h:72
IDownload::Error
Definition:
idownload.h:45
QFuture
Definition:
idownload.h:17
operator==
auto operator==(const T &left, const T &right)
Definition:
common.h:38
IDownload::Error::Type_
enum IDownload::Error::Type Type_
EntityTestHandleResult
The result of testing whether an entity could be handled by a plugin.
Definition:
entitytesthandleresult.h:26
IDownload::Error::Message_
QString Message_
Definition:
idownload.h:64
eitherfwd.h
src
interfaces
idownload.h
Generated by
1.8.17