LeviLamina
Loading...
Searching...
No Matches
StreamFileDownloader.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/threading/Async.h"
7#include "mc/util/DownloaderResult.h"
8#include "mc/util/DownloaderState.h"
9#include "mc/util/IFileChunkDownloader.h"
10
11// auto generated forward declare list
12// clang-format off
13struct FileInfo;
14namespace Bedrock::Http { class Request; }
15namespace Bedrock::Http { class Response; }
16// clang-format on
17
18class StreamFileDownloader : public ::IFileChunkDownloader,
19 public ::std::enable_shared_from_this<::StreamFileDownloader> {
20public:
21 // member variables
22 // NOLINTBEGIN
33 // NOLINTEND
34
35#ifdef LL_PLAT_S
36public:
37 // prevent constructor by default
38 StreamFileDownloader& operator=(StreamFileDownloader const&);
39 StreamFileDownloader(StreamFileDownloader const&);
40 StreamFileDownloader();
41
42#else // LL_PLAT_C
43public:
44 // prevent constructor by default
45 StreamFileDownloader& operator=(StreamFileDownloader const&);
46 StreamFileDownloader(StreamFileDownloader const&);
47
48#endif
49public:
50 // virtual functions
51 // NOLINTBEGIN
52#ifdef LL_PLAT_S
53 virtual ~StreamFileDownloader() /*override*/ = default;
54#else // LL_PLAT_C
55 virtual ~StreamFileDownloader() /*override*/;
56#endif
57
58 virtual void update() /*override*/;
59
60#ifdef LL_PLAT_S
61 virtual void initRealmsFileDownloader(
62 ::std::string const&,
63 int const,
64 ::std::string const&,
65 ::FileInfo const&,
66 uint64,
67 ::std::string const&,
68 ::std::function<void(::DownloaderResult)>
69 ) /*override*/;
70#else // LL_PLAT_C
71 virtual void initRealmsFileDownloader(
72 ::std::string const& callback,
73 int const,
74 ::std::string const&,
75 ::FileInfo const&,
76 uint64,
77 ::std::string const&,
78 ::std::function<void(::DownloaderResult)>
79 ) /*override*/;
80#endif
81
82#ifdef LL_PLAT_S
83 virtual void initFileDownloader(
84 ::std::string const&,
85 ::std::string const&,
86 ::FileInfo const&,
87 uint64,
88 uint64,
89 ::std::string const&,
90 ::std::function<void(::DownloaderResult)>
91 ) /*override*/;
92#else // LL_PLAT_C
93 virtual void initFileDownloader(
94 ::std::string const& downloadUrl,
95 ::std::string const& expectedFileSize,
96 ::FileInfo const& fromByteOffset,
97 uint64 callback,
98 uint64,
99 ::std::string const&,
100 ::std::function<void(::DownloaderResult)>
101 ) /*override*/;
102#endif
103
104#ifdef LL_PLAT_S
105 virtual void downloadFile(
106 ::std::function<void(::std::vector<uchar>, uint64, uint64, ::std::function<void(uint64, bool)>)>,
107 ::std::function<void(::DownloaderState)>
108 ) /*override*/;
109#else // LL_PLAT_C
110 virtual void downloadFile(
111 ::std::function<void(::std::vector<uchar>, uint64, uint64, ::std::function<void(uint64, bool)>)> dataCallback,
112 ::std::function<void(::DownloaderState)> endCallback
113 ) /*override*/;
114#endif
115
116 virtual bool canCancelDownload() const /*override*/;
117
118 virtual void cancelDownload() /*override*/;
119
120 virtual uint64 getDownloadTotalSize() const /*override*/;
121
122 virtual uint64 getDownloadReceivedSize() const /*override*/;
123
124 virtual float getDownloadProgress() const /*override*/;
125
126 virtual ::Bedrock::Http::Request _makeRequest();
127 // NOLINTEND
128
129public:
130 // member functions
131 // NOLINTBEGIN
132#ifdef LL_PLAT_C
133 MCNAPI StreamFileDownloader();
134
135 MCNAPI void _checkErrorAndRequeue(uint64 hasError, bool);
136
137 MCNAPI void _downloadFile();
138
139 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::Response> _downloadNextChunk(::Bedrock::Http::Request request);
140
141 MCNAPI ::Bedrock::Threading::Async<::std::tuple<uint64, bool>> _processResponse(::Bedrock::Http::Response response);
142#endif
143 // NOLINTEND
144
145public:
146 // constructor thunks
147 // NOLINTBEGIN
148#ifdef LL_PLAT_C
149 MCNAPI void* $ctor();
150#endif
151 // NOLINTEND
152
153public:
154 // destructor thunk
155 // NOLINTBEGIN
156 MCNAPI void $dtor();
157 // NOLINTEND
158
159public:
160 // virtual function thunks
161 // NOLINTBEGIN
162#ifdef LL_PLAT_C
163 MCNAPI void $update();
164
165 MCNAPI void $initRealmsFileDownloader(
166 ::std::string const& callback,
167 int const,
168 ::std::string const&,
169 ::FileInfo const&,
170 uint64,
171 ::std::string const&,
172 ::std::function<void(::DownloaderResult)>
173 );
174
175 MCNAPI void $initFileDownloader(
176 ::std::string const& downloadUrl,
177 ::std::string const& expectedFileSize,
178 ::FileInfo const& fromByteOffset,
179 uint64 callback,
180 uint64,
181 ::std::string const&,
182 ::std::function<void(::DownloaderResult)>
183 );
184
185 MCNAPI void $downloadFile(
186 ::std::function<void(::std::vector<uchar>, uint64, uint64, ::std::function<void(uint64, bool)>)> dataCallback,
187 ::std::function<void(::DownloaderState)> endCallback
188 );
189
190 MCNAPI bool $canCancelDownload() const;
191
192 MCNAPI void $cancelDownload();
193
194 MCNAPI uint64 $getDownloadTotalSize() const;
195
196 MCNAPI uint64 $getDownloadReceivedSize() const;
197
198 MCNAPI float $getDownloadProgress() const;
199
200 MCNAPI ::Bedrock::Http::Request $_makeRequest();
201#endif
202
203
204 // NOLINTEND
205
206public:
207 // vftables
208 // NOLINTBEGIN
209 MCNAPI static void** $vftable();
210 // NOLINTEND
211};
Definition Request.h:22
Definition Response.h:7
Definition IFileChunkDownloader.h:14
static MCAPI void ** $vftable()
MCAPI void $dtor()
Definition FileInfo.h:10
Definition Alias.h:14