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 virtual void initRealmsFileDownloader(
61 ::std::string const& downloadId,
62 int const slotIndex,
63 ::std::string const& downloadUrl,
64 ::FileInfo const& file,
65 uint64 fromByteOffset,
66 ::std::string const& downloadVersion,
67 ::std::function<void(::DownloaderResult)> callback
68 ) /*override*/;
69
70 virtual void initFileDownloader(
71 ::std::string const&,
72 ::std::string const& downloadUrl,
73 ::FileInfo const&,
74 uint64 expectedFileSize,
75 uint64 fromByteOffset,
76 ::std::string const&,
77 ::std::function<void(::DownloaderResult)> callback
78 ) /*override*/;
79
80 virtual void downloadFile(
81 ::std::function<void(::std::vector<uchar>, uint64, uint64, ::std::function<void(uint64, bool)>)> dataCallback,
82 ::std::function<void(::DownloaderState)> endCallback
83 ) /*override*/;
84
85 virtual bool canCancelDownload() const /*override*/;
86
87 virtual void cancelDownload() /*override*/;
88
89 virtual uint64 getDownloadTotalSize() const /*override*/;
90
91 virtual uint64 getDownloadReceivedSize() const /*override*/;
92
93 virtual float getDownloadProgress() const /*override*/;
94
95 virtual ::Bedrock::Http::Request _makeRequest();
96 // NOLINTEND
97
98public:
99 // member functions
100 // NOLINTBEGIN
101#ifdef LL_PLAT_C
102 MCNAPI StreamFileDownloader();
103
104 MCNAPI void _checkErrorAndRequeue(uint64 bytesWritten, bool hasError);
105
106 MCNAPI void _downloadFile();
107
108 MCNAPI ::Bedrock::Threading::Async<::Bedrock::Http::Response> _downloadNextChunk(::Bedrock::Http::Request request);
109
110 MCNAPI ::Bedrock::Threading::Async<::std::tuple<uint64, bool>> _processResponse(::Bedrock::Http::Response response);
111#endif
112 // NOLINTEND
113
114public:
115 // constructor thunks
116 // NOLINTBEGIN
117#ifdef LL_PLAT_C
118 MCNAPI void* $ctor();
119#endif
120 // NOLINTEND
121
122public:
123 // destructor thunk
124 // NOLINTBEGIN
125 MCNAPI void $dtor();
126 // NOLINTEND
127
128public:
129 // virtual function thunks
130 // NOLINTBEGIN
131#ifdef LL_PLAT_C
132 MCNAPI void $update();
133
134 MCNAPI void $initRealmsFileDownloader(
135 ::std::string const& downloadId,
136 int const slotIndex,
137 ::std::string const& downloadUrl,
138 ::FileInfo const& file,
139 uint64 fromByteOffset,
140 ::std::string const& downloadVersion,
141 ::std::function<void(::DownloaderResult)> callback
142 );
143
144 MCNAPI void $initFileDownloader(
145 ::std::string const&,
146 ::std::string const& downloadUrl,
147 ::FileInfo const&,
148 uint64 expectedFileSize,
149 uint64 fromByteOffset,
150 ::std::string const&,
151 ::std::function<void(::DownloaderResult)> callback
152 );
153
154 MCNAPI void $downloadFile(
155 ::std::function<void(::std::vector<uchar>, uint64, uint64, ::std::function<void(uint64, bool)>)> dataCallback,
156 ::std::function<void(::DownloaderState)> endCallback
157 );
158
159 MCNAPI bool $canCancelDownload() const;
160
161 MCNAPI void $cancelDownload();
162
163 MCNAPI uint64 $getDownloadTotalSize() const;
164
165 MCNAPI uint64 $getDownloadReceivedSize() const;
166
167 MCNAPI float $getDownloadProgress() const;
168
169 MCNAPI ::Bedrock::Http::Request $_makeRequest();
170#endif
171
172
173 // NOLINTEND
174
175public:
176 // vftables
177 // NOLINTBEGIN
178 MCNAPI static void** $vftable();
179 // NOLINTEND
180};
Definition Request.h:16
Definition Response.h:7
Definition IFileChunkDownloader.h:14
static MCAPI void ** $vftable()
MCAPI void $dtor()
Definition FileInfo.h:10
Definition Alias.h:14