11class CLASS_DECL_ACME file_context :
17 ::pointer<::folder> m_pfolderResource;
18 bool m_bFolderResourceCalculated;
19 bool m_bMainResourceMemoryCalculated;
24 ~file_context()
override;
27 void initialize(
::particle * pparticle)
override;
30 virtual void init_system();
31 virtual void init_context();
33 virtual void term_system();
34 virtual void term_context();
37 virtual void destroy()
override;
41 virtual ::string get_configuration_text(const ::scoped_string & scopedConfigurationFile);
43 virtual void calculate_main_resource_memory();
46 virtual ::block get_main_resource_block();
49 virtual ::folder* resource_folder();
50 virtual ::memory_file_pointer create_resource_file(const ::file::path & path);
51 virtual ::memory get_resource_memory(const ::file::path & path);
52 virtual ::file::enum_type resource_get_type(const ::file::path & path, ::string * pstrLogNotFound =
nullptr);
55 virtual void copy(::payload varTarget, ::payload varSource,
bool bFailIfExists =
false, enum_extract eextract = e_extract_first);
56 virtual void transfer(const ::file::path & pathNew, const ::file::path & path);
57 virtual void erase(const ::file::path & path);
58 virtual ::file::path duplicate(const ::file::path & path);
59 virtual ::file::path paste(const ::file::path & pathLocation, const ::file::path & path);
60 virtual void rename(const ::file::path & pathNew, const ::file::path & path);
63 virtual void trash_that_is_not_trash(const ::file::path & path);
67 virtual ::file::path get_filesystem_file(const ::file::path& path);
74 virtual void set_status(const ::file::path & path, const ::file::file_status &
status);
77 virtual void replace_with(const ::file::path & pathContext, const ::scoped_string & scopedstrNew, const ::scoped_string & scopedstrOld);
80 virtual ::file::enum_type get_type(const ::file::path & path, ::payload * pvarQuery);
81 virtual ::file::enum_type get_type(const ::file::path & path);
82 virtual ::file::enum_type safe_get_type(const ::file::path& path, ::payload* pvarQuery);
83 virtual ::file::enum_type safe_get_type(const ::file::path& path);
86 virtual ::payload length(const ::file::path & path);
89 virtual ::payload length(const ::file::path & path, ::payload * pvarQuery);
91 virtual void truncate(const ::file::path & path, filesize size = 0);
92 virtual void set_length(const ::file::path & path, filesize size);
94 virtual ::file::path module();
97 ::file::path time(const ::file::path & pathBasePath, ::i32 iDepth = 0, const ::scoped_string & scopedstrPrefix =
nullptr, const ::scoped_string & scopedstrSuffix =
nullptr,
bool bTryDelete =
false);
98 ::file::path time_square(const ::scoped_string & scopedstrPrefix =
nullptr, const ::scoped_string & scopedstrSuffix =
nullptr);
99 ::file::path time_log(const ::scoped_string & scopedstr);
102 virtual file_pointer time_square_file(const ::scoped_string & scopedstrPrefix =
nullptr, const ::scoped_string & scopedstrSuffix =
nullptr);
103 virtual file_pointer get(const ::file::path & name);
105 virtual file_pointer get_temporary_upload_file(const ::file::path & pathCurrent);
166 virtual bool try_create_file(const ::file::path & path,
bool bTryDelete);
169 virtual ::payload as_network_payload(const ::payload & payloadFile);
170 virtual ::payload safe_get_network_payload(const ::payload & payloadFile);
171 virtual ::pointer_array<::string_array> as_comma_separated(const ::payload &payloadFile);
172 virtual ::memory _005SignedMemory(const ::payload & payloadFile);
173 virtual string _005SignedString(const ::payload & payloadFile);
174 virtual string as_string(const ::payload & payloadFile);
175 virtual void as_memory(const ::payload & payloadFile,
memory_base & mem);
176 virtual ::memory as_memory(const ::payload & payloadFile);
177 virtual memsize read(const ::payload& payloadFile,
void * p, filesize position, memsize size,
bool bNoExceptionOnFail =
true);
178 virtual memsize read_beginning(const ::payload& payloadFile,
void * p, memsize size,
bool bNoExceptionOnFail =
true);
179 virtual memory beginning(const ::payload& payloadFile, memsize size,
bool bNoExceptionOnFail =
true);
182 inline string_array_base lines(const ::payload & payloadFile,
bool bAddEmpty =
true,
bool bNoExceptionOnFail =
true)
185 string_array_base straLines;
187 get_lines(straLines, payloadFile, bAddEmpty, bNoExceptionOnFail);
189 return ::transfer(straLines);
194 virtual void get_lines(string_array_base & stra, const ::payload & payloadFile,
bool bAddEmpty =
true,
bool bNoExceptionOnFail =
true);
195 virtual void put_lines(const ::payload& payloadFile,
const string_array_base& stra,
const plain_text_file_options& options = {});
199 virtual ::memory _005Signature(const ::payload & payloadFile);
202 virtual void put_memory(const ::payload & payloadFile,
::file::file * pfile);
203 virtual void put_memory(const ::payload & payloadFile, const ::block &
block);
204 virtual void _005PutSignedMemory(const ::payload & payloadFile, const ::block &
block);
205 virtual void put_text(const ::payload& payloadFile, const ::scoped_string & scopedstr);
206 virtual void put_text_utf8(const ::payload & payloadFile, const ::scoped_string & scopedstr);
207 virtual void _005PutSignedText(const ::payload & payloadFile, const ::scoped_string & scopedstr);
211 virtual void add_contents(const ::payload & payloadFile, const ::scoped_string & scopedstrContents);
214 virtual bool is_read_only(const ::file::path & path);
216 virtual file_pointer resource_get_file(const ::file::path & path);
218 virtual ::file::path sys_temp(const ::scoped_string & scopedstrName, const ::scoped_string & scopedstrExtension);
219 virtual ::file::path sys_temp_unique(const ::file::path & pszName);
222 virtual ::file::path replace_with_extension(const ::scoped_string & scopedstrExtension, const ::file::path & pathFile);
223 virtual void set_extension(
::file::path & str, const ::scoped_string & scopedstrExtension);
229 virtual void normalize(
string & str);
230 virtual ::std::strong_ordering cmp(const ::file::path & path1, const ::file::path & path2);
233 virtual string get_hash(const ::payload & payloadFile, enum_hash ehash);
237 virtual string md5(const ::payload & payloadFile);
240 virtual string nessie(const ::payload & payloadFile);
244 virtual bool is_link(const ::file::path & path);
246 virtual void get_last_write_time(
file_time_t * pfile_time, const ::scoped_string & scopedstrFilename);
262 virtual ::file_pointer file_get_file(
::file::path path, ::file::e_open eopen);
264 virtual ::file_pointer data_get_file(const ::scoped_string & scopedstrData, ::file::e_open eopen = ::file::e_open_read | ::file::e_open_binary);
266 virtual ::folder_pointer get_folder(
::file::file * pfile, const ::scoped_string & scopedstrImplementation, ::file::e_open eopen = ::file::e_open_read | ::file::e_open_binary);
268 virtual ::file_pointer http_get_file(const ::url::url & url, ::file::e_open eopen = ::file::e_open_read | ::file::e_open_binary, ::file::e_flag eflag = ::file::e_flag_none);
270 ::file_pointer get_file(const ::payload& payloadFile, ::file::e_open eopen, ::pointer < ::file::exception >* ppfileexception =
nullptr)
override;
272 virtual ::file_pointer _get_file(const ::payload & payloadFile, ::file::e_open eopen, ::pointer < ::file::exception > * ppfileexception =
nullptr);
274 virtual ::file_pointer defer_get_protocol_file(const ::scoped_string & scopedstrProtocol, const ::file::path & path, ::file::e_open eopen, ::pointer < ::file::exception > * pfileexception =
nullptr);
276 virtual ::file_pointer create_native_file(const ::file::path & path, ::file::e_open eopen, ::pointer < ::file::exception > * ppfileexception =
nullptr);
278 virtual ::file_pointer get_reader(const ::payload & payloadFile, ::file::e_open eopen = ::file::e_open_read | ::file::e_open_binary);
280 virtual ::file_pointer shared_reader(const ::payload & payloadFile, ::file::e_open eopen = ::file::e_open_read | ::file::e_open_binary);
282 virtual ::file_pointer get_writer(const ::payload & payloadFile, ::file::e_open eopen = ::file::e_open_write | ::file::e_open_create | ::file::e_open_defer_create_directory | ::file::e_open_binary);
284 virtual void post_output(const ::file::path & pathOut, const ::file::path & pathDownloading);
286 template <
typename T >
296 virtual ::file::path onedrive_global_ini();
297 virtual ::file::path onedrive_cid_ini();
300 virtual ::property_set get_ini(const ::payload& payloadFile);
301 virtual void set_ini(const ::payload& payloadFile, const ::property_set & set);
304 virtual ::property_set get_standard_configuration(const ::payload& payloadFile);
319 virtual bool exists(const ::file::path & path);
337 template <
class OBJECT >
338 void put(const ::payload & payloadFile, OBJECT & a)
341 auto pwriter = get_writer(payloadFile);
343 pwriter->write(&a,
sizeof(a));
348 void set(const ::payload & payloadFile, const ::memory_base &
memory);
351 template <
class OBJECT >
352 void as(OBJECT & a, const ::payload & payloadFile)
355 auto reader = get_reader(payloadFile);
391 string sys_temp(const_char_pointer pszName, const ::scoped_string & scopedstrExtension);
399 inline auto open_for_reading(const ::payload & payloadFile, ::file::e_open eopen = ::file::e_open_binary)
402 return get_file(payloadFile, eopen | ::file::e_open_read);
406 inline auto create_for_writing(const ::payload & payloadFile, ::file::e_open eopen = ::file::e_open_binary | ::file::e_open_defer_create_directory)
409 return get_file(payloadFile, eopen | ::file::e_open_create | ::file::e_open_write);
415 virtual ::file_pointer friendly_get_file(const ::payload & payloadFile, ::file::e_open eopen);
423 virtual void crypto_set(const ::payload & payloadFile, const ::scoped_string & scopedstrData, const ::scoped_string & scopedstrSalt);
424 virtual void crypto_get(const ::payload & payloadFile,
string & str, const ::scoped_string & scopedstrSalt);
427 template <
typename TYPE >
428 bool save(const ::payload & payloadFile,
const TYPE & o)
431 return put(payloadFile, o);
435 template <
typename TYPE >
436 inline bool load(TYPE & o, const ::payload & payloadFile)
439 return as(o, payloadFile);
444 virtual void save_lines(const ::payload & payloadFile, string_array_base & stra);
445 virtual void load_lines(string_array_base & stra, const ::payload & payloadFile);
449 virtual void touch(const ::file::path & path);
462 virtual void unzip_to_folder(const ::file::path& pathFolder, const ::file::path& pathZip,
::function<
bool(const::scoped_string& scopedstr) > functionCallback = {});
463 virtual ::file::path unzip_exe(const ::file::path& pathZip);