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