Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/SDK/file_operation_callback.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #pragma once | |
| 2 #include "metadb.h" | |
| 3 | |
| 4 //! Interface to notify component system about files being deleted or moved. Operates in app's main thread only. | |
| 5 class NOVTABLE file_operation_callback : public service_base { | |
| 6 public: | |
| 7 typedef const pfc::list_base_const_t<const char *> & t_pathlist; | |
| 8 //! p_items is a metadb::path_compare sorted list of files that have been deleted. | |
| 9 virtual void on_files_deleted_sorted(t_pathlist p_items) = 0; | |
| 10 //! p_from is a metadb::path_compare sorted list of files that have been moved, p_to is a list of corresponding target locations. | |
| 11 virtual void on_files_moved_sorted(t_pathlist p_from,t_pathlist p_to) = 0; | |
| 12 //! p_from is a metadb::path_compare sorted list of files that have been copied, p_to is a list of corresponding target locations. | |
| 13 virtual void on_files_copied_sorted(t_pathlist p_from,t_pathlist p_to) = 0; | |
| 14 | |
| 15 static void g_on_files_deleted(const pfc::list_base_const_t<const char *> & p_items); | |
| 16 static void g_on_files_moved(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to); | |
| 17 static void g_on_files_copied(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to); | |
| 18 | |
| 19 static bool g_search_sorted_list(const pfc::list_base_const_t<const char*> & p_list,const char * p_string,t_size & p_index); | |
| 20 static bool g_update_list_on_moved(metadb_handle_list_ref p_list,t_pathlist p_from,t_pathlist p_to); | |
| 21 | |
| 22 static bool g_update_list_on_moved_ex(metadb_handle_list_ref p_list,t_pathlist p_from,t_pathlist p_to, metadb_handle_list_ref itemsAdded, metadb_handle_list_ref itemsRemoved); | |
| 23 | |
| 24 static bool g_mark_dead_entries(metadb_handle_list_cref items, bit_array_var & mask, t_pathlist deadPaths); | |
| 25 | |
| 26 | |
| 27 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(file_operation_callback); | |
| 28 }; | |
| 29 | |
| 30 | |
| 31 | |
| 32 //! New in 0.9.5. | |
| 33 class NOVTABLE file_operation_callback_dynamic { | |
| 34 public: | |
| 35 //! p_items is a metadb::path_compare sorted list of files that have been deleted. | |
| 36 virtual void on_files_deleted_sorted(const pfc::list_base_const_t<const char *> & p_items) = 0; | |
| 37 //! p_from is a metadb::path_compare sorted list of files that have been moved, p_to is a list of corresponding target locations. | |
| 38 virtual void on_files_moved_sorted(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to) = 0; | |
| 39 //! p_from is a metadb::path_compare sorted list of files that have been copied, p_to is a list of corresponding target locations. | |
| 40 virtual void on_files_copied_sorted(const pfc::list_base_const_t<const char *> & p_from,const pfc::list_base_const_t<const char *> & p_to) = 0; | |
| 41 }; | |
| 42 | |
| 43 //! New in 0.9.5. | |
| 44 class NOVTABLE file_operation_callback_dynamic_manager : public service_base { | |
| 45 public: | |
| 46 virtual void register_callback(file_operation_callback_dynamic * p_callback) = 0; | |
| 47 virtual void unregister_callback(file_operation_callback_dynamic * p_callback) = 0; | |
| 48 | |
| 49 FB2K_MAKE_SERVICE_COREAPI(file_operation_callback_dynamic_manager); | |
| 50 }; | |
| 51 | |
| 52 //! New in 0.9.5. | |
| 53 class file_operation_callback_dynamic_impl_base : public file_operation_callback_dynamic { | |
| 54 public: | |
| 55 file_operation_callback_dynamic_impl_base() {file_operation_callback_dynamic_manager::get()->register_callback(this);} | |
| 56 ~file_operation_callback_dynamic_impl_base() {file_operation_callback_dynamic_manager::get()->unregister_callback(this);} | |
| 57 | |
| 58 void on_files_deleted_sorted(const pfc::list_base_const_t<const char*>& p_items) override { (void)p_items; } | |
| 59 void on_files_moved_sorted(const pfc::list_base_const_t<const char*>& p_from, const pfc::list_base_const_t<const char*>& p_to) override { (void)p_from; (void)p_to; } | |
| 60 void on_files_copied_sorted(const pfc::list_base_const_t<const char*>& p_from, const pfc::list_base_const_t<const char*>& p_to) override { (void)p_from; (void)p_to; } | |
| 61 | |
| 62 PFC_CLASS_NOT_COPYABLE_EX(file_operation_callback_dynamic_impl_base); | |
| 63 }; |
