-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMegaDownload.cpp
More file actions
76 lines (64 loc) · 1.58 KB
/
MegaDownload.cpp
File metadata and controls
76 lines (64 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "MegaDownload.h"
MegaDownload::MegaDownload(std::string name, std::string gid, MegaAppTransferListener *listener)
{
this->m_name = name;
this->m_gid = gid;
this->m_listener = listener;
}
int MegaDownload::CancelDownload()
{
this->m_listener->CancelTransfer();
return 0;
}
bool MegaDownload::IsCompleted()
{
return this->m_listener->IsCompleted();
}
std::string MegaDownload::Gid()
{
return this->m_gid;
}
std::string MegaDownload::Name()
{
return this->m_name;
}
int64_t MegaDownload::CompletedLength()
{
return this->m_listener->CompletedLength();
}
int64_t MegaDownload::TotalLength()
{
return this->m_listener->TotalLength();
}
int64_t MegaDownload::Speed()
{
return this->m_listener->Speed();
}
int MegaDownload::GetErrorCode()
{
return this->m_listener->GetErrorCode();
}
std::string MegaDownload::GetErrorString()
{
return this->m_listener->GetErrorString();
}
int MegaDownload::GetState()
{
return this->m_listener->GetState();
}
DownloadInfo* MegaDownload::ToDownloadInfo()
{
struct DownloadInfo* info = new DownloadInfo();
info->gid = this->Gid();
info->name = this->Name();
info->errorCode = this->GetErrorCode();
info->errorString = this->GetErrorString();
info->completedLength = this->CompletedLength();
info->totalLength = this->TotalLength();
info->speed = this->Speed();
info->state = this->GetState();
info->isCancelled = this->m_listener->IsCancelled();
info->isFailed = this->m_listener->IsFailed();
info->isCompleted = this->m_listener->IsCompleted();
return info;
}