LeviLamina
Loading...
Searching...
No Matches
FileSystem.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/file/DirectoryIterationFlags.h"
7#include "mc/deps/core/file/FileBufferingMode.h"
8#include "mc/deps/core/file/PathBuffer.h"
9#include "mc/deps/core/string/BasicStackString.h"
10#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
11#include "mc/platform/Result.h"
12#include "mc/platform/brstd/function_ref.h"
13
14// auto generated forward declare list
15// clang-format off
16namespace Core { class File; }
17namespace Core { class FileOpenMode; }
18namespace Core { class FileSizePresetToken; }
19namespace Core { class FileSystemImpl; }
20namespace Core { class PathView; }
21namespace Core { class Result; }
22namespace Core { struct DirectoryIterationItem; }
23namespace Core { struct ExcludedPath; }
24// clang-format on
25
26namespace Core {
27
29public:
30 // FileSystem inner types declare
31 // clang-format off
32 struct BasicFileData;
34 // clang-format on
35
36 // FileSystem inner types define
37 struct BasicFileData {
38 public:
39 // member variables
40 // NOLINTBEGIN
43 // NOLINTEND
44
45 public:
46 // prevent constructor by default
47 BasicFileData& operator=(BasicFileData const&);
48 BasicFileData(BasicFileData const&);
49 BasicFileData();
50 };
51
52 struct FileTransferProgress {
53 public:
54 // member variables
55 // NOLINTBEGIN
59 // NOLINTEND
60
61 public:
62 // prevent constructor by default
63 FileTransferProgress& operator=(FileTransferProgress const&);
64 FileTransferProgress(FileTransferProgress const&);
65 FileTransferProgress();
66 };
67
68public:
69 // virtual functions
70 // NOLINTBEGIN
71 virtual ::Core::Result openFile(
72 ::Core::PathView filePath,
73 ::Core::File& fileOut,
74 ::Core::FileOpenMode openMode,
75 ::Core::FileBufferingMode bufferingMode
76 ) = 0;
77
78 virtual bool fileExists(::Core::PathView filePath) = 0;
79
80 virtual ::Core::Result deleteFile(::Core::PathView filePath) = 0;
81
82 virtual ::Core::Result deleteFilePriority(::Core::PathView filePath) = 0;
83
84 virtual ::Core::Result getFileSize(::Core::PathView filePath, uint64* pFileSize) = 0;
85
86 virtual ::Core::Result renameFile(::Core::PathView sourceName, ::Core::PathView targetName) = 0;
87
88 virtual ::Core::Result createEmptyFile(::Core::PathView filePath) = 0;
89
90 virtual ::Core::Result copyFile(::Core::PathView sourceFileName, ::Core::PathView targetFileName) = 0;
91
92 virtual ::Core::Result copyFileWithLimit(::Core::PathView sourceFilePath, ::Core::PathView targetFilePath) = 0;
93
94 virtual ::Core::Result readFileData(::Core::PathView filePath, ::std::vector<uchar>& data) = 0;
95
96 virtual ::Bedrock::Result<::std::string> readFile(::Core::PathView filePath) = 0;
97
98 virtual ::Bedrock::Result<void> writeFile(::Core::PathView filePath, ::std::string_view data) = 0;
99
100 virtual ::Core::Result createOneDirectory(::Core::PathView directoryPath) = 0;
101
102 virtual ::Core::Result createOneDirectoryIfNotExisting(::Core::PathView dirName) = 0;
103
104 virtual ::Core::Result createDirectoryRecursively(::Core::PathView dirName) = 0;
105
106 virtual bool directoryExists(::Core::PathView dirName) = 0;
107
108 virtual ::Core::Result deleteEmptyDirectory(::Core::PathView dirPath) = 0;
109
110 virtual ::Core::Result deleteDirectoryAndContentsRecursively(::Core::PathView dirName) = 0;
111
112 virtual ::Core::Result deleteDirectoryContentsRecursively(::Core::PathView directoryName) = 0;
113
114 virtual ::Core::Result renameDirectory(::Core::PathView oldDirectoryName, ::Core::PathView newDirectoryName) = 0;
115
116 virtual ::Core::Result iterateOverDirectory(
117 ::Core::PathView dirName,
118 ::Core::DirectoryIterationFlags flags,
120 ) = 0;
121
122 virtual ::Core::Result
123 getDirectoryFiles(::std::vector<::Core::PathBuffer<::std::string>>& files, ::Core::PathView path) = 0;
124
125 virtual ::Core::Result getDirectoryFilesAndSizes(
126 ::std::vector<::Core::FileSystem::BasicFileData>& filesOut,
127 ::Core::PathView directoryPath
128 ) = 0;
129
130 virtual ::Core::Result getDirectoryFilesRecursively(
131 ::std::vector<::Core::PathBuffer<::std::string>>& files,
132 ::Core::PathView directoryPath
133 ) = 0;
134
135 virtual ::Core::Result getDirectoryFilesSizeRecursively(uint64& totalSize, ::Core::PathView directoryPath) = 0;
136
137 virtual ::Core::Result getDirectoryFilesAllocatedSizeRecursively(
138 uint64& totalSize,
139 uint64& totalAllocatedSize,
140 ::Core::PathView directoryPath
141 ) = 0;
142
143 virtual ::Core::Result copyDirectoryAndContentsRecursively(::Core::PathView from, ::Core::PathView to) = 0;
144
145 virtual ::Core::Result copyDirectoryAndContentsRecursivelyWithLimit(::Core::PathView from, ::Core::PathView to) = 0;
146
147 virtual bool isDirectoryPartiallyCopied(::Core::PathView directory) = 0;
148
149 virtual bool fileOrDirectoryExists(::Core::PathView fileOrDirectoryName) = 0;
150
151 virtual ::Core::Result getFileOrDirectorySize(::Core::PathView path, uint64* pFileSizeOut) = 0;
152
153 virtual ::Core::Result addIgnoredThrottlePath(::Core::PathView path) = 0;
154
155 virtual ::Core::Result removeIgnoredThrottlePath(::Core::PathView path) = 0;
156
157 virtual ::Core::Result isValidPath(::Core::PathView path) = 0;
158
159 virtual ::Core::Result getLastModificationTime(::Core::PathView filePath, int64* pLastModificationTime) = 0;
160
161 virtual ::Core::Result
162 copyTimeAndAccessRights(::Core::PathView sourceFilePath, ::Core::PathView targetFilePath) = 0;
163
164 virtual ::Core::Result
165 createFlatFile(::Core::PathView sourceDirectoryPath, ::Core::PathView targetDirectoryPath) = 0;
166
167 virtual bool isDirectoryPathAFlatFile(::Core::PathView directoryPath) = 0;
168
169 virtual ::Core::Result copyFlatFile(
170 ::Core::PathView flatFileParentDirectory,
171 ::Core::PathView targetDirectory,
172 ::std::vector<::Core::ExcludedPath> const& excludedDirectories,
173 ::std::vector<::Core::ExcludedPath> const& excludedFiles
174 ) = 0;
175
176 virtual ::Core::Result createDirectoryForFile(::Core::PathView filePath) = 0;
177
178 virtual ::Core::PathBuffer<::Core::BasicStackString<char, 1024>>
179 getUniqueFilePathForFile(::Core::PathView filePath) = 0;
180
181 virtual ::Core::PathBuffer<::Core::BasicStackString<char, 1024>>
182 getUniqueFilePathForDirectory(::Core::PathView directoryPath) = 0;
183
184 virtual ::Core::PathBuffer<::Core::BasicStackString<char, 1024>>
185 createUniquePathFromSeed(::Core::PathView basePath, ::std::function<::std::string(int)> seedGenerator) = 0;
186
187 virtual ::std::vector<::Core::PathBuffer<::std::string>> splitPathIntoFullPathSegments(::Core::PathView path) = 0;
188
189 virtual ::Core::Result readFileDataExt(
190 ::Core::PathView filePath,
191 uint64 filePosition,
192 uint64 bufferSize,
193 ::std::vector<uchar>& buffer,
194 uint64& bytesRead
195 ) = 0;
196
197 virtual ::Core::Result cleanPath_deprecated(
199 ::Core::PathView pathIn
200 ) = 0;
201
202 virtual ::Core::Result cleanPathSeparators_deprecated(
204 ::Core::PathView pathIn
205 ) = 0;
206
207 virtual bool checkStorageCorrupt(::Core::PathView path) = 0;
208
209 virtual ::std::unique_ptr<::Core::FileSizePresetToken>
210 presetFileInitialSize(::Core::PathView path, uint64 initialSize) = 0;
211
212 virtual ::Core::Result _getDirectoriesAndFileSizesRecursively(
213 ::Core::PathView directoryPath,
214 ::std::vector<::Core::PathBuffer<::std::string>>& directoriesOut,
215 ::std::vector<::Core::FileSystem::BasicFileData>& filesOut
216 ) = 0;
217
218 virtual ::Core::Result _copyDirectoryStructure(
219 ::Core::PathView from,
221 ::std::vector<::Core::PathBuffer<::std::string>> const& directories,
222 ::Core::FileSystemImpl* transaction
223 ) = 0;
224
225 virtual ::Core::Result _copyFilesWithLimit(
226 ::Core::PathView from,
228 ::std::vector<::Core::FileSystem::BasicFileData>& files,
229 uint64& currentFileBytesWritten,
230 uint64 const transactionLimit,
231 ::std::function<
233 fileTransferFunction
234 ) = 0;
235
236 virtual ::Core::Result _copyFlatFile(
237 ::Core::PathView flatFileParentDirectory,
238 ::Core::PathView targetDirectory,
239 ::std::vector<::Core::ExcludedPath> const& excludedDirectories,
240 ::std::vector<::Core::ExcludedPath> const& excludedFiles
241 ) = 0;
242
243 virtual ::std::optional<uint64> _checkFileInitialSize(::Core::PathView path) = 0;
244 // NOLINTEND
245
246public:
247 // static functions
248 // NOLINTBEGIN
249 MCNAPI static ::Core::FileSystem& get();
250 // NOLINTEND
251};
252
253} // namespace Core
Definition EnableNonOwnerReferences.h:7
Definition BasicStackString.h:8
Definition FileOpenMode.h:7
Definition FileSizePresetToken.h:7
Definition FileSystemImpl.h:30
Definition FileSystem.h:28
static MCAPI ::Core::FileSystem & get()
Definition File.h:18
Definition PathBuffer.h:8
Definition PathView.h:19
Definition Result.h:11
Definition function_ref.h:60
Definition DirectoryIterationItem.h:12
Definition ExcludedPath.h:7
Definition FileSystem.h:37
Definition FileSystem.h:52
Definition buffer.h:5
Definition Alias.h:14